grizzley90
24-11-2006 17:39:57
I ported another demo for no reason what so ever...
However there is a couple of problems:
-add chiropteraDM.pk3 and chiropteraDM.txt to media/packs
because it doesn't come with current mogre sdk but it comes with the ogre demos.
-add this file quake3settings.cfg to all exe folders
This is the code.
Bsp.cs
Program.cs
I hope you enjoy it!
However there is a couple of problems:
-add chiropteraDM.pk3 and chiropteraDM.txt to media/packs
because it doesn't come with current mogre sdk but it comes with the ogre demos.
-add this file quake3settings.cfg to all exe folders
Pak0Location: ../../media/packs/chiropteraDM.pk3
Map: maps/chiropteradm.bsp
This is the code.
Bsp.cs
using System;
using System.Collections.Generic;
using System.Text;
using Mogre;
namespace BSP
{
class BSP : Mogre.Demo.ExampleApplication.Example
{
String mQuakePk3;
String mQuakeLevel;
public override void LoadResources()
{
// Turn off rendering of everything except overlays
sceneMgr.ClearSpecialCaseRenderQueues();
sceneMgr.SetSpecialCaseRenderQueueMode(SceneManager.SpecialCaseRenderQueueMode.SCRQM_INCLUDE);
// Set up the world geometry link
ResourceGroupManager.Singleton.LinkWorldGeometryToResourceGroup(
ResourceGroupManager.Singleton.WorldResourceGroupName,
mQuakeLevel, 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);
}
// Override resource sources (include Quake3 archives)
public override void SetupResources()
{
// Load Quake3 locations from a file
ConfigFile cf = new ConfigFile();
cf.Load("quake3settings.cfg", "\t:=", true);
mQuakePk3 = cf.GetSetting("Pak0Location");
mQuakeLevel = cf.GetSetting("Map");
base.SetupResources();
ResourceGroupManager.Singleton.AddResourceLocation(
mQuakePk3, "Zip", ResourceGroupManager.Singleton.WorldResourceGroupName);
}
// Override scene manager (use indoor instead of generic)
public override void ChooseSceneManager()
{
sceneMgr = root.CreateSceneManager("BspSceneManager");
}
// Scene creation
public override void CreateScene()
{
// modify camera for close work
camera.NearClipDistance=(4);
camera.FarClipDistance=(4000);
// Also change position, and set Quake-type orientation
// Get random player start point
ViewPoint vp = sceneMgr.GetSuggestedViewpoint(true);
camera.Position = (vp.Position);
camera.Pitch(new Degree(90)); // Quake uses X/Y horizon, Z up
camera.Rotate(vp.Orientation);
// Don't yaw along variable axis, causes leaning
camera.SetFixedYawAxis(true, Vector3.UNIT_Z);
}
}
}
Program.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace BSP
{
class Program
{
static void Main(string[] args)
{
try
{
BSP app = new BSP();
app.Go();
}
catch
{
// Check if it's an Ogre Exception
if (Mogre.OgreException.IsThrown)
Mogre.Demo.ExampleApplication.Example.ShowOgreException();
else
throw;
}
}
}
}
I hope you enjoy it!