use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestShadowBug method simpleInitApp.
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(100f);
rootNode.attachChild(makeFloor());
Node characters = new Node("Characters");
characters.setShadowMode(ShadowMode.Cast);
rootNode.attachChild(characters);
Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
golem.scale(0.5f);
golem.setLocalTranslation(200.0f, -6f, 200f);
golem.setShadowMode(ShadowMode.CastAndReceive);
characters.attachChild(golem);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-1f, -1f, 1f));
sun.setColor(ColorRGBA.White.mult(1.3f));
rootNode.addLight(sun);
characters.addLight(sun);
SpotLight spot = new SpotLight();
// distance
spot.setSpotRange(13f);
// inner light cone (central beam)
spot.setSpotInnerAngle(15f * FastMath.DEG_TO_RAD);
// outer light cone (edge of the light)
spot.setSpotOuterAngle(20f * FastMath.DEG_TO_RAD);
// light color
spot.setColor(ColorRGBA.White.mult(1.3f));
spot.setPosition(new Vector3f(192.0f, -1f, 192f));
spot.setDirection(new Vector3f(1, -0.5f, 1));
rootNode.addLight(spot);
PointLight lamp_light = new PointLight();
lamp_light.setColor(ColorRGBA.Yellow);
lamp_light.setRadius(20f);
lamp_light.setPosition(new Vector3f(210.0f, 0f, 210f));
rootNode.addLight(lamp_light);
SpotLightShadowRenderer slsr = new SpotLightShadowRenderer(assetManager, 512);
slsr.setLight(spot);
slsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
slsr.setShadowIntensity(0.6f);
slsr.setFlushQueues(false);
viewPort.addProcessor(slsr);
PointLightShadowRenderer plsr = new PointLightShadowRenderer(assetManager, 512);
plsr.setLight(lamp_light);
plsr.setShadowIntensity(0.6f);
plsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
plsr.setFlushQueues(false);
viewPort.addProcessor(plsr);
viewPort.getCamera().setLocation(new Vector3f(192.0f, 10f, 192f));
float[] angles = new float[] { 3.14f / 2, 3.14f / 2, 0 };
viewPort.getCamera().setRotation(new Quaternion(angles));
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestSpotLight method setupSignpost.
public void setupSignpost() {
Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
// mat.setBoolean("VertexLighting", true);
signpost.setMaterial(mat);
signpost.rotate(0, FastMath.HALF_PI, 0);
signpost.setLocalTranslation(12, 3.5f, 30);
signpost.setLocalScale(4);
signpost.setShadowMode(ShadowMode.CastAndReceive);
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestSpotLightShadows method setupSignpost.
public void setupSignpost() {
Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
// mat.setBoolean("VertexLighting", true);
signpost.setMaterial(mat);
signpost.rotate(0, FastMath.HALF_PI, 0);
signpost.setLocalTranslation(12, 3.5f, 30);
signpost.setLocalScale(4);
signpost.setShadowMode(ShadowMode.CastAndReceive);
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestSpotLightTerrain method createSky.
private void createSky() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestBumpModel method simpleInitApp.
@Override
public void simpleInitApp() {
Spatial signpost = (Spatial) assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml"));
signpost.setMaterial((Material) assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"));
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial((Material) assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
// flourescent main light
pl = new PointLight();
pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f));
rootNode.addLight(pl);
// sunset light
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, 1).normalizeLocal());
dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f));
rootNode.addLight(dl);
// skylight
dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.6f, -1, -0.6f).normalizeLocal());
dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f));
rootNode.addLight(dl);
// white ambient light
dl = new DirectionalLight();
dl.setDirection(new Vector3f(1, -0.5f, -0.1f).normalizeLocal());
dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f));
rootNode.addLight(dl);
}
Aggregations