@Override protected void setMaterialParameters(Material material) { material.setVector3("LightPos", light == null ? new Vector3f() : light.getPosition()); }
@Override public void simpleUpdate(float tpf){ // cam.setLocation(new Vector3f(5.0347548f, 6.6481347f, 3.74853f)); // cam.setRotation(new Quaternion(-0.19183293f, 0.80776674f, -0.37974006f, -0.40805697f)); pos += tpf * vel * 5f; if (pos > 15){ vel *= -1; }else if (pos < -15){ vel *= -1; } pl.setPosition(new Vector3f(pos, 2, 0)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf) { angle1 += tpf * 0.25f; angle1 %= FastMath.TWO_PI; angle2 += tpf * 0.50f; angle2 %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle1) * 4f, 0.5f, FastMath.sin(angle1) * 4f)); p2.setPosition(new Vector3f(FastMath.cos(angle2) * 4f, 0.5f, FastMath.sin(angle2) * 4f)); lightMdl.setLocalTranslation(pl.getPosition()); lightMd2.setLocalTranslation(p2.getPosition()); } }
@Override public void simpleUpdate(float tpf){ angle += tpf * 0.25f; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 4f, 0.5f, FastMath.sin(angle) * 4f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ // cam.setLocation(new Vector3f(2.0632997f, 1.9493936f, 2.6885238f)); // cam.setRotation(new Quaternion(-0.053555284f, 0.9407851f, -0.17754152f, -0.28378546f)); angle += tpf; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 2f, 0.5f, FastMath.sin(angle) * 2f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 2f, 2f, FastMath.sin(angle) * 2f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf * 0.25f; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 4f, 0.5f, FastMath.sin(angle) * 4f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf * 0.25f; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 6f, 3f, FastMath.sin(angle) * 6f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 3f, 0.5f, FastMath.sin(angle) * 3f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf * 0.25f; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 6f, 3f, FastMath.sin(angle) * 6f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf * 0.25f; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 6f, 3f, FastMath.sin(angle) * 6f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override public void simpleUpdate(float tpf){ angle += tpf; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 2f, 0.5f, FastMath.sin(angle) * 2f)); lightMdl.setLocalTranslation(pl.getPosition()); }
@Override protected void updateShadowCams(Camera viewCam) { if (light == null) { logger.warning("The light can't be null for a " + getClass().getName()); return; } //bottom shadowCams[0].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Z.mult(-1f), Vector3f.UNIT_Y.mult(-1f)); //top shadowCams[1].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Z, Vector3f.UNIT_Y); //forward shadowCams[2].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Y, Vector3f.UNIT_Z.mult(-1f)); //backward shadowCams[3].setAxes(Vector3f.UNIT_X, Vector3f.UNIT_Y, Vector3f.UNIT_Z); //left shadowCams[4].setAxes(Vector3f.UNIT_Z, Vector3f.UNIT_Y, Vector3f.UNIT_X.mult(-1f)); //right shadowCams[5].setAxes(Vector3f.UNIT_Z.mult(-1f), Vector3f.UNIT_Y, Vector3f.UNIT_X); for (int i = 0; i < CAM_NUMBER; i++) { shadowCams[i].setFrustumPerspective(90f, 1f, 0.1f, light.getRadius()); shadowCams[i].setLocation(light.getPosition()); shadowCams[i].update(); shadowCams[i].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 }
tempPosition.set(light.getPosition()); float invRadius = light.getInvRadius(); transformPosition(viewMatrix, tempPosition);
case Point: PointLight pl = (PointLight) l; Vector3f pos = pl.getPosition(); float invRadius = pl.getInvRadius(); tmpVec.set(pos.getX(), pos.getY(), pos.getZ(), 1.0f);
ln.setLocalTranslation(p.getPosition()); int rand = FastMath.nextRandomInt(0, 3); switch (rand) { b.setLocalTranslation(p.getPosition().x, 2, p.getPosition().z);
case Point: PointLight pl = (PointLight) l; Vector3f pos = pl.getPosition(); float invRadius = pl.getInvRadius();
case Point: PointLight pl = (PointLight) l; Vector3f pos = pl.getPosition(); float invRadius = pl.getInvRadius(); tmpVec.set(pos.getX(), pos.getY(), pos.getZ(), 1.0f);
@Override protected void setMaterialParameters(Material material) { material.setVector3("LightPos", light == null ? new Vector3f() : light.getPosition()); }