This commit is contained in:
parent
80718cf937
commit
c5209c215b
3 changed files with 68 additions and 31 deletions
|
|
@ -44,34 +44,14 @@ public class Lesson1 extends SimpleGame {
|
|||
s.setRenderState(ts);
|
||||
|
||||
rootNode.attachChild(s);
|
||||
graphNode.attachChild(new Box("box",null, 0f,0f,0f));
|
||||
|
||||
buildSkyBox();
|
||||
rootNode.attachChild(this.skybox);
|
||||
|
||||
buildLighting();
|
||||
rootNode.setRenderState(lightState);
|
||||
rootNode.attachChild(this.skybox);
|
||||
}
|
||||
|
||||
public void simpleUpdate(){
|
||||
skybox.setLocalTranslation(cam.getLocation());
|
||||
}
|
||||
|
||||
private void buildLighting() {
|
||||
/** Set up a basic, default light. */
|
||||
PointLight pl = new PointLight();
|
||||
pl.setDiffuse(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
|
||||
pl.setAmbient(new ColorRGBA(0.5f, 0.0f, 0.0f, 1.0f));
|
||||
//create a point light at position 10,0,0
|
||||
pl.setLocation(new Vector3f(10,0,0));
|
||||
pl.setEnabled(true);
|
||||
|
||||
/** Attach the light to a lightState and the lightState to rootNode. */
|
||||
LightState lightState = display.getRenderer().createLightState();
|
||||
lightState.setEnabled(true);
|
||||
lightState.attach(pl);
|
||||
//scene.setRenderState(lightState);
|
||||
}
|
||||
|
||||
private void buildSkyBox() {
|
||||
skybox = new Skybox("skybox", 500, 500, 500);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue