public static void Main(string[] args) { device = new IrrlichtDevice(DriverType.OpenGL, new Dimension2D(640, 480), 32, false, true, false, false); if (device == null) { System.Console.WriteLine("Device could not be created. Exiting."); return; } device.WindowCaption = "Hello World - Irrlicht.Net Demo"; videoDriver = device.VideoDriver; sceneManager = device.SceneManager; guiEnvironment = device.GUIEnvironment; guiEnvironment.AddStaticTextW("Hello World! This is the Irrlicht.Net demo application", new Rect(10, 10, 590, 32), true, false, guiEnvironment.RootElement, -1, false); AnimatedMesh mesh = sceneManager.GetMesh("../../irrlicht/media/sydney.md2"); if (mesh == null) { System.Console.WriteLine("Meshfile could not be loaded"); return; } AnimatedMeshSceneNode node = sceneManager.AddAnimatedMeshSceneNode(mesh); if (node != null) { node.SetMaterialFlag(MaterialFlag.Lighting, false); node.SetMD2Animation(MD2Animation.Stand); node.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/sydney.bmp")); } CameraSceneNode camera = sceneManager.AddCameraSceneNode(sceneManager.RootSceneNode); camera.Position = new Vector3D(0, 30, -40); camera.Target = new Vector3D(0, 5, 0); device.OnEvent += new OnEventDelegate(device_OnEvent); while (device.Run()) { RenderLoop(); } device.Drop(); }
public static void Main(string[] args) { device = new IrrlichtDevice(DriverType.OpenGL, new Dimension2D(640, 480), 32, false, true, false, false); if (device == null) { System.Console.WriteLine("Device could not be created. Exiting."); return; } device.WindowCaption = "Movement - Irrlicht.Net Demo"; videoDriver = device.VideoDriver; sceneManager = device.SceneManager; guiEnvironment = device.GUIEnvironment; node = sceneManager.AddSphereSceneNode(1.0f, 32, sceneManager.RootSceneNode); node.Position = new Vector3D(0.0f, 0.0f, 30.0f); node.SetMaterialFlag(MaterialFlag.Lighting, false); node.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/wall.bmp")); SceneNode n = sceneManager.AddCubeSceneNode(1.0f, sceneManager.RootSceneNode, -1); n.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/t351sml.jpg")); n.SetMaterialFlag(MaterialFlag.Lighting, false); Animator anim = sceneManager.CreateFlyCircleAnimator(new Vector3D(0.0f, 0.0f, 30.0f), 20.0f, 0.01f); n.AddAnimator(anim); anim.Drop(); AnimatedMesh mesh = sceneManager.GetMesh("../../irrlicht/media/sydney.md2"); if (mesh == null) { System.Console.WriteLine("Meshfile could not be loaded"); return; } AnimatedMeshSceneNode anode = sceneManager.AddAnimatedMeshSceneNode(mesh); if (anode != null) { anode.SetMaterialFlag(MaterialFlag.Lighting, false); anode.SetMD2Animation(MD2Animation.Stand); anode.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/sydney.bmp")); anode.SetFrameLoop(160, 180); anode.AnimationSpeed = 30; anode.Rotation = new Vector3D(0, 180, 0); } Animator anims = sceneManager.CreateFlyStraightAnimator(new Vector3D(100, 0, 60), new Vector3D(-100, 0, 60), 5000, true); anode.AddAnimator(anims); anims.Drop(); CameraSceneNode camera = sceneManager.AddCameraSceneNodeFPS(sceneManager.RootSceneNode, 100, 100, false); camera.Position = new Vector3D(0, 30, -40); camera.Target = new Vector3D(0, 5, 0); device.CursorControl.Visible = true; device.OnEvent += new OnEventDelegate(device_OnEvent); while (device.Run()) { RenderLoop(); } device.Drop(); }