enhance TestMultiRenderTarget with small animation of light (rotating around 0,0,0 in 3s)
This commit is contained in:
parent
8ac5e70bd9
commit
8c10173775
@ -44,7 +44,6 @@ import com.jme3.post.SceneProcessor;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image.Format;
|
||||
@ -55,17 +54,18 @@ public class TestMultiRenderTarget extends SimpleApplication implements ScenePro
|
||||
|
||||
private FrameBuffer fb;
|
||||
private Texture2D diffuseData, normalData, specularData, depthData;
|
||||
private Geometry sphere;
|
||||
private Picture display1, display2, display3, display4;
|
||||
|
||||
private Picture display;
|
||||
private Material mat;
|
||||
|
||||
private String techOrig;
|
||||
private PointLight[] pls;
|
||||
|
||||
public static void main(String[] args){
|
||||
TestMultiRenderTarget app = new TestMultiRenderTarget();
|
||||
app.start();
|
||||
}
|
||||
private String techOrig;
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
@ -100,18 +100,26 @@ public class TestMultiRenderTarget extends SimpleApplication implements ScenePro
|
||||
ColorRGBA.Yellow
|
||||
};
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
pls = new PointLight[3];
|
||||
for (int i = 0; i < pls.length; i++){
|
||||
PointLight pl = new PointLight();
|
||||
float angle = 0.314159265f * i;
|
||||
pl.setPosition( new Vector3f(FastMath.cos(angle)*2f, 0,
|
||||
FastMath.sin(angle)*2f));
|
||||
pl.setColor(colors[i]);
|
||||
pl.setColor(colors[i % colors.length]);
|
||||
pl.setRadius(5);
|
||||
rootNode.addLight(pl);
|
||||
display.addLight(pl);
|
||||
pls[i] = pl;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
super.simpleUpdate(tpf);//To change body of generated methods, choose Tools | Templates.
|
||||
for (int i = 0; i < 3; i++){
|
||||
PointLight pl = pls[i];
|
||||
float angle = (float)Math.PI * (i + (timer.getTimeInSeconds() % 6)/3); // 3s for full loop
|
||||
pl.setPosition( new Vector3f(FastMath.cos(angle)*3f, 0,
|
||||
FastMath.sin(angle)*3f));
|
||||
}
|
||||
}
|
||||
public void initialize(RenderManager rm, ViewPort vp) {
|
||||
reshape(vp, vp.getCamera().getWidth(), vp.getCamera().getHeight());
|
||||
viewPort.setOutputFrameBuffer(fb);
|
||||
|
Loading…
x
Reference in New Issue
Block a user