Java Code Examples for com.jme3.light.PointLight#setColor()
The following examples show how to use
com.jme3.light.PointLight#setColor() .
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: TestSimpleBumps.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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); }
Example 2
Source File: TestBumpModel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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); AmbientLight al = new AmbientLight(); al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f)); rootNode.addLight(al); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal()); dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f)); rootNode.addLight(dl); }
Example 3
Source File: TestUnshadedModel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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"); mat.setColor("Ambient", ColorRGBA.DarkGray); mat.setColor("Diffuse", ColorRGBA.White); mat.setBoolean("UseMaterialColors", true); sphere.setMaterial(mat); rootNode.attachChild(sphere); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(4f, 0f, 0f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White); rootNode.addLight(al); }
Example 4
Source File: TestNormalMapping.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example 5
Source File: TestNormalMapping.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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); }
Example 6
Source File: TestSimpleBumps.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example 7
Source File: TestUnshadedModel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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"); mat.setColor("Ambient", ColorRGBA.DarkGray); mat.setColor("Diffuse", ColorRGBA.White); mat.setBoolean("UseMaterialColors", true); sphere.setMaterial(mat); rootNode.attachChild(sphere); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(4f, 0f, 0f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White); rootNode.addLight(al); }
Example 8
Source File: TestInstanceNodeWithLight.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { InstancedNode instancedNode = new InstancedNode("testInstancedNode"); rootNode.attachChild(instancedNode); box = new Geometry("Box", new Box(0.5f, 0.5f, 0.5f)); Material material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); material.setBoolean("UseInstancing", true); material.setColor("Diffuse", ColorRGBA.Red); material.setBoolean("UseMaterialColors", true); box.setMaterial(material); instancedNode.attachChild(box); instancedNode.instance(); pointLight = new PointLight(); pointLight.setColor(ColorRGBA.White); pointLight.setRadius(10f); rootNode.addLight(pointLight); box.setLocalTranslation(new Vector3f(offset, 0, 0)); pointLight.setPosition(new Vector3f(offset - 3f, 0, 0)); cam.setLocation(new Vector3f(offset - 5f, 0, 0)); cam.lookAtDirection(Vector3f.UNIT_X, Vector3f.UNIT_Y); }
Example 9
Source File: TestOgreLoading.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { // PointLight pl = new PointLight(); // pl.setPosition(new Vector3f(10, 10, -10)); // rootNode.addLight(pl); flyCam.setMoveSpeed(10f); // sunset light DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, 1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); lightMd2 = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMd2.setMaterial(assetManager.loadMaterial("Common/Materials/WhiteColor.j3m")); rootNode.attachChild(lightMd2); pl = new PointLight(); pl.setColor(new ColorRGBA(1, 0.9f, 0.9f, 0)); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); p2 = new PointLight(); p2.setColor(new ColorRGBA(0.9f, 1, 0.9f, 0)); p2.setPosition(new Vector3f(0f, 0f, 3f)); rootNode.addLight(p2); // create the geometry and attach it Spatial elephant = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml"); float scale = 0.05f; elephant.scale(scale, scale, scale); rootNode.attachChild(elephant); }
Example 10
Source File: OffScenePanel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void setupScene() { //setup framebuffer's cam camera.setFrustumPerspective(45f, 1f, 1f, 1000f); camera.setLocation(new Vector3f(5f, 5f, 5f)); camera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y); // setup framebuffer's scene light = new PointLight(); light.setPosition(camera.getLocation()); light.setColor(ColorRGBA.White); rootNode.addLight(light); // attach the scene to the viewport to be rendered viewPort.attachScene(rootNode); }
Example 11
Source File: TestJaime.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setupLights() { AmbientLight al = new AmbientLight(); al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1)); rootNode.addLight(al); SpotLight sl = new SpotLight(); sl.setColor(ColorRGBA.White.mult(1.0f)); sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f)); sl.setDirection(sl.getPosition().mult(-1)); sl.setSpotOuterAngle(0.1f); sl.setSpotInnerAngle(0.004f); rootNode.addLight(sl); //pointlight to fake indirect light coming from the ground PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White.mult(1.5f)); pl.setPosition(new Vector3f(0, 0, 1)); pl.setRadius(2); rootNode.addLight(pl); SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024); shadows.setLight(sl); shadows.setShadowIntensity(0.3f); shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8); viewPort.addProcessor(shadows); FilterPostProcessor fpp = new FilterPostProcessor(assetManager); SSAOFilter filter = new SSAOFilter(0.10997847f,0.440001f,0.39999998f,-0.008000026f);; fpp.addFilter(filter); fpp.addFilter(new FXAAFilter()); fpp.addFilter(new FXAAFilter()); viewPort.addProcessor(fpp); }
Example 12
Source File: TestLightRadius.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { Torus torus = new Torus(10, 6, 1, 3); // Torus torus = new Torus(50, 30, 1, 3); Geometry g = new Geometry("Torus Geom", torus); g.rotate(-FastMath.HALF_PI, 0, 0); g.center(); // g.move(0, 1, 0); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setFloat("Shininess", 32f); mat.setBoolean("UseMaterialColors", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.White); mat.setColor("Specular", ColorRGBA.White); // mat.setBoolean("VertexLighting", true); // mat.setBoolean("LowQuality", true); g.setMaterial(mat); rootNode.attachChild(g); 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.Green); pl.setRadius(4f); rootNode.addLight(pl); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.Red); dl.setDirection(new Vector3f(0, 1, 0)); rootNode.addLight(dl); }
Example 13
Source File: TestTangentCube.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { Box aBox = new Box(1, 1, 1); Geometry aGeometry = new Geometry("Box", aBox); TangentBinormalGenerator.generate(aBox); Material aMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); aMaterial.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg")); aMaterial.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall_normal.jpg")); aMaterial.setBoolean("UseMaterialColors", false); aMaterial.setColor("Diffuse", ColorRGBA.White); aMaterial.setColor("Specular", ColorRGBA.White); aMaterial.setFloat("Shininess", 64f); aGeometry.setMaterial(aMaterial); // Rotate 45 degrees to see multiple faces aGeometry.rotate(FastMath.QUARTER_PI, FastMath.QUARTER_PI, 0.0f); rootNode.attachChild(aGeometry); /** * Must add a light to make the lit object visible! */ PointLight aLight = new PointLight(); aLight.setPosition(new Vector3f(0, 3, 3)); aLight.setColor(ColorRGBA.Red); rootNode.addLight(aLight); // // AmbientLight bLight = new AmbientLight(); // bLight.setColor(ColorRGBA.Gray); // rootNode.addLight(bLight); ChaseCameraAppState chaser = new ChaseCameraAppState(); chaser.setTarget(aGeometry); getStateManager().attach(chaser); }
Example 14
Source File: TestLightNode.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { Torus torus = new Torus(10, 6, 1, 3); // Torus torus = new Torus(50, 30, 1, 3); Geometry g = new Geometry("Torus Geom", torus); g.rotate(-FastMath.HALF_PI, 0, 0); g.center(); // g.move(0, 1, 0); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setFloat("Shininess", 32f); mat.setBoolean("UseMaterialColors", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.White); mat.setColor("Specular", ColorRGBA.White); // mat.setBoolean("VertexLighting", true); // mat.setBoolean("LowQuality", true); g.setMaterial(mat); rootNode.attachChild(g); Geometry lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); movingNode=new Node("lightParentNode"); movingNode.attachChild(lightMdl); rootNode.attachChild(movingNode); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.Green); pl.setRadius(4f); rootNode.addLight(pl); LightNode lightNode=new LightNode("pointLight", pl); movingNode.attachChild(lightNode); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.Red); dl.setDirection(new Vector3f(0, 1, 0)); rootNode.addLight(dl); }
Example 15
Source File: TestSimpleLighting.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { Geometry teapot = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); TangentBinormalGenerator.generate(teapot.getMesh(), true); teapot.setLocalScale(2f); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); // mat.selectTechnique("GBuf"); mat.setFloat("Shininess", 25); mat.setBoolean("UseMaterialColors", true); cam.setLocation(new Vector3f(0.015041917f, 0.4572918f, 5.2874837f)); cam.setRotation(new Quaternion(-1.8875003E-4f, 0.99882424f, 0.04832061f, 0.0039016632f)); // mat.setTexture("ColorRamp", assetManager.loadTexture("Textures/ColorRamp/cloudy.png")); // // mat.setBoolean("VTangent", true); // mat.setBoolean("Minnaert", true); // mat.setBoolean("WardIso", true); // mat.setBoolean("VertexLighting", true); // mat.setBoolean("LowQuality", true); // mat.setBoolean("HighQuality", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.Gray); mat.setColor("Specular", ColorRGBA.Gray); teapot.setMaterial(mat); rootNode.attachChild(teapot); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); lightMdl.getMesh().setStatic(); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setRadius(4f); rootNode.addLight(pl); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal()); dl.setColor(ColorRGBA.Green); rootNode.addLight(dl); MaterialDebugAppState debug = new MaterialDebugAppState(); debug.registerBinding("Common/ShaderLib/BlinnPhongLighting.glsllib", teapot); stateManager.attach(debug); setPauseOnLostFocus(false); flyCam.setDragToRotate(true); }
Example 16
Source File: TestTwoSideLighting.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { // Two-sided lighting requires single pass. renderManager.setPreferredLightMode(TechniqueDef.LightMode.SinglePass); renderManager.setSinglePassLightBatchSize(4); cam.setLocation(new Vector3f(5.936224f, 3.3759952f, -3.3202777f)); cam.setRotation(new Quaternion(0.16265652f, -0.4811838f, 0.09137692f, 0.8565368f)); Geometry quadGeom = new Geometry("quad", new Quad(1, 1)); quadGeom.move(1, 0, 0); Material mat1 = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m"); // Display both front and back faces. mat1.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off); quadGeom.setMaterial(mat1); // SimpleBump material requires tangents. TangentBinormalGenerator.generate(quadGeom); rootNode.attachChild(quadGeom); Geometry teapot = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); teapot.move(-1, 0, 0); teapot.setLocalScale(2f); Material mat2 = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat2.setFloat("Shininess", 25); mat2.setBoolean("UseMaterialColors", true); mat2.setColor("Ambient", ColorRGBA.Black); mat2.setColor("Diffuse", ColorRGBA.Gray); mat2.setColor("Specular", ColorRGBA.Gray); // Only display backfaces. mat2.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Front); teapot.setMaterial(mat2); rootNode.attachChild(teapot); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); lightMdl.getMesh().setStatic(); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setRadius(4f); rootNode.addLight(pl); }
Example 17
Source File: TestTangentGenBadUV.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj"); if (teapot instanceof Geometry){ Geometry g = (Geometry) teapot; TangentBinormalGenerator.generate(g.getMesh()); }else{ throw new RuntimeException(); } teapot.setLocalScale(2f); Material mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m"); teapot.setMaterial(mat); rootNode.attachChild(teapot); Geometry debug = new Geometry( "Debug Teapot", TangentBinormalGenerator.genTbnLines(((Geometry) teapot).getMesh(), 0.03f) ); Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m"); debug.setMaterial(debugMat); debug.setCullHint(Spatial.CullHint.Never); debug.getLocalTranslation().set(teapot.getLocalTranslation()); debug.getLocalScale().set(teapot.getLocalScale()); rootNode.attachChild(debug); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal()); dl.setColor(ColorRGBA.White); rootNode.addLight(dl); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); lightMdl.getMesh().setStatic(); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); //pl.setRadius(3f); rootNode.addLight(pl); }
Example 18
Source File: TestMultiRenderTarget.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void simpleInitApp() { viewPort.addProcessor(this); renderManager.setForcedTechnique("GBuf"); // flyCam.setEnabled(false); cam.setLocation(new Vector3f(4.8037705f, 4.851632f, 10.789033f)); cam.setRotation(new Quaternion(-0.05143692f, 0.9483723f, -0.21131563f, -0.230846f)); Node tank = (Node) assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml"); //tankMesh.getMaterial().setColor("Specular", ColorRGBA.Black); rootNode.attachChild(tank); display1 = new Picture("Picture"); display1.move(0, 0, -1); // make it appear behind stats view display2 = (Picture) display1.clone(); display3 = (Picture) display1.clone(); display4 = (Picture) display1.clone(); display = (Picture) display1.clone(); ColorRGBA[] colors = new ColorRGBA[]{ ColorRGBA.White, ColorRGBA.Blue, ColorRGBA.Cyan, ColorRGBA.DarkGray, ColorRGBA.Green, ColorRGBA.Magenta, ColorRGBA.Orange, ColorRGBA.Pink, ColorRGBA.Red, ColorRGBA.Yellow }; for (int i = 0; i < 3; i++){ PointLight pl = new PointLight(); float angle = 0.314159265f * i; pl.setPosition( new Vector3f(FastMath.cos(angle)*2f, 0, FastMath.sin(angle)*2f)); pl.setColor(colors[i]); pl.setRadius(5); rootNode.addLight(pl); display.addLight(pl); } }
Example 19
Source File: TestTangentGenBadUV.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void simpleInitApp() { Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj"); if (teapot instanceof Geometry){ Geometry g = (Geometry) teapot; TangentBinormalGenerator.generate(g.getMesh()); }else{ throw new RuntimeException(); } teapot.setLocalScale(2f); Material mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m"); teapot.setMaterial(mat); rootNode.attachChild(teapot); Geometry debug = new Geometry( "Debug Teapot", TangentBinormalGenerator.genTbnLines(((Geometry) teapot).getMesh(), 0.03f) ); Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m"); debug.setMaterial(debugMat); debug.setCullHint(Spatial.CullHint.Never); debug.getLocalTranslation().set(teapot.getLocalTranslation()); debug.getLocalScale().set(teapot.getLocalScale()); rootNode.attachChild(debug); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal()); dl.setColor(ColorRGBA.White); rootNode.addLight(dl); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); lightMdl.getMesh().setStatic(); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); //pl.setRadius(3f); rootNode.addLight(pl); }
Example 20
Source File: TestLightNode.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void simpleInitApp() { Torus torus = new Torus(10, 6, 1, 3); // Torus torus = new Torus(50, 30, 1, 3); Geometry g = new Geometry("Torus Geom", torus); g.rotate(-FastMath.HALF_PI, 0, 0); g.center(); // g.move(0, 1, 0); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setFloat("Shininess", 32f); mat.setBoolean("UseMaterialColors", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.White); mat.setColor("Specular", ColorRGBA.White); // mat.setBoolean("VertexLighting", true); // mat.setBoolean("LowQuality", true); g.setMaterial(mat); rootNode.attachChild(g); Geometry lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); movingNode=new Node("lightParentNode"); movingNode.attachChild(lightMdl); rootNode.attachChild(movingNode); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.Green); pl.setRadius(4f); rootNode.addLight(pl); LightNode lightNode=new LightNode("pointLight", pl); movingNode.attachChild(lightNode); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.Red); dl.setDirection(new Vector3f(0, 1, 0)); rootNode.addLight(dl); }