irrlicht.net + ironpython?

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Guest

irrlicht.net + ironpython?

Post by Guest »

anyone tried to use irrlicht.net with ironpython 0.9 already? does that work?
Rob Loach

Post by Rob Loach »

Boo would work....

http://boo.codehaus.org/
ilikepython

Post by ilikepython »

i tried it with ironpython 0.9.2:

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)
the only problem is that it crashes if you close the application. i don't know why...
Guest

Post by Guest »

here is example 2:

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)
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!
Locked