use of com.jme3.light.SpotLight in project jmonkeyengine by jMonkeyEngine.
the class SceneLoader method parseLightSpotLightRange.
private void parseLightSpotLightRange(Attributes attribs) throws SAXException {
checkTopNode("light");
float outer = SAXUtil.parseFloat(attribs.getValue("outer"));
float inner = SAXUtil.parseFloat(attribs.getValue("inner"));
if (!(light instanceof SpotLight)) {
throw new SAXException("dotScene parse error: spotLightRange " + "can only appear under 'spot' light elements");
}
SpotLight sl = (SpotLight) light;
sl.setSpotInnerAngle(inner * 0.5f);
sl.setSpotOuterAngle(outer * 0.5f);
}
use of com.jme3.light.SpotLight 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