Fixed lights
This commit is contained in:
parent
14f395d273
commit
0935259b6c
2 changed files with 26 additions and 19 deletions
|
|
@ -7,9 +7,12 @@ import sg.util.SGUtil;
|
|||
|
||||
import com.jme.input.FirstPersonHandler;
|
||||
import com.jme.input.InputHandler;
|
||||
import com.jme.light.PointLight;
|
||||
import com.jme.math.Vector3f;
|
||||
import com.jme.renderer.ColorRGBA;
|
||||
import com.jme.renderer.Renderer;
|
||||
import com.jme.scene.Node;
|
||||
import com.jme.scene.state.LightState;
|
||||
import com.jme.system.DisplaySystem;
|
||||
import com.jmex.game.state.CameraGameState;
|
||||
import com.jmex.game.state.GameStateManager;
|
||||
|
|
@ -51,23 +54,37 @@ public class InGameState extends CameraGameState {
|
|||
rootNode.attachChild(dynamicNode);
|
||||
rootNode.attachChild(staticNode);
|
||||
|
||||
// ship
|
||||
Node ship = SGUtil.loadModel("sg/data/models/ships/G6.3ds");
|
||||
ship.setLocalTranslation(new Vector3f(0,0,-40));
|
||||
//ship.setLocalScale(0.01f);
|
||||
rootNode.attachChild(ship);
|
||||
loader.increment();
|
||||
|
||||
// environment
|
||||
environment = new Environment(rootNode);
|
||||
rootNode.attachChild(environment);
|
||||
loader.increment();
|
||||
|
||||
// ship
|
||||
Node ship = SGUtil.loadModel("sg/data/models/ships/G6.3ds");
|
||||
ship.setLocalTranslation(new Vector3f( 0, 0, 40));
|
||||
rootNode.attachChild(ship);
|
||||
loader.increment();
|
||||
|
||||
// inputs
|
||||
FirstPersonHandler first = new FirstPersonHandler( cam, 50, 1 );
|
||||
input = new InputHandler();
|
||||
input.addToAttachedHandlers( first );
|
||||
loader.increment();
|
||||
|
||||
// lights
|
||||
/** Set up a basic, default light. */
|
||||
PointLight light = new PointLight();
|
||||
light.setDiffuse( new ColorRGBA( 0.75f, 0.75f, 0.75f, 0.75f ) );
|
||||
light.setAmbient( new ColorRGBA( 0.5f, 0.5f, 0.5f, 1.0f ) );
|
||||
light.setLocation( new Vector3f( 100, 100, 100 ) );
|
||||
light.setEnabled( true );
|
||||
|
||||
/** Attach the light to a lightState and the lightState to rootNode. */
|
||||
LightState lightState = DisplaySystem.getDisplaySystem().getRenderer().createLightState();
|
||||
lightState.setEnabled( true );
|
||||
lightState.attach( light );
|
||||
rootNode.setRenderState( lightState );
|
||||
rootNode.updateRenderState();
|
||||
|
||||
// ***************** Done loading **********************************
|
||||
loader.setActive(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue