irrlicht.net + ironpython?
irrlicht.net + ironpython?
anyone tried to use irrlicht.net with ironpython 0.9 already? does that work?
i tried it with ironpython 0.9.2:
here is example 1 converted to ironpython:
the only problem is that it crashes if you close the application. i don't know why...
here is example 1 converted to ironpython:
Code: Select all
import sys
sys.LoadAssemblyFromFile("Irrlicht.NET.dll")
import System
from Irrlicht import *
from Irrlicht.Video import *
from Irrlicht.Core import *
from Irrlicht.Scene import *
device = IrrlichtDevice(DriverType.OPENGL, WindowCaption = "Irrlicht.NET IronPython - example 01 - Hello World")
device.CursorControl.Visible = False
VideoDriver = device.VideoDriver
SceneManager = device.SceneManager
cam = SceneManager.AddCameraSceneNodeFPS(None, 100, 100, -1)
node = SceneManager.AddAnimatedMeshSceneNode(SceneManager.GetMesh("sydney.md2"), None, -1)
node.SetMaterialTexture(0, VideoDriver.GetTexture("sydney.bmp"))
node.SetMaterialFlag(MaterialFlag.LIGHTING, False)
fps = 0
while device.Run():
if device.WindowActive:
VideoDriver.BeginScene(True, True, Color(0, 100, 100, 100))
SceneManager.DrawAll()
VideoDriver.EndScene()
if fps != VideoDriver.FPS:
fps = VideoDriver.FPS
device.WindowCaption = "Irrlicht.NET IronPython - example 01 - Hello World - [%s] - fps: %d" % (VideoDriver.Name, fps)
here is example 2:
irrlicht.NET is really cool!
there still are some warts like the crash problem (i don't know if that gets caused by ironpython or irrlicht.net) but if both are more mature this combination will rock!
Code: Select all
import sys
sys.LoadAssemblyFromFile("Irrlicht.NET.dll")
import System
from Irrlicht import *
from Irrlicht.Video import *
from Irrlicht.Core import *
from Irrlicht.Scene import *
device = IrrlichtDevice(DriverType.OPENGL, Dimension2D(1024, 768), 32, False, True, False)
device.WindowCaption = "octtree test"
device.CursorControl.Visible = False
driver = device.VideoDriver
scenemanager = device.SceneManager
device.FileSystem.AddZipFileArchive("obiwanshouse.pk3")
mesh = scenemanager.GetMesh("obiwanshouse.bsp")
node = scenemanager.AddOctTreeSceneNode(mesh.GetMesh(0), None, -1)
#node = scenemanager.AddMeshSceneNode(mesh.GetMesh(0), None, -1)
#node.Position = Vector3D(-1300, -144, -1249)
camera = scenemanager.AddCameraSceneNodeFPS(None, 100, 200, -1)
gui = device.GUIEnvironment
text = gui.AddStaticText("", Rect(10, 10, 500, 20), False, False, None, -1)
while device.Run():
if device.WindowActive:
driver.BeginScene(True, True, Color(0, 100, 100, 100))
scenemanager.DrawAll()
gui.DrawAll()
driver.EndScene()
campos = camera.AbsolutePosition
camrot = camera.Rotation
text.Text = "fps: %d pcount: %d campos: %.3f %.3f %.3f camrot: %.3f %.3f %.3f" \
% (driver.FPS,
driver.PrimitiveCountDrawn,
campos.X, campos.Y, campos.Z,
camrot.X, camrot.Y, camrot.Z)
