2009-03-08 17:25:15 +00:00
|
|
|
package sg;
|
|
|
|
|
|
2009-03-09 09:59:22 +00:00
|
|
|
import com.jme.app.SimpleGame;
|
|
|
|
|
import com.jme.scene.Skybox;
|
|
|
|
|
import com.jme.image.Texture;
|
|
|
|
|
import com.jme.util.TextureManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class SpaceGame extends SimpleGame {
|
|
|
|
|
private Skybox skybox;
|
2009-03-08 17:25:15 +00:00
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2009-03-09 09:59:22 +00:00
|
|
|
SpaceGame app = new SpaceGame();
|
|
|
|
|
app.setConfigShowMode(ConfigShowMode.AlwaysShow);
|
|
|
|
|
app.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void simpleInitGame() {
|
|
|
|
|
display.setTitle("SpaceGame");
|
|
|
|
|
buildSkyBox();
|
|
|
|
|
rootNode.attachChild(skybox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void simpleUpdate(){
|
|
|
|
|
skybox.setLocalTranslation(cam.getLocation());
|
|
|
|
|
}
|
2009-03-08 17:25:15 +00:00
|
|
|
|
2009-03-09 09:59:22 +00:00
|
|
|
private void buildSkyBox() {
|
|
|
|
|
skybox = new Skybox("skybox", 500, 500, 500);
|
|
|
|
|
Texture north = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/front.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
Texture south = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/rest.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
Texture east = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/rest.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
Texture west = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/rest.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
Texture up = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/rest.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
Texture down = TextureManager.loadTexture(
|
|
|
|
|
SpaceGame.class.getClassLoader().getResource(
|
|
|
|
|
"sg/data/skybox/advanced/rest.png"),
|
|
|
|
|
Texture.MinificationFilter.BilinearNearestMipMap,
|
|
|
|
|
Texture.MagnificationFilter.Bilinear);
|
|
|
|
|
skybox.setTexture(Skybox.Face.North, north);
|
|
|
|
|
skybox.setTexture(Skybox.Face.West, west);
|
|
|
|
|
skybox.setTexture(Skybox.Face.South, south);
|
|
|
|
|
skybox.setTexture(Skybox.Face.East, east);
|
|
|
|
|
skybox.setTexture(Skybox.Face.Up, up);
|
|
|
|
|
skybox.setTexture(Skybox.Face.Down, down);
|
|
|
|
|
skybox.preloadTextures();
|
|
|
|
|
skybox.updateRenderState();
|
2009-03-08 17:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
2009-03-09 09:59:22 +00:00
|
|
|
}
|