This commit is contained in:
parent
c5209c215b
commit
979ff20c27
2 changed files with 29 additions and 10 deletions
|
|
@ -1,8 +1,8 @@
|
|||
#Game Settings written by com.jme.app.BaseGame$BaseGameSettings at Sun Mar 08 18:41:50 CET 2009
|
||||
#Sun Mar 08 18:41:50 CET 2009
|
||||
#Game Settings written by com.jme.app.BaseGame$BaseGameSettings at Mon Mar 09 11:28:01 CET 2009
|
||||
#Mon Mar 09 11:28:01 CET 2009
|
||||
FREQ=60
|
||||
RENDERER=LWJGL
|
||||
WIDTH=1440
|
||||
RENDERER=LWJGL
|
||||
HEIGHT=900
|
||||
DEPTH=32
|
||||
FULLSCREEN=true
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
package sg;
|
||||
|
||||
import com.jme.app.SimpleGame;
|
||||
import com.jme.renderer.ColorRGBA;
|
||||
import com.jme.scene.Skybox;
|
||||
import com.jme.scene.state.LightState;
|
||||
import com.jme.image.Texture;
|
||||
import com.jme.light.PointLight;
|
||||
import com.jme.math.Vector3f;
|
||||
import com.jme.util.TextureManager;
|
||||
|
||||
|
||||
public class SpaceGame extends SimpleGame {
|
||||
private Skybox skybox;
|
||||
private LightState lightState;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpaceGame app = new SpaceGame();
|
||||
|
|
@ -19,8 +24,10 @@ public class SpaceGame extends SimpleGame {
|
|||
display.setTitle("SpaceGame");
|
||||
buildSkyBox();
|
||||
rootNode.attachChild(skybox);
|
||||
buildLighting();
|
||||
rootNode.setRenderState(lightState);
|
||||
}
|
||||
|
||||
|
||||
public void simpleUpdate(){
|
||||
skybox.setLocalTranslation(cam.getLocation());
|
||||
}
|
||||
|
|
@ -28,32 +35,32 @@ public class SpaceGame extends SimpleGame {
|
|||
private void buildSkyBox() {
|
||||
skybox = new Skybox("skybox", 500, 500, 500);
|
||||
Texture north = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/front.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
Texture south = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/rest.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
Texture east = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/rest.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
Texture west = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/rest.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
Texture up = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/rest.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
Texture down = TextureManager.loadTexture(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
SpaceGame.class.getClassLoader().getResource(
|
||||
"sg/data/skybox/advanced/rest.png"),
|
||||
Texture.MinificationFilter.BilinearNearestMipMap,
|
||||
Texture.MagnificationFilter.Bilinear);
|
||||
|
|
@ -67,4 +74,16 @@ public class SpaceGame extends SimpleGame {
|
|||
skybox.updateRenderState();
|
||||
}
|
||||
|
||||
private void buildLighting() {
|
||||
/** Set up a basic, default light. */
|
||||
PointLight light = new PointLight();
|
||||
light.setDiffuse( new ColorRGBA( 1.0f, 1.0f, 1.0f, 1.0f ) );
|
||||
light.setAmbient( new ColorRGBA( 0.5f, 0.5f, 0.5f, 1.0f ) );
|
||||
light.setLocation( new Vector3f( 100, 100, 100 ) );
|
||||
light.setEnabled( true );
|
||||
|
||||
lightState = display.getRenderer().createLightState();
|
||||
lightState.setEnabled( true );
|
||||
lightState.attach( light );
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue