How to use BspSceneManager/OctreeSceneManager in Ogre.Net?

LuRenJia

04-07-2006 16:36:59

Hi, folks!

I want to show octree boxes using OctreeManager.setShowBoxes, but I can't find it in OgreDotNet, no any namespaces or classes with it, BspSceneManager too.

Where are they? Not in OgreDotNet?

Any reply is helps.

pjcast

04-07-2006 17:47:29

You should look into the set & get options of the base scene manager class (that is, if it is wrapped in ODN). There should be a get option for setting the bounding boxes that you can call with set option. You should not ever need to use the derived scenemanager itself.

LuRenJia

13-07-2006 06:02:02

Thanks.

But I can't find that set option. I will carefully search again.

rastaman

13-07-2006 16:01:44

I don't see setOption/getOption in OgreBspSceneManager.h but OgreOctreeSceneManager.h has some options defined.
Here is how you would use them:

AxisAlignedBox aab = new AxisAlignedBox( -500,-500,-500, 500,500,500 );
mSceneManager.SetOption( "Size", AxisAlignedBox.getCPtr(aab).Handle );
aab.Dispose();
aab=null;

IntPtr p= System.Runtime.InteropServices.Marshal.AllocHGlobal(4); //32bit

System.Runtime.InteropServices.Marshal.WriteInt32(p , 0); //zero it
System.Runtime.InteropServices.Marshal.WriteByte(p , 1); //set the value 1/true in first byte for option CullCamera
mSceneManager.SetOption( "CullCamera", p);

System.Runtime.InteropServices.Marshal.WriteInt32(p , 100); //set the value 100 for option Depth
mSceneManager.SetOption( "Depth", p);

System.Runtime.InteropServices.Marshal.WriteInt32(p , 0); //zero it
System.Runtime.InteropServices.Marshal.WriteByte(p , 1); //set the value 1/true in first byte for option ShowOctree
mSceneManager.SetOption( "ShowOctree", p);

System.Runtime.InteropServices.Marshal.FreeHGlobal(p); //delete the allocated space

LuRenJia

23-07-2006 03:31:21

thanks to restaman.