Feature: added importing of Sun and Hemi lights from blender as
PointLight with very large radius and DirectionalLight (with proper warnings for the developer).
This commit is contained in:
parent
4633d9e546
commit
7783e096cc
@ -81,7 +81,9 @@ public class LightHelper extends AbstractBlenderHelper {
|
|||||||
((PointLight) light).setRadius(distance);
|
((PointLight) light).setRadius(distance);
|
||||||
break;
|
break;
|
||||||
case 1:// Sun
|
case 1:// Sun
|
||||||
LOGGER.log(Level.WARNING, "'Sun' lamp is not supported in jMonkeyEngine.");
|
LOGGER.log(Level.WARNING, "'Sun' lamp is not supported in jMonkeyEngine. Using PointLight with radius = Float.MAX_VALUE.");
|
||||||
|
light = new PointLight();
|
||||||
|
((PointLight) light).setRadius(Float.MAX_VALUE);
|
||||||
break;
|
break;
|
||||||
case 2:// Spot
|
case 2:// Spot
|
||||||
light = new SpotLight();
|
light = new SpotLight();
|
||||||
@ -98,21 +100,17 @@ public class LightHelper extends AbstractBlenderHelper {
|
|||||||
((SpotLight) light).setSpotInnerAngle(innerAngle);
|
((SpotLight) light).setSpotInnerAngle(innerAngle);
|
||||||
break;
|
break;
|
||||||
case 3:// Hemi
|
case 3:// Hemi
|
||||||
LOGGER.log(Level.WARNING, "'Hemi' lamp is not supported in jMonkeyEngine.");
|
LOGGER.log(Level.WARNING, "'Hemi' lamp is not supported in jMonkeyEngine. Using DirectionalLight instead.");
|
||||||
break;
|
|
||||||
case 4:// Area
|
case 4:// Area
|
||||||
light = new DirectionalLight();
|
light = new DirectionalLight();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new BlenderFileException("Unknown light source type: " + type);
|
throw new BlenderFileException("Unknown light source type: " + type);
|
||||||
}
|
}
|
||||||
if (light != null) {
|
|
||||||
float r = ((Number) structure.getFieldValue("r")).floatValue();
|
float r = ((Number) structure.getFieldValue("r")).floatValue();
|
||||||
float g = ((Number) structure.getFieldValue("g")).floatValue();
|
float g = ((Number) structure.getFieldValue("g")).floatValue();
|
||||||
float b = ((Number) structure.getFieldValue("b")).floatValue();
|
float b = ((Number) structure.getFieldValue("b")).floatValue();
|
||||||
light.setColor(new ColorRGBA(r, g, b, 1.0f));
|
light.setColor(new ColorRGBA(r, g, b, 1.0f));
|
||||||
result = new LightNode(structure.getName(), light);
|
return new LightNode(structure.getName(), light);
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user