hi guys,I'm newer here,I got a problem when i try to load MD2 files.But when I lanuch the code below,can sb tell why? thank you very much and sorry for my English
I see nothing in my CANVAS,(and I change many models,but the problems still exist)
public class LoadMODEL extends InputAdapterRenderLoop
{
Point3f eyePosition = new Point3f( 2.41f, 0f, 0f );
Point3f viewFocus = new Point3f( 0f, 0f, 0f );
Vector3f vecUp = Vector3f.POSITIVE_Y_AXIS;
private BranchGroup createScene( ResourceLocator resLoc, Animator animator ) throws Exception
{
MD2Model model = new MD2Loader().loadModel( resLoc.getResource("models/tris.MD2") );
TransformationDirectives rotDirecs =
new TransformationDirectives( 0.3f, 0.2f, 0f );
RotatableGroup rg = new RotatableGroup( rotDirecs );
rg.addChild( model );
animator.addAnimatableObject( rg );
return( new BranchGroup( rg ) );
}
Xith3DEnvironment env;
public LoadMODEL() throws Exception
{
super( 10f );
env = new Xith3DEnvironment( this );
Canvas3D canvas = Canvas3DFactory.createWindowed( 800, 600,
"Model Loading"
);
canvas.disableLighting(); // either do this or add a light source!
this.getInputManager().registerKeyboardAndMouse( canvas );
env.addCanvas( canvas );
ResourceLocator resLoc = ResourceLocator.create( "test-resources/" );
resLoc.createAndAddTSL( "textures" );
env.addPerspectiveBranch( createScene( resLoc, this.getAnimator() ) );
env.getView().lookAt(eyePosition, viewFocus, vecUp);
this.begin();
}
public static void main( String[] args ) throws Exception
{
new LoadMODEL();
}