Or are you also manually handling your own updates for them, too…. the required stuff that you must call right every frame or mess up the scene graph state.
Yes, precisely. My own "RootNode" class extends Node and manages itself. Basically it's a control for my 3D scene graph.
Obviously I could just use rootNode.addChild( myRootNode ) but then I will have two rootNodes. And I'm easy to get confused when it comes to software architecture ;)
Just make sure you call the two update methods on these nodes in the right place inline with your state manager. Or your scene graph state will be out of whack from the state’s perspective.
Obviously it won't work without updateLogicalState and updateGeometricState. But since you have to declare your rootNode using viewPort.attachScene() and since those two update methods must be called... why isn't it handled by Application ? It could check all the attached scenes and update them, no ?
Fair enough. Then just ignore the javadoc telling you not to manually call the state manager. You are in “advanced territory” where “normal documentation” no longer applies.
I can do this ;) now it's a personal taste, but I always considered the JavaDoc as advanced documentation. It has to be precise and universal. Just my opinion.
But I have no reason to manage my own InputManager. I’m not sure what the advantage is, though.
Basically, I use the InputManager for raw input processing. And I have a few objects to "improve" its abilities with reflection.
Just for exemple, my camera object looks like this :
[java]public class InpCamera extends AbstractInput
{
protected static final Logger logger = new Logger();
public static final AbstractCommand INPUT_MOVEFORWARD = new AnalogCommand( "moveForward" );
public static final AbstractCommand INPUT_MOVEBACKWARD = new AnalogCommand( "moveBackward" );
public static final AbstractCommand INPUT_STRAFERIGHT = new AnalogCommand( "strafeRight" );
public static final AbstractCommand INPUT_STRAFELEFT = new AnalogCommand( "strafeLeft" );
public static final AbstractCommand INPUT_INCREASEFOCAL = new DigitalRepeatCommand( "increaseFocal" );
public static final AbstractCommand INPUT_DECREASEFOCAL = new DigitalRepeatCommand( "decreaseFocal" );
public static final AbstractCommand INPUT_SLOWMOTION = new DigitalOnceCommand( "slowMotion" );
public static final AbstractCommand INPUT_ROTCAMERA = new DigitalOnceCommand( "rotCamera" );
public static final AbstractCommand MOUSE_LEFT = new AnalogCommand( "mouseLeft" );
public static final AbstractCommand MOUSE_RIGHT = new AnalogCommand( "mouseRight" );
public static final AbstractCommand MOUSE_UP = new AnalogCommand( "mouseUp" );
public static final AbstractCommand MOUSE_DOWN = new AnalogCommand( "mouseDown" );
public static final AbstractCommand MOUSE_WHEELUP = new AnalogCommand( "wheelUp" );
public static final AbstractCommand MOUSE_WHEELDOWN = new AnalogCommand( "wheelDown" );
public void init()
{
addMapping( INPUT_MOVEFORWARD, new KeyTrigger( KeyInput.KEY_Z ) );
addMapping( INPUT_MOVEBACKWARD, new KeyTrigger( KeyInput.KEY_S ) );
addMapping( INPUT_STRAFERIGHT, new KeyTrigger( KeyInput.KEY_D ) );
addMapping( INPUT_STRAFELEFT, new KeyTrigger( KeyInput.KEY_Q ) );
addMapping( INPUT_SLOWMOTION, new KeyTrigger( KeyInput.KEY_LSHIFT ) );
...
}
public void moveForward( float value )
{
moveCamera( value, false );
}
public void moveBackward( float value )
{
moveCamera( -value, false );
}
public void strafeLeft( float value )
{
moveCamera( value, true );
}
public void strafeRight( float value )
{
moveCamera( -value, true );
}
public void slowMotion( boolean isPressed, float tpf )
{
slowmotion = isPressed;
}
...
[/java]
Each input has its own method, which is faster and cleaner than a switch case.
Also, the DigitalRepeatCommand() object calls the method for every update() of the scene. instead of just once. It's only a beginning, I plan to add more input managment objects in the future. With conditional filters, and the like.
lets deprecate SimpleApplication for 3.1 and have it all in Application
Nuuuu ! :( This is evil.