use of com.jme3.light.AmbientLight 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