VB .Net 2. Tutorial "QuakeMap"

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
gagagu
Posts: 8
Joined: Wed Jul 13, 2005 1:32 pm

VB .Net 2. Tutorial "QuakeMap"

Post by gagagu »

the second one:

Code: Select all

Imports Irrlicht

Module Module1

    Sub Main()

        ' path to irrlicht media files
        Dim Irrlichtpath = "C:\copy\irrlicht-0.11.0\irrlicht-0.11.0\media\"

        ' driver variable
        Dim DriverType As New Irrlicht.Video.DriverType

        ' opengl as default 
        DriverType = Video.DriverType.OPENGL


        ' show question for driver
        Console.WriteLine("Please select a driver you want for this example (then press Return):")
        Console.WriteLine(" (a) Direct3D 9.0")
        Console.WriteLine(" (b) Direct3D 8.1")
        Console.WriteLine(" (c) OpenGL 1.2")
        Console.WriteLine(" (d) Software Renderer")
        Console.WriteLine(" (e) NullDevice")
        Console.WriteLine(" (else) exit")

        ' read user entry and set the driver type
        Dim Eingabe As Integer = Console.Read()
        Select Case (Strings.Chr(Eingabe))
            Case "a"
                drivertype = Video.DriverType.DIRECTX9
            Case "b"
                drivertype = Video.DriverType.DIRECTX8
            Case "c"
                drivertype = Video.DriverType.OPENGL
            Case "d"
                drivertype = Video.DriverType.SOFTWARE
            Case "e"
                drivertype = Video.DriverType.NULL_DRIVER
            Case Else
                Exit Sub
        End Select

        ' create and set device
        Dim dimension As New Irrlicht.Core.Dimension2D(800, 600)
        Dim device As New IrrlichtDevice(DriverType, dimension, 16, False, False, False, False, Nothing)

        ' define driver
        Dim driver As Irrlicht.Video.IVideoDriver
        driver = device.VideoDriver()

        ' define scene manager
        Dim smgr As Irrlicht.Scene.ISceneManager
        smgr = device.SceneManager

        ' load and add quake pak file
        device.FileSystem.AddZipFileArchive(Irrlichtpath + "map-20kdm2.pk3")

        ' load mesh
        Dim mesh As Irrlicht.Scene.IAnimatedMesh = device.SceneManager.GetMesh("20kdm2.bsp")

        ' add mesh to node
        Dim node As Irrlicht.Scene.ISceneNode

        ' add mesh to node and set position
        If Not mesh Is Nothing Then
            node = smgr.AddOctTreeSceneNode(mesh.GetMesh(0, 0, 0, 0), Nothing, 1)
            node.Position = New Irrlicht.Core.Vector3D(-1300, -144, -1249)
        Else
            MsgBox("could not load mesh: 20kdm2.bsp")
        End If

        ' set camera
        smgr.AddCameraSceneNodeFPS()

        ' device control should be visible
        device.CursorControl.Visible = False

        ' variables for show fps
        Dim lastFPS As Integer = -1
        Dim fps As Integer
        Dim caption As String

        ' main loop
        While device.Run
            ' Start scene
            driver.BeginScene(True, True, New Irrlicht.Video.Color(0, 200, 200, 200))
            ' draw all items of manager
            smgr.DrawAll()
            ' end scene
            driver.EndScene()

            ' calculate and show fps in caption
            fps = driver.FPS
            If lastFPS <> fps Then

                caption = "2. Quake 3 Map! - Irrlicht Engine Demo ["
                caption += driver.Name
                caption += "] FPS:"
                caption += CStr(fps)
                device.WindowCaption = caption
                lastFPS = fps
            End If
        End While
    End Sub

End Module
HopeDagger
Posts: 18
Joined: Wed Jun 08, 2005 3:14 am

Post by HopeDagger »

Don't get put down just because nobody is replying. I for one am thankful for the efforts of people like yourself to bring the .NET flavour of Irrlicht some resources like tutorials. :)
grim93

Post by grim93 »

PS Where can get the mesh and map files
Raedwulf
Posts: 62
Joined: Sat Aug 20, 2005 7:08 am

Post by Raedwulf »

Just download irrlicht engine.
This example is based on the c++ version. It uses the same media-files(e.g. textures etc.)
Guest

Post by Guest »

What apps do people use to create map files? The difficulty in getting my meshes to load into Irrlicht is the only thing that has kept me from really diving into learning to use the engine.
Locked