I successfully translated some of the IRRLICHTLIME samples from C# to VB.NET 2010. I combined several samples into one. Problem I am having is trying to get materials and lighting to function correctly. This is something essential to the games I wrote because 3D objects get re-colored and alpha changed often inside my games.
I would like to upload the whole code here, but don't see where I can attach files.
Code: Select all
Light0 = smgr.AddLightSceneNode(Nothing, New Vector3Df(0, 4096, 0), New Colorf(0.5, 1.0, 0.5, 1.0), 65535, 1)
Light0.Visible = True
materialx = New Material
materialx.AmbientColor = New Color(255, 128, 0, 255)
materialx.DiffuseColor = New Color(255, 128, 0, 255)
materialx.EmissiveColor = New Color(0, 0, 0, 0)
materialx.SpecularColor = New Color(64, 32, 0, 128)
materialx.SetTexture(1, Driver.GetTexture("media/wall02.jpg"))
materialx.BackfaceCulling = False
materialx.Type = MaterialType.Solid
materialx.SetFlag(MaterialFlag.NormalizeNormals, True)
materialx.Shininess = 128
materialx.Fog = False
materialx.SetFlag(MaterialFlag.Lighting, False)
materialx.Lighting = True
materialx.MaterialTypeParam = 1
materialx.MaterialTypeParam2 = 2
materialx.ColorMask = ColorPlane.All
...
Dim buf0 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
Dim buf1 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
Dim buf2 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
Dim buf3 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
Dim buf4 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
Dim vertices(7 * 2 - 1) As Vertex3D
Dim indices(5 * 6 - 1) As UShort
Dim indices4 As UShort() = New UShort() {0, 1, 2, 1, 3, 2} ',
Dim i As Integer
Dim j As Single
Dim k As Integer
Dim v As Integer
k = 0
i = 0
v = 0
For v = 0 To 6 Step 2
If j < 384 Then
indices(k + 0) = v + 0
indices(k + 1) = v + 1
indices(k + 2) = v + 2
indices(k + 3) = v + 1
indices(k + 4) = v + 3
indices(k + 5) = v + 2
k = k + 6
End If
Next
v = 0
i = 0
For j = 256 To 1024 Step 128
vertices(v + 0) = New Vertex3D(50, 100, j, 50, 0, j, New Color(255, 255, 255), 0, i)
vertices(v + 1) = New Vertex3D(50, 0, j, 50, 0, j, New Color(255, 255, 255), 1, i)
v = v + 2
i = i + 1
Next j
WallMesh(0) = IrrlichtLime.Scene.Mesh.Create
WallMesh(0).AddMeshBuffer(buf0)
buf0.Append(vertices, indices)
buf0.RecalculateBoundingBox()
buf0.Drop()
WallNode(0) = smgr.AddMeshSceneNode(WallMesh(0))
WallNode(0).Position = New Vector3Df(-2048, 512, 512)
WallNode(0).SetMaterial(0, materialx)
WallMesh(0).SetMaterialFlag(MaterialFlag.Lighting, True)
WallMesh(0).SetMaterialFlag(MaterialFlag.ColorMaterial, True)
i = 0
v = 0
For j = 256 To 1024 Step 128
vertices(v + 1) = New Vertex3D(-50, 100, j, 0, 0, 0, New Color(255, 255, 255), 1, i)
vertices(v + 0) = New Vertex3D(-50, 0, j, 0, 0, 0, New Color(255, 255, 255), 0, i)
v = v + 2
i = i + 1
Next j
WallMesh(1) = IrrlichtLime.Scene.Mesh.Create
WallMesh(1).AddMeshBuffer(buf1)
buf1.Append(vertices, indices)
buf1.RecalculateBoundingBox()
buf1.Drop()
WallNode(1) = smgr.AddMeshSceneNode(WallMesh(1))
WallMesh(1).SetMaterialFlag(MaterialFlag.Lighting, False)
WallNode(1).Position = New Vector3Df(-2048, 512, 512)
WallNode(1).SetMaterial(0, materialx)
i = 0
v = 0
For j = 256 To 1024 Step 128
vertices(v + 0) = New Vertex3D(-50, 100, j, 0, 0, 0, New Color(255, 255, 255), 0, i)
vertices(v + 1) = New Vertex3D(50, 100, j, 0, 0, 0, New Color(255, 255, 255), 1, i)
v = v + 2
i = i + 1
Next j
WallMesh(2) = IrrlichtLime.Scene.Mesh.Create
WallMesh(2).AddMeshBuffer(buf2)
buf2.Append(vertices, indices)
buf2.RecalculateBoundingBox()
buf2.Drop()
WallNode(2) = smgr.AddMeshSceneNode(WallMesh(2))
WallNode(2).Position = New Vector3Df(-2048, 512, 512)
WallNode(2).SetMaterial(0, materialx)
i = 0
v = 0
For j = 256 To 1024 Step 128
vertices(v + 0) = New Vertex3D(50, 0, j, 0, 0, j, New Color(255, 255, 255), 0, i)
vertices(v + 1) = New Vertex3D(-50, 0, j, 0, 0, j, New Color(255, 255, 255), 1, i)
v = v + 2
i = i + 1
Next j
WallMesh(3) = IrrlichtLime.Scene.Mesh.Create
WallMesh(3).AddMeshBuffer(buf3)
buf3.Append(vertices, indices)
buf3.RecalculateBoundingBox()
buf3.Drop()
WallNode(3) = smgr.AddMeshSceneNode(WallMesh(3))
WallNode(3).Position = New Vector3Df(-2048, 512, 512)
WallNode(3).SetMaterial(0, materialx)
vertices(0) = New Vertex3D(-50, 100, 256, 0, 0, 0, New Color(255, 255, 255), 0, 0)
vertices(1) = New Vertex3D(-50, 0, 256, 0, 0, 0, New Color(255, 255, 255), 0, 1)
vertices(2) = New Vertex3D(50, 100, 256, 0, 0, 0, New Color(255, 255, 255), 1, 0)
vertices(3) = New Vertex3D(50, 0, 256, 0, 0, 0, New Color(255, 255, 255), 1, 1)
WallMesh(4) = IrrlichtLime.Scene.Mesh.Create
WallMesh(4).AddMeshBuffer(buf4)
buf4.Append(vertices, indices4)
buf4.RecalculateBoundingBox()
buf4.Drop()
WallNode(4) = smgr.AddMeshSceneNode(WallMesh(4))
WallNode(4).Position = New Vector3Df(-2048, 512, 512)
WallNode(4).SetMaterial(0, materialx)
...
I am considering converting an advance user friendly Role Playing Game maker to use IRRLICHT and IRRLICHTLIME. Whole thing was done in Visual Basic. Project is over 10 years old and 10s of thousands lines of coding. Currently using Truevision3D 6.5 to drive the 3D part of it. Reason is that the programmers of TV3D seem to have abandoned their project. Have not seen an update for 3 years now. Plus they are charging a larger royalty to use their engine. People using their message board has been on the decline.