Topic: Loading .x models with the irrlicht mod

Hello all,

  I am new to both Irrlicht and Blitzmax.  I want to thank Gman for this wonderful mod. 

  Recently, I tried to modify the Hello World example to load a .X (DirectX) animated model.  However, even though the program compiles and runs, the mesh is not displayed.  Here's the code I used.

Local driver:IVideoDriver = device.getVideoDriver()
Local smgr:ISceneManager = device.getSceneManager()
Local guienv:IGUIEnvironment = device.getGUIEnvironment()
 
Local mesh:IAnimatedMesh = smgr.getMesh("characteranimation3.x")

If (mesh)
  Print "Mesh loaded succesfully."
EndIf  



Local node:IAnimatedMeshSceneNode = smgr.addAnimatedMeshSceneNode( mesh )

If (node)
Print"The animated scene node exists!"

EndIf


smgr.addCameraSceneNode(Null, _VECTOR3DF(0,30,-40), _VECTOR3DF(0,5,0))



While(device.run())
    driver.beginScene(True, True, _SCOLOR(255,100,101,140))

    smgr.drawAll()
    guienv.drawAll()

    driver.endScene()
Wend

Both IF commands execute, which means I should be seeing my model.... but I can't.  Can anyone explain this?  Any help will be greatly appreciated.

Re: Loading .x models with the irrlicht mod

greetings smile  the code looks correct.  i would wonder about camera positioning and size of the .x mesh (ie too small to see from the current camera angle).  i would first try to add a FPS camera instead and look around to see if you can find the model.  also, try adding a lightscenenode to see if lighting could be an issue.  if all else fails and you dont mind, zip up an example BMX with the .x file and i will take a look.

Re: Loading .x models with the irrlicht mod

node.setMaterialFlag(EMF_LIGHTING, False)

Re: Loading .x models with the irrlicht mod

greetings smile  unfortunately im nowhere near knowledgable on models but i took a look and feel that there is an issue somewhere with the .x.  i tried the meshviewer tool that comes with the Irrlicht distribution and it couldnt view it.  i also tried to load the file in Ultimate Unwrap and it failed with an error. 

for the FPS camera you can use addCameraSceneNodeFPS() instead of addCameraSceneNode().

to load models in iB3D you would use something like the following:

Local syd:MESH=ib3d_LoadAnimMesh("sydney.md2")
Local tex:TEXTURE=ib3d_LoadTexture("sydney.bmp")
ib3d_EntityTexture(syd,tex)