irrlichtのpythonラップ
irrlicthのpythonラップができた。
とりあえず、HelloWorldがそのまま動くようになった。
当面は、Irrlichtのexampleの動作を確認しながら足りない要素のラップを進める方針。あと、データの読み込みが不便なので、python側でデータをロードしてirrlichtのメッシュを組み立てられるようにAPIを整備したい。
リソースの管理は、python側に移す。
それと、少し前にjava向けにbulletのラップしていて途中になっているものがあるので続きをやる予定。bulletの操作もpython側に移す。
pygameのOpenGLエンジンとして使えるようにしたい。
01.HelloWorld.py
#!/usr/bin/env python import sys import irr MEDIA_PATH="../../../irrlicht/media" if __name__=="__main__": device = irr.createDevice( irr.EDT_SOFTWARE, irr.dimension2dui(640, 480), 16, False, False, False, None); if not device: sys.exit(1) device.setWindowCaption(u"Hello World! - Irrlicht Engine Demo"); driver = device.getVideoDriver(); smgr = device.getSceneManager(); guienv = device.getGUIEnvironment(); guienv.addStaticText( u"Hello World! This is the Irrlicht Software renderer!", irr.recti(10, 10, 260, 40), True ); mesh = smgr.getMesh(irr.path(MEDIA_PATH+"/sydney.md2")); if not mesh: device.drop(); sys.exit(1) node = smgr.addAnimatedMeshSceneNode( mesh ); if not node: device.drop() sys.exit(1) if node: node.setMaterialFlag(irr.EMF_LIGHTING, False); node.setMD2Animation(irr.EMAT_STAND); node.setMaterialTexture( 0, driver.getTexture(irr.path(MEDIA_PATH+"/sydney.bmp"))); smgr.addCameraSceneNode(None, irr.vector3df(0,30,-40), irr.vector3df(0,5,0)); while device.run(): driver.beginScene(True, True, irr.SColor(255,100,101,140)); smgr.drawAll(); guienv.drawAll(); driver.endScene(); device.drop();