Irrlciht Wrapper Bug?
BlitzMax Forums/BlitzMax Beginners Area/Irrlciht Wrapper Bug?
| ||
| Is it a Bug in the Wrapper? <code> Strict Framework BRL.Blitz Import BRL.StandardIO Import gg.IrrBMAX ' let user Select driver Type Local driverType:Int=EDT_NULL Local strInput:String="" Local shadows:Int=1 driverType=EDT_OPENGL ' create device Local device:T_irrIrrlichtDevice= .. T_irrIrrlichtDevice.create(driverType,T_irrDimension2d_s32.create(1024,768),32,True,shadows) If device.handle=0 Then Return ' could Not create selected driver. Local Driver:T_irrIVideoDriver=device.getVideoDriver() Local smgr:T_irrISceneManager=device.getSceneManager() Local mesh:T_irrIAnimatedMesh=smgr.getMesh("../media/room.3ds") Local entity:T_irrIMesh=mesh.getmesh(1)'getMeshBufferCount() Local i%=entity.getMeshBufferCount() Local l% Local m:T_irrIMeshBuffer Local mat:T_irrSMaterial For l=1 To i m=entity.getMeshBuffer(i) mat=m.getmaterial() ' mat. Next smgr.getMeshManipulator().makePlanarTextureMapping(mesh.getMesh(0),0.004) Local node:T_irrISceneNode=smgr.addAnimatedMeshSceneNode(mesh) node.setMaterialTexture(0,driver.getTexture("../media/rockwall.bmp")) node.getMaterial(0).getEmissiveColor().set(0,0,0,0) </code> |
| ||
had a few bugs in your sample code. all my fixes have comments denoted by "FIX:"
Strict
Framework BRL.Blitz
Import BRL.StandardIO
Import gg.IrrBMAX
' let user Select driver Type
Local driverType:Int=EDT_NULL
Local strInput:String=""
Local shadows:Int=1
driverType=EDT_OPENGL
' create device
Local device:T_irrIrrlichtDevice= ..
T_irrIrrlichtDevice.create(driverType,T_irrDimension2d_s32.create(1024,768),32,True,shadows)
If device.handle=0 Then Return ' could Not create selected driver.
Local Driver:T_irrIVideoDriver=device.getVideoDriver()
Local smgr:T_irrISceneManager=device.getSceneManager()
Local mesh:T_irrIAnimatedMesh=smgr.getMesh("../media/room.3ds")
' FIX: changed to 0 since all indexes are 0 based
' NOTE: mesh.getFrameCount() will get you how many frames there are
Local entity:T_irrIMesh=mesh.getmesh(0)'getMeshBufferCount()
Local i%=entity.getMeshBufferCount()
Local l%
Local m:T_irrIMeshBuffer
Local mat:T_irrSMaterial
' FIX: again, need to start indexing with 0 here
For l=0 To i-1
' FIX: had variable i as the index, needed to be l
m=entity.getMeshBuffer(l)
mat=m.getmaterial()
' mat.
Next
smgr.getMeshManipulator().makePlanarTextureMapping(mesh.getMesh(0),0.004)
Local node:T_irrISceneNode=smgr.addAnimatedMeshSceneNode(mesh)
node.setMaterialTexture(0,driver.getTexture("../media/rockwall.bmp"))
node.getMaterial(0).getEmissiveColor().set(0,0,0,0)
|