C
Charles Simpsons
Hello.
I am trying to convert a C# to VB.NET.
Can you please tell me what I'm doing wrong and how I can fix it?
I am getting the error "Namespace declarations can only be used..."
Thank you!
This is my module:
Imports System
Imports System.Collections.Generic
Imports System.Text
Module Module1
Namespace Mogre.Demo.BSP
Class Program
Private Shared Sub Main(ByVal args As String())
Try
Dim app As New BspApplication()
app.Go()
Catch generatedExceptionName As
System.Runtime.InteropServices.SEHException
' Check if it's an Ogre Exception
If OgreException.IsThrown Then
ExampleApplication.Example.ShowOgreException()
Else
Throw
End If
End Try
End Sub
End Class
Class BspApplication
Inherits Mogre.Demo.ExampleApplication.Example
Private quakePk3 As String
Private quakeLevel As String
Private loadingBar As New
Mogre.Demo.ExampleApplication.LoadingBar()
Public Overloads Overrides Sub LoadResources()
loadingBar.Start(window, 1, 1, 0.75F)
' Turn off rendering of everything except overlays
sceneMgr.ClearSpecialCaseRenderQueues()
sceneMgr.AddSpecialCaseRenderQueue(CByte(RenderQueueGroupID.RENDER_QUEUE_OVERLAY))
'fix: RenderQueueGroupID.RENDER_QUEUE_OVERLAY
sceneMgr.SetSpecialCaseRenderQueueMode(SceneManager.SpecialCaseRenderQueueMode.SCRQM_INCLUDE)
' Set up the world geometry link
ResourceGroupManager.Singleton.LinkWorldGeometryToResourceGroup(ResourceGroupManager.Singleton.WorldResourceGroupName,
quakeLevel, sceneMgr)
' Initialise the rest of the resource groups, parse
scripts etc
ResourceGroupManager.Singleton.InitialiseAllResourceGroups()
ResourceGroupManager.Singleton.LoadResourceGroup(ResourceGroupManager.Singleton.WorldResourceGroupName,
False, True)
' Back to full rendering
sceneMgr.ClearSpecialCaseRenderQueues()
sceneMgr.SetSpecialCaseRenderQueueMode(SceneManager.SpecialCaseRenderQueueMode.SCRQM_EXCLUDE)
loadingBar.Finish()
End Sub
' Override resource sources (include Quake3 archives)
Public Overloads Overrides Sub SetupResources()
Dim cf As New ConfigFile()
cf.Load("quake3settings.cfg", "" & Chr(9) & ":=", True)
quakePk3 = cf.GetSetting("Pak0Location")
quakeLevel = cf.GetSetting("Map")
MyBase.SetupResources()
ResourceGroupManager.Singleton.AddResourceLocation(quakePk3, "Zip",
ResourceGroupManager.Singleton.WorldResourceGroupName, True)
End Sub
' Override scene manager (use indoor instead of generic)
Public Overloads Overrides Sub ChooseSceneManager()
sceneMgr =
Root.Singleton.CreateSceneManager("BspSceneManager")
End Sub
' Scene creation
Public Overloads Overrides Sub CreateScene()
camera.NearClipDistance = 4.0F
camera.FarClipDistance = 4000.0F
Dim vp As ViewPoint = sceneMgr.GetSuggestedViewpoint(True)
camera.Position = vp.Position
camera.Pitch(New Degree(90.0F))
camera.Rotate(vp.Orientation)
camera.SetFixedYawAxis(True, Vector3.UNIT_Z)
End Sub
End Class
End Namespace
End Module
I am trying to convert a C# to VB.NET.
Can you please tell me what I'm doing wrong and how I can fix it?
I am getting the error "Namespace declarations can only be used..."
Thank you!
This is my module:
Imports System
Imports System.Collections.Generic
Imports System.Text
Module Module1
Namespace Mogre.Demo.BSP
Class Program
Private Shared Sub Main(ByVal args As String())
Try
Dim app As New BspApplication()
app.Go()
Catch generatedExceptionName As
System.Runtime.InteropServices.SEHException
' Check if it's an Ogre Exception
If OgreException.IsThrown Then
ExampleApplication.Example.ShowOgreException()
Else
Throw
End If
End Try
End Sub
End Class
Class BspApplication
Inherits Mogre.Demo.ExampleApplication.Example
Private quakePk3 As String
Private quakeLevel As String
Private loadingBar As New
Mogre.Demo.ExampleApplication.LoadingBar()
Public Overloads Overrides Sub LoadResources()
loadingBar.Start(window, 1, 1, 0.75F)
' Turn off rendering of everything except overlays
sceneMgr.ClearSpecialCaseRenderQueues()
sceneMgr.AddSpecialCaseRenderQueue(CByte(RenderQueueGroupID.RENDER_QUEUE_OVERLAY))
'fix: RenderQueueGroupID.RENDER_QUEUE_OVERLAY
sceneMgr.SetSpecialCaseRenderQueueMode(SceneManager.SpecialCaseRenderQueueMode.SCRQM_INCLUDE)
' Set up the world geometry link
ResourceGroupManager.Singleton.LinkWorldGeometryToResourceGroup(ResourceGroupManager.Singleton.WorldResourceGroupName,
quakeLevel, sceneMgr)
' Initialise the rest of the resource groups, parse
scripts etc
ResourceGroupManager.Singleton.InitialiseAllResourceGroups()
ResourceGroupManager.Singleton.LoadResourceGroup(ResourceGroupManager.Singleton.WorldResourceGroupName,
False, True)
' Back to full rendering
sceneMgr.ClearSpecialCaseRenderQueues()
sceneMgr.SetSpecialCaseRenderQueueMode(SceneManager.SpecialCaseRenderQueueMode.SCRQM_EXCLUDE)
loadingBar.Finish()
End Sub
' Override resource sources (include Quake3 archives)
Public Overloads Overrides Sub SetupResources()
Dim cf As New ConfigFile()
cf.Load("quake3settings.cfg", "" & Chr(9) & ":=", True)
quakePk3 = cf.GetSetting("Pak0Location")
quakeLevel = cf.GetSetting("Map")
MyBase.SetupResources()
ResourceGroupManager.Singleton.AddResourceLocation(quakePk3, "Zip",
ResourceGroupManager.Singleton.WorldResourceGroupName, True)
End Sub
' Override scene manager (use indoor instead of generic)
Public Overloads Overrides Sub ChooseSceneManager()
sceneMgr =
Root.Singleton.CreateSceneManager("BspSceneManager")
End Sub
' Scene creation
Public Overloads Overrides Sub CreateScene()
camera.NearClipDistance = 4.0F
camera.FarClipDistance = 4000.0F
Dim vp As ViewPoint = sceneMgr.GetSuggestedViewpoint(True)
camera.Position = vp.Position
camera.Pitch(New Degree(90.0F))
camera.Rotate(vp.Orientation)
camera.SetFixedYawAxis(True, Vector3.UNIT_Z)
End Sub
End Class
End Namespace
End Module