/** * Loads scene ambient light. * @param worldStructure * the world's blender structure * @return the scene's ambient light */ public Light toAmbientLight(Structure worldStructure) { LOGGER.fine("Loading ambient light."); AmbientLight ambientLight = null; float ambr = ((Number) worldStructure.getFieldValue("ambr")).floatValue(); float ambg = ((Number) worldStructure.getFieldValue("ambg")).floatValue(); float ambb = ((Number) worldStructure.getFieldValue("ambb")).floatValue(); if (ambr > 0 || ambg > 0 || ambb > 0) { ambientLight = new AmbientLight(); ColorRGBA ambientLightColor = new ColorRGBA(ambr, ambg, ambb, 0.0f); ambientLight.setColor(ambientLightColor); LOGGER.log(Level.FINE, "Loaded ambient light: {0}.", ambientLightColor); } else { LOGGER.finer("Ambient light is set to BLACK which means: no ambient light! The ambient light node will not be included in the result."); } return ambientLight; }
private void parseLight(Attributes attribs) throws SAXException { if (node == null || node.getParent() == null) { throw new SAXException("dotScene parse error: light can only appear under a node"); } checkTopNode("node"); String lightType = parseString(attribs.getValue("type"), "point"); if (lightType.equals("point")) { light = new PointLight(); } else if (lightType.equals("directional") || lightType.equals("sun")) { light = new DirectionalLight(); // Assuming "normal" property is not provided ((DirectionalLight) light).setDirection(Vector3f.UNIT_Z); } else if (lightType.equals("spotLight") || lightType.equals("spot")) { light = new SpotLight(); } else if (lightType.equals("omni")) { // XXX: It doesn't seem any exporters actually emit this type? light = new AmbientLight(); } else { logger.log(Level.WARNING, "No matching jME3 LightType found for OGRE LightType: {0}", lightType); } logger.log(Level.FINEST, "{0} created.", light); if (!parseBool(attribs.getValue("visible"), true)) { // set to disabled } // "attach" it to the parent of this node if (light != null) { node.getParent().addLight(light); } }
private void setUpLight() { // We add light so we see the scene AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White.mult(1.3f)); rootNode.addLight(al); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal()); rootNode.addLight(dl); }
System.out.println("Points: " + player.getUserData("points")); AmbientLight al = new AmbientLight(); rootNode.addLight(al);
AmbientLight al = new AmbientLight(); scene.addLight(al);
@Test public void testAmbientFiltering() { geom.addLight(new AmbientLight()); checkFilteredLights(1); // Ambient lights must never be filtered // Test for bounding Sphere geom.setModelBound(new BoundingSphere(0.5f, Vector3f.ZERO)); checkFilteredLights(1); // Ambient lights must never be filtered }
rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray));
@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); } }
@Override public void simpleInitApp() { makeTerrain(); flyCam.setMoveSpeed(50); sl = new SpotLight(); sl.setSpotRange(100); sl.setSpotOuterAngle(20 * FastMath.DEG_TO_RAD); sl.setSpotInnerAngle(15 * FastMath.DEG_TO_RAD); sl.setDirection(new Vector3f(-0.39820394f, -0.73094344f, 0.55421597f)); sl.setPosition(new Vector3f(-64.61567f, -87.615425f, -202.41328f)); rootNode.addLight(sl); AmbientLight ambLight = new AmbientLight(); ambLight.setColor(ColorRGBA.Black); rootNode.addLight(ambLight); cam.setLocation(new Vector3f(-41.219646f, 0.8363f, -171.67267f)); cam.setRotation(new Quaternion(-0.04562731f, 0.89917684f, -0.09668826f, -0.4243236f)); sl.setDirection(cam.getDirection()); sl.setPosition(cam.getLocation()); }
@Override public void simpleInitApp() { loadHintText(); initCrossHairs(); setupKeys(); createMarker(); // WIREFRAME material matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); matWire.getAdditionalRenderState().setWireframe(true); matWire.setColor("Color", ColorRGBA.Green); createTerrain(); //createTerrainGrid(); DirectionalLight light = new DirectionalLight(); light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize()); rootNode.addLight(light); AmbientLight ambLight = new AmbientLight(); ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f)); rootNode.addLight(ambLight); cam.setLocation(new Vector3f(0, 256, 0)); cam.lookAtDirection(new Vector3f(0, -1f, 0).normalizeLocal(), Vector3f.UNIT_X); }
public void setupLighting(){ AmbientLight al=new AmbientLight(); al.setColor(ColorRGBA.White.mult(0.02f)); rootNode.addLight(al);
@Test public void testSimpleSort() { Geometry g = new Geometry("test", new Mesh()); LightList list = new LightList(g); list.add(new SpotLight(Vector3f.ZERO, Vector3f.UNIT_X)); list.add(new PointLight(Vector3f.UNIT_X)); list.add(new DirectionalLight(Vector3f.UNIT_X)); list.add(new AmbientLight()); list.sort(true); assert list.get(0) instanceof AmbientLight; // Ambients always first assert list.get(1) instanceof DirectionalLight; // .. then directionals assert list.get(2) instanceof SpotLight; // Spot is 0 units away from geom assert list.get(3) instanceof PointLight; // .. and point is 1 unit away. }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(68.45442f, 8.235511f, 7.9676695f)); cam.setRotation(new Quaternion(0.046916496f, -0.69500375f, 0.045538206f, 0.7160271f)); flyCam.setMoveSpeed(50); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); Texture diff = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg"); diff.setWrap(Texture.WrapMode.Repeat); Texture norm = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall_normal.jpg"); norm.setWrap(Texture.WrapMode.Repeat); mat.setTexture("DiffuseMap", diff); mat.setTexture("NormalMap", norm); mat.setFloat("Shininess", 2.0f); AmbientLight al = new AmbientLight(); al.setColor(new ColorRGBA(1.8f, 1.8f, 1.8f, 1.0f)); rootNode.addLight(al); model = (Geometry) assetManager.loadModel("Models/Sponza/Sponza.j3o"); model.getMesh().scaleTextureCoordinates(new Vector2f(2, 2)); model.setMaterial(mat); rootNode.attachChild(model); FilterPostProcessor fpp = new FilterPostProcessor(assetManager); SSAOFilter ssaoFilter = new SSAOFilter(2.9299974f,32.920483f,5.8100376f,0.091000035f);; ssaoFilter.setApproximateNormals(true); fpp.addFilter(ssaoFilter); SSAOUI ui = new SSAOUI(inputManager, ssaoFilter); viewPort.addProcessor(fpp); }
public void setupLights() { AmbientLight al = new AmbientLight(); al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1)); rootNode.addLight(al);
AmbientLight light = new AmbientLight(); light.setColor(ColorRGBA.LightGray); rootNode.addLight(light);
viewPort.setBackgroundColor(ColorRGBA.DarkGray); rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal())); rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray));
AmbientLight al = new AmbientLight(); rootNode.addLight(al);
rootNode.addLight(dl); AmbientLight am = new AmbientLight(); am.setColor(ColorRGBA.White.mult(2)); rootNode.addLight(am);
rootNode.addLight(light); AmbientLight ambLight = new AmbientLight(); ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f)); rootNode.addLight(ambLight);
PointLight point = new PointLight(Vector3f.UNIT_X); DirectionalLight directional = new DirectionalLight(Vector3f.UNIT_X); AmbientLight ambient = new AmbientLight();