Irrlicht.NET

Irrlicht.NET documentation 

Welcome to the Irrlicht Engine API documentation. Here you'll find any information you'll need to develop applications with the Irrlicht Engine. If you look for a tutorial on how to start, take a look at the homepage of the Irrlicht Engine at irrlicht.sourceforge.net or into the SDK in the directory \examples.net.

The Irrlicht Engine is intended to be an easy-to-use 3d engine, so this documentation is an important part of it. If you have any questions or suggestions, just send a email to the author of the engine, Nikolaus Gebhardt (niko (at) irrlicht3d.org).

Overview

The Irrlicht Engine was orginally written in C++ (Irrlicht.dll). Irrlicht.NET (Irrlicht.NET.dll) makes it possible to use this library from any .NET language. Irrlicht.NET is handwritten by me and it is not automaticly generated, which results in a nice .NET like naming scheme and use of the cool .NET specific features like properties, etc. This documentation is only about the .NET part of the engine, if you want to know how to use the native engine, take a look into the other help file, which is named irrlicht.chm.

Please note that Irrlicht.NET currently is a very early alpha version. Not every feature of the native engine has been ported yet.

How to use Irrlicht.NET

Take a look in the /examples.net folder of the SDK, there you'll find some examples for C# and VisualBasic.NET which are using Irrlicht.NET. Be sure to copy both files, Irrlicht.dll and Irrlicht.NET.dll into the folder where your application is. This is a short example written in C#, showing how to use basic features Irrlicht.NET. It loads an md2 file, attaches a texture to it, and displays it animated, letting the user fly around it using a camera controlled by mouse and keyboard:

 
[C#]
using System;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;


namespace HelloWorld
{
  class Example
  {
   [STAThread]
   static void Main(string[] args)
   {
     // start up the engine
     IrrlichtDevice device = new IrrlichtDevice(DriverType.OPENGL);
     device.WindowCaption = "Irrlicht.NET C# example 01 - Hello World";

   
     // load a texture
     ITexture texSydney =
        device.VideoDriver.GetTexture(@"..\..\media\sydney.bmp");
     
     // load the animated mesh of sydney
     Irrlicht.Scene.IAnimatedMesh mesh =
       device.SceneManager.GetMesh(@"..\..\media\sydney.md2");


     // add a user controlled camera and the animated mesh to the scene
     ICameraSceneNode cam =
        device.SceneManager.AddCameraSceneNodeFPS(null, 100, 100, -1);
     cam.Position = new Vector3D(20,0,-50);


     ISceneNode node =
       device.SceneManager.AddAnimatedMeshSceneNode(mesh, null, -1);
     node.SetMaterialTexture(0, texSydney);
     node.SetMaterialFlag(MaterialFlag.LIGHTING, false);


     // make mouse cursor invisible
     device.CursorControl.Visible = false;

     
     // start drawing loop
     int fps = 0;

     while(device.Run())
     {
       if (device.WindowActive)
       {
          device.VideoDriver.BeginScene(
             true, true, new Color(0,100,100,100));

          device.SceneManager.DrawAll();

          device.VideoDriver.EndScene();

          
          // display frames per second value
          if (fps != device.VideoDriver.FPS)
          {
            fps = device.VideoDriver.FPS;
            device.WindowCaption =
                "Irrlicht.NET C# example 01 - Hello World ["
+
                device.VideoDriver.Name + "] fps:" + fps;
          }
       }
     } // end drawing-loop

   } // end main()

  } // end class

} // end namespace

Solving Problems

If you have problems with this example, try this: