added contents

This commit is contained in:
Mark Minas
2024-09-18 17:04:31 +02:00
parent d28b17eba5
commit 71a4ac8d12
176 changed files with 51198 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
plugins {
id 'buildlogic.jme-application-conventions'
}
description = 'Battleship converter for resources'
dependencies {
implementation libs.jme3.core
runtimeOnly libs.jme3.desktop
runtimeOnly libs.jme3.plugins
}
application {
mainClass = 'pp.battleship.exporter.ModelExporter'
}

View File

@@ -0,0 +1,69 @@
////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////
package pp.battleship.exporter;
import com.jme3.app.SimpleApplication;
import com.jme3.export.JmeExporter;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.scene.Spatial;
import com.jme3.system.JmeContext;
import com.jme3.util.TangentBinormalGenerator;
import java.io.File;
import java.io.IOException;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
/**
* This class transforms models into j3o format.
*/
public class ModelExporter extends SimpleApplication {
private static final Logger LOGGER = System.getLogger(ModelExporter.class.getName());
/**
* The main method of the converter
*
* @param args input args
*/
public static void main(String[] args) {
ModelExporter application = new ModelExporter();
application.start(JmeContext.Type.Headless);
}
/**
* Overrides {@link com.jme3.app.SimpleApplication#simpleInitApp()}.
* It initializes a simple app by exporting robots and rocks.
*/
@Override
public void simpleInitApp() {
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS
stop();
}
/**
* Exports spatial into a file
*
* @param fileName the file name of the model
* @param exportFileName the name of the file where the .j3o file is going to be stored
*/
private void export(String fileName, String exportFileName) {
final File file = new File(exportFileName);
JmeExporter exporter = BinaryExporter.getInstance();
try {
final Spatial model = getAssetManager().loadModel(fileName);
TangentBinormalGenerator.generate(model);
exporter.save(model, file);
}
catch (IOException exception) {
LOGGER.log(Level.ERROR, "write to {0} failed", file); //NON-NLS
throw new RuntimeException(exception);
}
LOGGER.log(Level.INFO, "wrote file {0}", file); //NON-NLS
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

View File

@@ -0,0 +1,18 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 16.03.2012 14:15:53
newmtl _King_George_V
Ns 60.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 1.0000 1.0000 1.0000
Kd 1.0000 1.0000 1.0000
Ks 0.4500 0.4500 0.4500
Ke 0.0000 0.0000 0.0000
map_Ka King_George_V.jpg
map_Kd King_George_V.jpg
map_bump King_George_V_bump.jpg
bump King_George_V_bump.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -0,0 +1,3 @@
based on:
https://free3d.com/3d-model/wwii-ship-uk-king-george-v-class-battleship-v1--185381.html
License: Free Personal Use Only