corrected 'Editorstate' and 'GameServerLogic' and edited 'SeaSynchronizer' and added assets
This commit is contained in:
@@ -7,9 +7,13 @@
|
||||
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.jme3.light.AmbientLight;
|
||||
import com.jme3.light.DirectionalLight;
|
||||
import com.jme3.light.Light;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
@@ -26,6 +30,7 @@
|
||||
import static pp.util.FloatMath.HALF_PI;
|
||||
import static pp.util.FloatMath.PI;
|
||||
|
||||
//TODO models
|
||||
/**
|
||||
* The {@code SeaSynchronizer} class is responsible for synchronizing the graphical
|
||||
* representation of the ships and shots on the sea map with the underlying data model.
|
||||
@@ -35,6 +40,9 @@
|
||||
class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
|
||||
private static final String SUBMARINE ="Models/Submarine/submarine.obj";
|
||||
private static final String DESTROYER ="Models/Destroyer/10619_Battleship.obj";
|
||||
private static final String SMALL_SHIP ="Models/SmallShip/10634_SpeedBoat_v01_LOD3.obj";
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
private static final String SHOT = "shot"; //NON-NLS
|
||||
@@ -141,7 +149,14 @@ public Spatial visit(Battleship ship) {
|
||||
* @return the spatial representing the battleship
|
||||
*/
|
||||
private Spatial createShip(Battleship ship) {
|
||||
return ship.getLength() == 4 ? createBattleship(ship) : createBox(ship);
|
||||
//return ship.getLength() == 4 ? createBattleship(ship) : createBox(ship);
|
||||
return switch(ship.getLength()){
|
||||
case(1)-> createSmallShip(ship);
|
||||
case(2)-> createSubmarine(ship);
|
||||
case(3)-> createDestroyer(ship);
|
||||
case(4)-> createBattleship(ship);
|
||||
default -> createBox(ship);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,6 +176,36 @@ private Spatial createBox(Battleship ship) {
|
||||
return geometry;
|
||||
}
|
||||
|
||||
private Spatial createDestroyer(Battleship ship){
|
||||
final Spatial model=app.getAssetManager().loadModel(DESTROYER);
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot())-HALF_PI, 0f);
|
||||
model.scale(0.0001f);
|
||||
model.move(0,0.3f ,0);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
return model;
|
||||
}
|
||||
|
||||
private Spatial createSubmarine(Battleship ship){
|
||||
final Spatial model=app.getAssetManager().loadModel(SUBMARINE);
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(0.25f);
|
||||
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
private Spatial createSmallShip(Battleship ship){
|
||||
final Spatial model = app.getAssetManager().loadModel(SMALL_SHIP);
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()) + HALF_PI, 0f);
|
||||
model.scale(0.001f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Material} with the specified color.
|
||||
* If the color includes transparency (i.e., alpha value less than 1),
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
newmtl Battleship
|
||||
illum 4
|
||||
Kd 0.00 0.00 0.00
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
map_Kd BattleshipC.jpg
|
||||
Ni 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 256.00
|
||||
newmtl blinn1SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 256.00
|
||||
newmtl blinn2SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 256.00
|
||||
newmtl blinn3SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
newmtl blinn4SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
newmtl blinn5SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
newmtl blinn6SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
newmtl blinn7SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
newmtl blinn8SG
|
||||
illum 4
|
||||
Kd 0.50 0.50 0.50
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
Ns 256.00
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 717 KiB |
@@ -0,0 +1,28 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 08.06.2011 15:26:00
|
||||
|
||||
newmtl _10634_SpeedBoat_v01_LOD310634_SpeedBoat_v01
|
||||
Ns 53.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.5882 0.5882 0.5882
|
||||
Kd 0.5882 0.5882 0.5882
|
||||
Ks 0.2000 0.2000 0.2000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka 10634_SpeedBoat_v01.jpg
|
||||
map_Kd 10634_SpeedBoat_v01.jpg
|
||||
|
||||
newmtl glass
|
||||
Ns 80.0000
|
||||
Ni 1.5000
|
||||
d 0.2000
|
||||
Tr 0.8000
|
||||
Tf 0.2000 0.2000 0.2000
|
||||
illum 2
|
||||
Ka 0.5882 0.5882 0.5882
|
||||
Kd 0.5882 0.5882 0.5882
|
||||
Ks 0.5000 0.5000 0.5000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
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/Submarine/submarine.obj
Normal file
203099
Projekte/battleship/client/src/main/resources/Models/Submarine/submarine.obj
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user