Add ship models
@@ -10,6 +10,9 @@
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Quaternion;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
@@ -42,7 +45,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final ColorRGBA SPLASH_COLOR = new ColorRGBA(0f, 0f, 1f, 0.4f);
|
||||
private static final ColorRGBA HIT_COLOR = new ColorRGBA(1f, 0f, 0f, 0.4f);
|
||||
|
||||
private final ShipMap map;
|
||||
private final ShipMap map;
|
||||
private final BattleshipApp app;
|
||||
|
||||
/**
|
||||
@@ -141,7 +144,33 @@ public Spatial visit(Battleship ship) {
|
||||
* @return the spatial representing the battleship
|
||||
*/
|
||||
private Spatial createShip(Battleship ship) {
|
||||
return ship.getLength() == 4 ? createBattleship(ship) : createBox(ship);
|
||||
final int len = ship.getLength();
|
||||
|
||||
Quaternion q0 = new Quaternion();
|
||||
|
||||
Quaternion q1 = new Quaternion();
|
||||
q1.fromAngleAxis(PI/2, new Vector3f(1, 0, 0));
|
||||
|
||||
Quaternion q2 = new Quaternion();
|
||||
q2.fromAngleAxis(PI/2, new Vector3f(1, 0, 0));
|
||||
|
||||
switch (len) {
|
||||
case 1 -> {
|
||||
return createBattleship(ship, "Models/Uboat/uboat.j3o", 0.2f, new Vector3f(0.0f, -0.1f, 0.0f), q0);
|
||||
}
|
||||
case 2 -> {
|
||||
return createBattleship(ship, "Models/KingGeorgeV/KingGeorgeV.j3o", 1.0f, new Vector3f(0.0f, 0.0f, 0.0f), q0);
|
||||
}
|
||||
case 3 -> {
|
||||
return createBattleship(ship, "Models/EssexClass/essex.j3o", 0.8f, new Vector3f(0.0f, 0.3f, 0.0f), q2);
|
||||
}
|
||||
case 4 -> {
|
||||
return createBattleship(ship, "Models/Container/container.j3o", 0.05f, new Vector3f(0.0f, 0.0f, 0.0f), q1);
|
||||
}
|
||||
default -> {
|
||||
return createBox(ship);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,16 +210,22 @@ private Material createColoredMaterial(ColorRGBA color) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a detailed 3D model to represent a "King George V" battleship.
|
||||
* Creates a 3D model to represent a "battleship".
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the spatial representing the "King George V" battleship
|
||||
* @param path the battleship to be represented
|
||||
* @param scale the battleship to be represented
|
||||
* @param translation the battleship to be represented
|
||||
* @param rotation the battleship to be represented
|
||||
* @return the spatial representing the battleship
|
||||
*/
|
||||
private Spatial createBattleship(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(KING_GEORGE_V_MODEL);
|
||||
private Spatial createBattleship(Battleship ship, String path, float scale, Vector3f translation, Quaternion rotation) {
|
||||
final Spatial model = app.getAssetManager().loadModel(path);
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(1.48f);
|
||||
model.rotate(rotation);
|
||||
model.scale(scale);
|
||||
model.setLocalTranslation(translation);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;
|
||||
|
||||
|
After Width: | Height: | Size: 332 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 629 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 122 KiB |
@@ -0,0 +1,35 @@
|
||||
# Blender 4.2.1 LTS MTL File: 'untitled.blend'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Bridge
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.500000
|
||||
illum 2
|
||||
map_Kd Bridge_baseColor.png
|
||||
map_Ke Bridge_emissive.jpg
|
||||
map_d Bridge_baseColor.png
|
||||
map_Bump -bm 1.000000 Bridge_normal.jpg
|
||||
|
||||
newmtl Containers
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Containers_baseColor.jpg
|
||||
map_Bump -bm 1.000000 Containers_normal.jpg
|
||||
|
||||
newmtl Hull
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Hull_baseColor.jpg
|
||||
map_Bump -bm 1.000000 Hull_normal.jpg
|
||||
571196
Projekte/battleship/client/src/main/resources/Models/Container/container.obj
Normal file
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 98 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
@@ -0,0 +1,180 @@
|
||||
newmtl Model001_Material001
|
||||
map_Kd Yorktown_paint6.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material002
|
||||
map_Kd diff_null_7.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material003
|
||||
map_Kd diff_null_14.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material004
|
||||
map_Kd diff_null_Color005.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material005
|
||||
map_Kd diff_null_8.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material006
|
||||
map_Kd diff_null_Color007.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material007
|
||||
map_Kd diff_null_17.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material008
|
||||
map_Kd diff_null_FrontColor.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material009
|
||||
map_Kd diff_null_BackColor.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material010
|
||||
map_Kd diff_null_4.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material011
|
||||
map_Kd Color_004.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material012
|
||||
map_Kd diff_null_Gray1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material013
|
||||
map_Kd diff_null_3.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material014
|
||||
map_Kd Metal_Rough.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material015
|
||||
map_Kd diff_null_12.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material016
|
||||
map_Kd diff_null_19.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material017
|
||||
map_Kd diff_null_Color003.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material018
|
||||
map_Kd diff_null_mat1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material019
|
||||
map_Kd diff_null_1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material020
|
||||
map_Kd diff_null_2.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material021
|
||||
map_Kd diff_null_Black1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material022
|
||||
map_Kd diff_null_Model001Materia.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material023
|
||||
map_Kd diff_null_Model001Mate1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material024
|
||||
map_Kd diff_null_13.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material025
|
||||
map_Kd _6.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material026
|
||||
map_Kd Metal_Aluminum_Anodized.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material027
|
||||
map_Kd diff_null_Color006.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material028
|
||||
map_Kd Blinds_Vertical_Stripe_Gray.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material029
|
||||
map_Kd diff_null_15.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material030
|
||||
map_Kd diff_null_Color002.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material031
|
||||
map_Kd Cladding_Siding_Tan.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material032
|
||||
map_Kd diff_null_Color008.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material033
|
||||
map_Kd diff_null_16.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material034
|
||||
map_Kd _2.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material035
|
||||
map_Kd Blinds_Roman_Hobbled_Blue.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material036
|
||||
map_Kd Blinds_Wood_White.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material037
|
||||
map_Kd Metal_Seamed.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material038
|
||||
map_Kd image_16.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material039
|
||||
map_Kd diff_null_9.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material040
|
||||
map_Kd image_15.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material041
|
||||
map_Kd _Blinds_Roman_Hobbled_Blue_1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material042
|
||||
map_Kd diff_null_10.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material043
|
||||
map_Kd diff_null_Material5.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material044
|
||||
map_Kd diff_null_Material1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material045
|
||||
map_Kd diff_null_11.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
564702
Projekte/battleship/client/src/main/resources/Models/EssexClass/essex.obj
Normal file
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 670 KiB |
|
After Width: | Height: | Size: 168 KiB |
@@ -0,0 +1,16 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 29.03.2012 14:25:39
|
||||
|
||||
newmtl default
|
||||
Ns 35.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.5400 0.5400 0.5400
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
|
||||
map_Kd 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
|
||||
203099
Projekte/battleship/client/src/main/resources/Models/Uboat/uboat.obj
Normal file
BIN
Projekte/battleship/converter/KingGeorgeV.j3o
Normal file
BIN
Projekte/battleship/converter/container.j3o
Normal file
BIN
Projekte/battleship/converter/essex.j3o
Normal file
@@ -42,6 +42,9 @@ public static void main(String[] args) {
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS
|
||||
export("Models/EssexClass/essex.obj", "essex.j3o"); //NON-NLS
|
||||
export("Models/Container/container.obj", "container.j3o"); //NON-NLS
|
||||
export("Models/Uboat/uboat.obj", "uboat.j3o"); //NON-NLS
|
||||
|
||||
stop();
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 332 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 629 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 122 KiB |
@@ -0,0 +1,35 @@
|
||||
# Blender 4.2.1 LTS MTL File: 'untitled.blend'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Bridge
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.500000
|
||||
illum 2
|
||||
map_Kd Bridge_baseColor.png
|
||||
map_Ke Bridge_emissive.jpg
|
||||
map_d Bridge_baseColor.png
|
||||
map_Bump -bm 1.000000 Bridge_normal.jpg
|
||||
|
||||
newmtl Containers
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Containers_baseColor.jpg
|
||||
map_Bump -bm 1.000000 Containers_normal.jpg
|
||||
|
||||
newmtl Hull
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Hull_baseColor.jpg
|
||||
map_Bump -bm 1.000000 Hull_normal.jpg
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 80 KiB |