Testmerge #5
@@ -1,10 +1,14 @@
|
|||||||
package pp.mdga.client.Board;
|
package pp.mdga.client.Board;
|
||||||
|
|
||||||
|
import com.jme3.light.AmbientLight;
|
||||||
|
import com.jme3.light.DirectionalLight;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.queue.RenderQueue;
|
import com.jme3.renderer.queue.RenderQueue;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.control.AbstractControl;
|
import com.jme3.scene.control.AbstractControl;
|
||||||
|
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
@@ -34,6 +38,7 @@ public BoardView(MdgaApp app) {
|
|||||||
this.playerMap = new HashMap<>();
|
this.playerMap = new HashMap<>();
|
||||||
|
|
||||||
initMap();
|
initMap();
|
||||||
|
initCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap){
|
private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap){
|
||||||
@@ -60,6 +65,28 @@ private void initMap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initCamera() {
|
||||||
|
app.getFlyByCamera().setEnabled(true);
|
||||||
|
int zoom = 20;
|
||||||
|
app.getCamera().setLocation(new Vector3f(-zoom,0,zoom));
|
||||||
|
app.getCamera().lookAt(new Vector3f(0,0,0), new Vector3f(0,0,1));
|
||||||
|
|
||||||
|
DirectionalLight sun = new DirectionalLight();
|
||||||
|
sun.setColor(ColorRGBA.White);
|
||||||
|
sun.setDirection(new Vector3f(0.3f,0,-1));
|
||||||
|
app.getRootNode().addLight(sun);
|
||||||
|
|
||||||
|
AmbientLight ambient = new AmbientLight();
|
||||||
|
ambient.setColor(new ColorRGBA(0.3f,0.3f,0.3f,1));
|
||||||
|
app.getRootNode().addLight(ambient);
|
||||||
|
|
||||||
|
final int SHADOWMAP_SIZE= 1024 * 8;
|
||||||
|
DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(app.getAssetManager(), SHADOWMAP_SIZE, 4);
|
||||||
|
dlsr.setLight(sun);
|
||||||
|
app.getViewPort().addProcessor(dlsr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Color assetToColor(BoardAsset asset){
|
private Color assetToColor(BoardAsset asset){
|
||||||
return switch(asset){
|
return switch(asset){
|
||||||
case lw -> Color.AIRFORCE;
|
case lw -> Color.AIRFORCE;
|
||||||
|
|||||||
Reference in New Issue
Block a user