public void onAction(String name, boolean value, float tpf) { if (name.equals("use_water") && value) { if (!useWater) { useWater = true; waterPlane.setMaterial(waterProcessor.getMaterial()); } else { useWater = false; waterPlane.setMaterial(mat); } } else if (name.equals("lightup") && value) { lightPos.y++; } else if (name.equals("lightdown") && value) { lightPos.y--; } else if (name.equals("lightleft") && value) { lightPos.x--; } else if (name.equals("lightright") && value) { lightPos.x++; } else if (name.equals("lightforward") && value) { lightPos.z--; } else if (name.equals("lightback") && value) { lightPos.z++; } } }
@Override public void setMaterial(Material mat){ for (int i = 0; i < children.size(); i++){ children.get(i).setMaterial(mat); } }
/** * Instantiate an enabled control to visualize the specified character. * * @param debugAppState which app state (not null, alias created) * @param body the character to visualize (not null, alias created) */ public BulletCharacterDebugControl(BulletDebugAppState debugAppState, PhysicsCharacter body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_PINK); }
/** * Instantiate an enabled control to visualize the specified ghost object. * * @param debugAppState which app state (not null, alias created) * @param body which object to visualize (not null, alias created) */ public BulletGhostObjectDebugControl(BulletDebugAppState debugAppState, PhysicsGhostObject body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_YELLOW); }
/** * Instantiate an enabled control to visualize the specified body. * * @param debugAppState which app state (not null, alias created) * @param body which body to visualize (not null, alias created) */ public BulletRigidBodyDebugControl(BulletDebugAppState debugAppState, PhysicsRigidBody body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_BLUE); }
/** * Instantiate an enabled control to visualize the specified ghost object. * * @param debugAppState which app state (not null, alias created) * @param body which object to visualize (not null, alias created) */ public BulletGhostObjectDebugControl(BulletDebugAppState debugAppState, PhysicsGhostObject body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_YELLOW); }
/** * Instantiate an enabled control to visualize the specified character. * * @param debugAppState which app state (not null, alias created) * @param body the character to visualize (not null, alias created) */ public BulletCharacterDebugControl(BulletDebugAppState debugAppState, PhysicsCharacter body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_PINK); }
/** * Instantiate an enabled control to visualize the specified body. * * @param debugAppState which app state (not null, alias created) * @param body which body to visualize (not null, alias created) */ public BulletRigidBodyDebugControl(BulletDebugAppState debugAppState, PhysicsRigidBody body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_BLUE); }
public void onAction(String name, boolean isPressed, float tpf) { if (isPressed) return; Material mat; if (isLit){ mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m"); debugTangents.setCullHint(CullHint.Inherit); }else{ mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setTexture("NormalMap", assetManager.loadTexture("Models/TangentBugs/test_normal.png")); debugTangents.setCullHint(CullHint.Always); } isLit = !isLit; badModel.setMaterial(mat); } }, "space");
public void setupSignpost() { Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml"); Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"); signpost.setMaterial(mat); signpost.rotate(0, FastMath.HALF_PI, 0); signpost.setLocalTranslation(12, 3.5f, 30); signpost.setLocalScale(4); signpost.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(signpost); }
public void setupSignpost(){ Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml"); Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"); signpost.setMaterial(mat); signpost.rotate(0, FastMath.HALF_PI, 0); signpost.setLocalTranslation(12, 3.5f, 30); signpost.setLocalScale(4); signpost.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(signpost); }
public void setupRobotGuy(){ Node model = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml"); Material mat = assetManager.loadMaterial("Models/Oto/Oto.j3m"); model.getChild(0).setMaterial(mat); // model.setAnimation("Walk"); model.setLocalTranslation(30, 10.5f, 30); model.setLocalScale(2); model.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(model); }
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); }
public void setupSignpost() { Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml"); Material matSp = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"); TangentBinormalGenerator.generate(signpost); signpost.setMaterial(matSp); signpost.rotate(0, FastMath.HALF_PI, 0); signpost.setLocalTranslation(12, 23.5f, 30); signpost.setLocalScale(4); signpost.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(signpost); }
public void setupSignpost() { Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml"); Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"); TangentBinormalGenerator.generate(signpost); signpost.setMaterial(mat); signpost.rotate(0, FastMath.HALF_PI, 0); signpost.setLocalTranslation(12, 23.5f, 30); signpost.setLocalScale(4); signpost.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(signpost); }
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); }
@Override public void initialize(){ super.initialize(); System.out.println("Initialize"); RootNodeState state = new RootNodeState(); viewPort.attachScene(state.getRootNode()); stateManager.attach(state); Spatial model = assetManager.loadModel("Models/Teapot/Teapot.obj"); model.scale(3); model.setMaterial(assetManager.loadMaterial("Interface/Logo/Logo.j3m")); state.getRootNode().attachChild(model); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); niftyDisplay.getNifty().fromXml("Interface/Nifty/HelloJme.xml", "start"); guiViewPort.addProcessor(niftyDisplay); }
@Override public void simpleInitApp() { initInput(); initScene(); //create processor waterProcessor = new SimpleWaterProcessor(assetManager); waterProcessor.setReflectionScene(sceneNode); waterProcessor.setDebug(true); viewPort.addProcessor(waterProcessor); waterProcessor.setLightPosition(lightPos); //create water quad //waterPlane = waterProcessor.createWaterGeometry(100, 100); waterPlane=(Spatial) assetManager.loadModel("Models/WaterTest/WaterTest.mesh.xml"); waterPlane.setMaterial(waterProcessor.getMaterial()); waterPlane.setLocalScale(40); waterPlane.setLocalTranslation(-5, 0, 5); rootNode.attachChild(waterPlane); }
@Override public void simpleInitApp() { Quad quadMesh = new Quad(1, 1); Geometry sphere = new Geometry("Rock Ball", quadMesh); Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m"); sphere.setMaterial(mat); TangentBinormalGenerator.generate(sphere); rootNode.attachChild(sphere); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); // DirectionalLight dl = new DirectionalLight(); // dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal()); // dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f)); // rootNode.addLight(dl); }
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); sphere.setMaterial(mat); rootNode.attachChild(sphere); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); // DirectionalLight dl = new DirectionalLight(); // dl.setDirection(new Vector3f(1,-1,1).normalizeLocal()); // dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f)); // rootNode.addLight(dl); }