com.jme3.renderer.queue.RenderQueue.ShadowMode Java Examples
The following examples show how to use
com.jme3.renderer.queue.RenderQueue.ShadowMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestBrickWall.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("shoot") && !keyPressed) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(cam.getLocation()); SphereCollisionShape bulletCollisionShape = new SphereCollisionShape(0.4f); RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); // RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1); bulletNode.setLinearVelocity(cam.getDirection().mult(25)); bulletg.addControl(bulletNode); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletNode); } if (name.equals("gc") && !keyPressed) { System.gc(); } }
Example #2
Source File: TestSpotLight.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess",3); // mat.setBoolean("VertexLighting", true); Box floor = new Box(Vector3f.ZERO, 50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #3
Source File: TestHoveringTank.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void buildPlayer() { spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml"); CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft); spaceCraft.setShadowMode(ShadowMode.CastAndReceive); spaceCraft.setLocalTranslation(new Vector3f(-140, 14, -23)); spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0})); hoverControl = new PhysicsHoverControl(colShape, 500); hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02); spaceCraft.addControl(hoverControl); rootNode.attachChild(spaceCraft); getPhysicsSpace().add(hoverControl); ChaseCamera chaseCam = new ChaseCamera(cam, inputManager); spaceCraft.addControl(chaseCam); flyCam.setEnabled(false); }
Example #4
Source File: TestSpotLight.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess",3); // mat.setBoolean("VertexLighting", true); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #5
Source File: PssmShadowRenderer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void postFrame(FrameBuffer out) { Camera cam = viewPort.getCamera(); if (!noOccluders) { postshadowMat.setColor("Splits", splits); for (int i = 0; i < nbSplits; i++) { postshadowMat.setMatrix4("LightViewProjectionMatrix" + i, lightViewProjectionsMatrices[i]); } renderManager.setForcedMaterial(postshadowMat); viewPort.getQueue().renderShadowQueue(ShadowMode.Receive, renderManager, cam, flushQueues); renderManager.setForcedMaterial(null); renderManager.setCamera(cam, false); } if (debug) { displayShadowMap(renderManager.getRenderer()); } }
Example #6
Source File: TestSpotLightShadows.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor() { Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setBoolean("UseMaterialColors", true); mat.setColor("Diffuse", ColorRGBA.White.clone()); mat.setColor("Ambient", ColorRGBA.White.clone()); // mat.setColor("Specular", ColorRGBA.White.clone()); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess", 0); // mat.setBoolean("VertexLighting", true); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #7
Source File: Spatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); name = ic.readString("name", null); worldBound = (BoundingVolume) ic.readSavable("world_bound", null); cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit); batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit); queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class, RenderQueue.Bucket.Inherit); shadowMode = ic.readEnum("shadow_mode", ShadowMode.class, ShadowMode.Inherit); localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY); localLights = (LightList) ic.readSavable("lights", null); localLights.setOwner(this); //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split //the AnimControl creates the SkeletonControl for old files and add it to the spatial. //The SkeletonControl must be the last in the stack so we add the list of all other control before it. //When backward compatibility won't be needed anymore this can be replaced by : //controls = ic.readSavableArrayList("controlsList", null)); controls.addAll(0, ic.readSavableArrayList("controlsList", null)); userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null); }
Example #8
Source File: TestShadowsPerf.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createballs() { System.out.println((frames / time) + ";" + val); for (int i = val; i < val+1 ; i++) { Geometry s = sphere.clone().clone(false); s.setMaterial(mat); s.setLocalTranslation(i - 30, 5, (((i) * 2) % 40) - 50); s.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(s); } if (val == 300) { stop(); } val += 1; time = 0; frames = 0; }
Example #9
Source File: TestHoveringTank.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void buildPlayer() { spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml"); CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft); spaceCraft.setShadowMode(ShadowMode.CastAndReceive); spaceCraft.setLocalTranslation(startLocation); spaceCraft.setLocalRotation(startOrientation); hoverControl = new PhysicsHoverControl(colShape, 500); spaceCraft.addControl(hoverControl); rootNode.attachChild(spaceCraft); getPhysicsSpace().add(hoverControl); hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02); ChaseCamera chaseCam = new ChaseCamera(cam, inputManager); spaceCraft.addControl(chaseCam); flyCam.setEnabled(false); }
Example #10
Source File: TestBrickWall.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("shoot") && !keyPressed) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(cam.getLocation()); SphereCollisionShape bulletCollisionShape = new SphereCollisionShape(0.4f); RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); // RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1); bulletNode.setLinearVelocity(cam.getDirection().mult(25)); bulletg.addControl(bulletNode); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletNode); } if (name.equals("gc") && !keyPressed) { System.gc(); } }
Example #11
Source File: WelcomeScreen.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void setupSkyBox() { Mesh sphere = new Sphere(32, 32, 10f); sphere.setStatic(); skyBox = new Geometry("SkyBox", sphere); skyBox.setQueueBucket(Bucket.Sky); skyBox.setShadowMode(ShadowMode.Off); Image cube = SceneApplication.getApplication().getAssetManager().loadTexture("Textures/blue-glow-1024.dds").getImage(); TextureCubeMap cubemap = new TextureCubeMap(cube); Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Sky.j3md"); mat.setBoolean("SphereMap", false); mat.setTexture("Texture", cubemap); mat.setVector3("NormalScale", new Vector3f(1, 1, 1)); skyBox.setMaterial(mat); ((Node) SceneApplication.getApplication().getViewPort().getScenes().get(0)).attachChild(skyBox); }
Example #12
Source File: PssmShadowRenderer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Geometry createFrustum(Vector3f[] pts, int i) { WireFrustum frustum = new WireFrustum(pts); Geometry frustumMdl = new Geometry("f", frustum); frustumMdl.setCullHint(Spatial.CullHint.Never); frustumMdl.setShadowMode(ShadowMode.Off); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.getAdditionalRenderState().setWireframe(true); frustumMdl.setMaterial(mat); switch (i) { case 0: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink); break; case 1: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red); break; case 2: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green); break; case 3: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue); break; default: frustumMdl.getMaterial().setColor("Color", ColorRGBA.White); break; } frustumMdl.updateGeometricState(); return frustumMdl; }
Example #13
Source File: TestPostFilters.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #14
Source File: PssmShadowRenderer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private Geometry createFrustum(Vector3f[] pts, int i) { WireFrustum frustum = new WireFrustum(pts); Geometry frustumMdl = new Geometry("f", frustum); frustumMdl.setCullHint(Spatial.CullHint.Never); frustumMdl.setShadowMode(ShadowMode.Off); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.getAdditionalRenderState().setWireframe(true); frustumMdl.setMaterial(mat); switch (i) { case 0: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink); break; case 1: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red); break; case 2: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green); break; case 3: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue); break; default: frustumMdl.getMaterial().setColor("Color", ColorRGBA.White); break; } frustumMdl.updateGeometricState(); return frustumMdl; }
Example #15
Source File: MyParticleEmitter.java From OpenRTS with MIT License | 5 votes |
public MyParticleEmitter(String name, Type type, int numParticles) { super(); this.name = name; setBatchHint(BatchHint.Never); // ignore world transform, unless user sets inLocalSpace this.setIgnoreTransform(true); // particles neither receive nor cast shadows this.setShadowMode(ShadowMode.Off); // particles are usually transparent this.setQueueBucket(Bucket.Transparent); meshType = type; // Must create clone of shape/influencer so that a reference to a static is // not maintained shape = shape.deepClone(); particleInfluencer = particleInfluencer.clone(); control = new MyParticleEmitter.ParticleEmitterControl(this); controls.add(control); switch (meshType) { case Point: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; case Triangle: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; default: throw new IllegalStateException("Unrecognized particle type: " + meshType); } this.setNumParticles2(numParticles); // particleMesh.initParticleData(this, particles.length); }
Example #16
Source File: Spatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return The shadow mode of this spatial, if the local shadow * mode is set to inherit, then the parent's shadow mode is returned. * * @see Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) * @see ShadowMode */ public RenderQueue.ShadowMode getShadowMode() { if (shadowMode != RenderQueue.ShadowMode.Inherit) { return shadowMode; } else if (parent != null) { return parent.getShadowMode(); } else { return ShadowMode.Off; } }
Example #17
Source File: Spatial.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @return The shadow mode of this spatial, if the local shadow * mode is set to inherit, then the parent's shadow mode is returned. * * @see Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) * @see ShadowMode */ public RenderQueue.ShadowMode getShadowMode() { if (shadowMode != RenderQueue.ShadowMode.Inherit) { return shadowMode; } else if (parent != null) { return parent.getShadowMode(); } else { return ShadowMode.Off; } }
Example #18
Source File: AbstractShadowRendererVR.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * debug function to create a visible frustum */ protected Geometry createFrustum(Vector3f[] pts, int i) { WireFrustum frustum = new WireFrustum(pts); Geometry frustumMdl = new Geometry("f", frustum); frustumMdl.setCullHint(Spatial.CullHint.Never); frustumMdl.setShadowMode(ShadowMode.Off); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.getAdditionalRenderState().setWireframe(true); frustumMdl.setMaterial(mat); switch (i) { case 0: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink); break; case 1: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red); break; case 2: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green); break; case 3: frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue); break; default: frustumMdl.getMaterial().setColor("Color", ColorRGBA.White); break; } frustumMdl.updateGeometricState(); return frustumMdl; }
Example #19
Source File: TestBrickTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void initFloor() { Box floorBox = new Box(Vector3f.ZERO, 10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, 0, 0); floor.addControl(new RigidBodyControl(0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
Example #20
Source File: TestBrickTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); // bulletAppState.setEnabled(false); stateManager.attach(bulletAppState); bullet = new Sphere(32, 32, 0.4f, true, false); bullet.setTextureMode(TextureMode.Projected); bulletCollisionShape = new SphereCollisionShape(0.4f); brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth); brick.scaleTextureCoordinates(new Vector2f(1f, .5f)); //bulletAppState.getPhysicsSpace().enableDebug(assetManager); initMaterial(); initTower(); initFloor(); initCrossHairs(); this.cam.setLocation(new Vector3f(0, 25f, 8f)); cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0)); cam.setFrustumFar(80); inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "shoot"); rootNode.setShadowMode(ShadowMode.Off); bsr = new PssmShadowRenderer(assetManager, 1024, 2); bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal()); bsr.setLambda(0.55f); bsr.setShadowIntensity(0.6f); bsr.setCompareMode(CompareMode.Hardware); bsr.setFilterMode(FilterMode.PCF4); viewPort.addProcessor(bsr); }
Example #21
Source File: TestBrickTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("shoot") && !keyPressed) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(cam.getLocation()); RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); // RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1); bulletNode.setLinearVelocity(cam.getDirection().mult(25)); bulletg.addControl(bulletNode); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletNode); } }
Example #22
Source File: TestBatchNodeTower.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void initFloor() { Box floorBox = new Box(10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, 0, 0); floor.addControl(new RigidBodyControl(0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
Example #23
Source File: TestBatchNodeTower.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("shoot") && !keyPressed) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(cam.getLocation()); RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); // RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1); bulletNode.setLinearVelocity(cam.getDirection().mult(25)); bulletg.addControl(bulletNode); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletNode); } }
Example #24
Source File: TestEverything.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #25
Source File: TestWalkingChar.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void addBrick(Vector3f ori) { Geometry reBoxg = new Geometry("brick", brick); reBoxg.setMaterial(matBullet); reBoxg.setLocalTranslation(ori); reBoxg.addControl(new RigidBodyControl(1.5f)); reBoxg.setShadowMode(ShadowMode.CastAndReceive); this.rootNode.attachChild(reBoxg); this.getPhysicsSpace().add(reBoxg); }
Example #26
Source File: TestEverything.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #27
Source File: TestEverything.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #28
Source File: TestParallaxPBR.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #29
Source File: Spatial.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * @return The shadow mode of this spatial, if the local shadow * mode is set to inherit, then the parent's shadow mode is returned. * * @see Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) * @see ShadowMode */ public RenderQueue.ShadowMode getShadowMode() { if (shadowMode != RenderQueue.ShadowMode.Inherit) { return shadowMode; } else if (parent != null) { return parent.getShadowMode(); } else { return ShadowMode.Off; } }
Example #30
Source File: Spatial.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); name = ic.readString("name", null); worldBound = (BoundingVolume) ic.readSavable("world_bound", null); cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit); batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit); queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class, RenderQueue.Bucket.Inherit); shadowMode = ic.readEnum("shadow_mode", ShadowMode.class, ShadowMode.Inherit); localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY); localLights = (LightList) ic.readSavable("lights", null); localLights.setOwner(this); ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null); if (localOverridesList == null) { localOverrides = new SafeArrayList<>(MatParamOverride.class); } else { localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList); } worldOverrides = new SafeArrayList<>(MatParamOverride.class); //changed for backward compatibility with j3o files //generated before the AnimControl/SkeletonControl split //the AnimControl creates the SkeletonControl for old files and add it to the spatial. //The SkeletonControl must be the last in the stack //so we add the list of all other control before it. //When backward compatibility won't be needed anymore this can be replaced by : //controls = ic.readSavableArrayList("controlsList", null)); controls.addAll(0, ic.readSavableArrayList("controlsList", null)); userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null); }