Ported BSP demo

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
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! :D :D :D

Bekas

25-11-2006 13:15:35

Nice, I'll add it to SVN :)

CK_MACK

25-01-2007 07:09:06

What demo is this one?

Bekas

25-01-2007 12:10:03

Um, back when grizzley90 posted it I didn't include chiropteraDM.pk3 to the SDK, but now that I do I forgot to add the demo :?

Anyway, if you want to try it out, add the 'quake3settings.cfg' file, as grizzley suggested, and use the posted code.

grizzley90

26-01-2007 00:21:33

oh that would explain why the cellshading demo is in and not this one. Its quite alright as anyone that needs to use bsp can search this up.