C# Class Axiom.SceneManagers.Bsp.BspSceneManager

Specialisation of the SceneManager class to deal with indoor scenes based on a BSP tree.
This class refines the behaviour of the default SceneManager to manage a scene whose bulk of geometry is made up of an indoor environment which is organised by a Binary Space Partition (BSP) tree.

A BSP tree progressively subdivides the space using planes which are the nodes of the tree. At some point we stop subdividing and everything in the remaining space is part of a 'leaf' which contains a number of polygons. Typically we traverse the tree to locate the leaf in which a point in space is (say the camera origin) and work from there. A second structure, the Potentially Visible Set, tells us which other leaves can been seen from this leaf, and we test their bounding boxes against the camera frustum to see which we need to draw. Leaves are also a good place to start for collision detection since they divide the level into discrete areas for testing.

This BSP and PVS technique has been made famous by engines such as Quake and Unreal. Ogre provides support for loading Quake3 level files to populate your world through this class, by calling the BspSceneManager.LoadWorldGeometry. Note that this interface is made available at the top level of the SceneManager class so you don't have to write your code specifically for this class - just call Root::getSceneManager passing a SceneType of ST_INDOOR and in the current implementation you will get a BspSceneManager silently disguised as a standard SceneManager.

Inheritance: Axiom.Core.SceneManager
Afficher le fichier Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Свойство Type Description
aaBGeometry Axiom.Graphics.RenderOperation
bspGeometry BspGeometry
faceGroupChecked bool>.Dictionary
level BspLevel
lightAddedToFrustum bool[]
matFaceGroupMap BspStaticFaceGroup>.Collections.MultiMap
objectsForRendering Axiom.Collections.MovableObjectCollection
renderOp Axiom.Graphics.RenderOperation
showNodeAABs bool
spotlightFrustum SpotlightFrustum
textureLightMaterial Axiom.Graphics.Material
textureLightPass Axiom.Graphics.Pass

Méthodes publiques

Méthode Description
BspSceneManager ( string name ) : System
CreateIntersectionQuery ( uint mask ) : IntersectionSceneQuery

Creates an IntersectionSceneQuery for this scene manager.

This method creates a new instance of a query object for locating intersecting objects. See SceneQuery and IntersectionSceneQuery for full details.

CreateRayQuery ( Ray ray, uint mask ) : RaySceneQuery

Creates a RaySceneQuery for this scene manager.

This method creates a new instance of a query object for this scene manager, looking for objects which fall along a ray. See SceneQuery and RaySceneQuery for full details.

CreateSceneNode ( ) : SceneNode

Creates a specialized Plugin_BSPSceneManager.BspSceneNode.

CreateSceneNode ( string name ) : SceneNode

Creates a specialized Plugin_BSPSceneManager.BspSceneNode.

CreateSphereRegionQuery ( Sphere sphere, uint mask ) : SphereRegionSceneQuery

Creates a SphereSceneQuery for this scene manager.

This method creates a new instance of a query object for this scene manager, for a spherical region. See SceneQuery and SphereSceneQuery for full details.

EstimateWorldGeometry ( Stream stream, string typeName ) : int
EstimateWorldGeometry ( string filename ) : int
FindVisibleObjects ( Camera camera, bool onlyShadowCasters ) : void

Overriden from SceneManager.

GetSuggestedViewpoint ( bool random ) : ViewPoint

Specialised to suggest viewpoints.

LoadWorldGeometry ( ) : void
LoadWorldGeometry ( string filename ) : void

Specialized from SceneManager to support Quake3 bsp files.

SetWorldGeometry ( Stream stream, string typeName ) : void
SetWorldGeometry ( string filename ) : void

Méthodes protégées

Méthode Description
AddBoundingBox ( AxisAlignedBox aab, bool visible ) : void

Adds a bounding box to draw if turned on.

CacheGeometry ( IntPtr indexes, BspStaticFaceGroup faceGroup ) : int

Caches a face group for imminent rendering.

CacheLightGeometry ( TextureLight light, uint pIndexes, TextureLightMap pTexLightMaps, BspVertex pVertices, BspStaticFaceGroup faceGroup ) : int

Caches a face group and calculates texture lighting coordinates.

FindShadowCastersForLight ( Light light, Camera camera ) : IList
InitTextureLighting ( ) : void
OnRenderQueueEnded ( RenderQueueGroupID group, string invocation ) : bool
ProcessVisibleLeaf ( Axiom.SceneManagers.Bsp.BspNode leaf, Camera camera, bool onlyShadowCasters ) : void

Tags geometry in the leaf specified for later rendering.

RenderSingleObject ( IRenderable renderable, Pass pass, bool doLightIteration, LightList manualLightList ) : void

Overriden from SceneManager.

RenderStaticGeometry ( ) : void

Renders the static level geometry tagged in Plugin_BSPSceneManager.BspSceneManager.WalkTree.

RenderTextureLighting ( Light light ) : void

Renders the texture lighting tagged in the specified light

RenderTextureShadowOnGeometry ( ) : void

Renders texture shadow on tagged in level geometry.

WalkTree ( Camera camera, bool onlyShadowCasters ) : Axiom.SceneManagers.Bsp.BspNode

Walks the BSP tree looking for the node which the camera is in, and tags any geometry which is in a visible leaf for later processing.

Private Methods

Méthode Description
NotifyObjectDetached ( Axiom.Core.MovableObject obj ) : void

Internal method for notifying the level that an object has been detached from a node.

NotifyObjectMoved ( Axiom.Core.MovableObject obj, Vector3 pos ) : void

Internal method for tagging Plugin_BSPSceneManager.BspNode's with objects which intersect them.

Method Details

AddBoundingBox() protected méthode

Adds a bounding box to draw if turned on.
protected AddBoundingBox ( AxisAlignedBox aab, bool visible ) : void
aab Axiom.Math.AxisAlignedBox
visible bool
Résultat void

BspSceneManager() public méthode

public BspSceneManager ( string name ) : System
name string
Résultat System

CacheGeometry() protected méthode

Caches a face group for imminent rendering.
protected CacheGeometry ( IntPtr indexes, BspStaticFaceGroup faceGroup ) : int
indexes System.IntPtr
faceGroup BspStaticFaceGroup
Résultat int

CacheLightGeometry() protected méthode

Caches a face group and calculates texture lighting coordinates.
protected CacheLightGeometry ( TextureLight light, uint pIndexes, TextureLightMap pTexLightMaps, BspVertex pVertices, BspStaticFaceGroup faceGroup ) : int
light TextureLight
pIndexes uint
pTexLightMaps TextureLightMap
pVertices BspVertex
faceGroup BspStaticFaceGroup
Résultat int

CreateIntersectionQuery() public méthode

Creates an IntersectionSceneQuery for this scene manager.
This method creates a new instance of a query object for locating intersecting objects. See SceneQuery and IntersectionSceneQuery for full details.
public CreateIntersectionQuery ( uint mask ) : IntersectionSceneQuery
mask uint The query mask to apply to this query; can be used to filter out certain objects; see SceneQuery for details.
Résultat Axiom.Core.IntersectionSceneQuery

CreateRayQuery() public méthode

Creates a RaySceneQuery for this scene manager.
This method creates a new instance of a query object for this scene manager, looking for objects which fall along a ray. See SceneQuery and RaySceneQuery for full details.
public CreateRayQuery ( Ray ray, uint mask ) : RaySceneQuery
ray Axiom.Math.Ray Details of the ray which describes the region for this query.
mask uint The query mask to apply to this query; can be used to filter out certain objects; see SceneQuery for details.
Résultat Axiom.Core.RaySceneQuery

CreateSceneNode() public méthode

Creates a specialized Plugin_BSPSceneManager.BspSceneNode.
public CreateSceneNode ( ) : SceneNode
Résultat Axiom.Core.SceneNode

CreateSceneNode() public méthode

Creates a specialized Plugin_BSPSceneManager.BspSceneNode.
public CreateSceneNode ( string name ) : SceneNode
name string
Résultat Axiom.Core.SceneNode

CreateSphereRegionQuery() public méthode

Creates a SphereSceneQuery for this scene manager.
This method creates a new instance of a query object for this scene manager, for a spherical region. See SceneQuery and SphereSceneQuery for full details.
public CreateSphereRegionQuery ( Sphere sphere, uint mask ) : SphereRegionSceneQuery
sphere Axiom.Math.Sphere Details of the sphere which describes the region for this query.
mask uint The query mask to apply to this query; can be used to filter out certain objects; see SceneQuery for details.
Résultat Axiom.Core.SphereRegionSceneQuery

EstimateWorldGeometry() public méthode

public EstimateWorldGeometry ( Stream stream, string typeName ) : int
stream Stream
typeName string
Résultat int

EstimateWorldGeometry() public méthode

public EstimateWorldGeometry ( string filename ) : int
filename string
Résultat int

FindShadowCastersForLight() protected méthode

protected FindShadowCastersForLight ( Light light, Camera camera ) : IList
light Axiom.Core.Light
camera Axiom.Core.Camera
Résultat IList

FindVisibleObjects() public méthode

Overriden from SceneManager.
public FindVisibleObjects ( Camera camera, bool onlyShadowCasters ) : void
camera Axiom.Core.Camera
onlyShadowCasters bool
Résultat void

GetSuggestedViewpoint() public méthode

Specialised to suggest viewpoints.
public GetSuggestedViewpoint ( bool random ) : ViewPoint
random bool
Résultat Axiom.Core.ViewPoint

InitTextureLighting() protected méthode

protected InitTextureLighting ( ) : void
Résultat void

LoadWorldGeometry() public méthode

public LoadWorldGeometry ( ) : void
Résultat void

LoadWorldGeometry() public méthode

Specialized from SceneManager to support Quake3 bsp files.
public LoadWorldGeometry ( string filename ) : void
filename string
Résultat void

OnRenderQueueEnded() protected méthode

protected OnRenderQueueEnded ( RenderQueueGroupID group, string invocation ) : bool
group RenderQueueGroupID
invocation string
Résultat bool

ProcessVisibleLeaf() protected méthode

Tags geometry in the leaf specified for later rendering.
protected ProcessVisibleLeaf ( Axiom.SceneManagers.Bsp.BspNode leaf, Camera camera, bool onlyShadowCasters ) : void
leaf Axiom.SceneManagers.Bsp.BspNode
camera Axiom.Core.Camera
onlyShadowCasters bool
Résultat void

RenderSingleObject() protected méthode

Overriden from SceneManager.
protected RenderSingleObject ( IRenderable renderable, Pass pass, bool doLightIteration, LightList manualLightList ) : void
renderable IRenderable
pass Axiom.Graphics.Pass
doLightIteration bool
manualLightList LightList
Résultat void

RenderStaticGeometry() protected méthode

Renders the static level geometry tagged in Plugin_BSPSceneManager.BspSceneManager.WalkTree.
protected RenderStaticGeometry ( ) : void
Résultat void

RenderTextureLighting() protected méthode

Renders the texture lighting tagged in the specified light
protected RenderTextureLighting ( Light light ) : void
light Axiom.Core.Light
Résultat void

RenderTextureShadowOnGeometry() protected méthode

Renders texture shadow on tagged in level geometry.
protected RenderTextureShadowOnGeometry ( ) : void
Résultat void

SetWorldGeometry() public méthode

public SetWorldGeometry ( Stream stream, string typeName ) : void
stream Stream
typeName string
Résultat void

SetWorldGeometry() public méthode

public SetWorldGeometry ( string filename ) : void
filename string
Résultat void

WalkTree() protected méthode

Walks the BSP tree looking for the node which the camera is in, and tags any geometry which is in a visible leaf for later processing.
protected WalkTree ( Camera camera, bool onlyShadowCasters ) : Axiom.SceneManagers.Bsp.BspNode
camera Axiom.Core.Camera
onlyShadowCasters bool
Résultat Axiom.SceneManagers.Bsp.BspNode

Property Details

aaBGeometry protected_oe property

protected RenderOperation,Axiom.Graphics aaBGeometry
Résultat Axiom.Graphics.RenderOperation

bspGeometry protected_oe property

protected BspGeometry,Axiom.SceneManagers.Bsp bspGeometry
Résultat BspGeometry

faceGroupChecked protected_oe property

protected Dictionary faceGroupChecked
Résultat bool>.Dictionary

level protected_oe property

protected BspLevel,Axiom.SceneManagers.Bsp level
Résultat BspLevel

lightAddedToFrustum protected_oe property

protected bool[] lightAddedToFrustum
Résultat bool[]

matFaceGroupMap protected_oe property

protected Collections.MultiMap matFaceGroupMap
Résultat BspStaticFaceGroup>.Collections.MultiMap

objectsForRendering protected_oe property

protected MovableObjectCollection,Axiom.Collections objectsForRendering
Résultat Axiom.Collections.MovableObjectCollection

renderOp protected_oe property

protected RenderOperation,Axiom.Graphics renderOp
Résultat Axiom.Graphics.RenderOperation

showNodeAABs protected_oe property

protected bool showNodeAABs
Résultat bool

spotlightFrustum protected_oe property

protected SpotlightFrustum,Axiom.SceneManagers.Bsp spotlightFrustum
Résultat SpotlightFrustum

textureLightMaterial protected_oe property

protected Material,Axiom.Graphics textureLightMaterial
Résultat Axiom.Graphics.Material

textureLightPass protected_oe property

protected Pass,Axiom.Graphics textureLightPass
Résultat Axiom.Graphics.Pass