No Exampleapp.net source

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
jivemasta

No Exampleapp.net source

Post by jivemasta »

You include the .exe file Exampleapp.net, but include no source to look at. Can you put it up somewhere so we can get it?
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

Do you mean the .NET example? If so, look in
irrlicht-0.12.0\examples.net\01.HelloWorld_cs (C#)
irrlicht-0.12.0\examples.net\01.HelloWorld_vb (VB.NET)

Also, its just .NET assembly so you can open the .exe and .dll in any .NET reflection tool and export out the code. Microsoft even included a reverse engineer .exe included somewhere in the .NET SDK that exports assemblies to C# .cs files.

I use Lutz's Reflector and it works pretty well (it does some other stuff). Do a search for Lutz Reflector and you'll find the site - its also over at gotdotnet.com workspaces.

.NET disassemblers
1) http://www.saurik.com/net/exemplar/
2) http://www.aisto.com/roeder/dotnet/

If you are doing VB, then use Lutz's tool. His Reflector disassembles into both C# and VB.
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

Well, I figure'd I'd just disassemble and post it to save you some time :)

Taking a break right now anyways :D

There might be some errors in there (from the disassemble), I didn't recompile to verify.

Code: Select all

using Irrlicht;
using Irrlicht.Core;
using Irrlicht.GUI;
using Irrlicht.Scene;
using Irrlicht.Video;
using System;
using System.Windows.Forms;

internal class ExampleApp : IEventReceiver
{
    // Methods
    public ExampleApp()
    {
        this.SelectedDriverType = DriverType.DIRECTX8;
        this.ClickedButton = TestScenarios.NONE;
    }

    public void displayMainMenu()
    {
        IrrlichtDevice device1 = new IrrlichtDevice(DriverType.SOFTWARE, new Dimension2D(0x200, 0x180), 0x10, false, false, false);
        device1.EventReceiver = this;
        device1.WindowCaption = "Irrlicht .NET test demos - main menu";
        IGUIFont font1 = device1.GUIEnvironment.GetFont("../../media/fonthaettenschweiler.bmp");
        if (font1 != null)
        {
            device1.GUIEnvironment.Skin.Font = font1;
        }
        device1.GUIEnvironment.AddImage(device1.VideoDriver.GetTexture("../../media/dotnetback.jpg"), new Position2D(0, 0), false, null, -1, "");
        Rect rect1 = new Rect(150, 60, 350, 0x87);
        IGUIListBox box1 = device1.GUIEnvironment.AddListBox(rect1, null, -1, true);
        box1.AddItem("Irrlicht Software Renderer 1.0");
        box1.AddItem("Direct3D 8.1");
        box1.AddItem("Direct3D 9.0c");
        box1.AddItem("OpenGL 1.5");
        box1.Selected = ((int) this.SelectedDriverType) - 1;
        rect1.LowerRightCorner.Y += 50;
        rect1.UpperLeftCorner.Y += 100;
        device1.GUIEnvironment.AddButton(rect1, null, 1, "Start Terrain Test");
        rect1.LowerRightCorner.Y += 30;
        rect1.UpperLeftCorner.Y += 30;
        device1.GUIEnvironment.AddButton(rect1, null, 2, "Start Indoor Test");
        rect1.LowerRightCorner.Y += 30;
        rect1.UpperLeftCorner.Y += 30;
        device1.GUIEnvironment.AddButton(rect1, null, 3, "Start Windows.Forms Test");
        device1.GUIEnvironment.AddStaticText("Background 3D scene created by Alvaro F. Celis, rendered using Irrlicht", new Rect(2, 0x170, 500, 0x180), false, false, null, -1);
        while (device1.Run() && (this.ClickedButton == TestScenarios.NONE))
        {
            if (!device1.WindowActive)
            {
                continue;
            }
            device1.VideoDriver.BeginScene(true, true, new Color(0xff, 0, 0, 50));
            device1.SceneManager.DrawAll();
            device1.GUIEnvironment.DrawAll();
            device1.VideoDriver.EndScene();
        }
        device1.CloseDevice();
    }

    [STAThread]
    private static void Main(string[] args)
    {
        ExampleApp app1 = new ExampleApp();
        app1.displayMainMenu();
        switch (app1.ClickedButton)
        {
            case TestScenarios.TERRAIN_TEST:
            {
                app1.runTerrainTest();
                return;
            }
            case TestScenarios.INDOOR_TEST:
            {
                app1.runIndoorTest();
                return;
            }
            case TestScenarios.WINDOWS_FORMS_TEST:
            {
                app1.runIrrlichtInWindowsFormTest();
                return;
            }
        }
    }

    public bool OnEvent(Event e)
    {
        if (e.Type == EventType.GUIEvent)
        {
            if (e.GUIEventType == GUIEvent.LISTBOX_CHANGED)
            {
                int num1 = ((IGUIListBox) e.GUIEventCaller).Selected;
                this.SelectedDriverType = (DriverType) (num1 + 1);
            }
            else if (e.GUIEventType == GUIEvent.BUTTON_CLICKED)
            {
                this.ClickedButton = (TestScenarios) e.GUIEventCaller.ID;
            }
        }
        else if (((e.Type == EventType.KeyInput) && !e.KeyPressedDown) && ((e.Key == KeyCode.KEY_KEY_S) && (this.Shadow != null)))
        {
            this.Shadow.Visible = !this.Shadow.Visible;
            return true;
        }
        return false;
    }

    public void runIndoorTest()
    {
        IrrlichtDevice device1 = new IrrlichtDevice(this.SelectedDriverType, new Dimension2D(800, 600), 0x10, false, true, false);
        device1.EventReceiver = this;
        device1.ResizeAble = true;
        device1.WindowCaption = "Irrlicht.NET indoor test";
        ITexture texture1 = device1.VideoDriver.GetTexture(@"..\..\media\sydney.bmp");
        ITexture texture2 = device1.VideoDriver.GetTexture(@"..\..\media\wall.jpg");
        ITexture texture3 = device1.VideoDriver.GetTexture(@"..\..\media\irrlichtlogoaligned.jpg");
        IAnimatedMesh mesh1 = device1.SceneManager.GetMesh(@"..\..\media\sydney.md2");
        if (mesh1 == null)
        {
            MessageBox.Show(@"Could not load mesh ..\..\media\sydney.md2, exiting.", "Problem starting program");
        }
        else
        {
            ISceneNode node1 = device1.SceneManager.AddTestSceneNode(15f, null, -1, new Vector3D(30f, -15f, 0f));
            node1.SetMaterialTexture(0, texture2);
            ISceneNodeAnimator animator1 = device1.SceneManager.CreateRotationAnimator(new Vector3D(0.2f, 0.2f, 0f));
            node1.AddAnimator(animator1);
            IAnimatedMeshSceneNode node2 = device1.SceneManager.AddAnimatedMeshSceneNode(mesh1, null, -1);
            node2.SetMaterialTexture(0, texture1);
            node2.SetMaterialFlag(MaterialFlag.LIGHTING, false);
            node2.Scale = new Vector3D(2f, 2f, 2f);
            node2.Position = new Vector3D(0f, -20f, 0f);
            this.Shadow = node2.AddShadowVolumeSceneNode();
            if (this.Shadow != null)
            {
                this.Shadow.Visible = false;
            }
            device1.SceneManager.AddLightSceneNode(null, new Vector3D(20f, 100f, -50f), new Colorf(255f, 0f, 0f), 200f, -1);
            device1.FileSystem.AddZipFileArchive("../../media/map-20kdm2.pk3");
            IAnimatedMesh mesh2 = device1.SceneManager.GetMesh("20kdm2.bsp");
            ISceneNode node3 = device1.SceneManager.AddOctTreeSceneNode(mesh2, (ISceneNode) null, -1);
            node3.Position = new Vector3D(-1370f, -130f, -1400f);
            ITriangleSelector selector1 = device1.SceneManager.CreateOctTreeTriangleSelector(mesh2.GetMesh(0), node3, 0x80);
            ICameraSceneNode node4 = device1.SceneManager.AddCameraSceneNodeFPS(null, 100f, 300f, -1);
            node4.Position = new Vector3D(20f, 300f, -50f);
            device1.CursorControl.Visible = false;
            ISceneNodeAnimator animator2 = device1.SceneManager.CreateCollisionResponseAnimator(selector1, node4, new Vector3D(30f, 50f, 30f), new Vector3D(0f, -3f, 0f), new Vector3D(0f, 50f, 0f), 0.0005f);
            node4.AddAnimator(animator2);
            IGUIFont font1 = device1.GUIEnvironment.GetFont("../../media/fonthaettenschweiler.bmp");
            device1.GUIEnvironment.Skin.Font = font1;
            device1.GUIEnvironment.AddMessageBox("Hello World", "I'm a Irrlicht.NET MessageBox. Please press SPACE to close me.", true, MessageBoxFlag.CANCEL | MessageBoxFlag.OK, null, -1);
            int num1 = 0;
            while (device1.Run())
            {
                if (!device1.WindowActive)
                {
                    continue;
                }
                device1.VideoDriver.BeginScene(true, true, new Color(0xff, 0, 0, 50));
                device1.SceneManager.DrawAll();
                device1.GUIEnvironment.DrawAll();
                device1.VideoDriver.Draw2DImage(texture3, new Position2D(10, 10), new Rect(0, 0, 0x58, 0x1f), new Rect(new Position2D(0, 0), device1.VideoDriver.ScreenSize), new Color(0xffffff), false);
                font1.Draw("Press 'S' to toggle the visibility of the realtime shadow.", new Position2D(120, 20), new Color(100, 150, 200, 200));
                device1.VideoDriver.EndScene();
                if (num1 != device1.VideoDriver.FPS)
                {
                    num1 = device1.VideoDriver.FPS;
                    object[] objArray1 = new object[4] { "Irrlicht.NET test (primitives:", device1.VideoDriver.PrimitiveCountDrawn, ") fps:", num1 } ;
                    device1.WindowCaption = string.Concat(objArray1);
                }
            }
        }
    }

    private void runIrrlichtInWindowsFormTest()
    {
        Form form1 = new Form();
        form1.Text = "Irrlicht running embedded in Windows.Form";
        IrrlichtDevice device1 = new IrrlichtDevice(this.SelectedDriverType, new Dimension2D(800, 600), 0x10, false, false, false, true, form1.Handle);
        form1.Show();
        ICameraSceneNode node1 = device1.SceneManager.AddCameraSceneNode(null, new Vector3D(), new Vector3D(), -1);
        ISceneNodeAnimator animator1 = device1.SceneManager.CreateFlyCircleAnimator(new Vector3D(0f, 10f, 0f), 30f, 0.003f);
        node1.AddAnimator(animator1);
        ISceneNode node2 = device1.SceneManager.AddTestSceneNode(25f, null, -1, new Vector3D());
        node2.SetMaterialTexture(0, device1.VideoDriver.GetTexture("../../media/rockwall.bmp"));
        while (device1.Run() && form1.Visible)
        {
            if (!device1.WindowActive)
            {
                continue;
            }
            device1.VideoDriver.BeginScene(true, true, new Color(0xff, 0, 0, 50));
            device1.SceneManager.DrawAll();
            device1.GUIEnvironment.DrawAll();
            device1.VideoDriver.EndScene();
        }
    }

    public void runTerrainTest()
    {
        IrrlichtDevice device1 = new IrrlichtDevice(this.SelectedDriverType, new Dimension2D(800, 600), 0x10, false, false, false);
        device1.EventReceiver = this;
        device1.ResizeAble = true;
        device1.WindowCaption = "Irrlicht.NET terrain test";
        ICameraSceneNode node1 = device1.SceneManager.AddCameraSceneNodeFPS(null, 100f, 1200f, -1);
        node1.Position = new Vector3D(3800f, 510f, 7400f);
        node1.Target = new Vector3D(4794f, 686f, 5400f);
        node1.FarValue = 12000f;
        ITerrainSceneNode node2 = device1.SceneManager.AddTerrainSceneNode("../../media/terrain-heightmap.bmp", null, -1, new Vector3D(), new Vector3D(40f, 4.4f, 40f), new Color(0xff, 0xff, 0xff, 0xff));
        node2.SetMaterialFlag(MaterialFlag.LIGHTING, false);
        node2.SetMaterialType(MaterialType.DETAIL_MAP);
        node2.SetMaterialTexture(0, device1.VideoDriver.GetTexture("../../media/terrain-texture.jpg"));
        node2.SetMaterialTexture(1, device1.VideoDriver.GetTexture("../../media/detailmap3.jpg"));
        node2.ScaleTexture(1f, 20f);
        ITriangleSelector selector1 = device1.SceneManager.CreateTerrainTriangleSelector(node2, 0);
        ISceneNodeAnimator animator1 = device1.SceneManager.CreateCollisionResponseAnimator(selector1, node1, new Vector3D(30f, 50f, 30f), new Vector3D(0f, 0f, 0f), new Vector3D(0f, 50f, 0f), 0.0005f);
        node1.AddAnimator(animator1);
        device1.SceneManager.AddSkyBoxSceneNode(device1.VideoDriver.GetTexture("../../media/irrlicht2_up.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_dn.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_lf.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_rt.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_ft.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_bk.jpg"), null, -1);
        device1.CursorControl.Visible = false;
        while (device1.Run())
        {
            if (!device1.WindowActive)
            {
                continue;
            }
            device1.VideoDriver.BeginScene(true, true, new Color(0xff, 0, 0, 50));
            device1.SceneManager.DrawAll();
            device1.GUIEnvironment.DrawAll();
            device1.VideoDriver.EndScene();
        }
    }


    // Fields
    private TestScenarios ClickedButton;
    private DriverType SelectedDriverType;
    private ISceneNode Shadow;
}

internal enum TestScenarios
{
    // Fields
    INDOOR_TEST = 2,
    NONE = 0,
    TERRAIN_TEST = 1,
    WINDOWS_FORMS_TEST = 3
}


VB.NET version

Code: Select all

Imports Irrlicht
Imports Irrlicht.Core
Imports Irrlicht.GUI
Imports Irrlicht.Scene
Imports Irrlicht.Video
Imports System
Imports System.Windows.Forms


    Friend Class ExampleApp
        Implements IEventReceiver

        ' Methods
        Public Sub New()
            Me.SelectedDriverType = DriverType.DIRECTX8
            Me.ClickedButton = TestScenarios.NONE
        End Sub

        Public Sub displayMainMenu()
            Dim device1 As New IrrlichtDevice(DriverType.SOFTWARE, New Dimension2D(512, 384), 16, False, False, False)
            device1.EventReceiver = Me
            device1.WindowCaption = "Irrlicht .NET test demos - main menu"
            Dim font1 As IGUIFont = device1.GUIEnvironment.GetFont("../../media/fonthaettenschweiler.bmp")
            If (Not font1 Is Nothing) Then
                device1.GUIEnvironment.Skin.Font = font1
            End If
            device1.GUIEnvironment.AddImage(device1.VideoDriver.GetTexture("../../media/dotnetback.jpg"), New Position2D(0, 0), False, Nothing, -1, "")
            Dim rect1 As New Rect(150, 60, 350, 135)
            Dim box1 As IGUIListBox = device1.GUIEnvironment.AddListBox(rect1, Nothing, -1, True)
            box1.AddItem("Irrlicht Software Renderer 1.0")
            box1.AddItem("Direct3D 8.1")
            box1.AddItem("Direct3D 9.0c")
            box1.AddItem("OpenGL 1.5")
            box1.Selected = (CType(Me.SelectedDriverType, Integer) - 1)
            rect1.LowerRightCorner.Y = (rect1.LowerRightCorner.Y + 50)
            rect1.UpperLeftCorner.Y = (rect1.UpperLeftCorner.Y + 100)
            device1.GUIEnvironment.AddButton(rect1, Nothing, 1, "Start Terrain Test")
            rect1.LowerRightCorner.Y = (rect1.LowerRightCorner.Y + 30)
            rect1.UpperLeftCorner.Y = (rect1.UpperLeftCorner.Y + 30)
            device1.GUIEnvironment.AddButton(rect1, Nothing, 2, "Start Indoor Test")
            rect1.LowerRightCorner.Y = (rect1.LowerRightCorner.Y + 30)
            rect1.UpperLeftCorner.Y = (rect1.UpperLeftCorner.Y + 30)
            device1.GUIEnvironment.AddButton(rect1, Nothing, 3, "Start Windows.Forms Test")
            device1.GUIEnvironment.AddStaticText("Background 3D scene created by Alvaro F. Celis, rendered using Irrlicht", New Rect(2, 368, 500, 384), False, False, Nothing, -1)
            Do While (device1.Run AndAlso (Me.ClickedButton = TestScenarios.NONE))
                If Not device1.WindowActive Then
                    Continue Do
                End If
                device1.VideoDriver.BeginScene(True, True, New Color(255, 0, 0, 50))
                device1.SceneManager.DrawAll
                device1.GUIEnvironment.DrawAll
                device1.VideoDriver.EndScene
            Loop
            device1.CloseDevice
        End Sub

        <STAThread> _
        Private Shared Sub Main(ByVal args As String())
            Dim app1 As New ExampleApp
            app1.displayMainMenu
            Select Case app1.ClickedButton
                Case TestScenarios.TERRAIN_TEST
                    app1.runTerrainTest
                    Return
                Case TestScenarios.INDOOR_TEST
                    app1.runIndoorTest
                    Return
                Case TestScenarios.WINDOWS_FORMS_TEST
                    app1.runIrrlichtInWindowsFormTest
                    Return
            End Select
        End Sub

        Public Function OnEvent(ByVal e As Event) As Boolean
            If (e.Type = EventType.GUIEvent) Then
                If (e.GUIEventType = GUIEvent.LISTBOX_CHANGED) Then
                    Dim num1 As Integer = CType(e.GUIEventCaller, IGUIListBox).Selected
                    Me.SelectedDriverType = CType((num1 + 1), DriverType)
                Else
                    If (e.GUIEventType = GUIEvent.BUTTON_CLICKED) Then
                        Me.ClickedButton = CType(e.GUIEventCaller.ID, TestScenarios)
                    End If
                End If
            Else
                If (((e.Type = EventType.KeyInput) AndAlso Not e.KeyPressedDown) AndAlso ((e.Key = KeyCode.KEY_KEY_S) AndAlso (Not Me.Shadow Is Nothing))) Then
                    Me.Shadow.Visible = Not Me.Shadow.Visible
                    Return True
                End If
            End If
            Return False
        End Function

        Public Sub runIndoorTest()
            Dim device1 As New IrrlichtDevice(Me.SelectedDriverType, New Dimension2D(800, 600), 16, False, True, False)
            device1.EventReceiver = Me
            device1.ResizeAble = True
            device1.WindowCaption = "Irrlicht.NET indoor test"
            Dim texture1 As ITexture = device1.VideoDriver.GetTexture("..\..\media\sydney.bmp")
            Dim texture2 As ITexture = device1.VideoDriver.GetTexture("..\..\media\wall.jpg")
            Dim texture3 As ITexture = device1.VideoDriver.GetTexture("..\..\media\irrlichtlogoaligned.jpg")
            Dim mesh1 As IAnimatedMesh = device1.SceneManager.GetMesh("..\..\media\sydney.md2")
            If (mesh1 Is Nothing) Then
                MessageBox.Show("Could not load mesh ..\..\media\sydney.md2, exiting.", "Problem starting program")
            Else
                Dim node1 As ISceneNode = device1.SceneManager.AddTestSceneNode(15!, Nothing, -1, New Vector3D(30!, -15!, 0!))
                node1.SetMaterialTexture(0, texture2)
                Dim animator1 As ISceneNodeAnimator = device1.SceneManager.CreateRotationAnimator(New Vector3D(0.2!, 0.2!, 0!))
                node1.AddAnimator(animator1)
                Dim node2 As IAnimatedMeshSceneNode = device1.SceneManager.AddAnimatedMeshSceneNode(mesh1, Nothing, -1)
                node2.SetMaterialTexture(0, texture1)
                node2.SetMaterialFlag(MaterialFlag.LIGHTING, False)
                node2.Scale = New Vector3D(2!, 2!, 2!)
                node2.Position = New Vector3D(0!, -20!, 0!)
                Me.Shadow = node2.AddShadowVolumeSceneNode
                If (Not Me.Shadow Is Nothing) Then
                    Me.Shadow.Visible = False
                End If
                device1.SceneManager.AddLightSceneNode(Nothing, New Vector3D(20!, 100!, -50!), New Colorf(255!, 0!, 0!), 200!, -1)
                device1.FileSystem.AddZipFileArchive("../../media/map-20kdm2.pk3")
                Dim mesh2 As IAnimatedMesh = device1.SceneManager.GetMesh("20kdm2.bsp")
                Dim node3 As ISceneNode = device1.SceneManager.AddOctTreeSceneNode(mesh2, CType(Nothing, ISceneNode), -1)
                node3.Position = New Vector3D(-1370!, -130!, -1400!)
                Dim selector1 As ITriangleSelector = device1.SceneManager.CreateOctTreeTriangleSelector(mesh2.GetMesh(0), node3, 128)
                Dim node4 As ICameraSceneNode = device1.SceneManager.AddCameraSceneNodeFPS(Nothing, 100!, 300!, -1)
                node4.Position = New Vector3D(20!, 300!, -50!)
                device1.CursorControl.Visible = False
                Dim animator2 As ISceneNodeAnimator = device1.SceneManager.CreateCollisionResponseAnimator(selector1, node4, New Vector3D(30!, 50!, 30!), New Vector3D(0!, -3!, 0!), New Vector3D(0!, 50!, 0!), 0.0005!)
                node4.AddAnimator(animator2)
                Dim font1 As IGUIFont = device1.GUIEnvironment.GetFont("../../media/fonthaettenschweiler.bmp")
                device1.GUIEnvironment.Skin.Font = font1
                device1.GUIEnvironment.AddMessageBox("Hello World", "I'm a Irrlicht.NET MessageBox. Please press SPACE to close me.", True, (MessageBoxFlag.CANCEL Or MessageBoxFlag.OK), Nothing, -1)
                Dim num1 As Integer = 0
                Do While device1.Run
                    If Not device1.WindowActive Then
                        Continue Do
                    End If
                    device1.VideoDriver.BeginScene(True, True, New Color(255, 0, 0, 50))
                    device1.SceneManager.DrawAll
                    device1.GUIEnvironment.DrawAll
                    device1.VideoDriver.Draw2DImage(texture3, New Position2D(10, 10), New Rect(0, 0, 88, 31), New Rect(New Position2D(0, 0), device1.VideoDriver.ScreenSize), New Color(16777215), False)
                    font1.Draw("Press 'S' to toggle the visibility of the realtime shadow.", New Position2D(120, 20), New Color(100, 150, 200, 200))
                    device1.VideoDriver.EndScene
                    If (num1 <> device1.VideoDriver.FPS) Then
                        num1 = device1.VideoDriver.FPS
                        Dim objArray1 As Object() = New Object() { "Irrlicht.NET test (primitives:", device1.VideoDriver.PrimitiveCountDrawn, ") fps:", num1 }
                        device1.WindowCaption = String.Concat(objArray1)
                    End If
                Loop
            End If
        End Sub

        Private Sub runIrrlichtInWindowsFormTest()
            Dim form1 As New Form
            form1.Text = "Irrlicht running embedded in Windows.Form"
            Dim device1 As New IrrlichtDevice(Me.SelectedDriverType, New Dimension2D(800, 600), 16, False, False, False, True, form1.Handle)
            form1.Show
            Dim node1 As ICameraSceneNode = device1.SceneManager.AddCameraSceneNode(Nothing, New Vector3D, New Vector3D, -1)
            Dim animator1 As ISceneNodeAnimator = device1.SceneManager.CreateFlyCircleAnimator(New Vector3D(0!, 10!, 0!), 30!, 0.003!)
            node1.AddAnimator(animator1)
            Dim node2 As ISceneNode = device1.SceneManager.AddTestSceneNode(25!, Nothing, -1, New Vector3D)
            node2.SetMaterialTexture(0, device1.VideoDriver.GetTexture("../../media/rockwall.bmp"))
            Do While (device1.Run AndAlso form1.Visible)
                If Not device1.WindowActive Then
                    Continue Do
                End If
                device1.VideoDriver.BeginScene(True, True, New Color(255, 0, 0, 50))
                device1.SceneManager.DrawAll
                device1.GUIEnvironment.DrawAll
                device1.VideoDriver.EndScene
            Loop
        End Sub

        Public Sub runTerrainTest()
            Dim device1 As New IrrlichtDevice(Me.SelectedDriverType, New Dimension2D(800, 600), 16, False, False, False)
            device1.EventReceiver = Me
            device1.ResizeAble = True
            device1.WindowCaption = "Irrlicht.NET terrain test"
            Dim node1 As ICameraSceneNode = device1.SceneManager.AddCameraSceneNodeFPS(Nothing, 100!, 1200!, -1)
            node1.Position = New Vector3D(3800!, 510!, 7400!)
            node1.Target = New Vector3D(4794!, 686!, 5400!)
            node1.FarValue = 12000!
            Dim node2 As ITerrainSceneNode = device1.SceneManager.AddTerrainSceneNode("../../media/terrain-heightmap.bmp", Nothing, -1, New Vector3D, New Vector3D(40!, 4.4!, 40!), New Color(255, 255, 255, 255))
            node2.SetMaterialFlag(MaterialFlag.LIGHTING, False)
            node2.SetMaterialType(MaterialType.DETAIL_MAP)
            node2.SetMaterialTexture(0, device1.VideoDriver.GetTexture("../../media/terrain-texture.jpg"))
            node2.SetMaterialTexture(1, device1.VideoDriver.GetTexture("../../media/detailmap3.jpg"))
            node2.ScaleTexture(1!, 20!)
            Dim selector1 As ITriangleSelector = device1.SceneManager.CreateTerrainTriangleSelector(node2, 0)
            Dim animator1 As ISceneNodeAnimator = device1.SceneManager.CreateCollisionResponseAnimator(selector1, node1, New Vector3D(30!, 50!, 30!), New Vector3D(0!, 0!, 0!), New Vector3D(0!, 50!, 0!), 0.0005!)
            node1.AddAnimator(animator1)
            device1.SceneManager.AddSkyBoxSceneNode(device1.VideoDriver.GetTexture("../../media/irrlicht2_up.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_dn.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_lf.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_rt.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_ft.jpg"), device1.VideoDriver.GetTexture("../../media/irrlicht2_bk.jpg"), Nothing, -1)
            device1.CursorControl.Visible = False
            Do While device1.Run
                If Not device1.WindowActive Then
                    Continue Do
                End If
                device1.VideoDriver.BeginScene(True, True, New Color(255, 0, 0, 50))
                device1.SceneManager.DrawAll
                device1.GUIEnvironment.DrawAll
                device1.VideoDriver.EndScene
            Loop
        End Sub


        ' Fields
        Private ClickedButton As TestScenarios
        Private SelectedDriverType As DriverType
        Private Shadow As ISceneNode
    End Class

    Friend Enum TestScenarios
        ' Fields
        INDOOR_TEST = 2
        NONE = 0
        TERRAIN_TEST = 1
        WINDOWS_FORMS_TEST = 3
    End Enum
Guest

Post by Guest »

The full source code for the ExampleApp you are looking for is compressed with the source code of the engine in the source.zip. You don't need to disassemble the executable.
Guest

Post by Guest »

Thanks! The disassembly has a couple errors to work out
Locked