2009-03-10 13:41:26 +00:00
|
|
|
package sg.env;
|
|
|
|
|
|
2009-03-10 16:32:33 +00:00
|
|
|
import sg.util.SGUtil;
|
2009-03-10 13:41:26 +00:00
|
|
|
|
|
|
|
|
import com.jme.image.Texture;
|
|
|
|
|
import com.jme.scene.Node;
|
|
|
|
|
import com.jme.scene.Skybox;
|
2009-03-10 16:32:33 +00:00
|
|
|
import com.jme.system.DisplaySystem;
|
2009-03-10 13:41:26 +00:00
|
|
|
|
|
|
|
|
public class Environment extends Node {
|
2009-03-10 15:27:00 +00:00
|
|
|
private static final long serialVersionUID = 1L;
|
2009-03-10 16:32:33 +00:00
|
|
|
|
|
|
|
|
private Skybox space;
|
2009-03-10 13:41:26 +00:00
|
|
|
|
|
|
|
|
public Environment(){
|
|
|
|
|
buildSkyBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buildSkyBox() {
|
2009-03-10 16:32:33 +00:00
|
|
|
space = new Skybox("space", 500, 500, 500);
|
|
|
|
|
Texture north = SGUtil.loadTexture("sg/data/skybox/advanced/front.png");
|
|
|
|
|
Texture rest = SGUtil.loadTexture("sg/data/skybox/advanced/rest.png");
|
|
|
|
|
|
|
|
|
|
space.setTexture(Skybox.Face.North, north);
|
|
|
|
|
space.setTexture(Skybox.Face.West, rest);
|
|
|
|
|
space.setTexture(Skybox.Face.South, rest);
|
|
|
|
|
space.setTexture(Skybox.Face.East, rest);
|
|
|
|
|
space.setTexture(Skybox.Face.Up, rest);
|
|
|
|
|
space.setTexture(Skybox.Face.Down, rest);
|
|
|
|
|
space.preloadTextures();
|
|
|
|
|
space.updateRenderState();
|
|
|
|
|
this.attachChild(space);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void update(){
|
|
|
|
|
space.setLocalTranslation(DisplaySystem.getDisplaySystem().getRenderer().getCamera().getLocation());
|
2009-03-10 13:41:26 +00:00
|
|
|
}
|
|
|
|
|
}
|