Added models as .j3o file
added color & bump texture path in 'ShipModelÃ' added lighting texture for models
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
*/
|
||||
class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md";
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
private static final String SHOT = "shot"; //NON-NLS
|
||||
@@ -206,6 +207,15 @@ private Spatial createBattleship(Battleship ship, ShipModel shipModel) {
|
||||
model.setLocalTranslation(shipModel.getTranslation());
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
Material mat = new Material(app.getAssetManager(), LIGHTING);
|
||||
|
||||
String colorPath = shipModel.getColorPath();
|
||||
String bumpPath = shipModel.getBumpPath();
|
||||
if (colorPath != null) mat.setTexture("DiffuseMap",app.getAssetManager().loadTexture(colorPath));
|
||||
if (bumpPath != null) mat.setTexture("NormalMap", app.getAssetManager().loadTexture(bumpPath));
|
||||
|
||||
mat.setReceivesShadows(true);
|
||||
model.setMaterial(mat);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,19 +3,31 @@
|
||||
import com.jme3.math.Vector3f;
|
||||
|
||||
public enum ShipModel {
|
||||
SHIP1("Models/Ships/1/ship1.obj",0.15f, new Vector3f(0f, 0f, 0f)),
|
||||
SHIP2("Models/Ships/2/ship2.obj",0.03f, new Vector3f(0f, 0.2f, 0f)),
|
||||
SHIP3("Models/Ships/3/ship3.obj",0.47f, new Vector3f(0f, -0.2f, 0f)),
|
||||
SHIP4("Models/Ships/4/ship4.obj",1.48f, new Vector3f(0f, 0f, 0f));
|
||||
SHIP1("Models/Ships/1/ship1.j3o",0.15f, new Vector3f(0f, 0f, 0f), "Models/Ships/1/ship1_color.png", null),
|
||||
SHIP2("Models/Ships/2/ship2.j3o",0.03f, new Vector3f(0f, 0.2f, 0f), "Models/Ships/2/ship2.jpg", null),
|
||||
SHIP3("Models/Ships/3/ship3.j3o",0.47f, new Vector3f(0f, -0.2f, 0f), "Models/Ships/3/ship3_color.jpg", null),
|
||||
SHIP4("Models/Ships/4/ship4.j3o",1.48f, new Vector3f(0f, 0f, 0f), "Models/Ships/4/ship4_color.jpg", "Models/Ships/4/ship4_bump.jpg");
|
||||
|
||||
private final String modelPath;
|
||||
private final float modelScale;
|
||||
private final Vector3f translation;
|
||||
private final String colorPath;
|
||||
private final String bumpPath;
|
||||
|
||||
ShipModel(String modelPath, float modelScale, Vector3f translation){
|
||||
ShipModel(String modelPath, float modelScale, Vector3f translation, String colorPath, String bumpPath){
|
||||
this.modelPath = modelPath;
|
||||
this.modelScale = modelScale;
|
||||
this.translation = translation;
|
||||
this.colorPath = colorPath;
|
||||
this.bumpPath = bumpPath;
|
||||
}
|
||||
|
||||
public String getBumpPath() {
|
||||
return bumpPath;
|
||||
}
|
||||
|
||||
public String getColorPath() {
|
||||
return colorPath;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
|
||||
Binary file not shown.
@@ -19,4 +19,4 @@ Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd ship1_color_2.png
|
||||
map_Kd ship1_color.png
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 87 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user