@Override public Shader makeCurrent(AssetManager assetManager, RenderManager renderManager, EnumSet<Caps> rendererCaps, LightList lights, DefineList defines) { // TODO: if it ever changes that render isn't called // right away with the same geometry after makeCurrent, it would be // a problem. // Do a radix sort. tempDirLights.clear(); tempPointLights.clear(); tempSpotLights.clear(); for (Light light : lights) { switch (light.getType()) { case Directional: tempDirLights.add((DirectionalLight) light); break; case Point: tempPointLights.add((PointLight) light); break; case Spot: tempSpotLights.add((SpotLight) light); break; } } defines.set(numDirLightsDefineId, tempDirLights.size()); defines.set(numPointLightsDefineId, tempPointLights.size()); defines.set(numSpotLightsDefineId, tempSpotLights.size()); return techniqueDef.getShader(assetManager, rendererCaps, defines); }
if (light.getType() == Light.Type.Probe) { probeBlendStrat.registerProbe((LightProbe) light); } else {
public void updateLights(Spatial scene) { for (Light light : scene.getWorldLightList()) { switch (light.getType()) {
if(l.getType() == Light.Type.Ambient){ endIndex++; continue; if(l.getType() != Light.Type.Probe){ lightData.setVector4InArray(color.getRed(), color.getGreen(), color.getBlue(), l.getType().getId(), lightDataIndex); lightDataIndex++; switch (l.getType()) { case Directional: DirectionalLight dl = (DirectionalLight) l; break; default: throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
if (l.getType() == Light.Type.Ambient || l.getType() == Light.Type.Probe) { continue; tmpLightColor.a = l.getType().getId(); lightColor.setValue(VarType.Vector4, tmpLightColor); switch (l.getType()) { case Directional: DirectionalLight dl = (DirectionalLight) l; throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
if (l.getType() == Light.Type.Ambient || l.getType() == Light.Type.Probe) { endIndex++; continue; color.getGreen(), color.getBlue(), l.getType().getId(), lightDataIndex); lightDataIndex++; switch (l.getType()) { case Directional: DirectionalLight dl = (DirectionalLight) l; break; default: throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
@Override public Shader makeCurrent(AssetManager assetManager, RenderManager renderManager, EnumSet<Caps> rendererCaps, LightList lights, DefineList defines) { // TODO: if it ever changes that render isn't called // right away with the same geometry after makeCurrent, it would be // a problem. // Do a radix sort. tempDirLights.clear(); tempPointLights.clear(); tempSpotLights.clear(); for (Light light : lights) { switch (light.getType()) { case Directional: tempDirLights.add((DirectionalLight) light); break; case Point: tempPointLights.add((PointLight) light); break; case Spot: tempSpotLights.add((SpotLight) light); break; } } defines.set(numDirLightsDefineId, tempDirLights.size()); defines.set(numPointLightsDefineId, tempPointLights.size()); defines.set(numSpotLightsDefineId, tempSpotLights.size()); return techniqueDef.getShader(assetManager, rendererCaps, defines); }
private void initLight() { System.out.println("LightList size = "+rootNode.getLocalLightList().size()); while(rootNode.getLocalLightList().size() > 0) { System.out.println("\t"+rootNode.getLocalLightList().get(0).getType().name()); rootNode.removeLight(rootNode.getLocalLightList().get(0)); } System.out.println("LightList size = "+rootNode.getLocalLightList().size()); DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(0f, -1f, 0f)); rootNode.addLight(sun); AmbientLight ambientLight = new AmbientLight(); ambientLight.setColor(ColorRGBA.Red.mult(0.1f)); rootNode.addLight(ambientLight); }
Light light = worldLights.get(i); if (light.getType() == Light.Type.Probe) { continue;
/** * Updates the camera view direction and position based on the light */ public void updateLightCamera(Camera lightCam) { if (target.getType() == Light.Type.Directional) { DirectionalLight dl = (DirectionalLight) target; lightCam.setParallelProjection(true); lightCam.setLocation(Vector3f.ZERO); lightCam.lookAtDirection(dl.getDirection(), Vector3f.UNIT_Y); lightCam.setFrustum(-1, 1, -1, 1, 1, -1); } else { PointLight pl = (PointLight) target; lightCam.setParallelProjection(false); lightCam.setLocation(pl.getPosition()); // direction will have to be calculated automatically lightCam.setFrustumPerspective(45, 1, 1, 300); } } }
for (Spatial scene : viewPort.getScenes()) { for (Light light : scene.getWorldLightList()) { if(light.getType() == Light.Type.Probe){ LightProbe p = (LightProbe)light; TempVars vars = TempVars.get();
if (light.getType() == Light.Type.Probe) { probeBlendStrat.registerProbe((LightProbe) light); } else {
@Override public void update(float tpf) { for (Light light : scene.getWorldLightList()) { switch (light.getType()) {
if(l.getType() == Light.Type.Ambient){ endIndex++; continue; if(l.getType() != Light.Type.Probe){ lightData.setVector4InArray(color.getRed(), color.getGreen(), color.getBlue(), l.getType().getId(), lightDataIndex); lightDataIndex++; switch (l.getType()) { case Directional: DirectionalLight dl = (DirectionalLight) l; break; default: throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
if (l.getType() == Light.Type.Ambient) { endIndex++; continue; color.getGreen(), color.getBlue(), l.getType().getId(), lightDataIndex); lightDataIndex++; switch (l.getType()) { case Directional: DirectionalLight dl = (DirectionalLight) l; break; default: throw new UnsupportedOperationException("Unknown type of light: " + l.getType());