/** * 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); } }
@Override public void onAction(String name, boolean isPressed, float tpf) { if ((name.equals("ShadowUp") || name.equals("ShadowDown")) && isPressed) { al.setColor(ColorRGBA.White.mult((1 - plsr.getShadowIntensity()) * 0.2f)); } } }
System.out.println("Points: " + player.getUserData("points")); AmbientLight al = new AmbientLight(); rootNode.addLight(al);
al.setColor(ColorRGBA.White.mult((1 - dlsr.getShadowIntensity()) * 0.2f));
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); }
AmbientLight al = new AmbientLight(); scene.addLight(al);
@Override public Object call() throws Exception { ColorRGBA jmeAmbient = JMEDataTypeUtils.colorToColorRGBA(ambient); ambientLight.setColor(jmeAmbient); notifyRepaint(); return null; } });
if (!color.equals(ColorRGBA.Black) && !color.equals(ColorRGBA.BlackNoAlpha)) { AmbientLight al = new AmbientLight(); al.setColor(color); root.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 }
public void setAmbientLightBrightness(float brightness) { ambientLight.setColor(ColorRGBA.White.mult(brightness)); notifyRepaint(); }
@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); } }
rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray));
public void setAmbientLightBrightness(float brightness) { ambientLight.setColor(ColorRGBA.White.mult(brightness)); notifyRepaint(); }
@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() { AmbientLight al = new AmbientLight(); rootNode.addLight(al);
lightmarker.setColor(ColorRGBA.Red.mult(2f));
@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); }
@Override public void simpleInitApp() { AmbientLight al = new AmbientLight(); rootNode.addLight(al);
public void setupLighting(){ AmbientLight al=new AmbientLight(); al.setColor(ColorRGBA.White.mult(0.02f)); rootNode.addLight(al);