use of com.jme3.light.PointLight in project jmonkeyengine by jMonkeyEngine.
the class TestNormalMapping method simpleInitApp.
@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);
}
use of com.jme3.light.PointLight in project jmonkeyengine by jMonkeyEngine.
the class TestUnshadedModel method simpleInitApp.
@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);
}
use of com.jme3.light.PointLight in project jmonkeyengine by jMonkeyEngine.
the class TestOgreLoading method simpleInitApp.
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 = (Spatial) assetManager.loadModel("Models/Elephant/Elephant.mesh.xml");
float scale = 0.05f;
elephant.scale(scale, scale, scale);
rootNode.attachChild(elephant);
}
use of com.jme3.light.PointLight in project jmonkeyengine by jMonkeyEngine.
the class SceneLoader method parseLight.
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);
}
}
Aggregations