use of com.jme3.shadow.BasicShadowRenderer in project jmonkeyengine by jMonkeyEngine.
the class TestBrickWall method simpleInitApp.
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach(bulletAppState);
bullet = new Sphere(32, 32, 0.4f, true, false);
bullet.setTextureMode(TextureMode.Projected);
bulletCollisionShape = new SphereCollisionShape(0.4f);
brick = new Box(bLength, bHeight, bWidth);
brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
initMaterial();
initWall();
initFloor();
initCrossHairs();
this.cam.setLocation(new Vector3f(0, 6f, 6f));
cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
cam.setFrustumFar(15);
inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "shoot");
inputManager.addMapping("gc", new KeyTrigger(KeyInput.KEY_X));
inputManager.addListener(actionListener, "gc");
rootNode.setShadowMode(ShadowMode.Off);
bsr = new BasicShadowRenderer(assetManager, 256);
bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
viewPort.addProcessor(bsr);
}
use of com.jme3.shadow.BasicShadowRenderer in project jmonkeyengine by jMonkeyEngine.
the class TestFancyCar method simpleInitApp.
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
// bulletAppState.getPhysicsSpace().enableDebug(assetManager);
if (settings.getRenderer().startsWith("LWJGL")) {
BasicShadowRenderer bsr = new BasicShadowRenderer(assetManager, 512);
bsr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
// viewPort.addProcessor(bsr);
}
cam.setFrustumFar(150f);
flyCam.setMoveSpeed(10);
setupKeys();
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
// setupFloor();
buildPlayer();
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.5f, -1f, -0.3f).normalizeLocal());
rootNode.addLight(dl);
dl = new DirectionalLight();
dl.setDirection(new Vector3f(0.5f, -0.1f, 0.3f).normalizeLocal());
// rootNode.addLight(dl);
}
use of com.jme3.shadow.BasicShadowRenderer in project jmonkeyengine by jMonkeyEngine.
the class TestEverything method setupBasicShadow.
public void setupBasicShadow() {
if (renderer.getCaps().contains(Caps.GLSL100)) {
bsr = new BasicShadowRenderer(assetManager, 1024);
bsr.setDirection(lightDir);
viewPort.addProcessor(bsr);
}
}
use of com.jme3.shadow.BasicShadowRenderer in project jmonkeyengine by jMonkeyEngine.
the class TestShadow method simpleInitApp.
@Override
public void simpleInitApp() {
// put the camera in a bad position
cam.setLocation(new Vector3f(0.7804813f, 1.7502685f, -2.1556435f));
cam.setRotation(new Quaternion(0.1961598f, -0.7213164f, 0.2266092f, 0.6243975f));
cam.setFrustumFar(10);
Material mat = assetManager.loadMaterial("Common/Materials/WhiteColor.j3m");
rootNode.setShadowMode(ShadowMode.Off);
Box floor = new Box(3, 0.1f, 3);
Geometry floorGeom = new Geometry("Floor", floor);
floorGeom.setMaterial(mat);
floorGeom.setLocalTranslation(0, -0.2f, 0);
floorGeom.setShadowMode(ShadowMode.Receive);
rootNode.attachChild(floorGeom);
teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
teapot.setLocalScale(2f);
teapot.setMaterial(mat);
teapot.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(teapot);
// lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
// lightMdl.setMaterial(mat);
// // disable shadowing for light representation
// lightMdl.setShadowMode(ShadowMode.Off);
// rootNode.attachChild(lightMdl);
bsr = new BasicShadowRenderer(assetManager, 512);
bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
viewPort.addProcessor(bsr);
frustum = new WireFrustum(bsr.getPoints());
frustumMdl = new Geometry("f", frustum);
frustumMdl.setCullHint(Spatial.CullHint.Never);
frustumMdl.setShadowMode(ShadowMode.Off);
frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
frustumMdl.getMaterial().getAdditionalRenderState().setWireframe(true);
frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
rootNode.attachChild(frustumMdl);
}
Aggregations