@Override public void simpleUpdate(float tpf) { if (up) { Vector3f v = l.getDirection(); v.y += tpf / s; setDir(v); Vector3f v = l.getDirection(); v.y -= tpf / s; setDir(v); Vector3f v = l.getDirection(); v.x += tpf / s; setDir(v); Vector3f v = l.getDirection(); v.x -= tpf / s; setDir(v); Vector3f v = l.getDirection(); v.z += tpf / s; setDir(v); Vector3f v = l.getDirection(); v.z -= tpf / s; setDir(v);
@Override protected void setMaterialParameters(Material material) { material.setColor("Splits", splits); material.setVector3("LightDir", light.getDirection()); if (fadeInfo != null) { material.setVector2("FadeInfo", fadeInfo); } }
@Override protected void setMaterialParameters(Material material) { material.setColor("Splits", splits); material.setVector3("LightDir", light == null ? new Vector3f() : light.getDirection()); if (fadeInfo != null) { material.setVector2("FadeInfo", fadeInfo); } }
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
DirectionalLight dl = (DirectionalLight) light; Quaternion q = node.getWorldRotation(); Vector3f dir = dl.getDirection(); q.multLocal(dir); dl.setDirection(dir);
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
private void lightToSpatial(Light light) { TempVars vars = TempVars.get(); if (light instanceof PointLight) { PointLight pLight = (PointLight) light; Vector3f vecDiff = vars.vect1.set(pLight.getPosition()).subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } if (light instanceof DirectionalLight) { DirectionalLight dLight = (DirectionalLight) light; vars.vect1.set(dLight.getDirection()).multLocal(-1.0f); Vector3f vecDiff = vars.vect1.subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } vars.release(); //TODO add code for Spot light here when it's done }
for (DirectionalLight light : tempDirLights) { ColorRGBA color = light.getColor(); tempDirection.set(light.getDirection()); transformDirection(viewMatrix, tempDirection); lightData.setVector4InArray(color.r, color.g, color.b, 1f, index++);
case Directional: DirectionalLight dl = (DirectionalLight) l; Vector3f dir = dl.getDirection();
case Directional: DirectionalLight dl = (DirectionalLight) l; Vector3f dir = dl.getDirection();
case Directional: DirectionalLight dl = (DirectionalLight) l; Vector3f dir = dl.getDirection();
DirectionalLight directionalLight = findLight((Node) reflectionScene); if (directionalLight != null && useDirectionLightFromScene()) { lightDirection = directionalLight.getDirection();
System.out.println("Here We Go: " + sun.getDirection()); sun.setColor(ColorRGBA.White); rootNode.addLight(sun);
@Override protected void setMaterialParameters(Material material) { material.setColor("Splits", splits); material.setVector3("LightDir", light == null ? new Vector3f() : light.getDirection()); if (fadeInfo != null) { material.setVector2("FadeInfo", fadeInfo); } }
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
DirectionalLight dl = (DirectionalLight) light; Quaternion q = node.getWorldRotation(); Vector3f dir = dl.getDirection(); q.multLocal(dir); dl.setDirection(dir);
/** * 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); } } }
private void lightToSpatial(Light light) { TempVars vars = TempVars.get(); if (light instanceof PointLight) { PointLight pLight = (PointLight) light; Vector3f vecDiff = vars.vect1.set(pLight.getPosition()).subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } if (light instanceof DirectionalLight) { DirectionalLight dLight = (DirectionalLight) light; vars.vect1.set(dLight.getDirection()).multLocal(-1.0f); Vector3f vecDiff = vars.vect1.subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } vars.release(); //TODO add code for Spot light here when it's done }
private void lightToSpatial(Light light) { TempVars vars = TempVars.get(); if (light instanceof PointLight) { PointLight pLight = (PointLight) light; Vector3f vecDiff = vars.vect1.set(pLight.getPosition()).subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } if (light instanceof DirectionalLight) { DirectionalLight dLight = (DirectionalLight) light; vars.vect1.set(dLight.getDirection()).multLocal(-1.0f); Vector3f vecDiff = vars.vect1.subtractLocal(spatial.getWorldTranslation()); spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation())); } vars.release(); //TODO add code for Spot light here when it's done }
for (DirectionalLight light : tempDirLights) { ColorRGBA color = light.getColor(); tempDirection.set(light.getDirection()); transformDirection(viewMatrix, tempDirection); lightData.setVector4InArray(color.r, color.g, color.b, 1f, index++);