OGRE  1.12.8
Object-Oriented Graphics Rendering Engine
Ogre::BspLevel Class Reference

Holds all the data associated with a Binary Space Parition (BSP) based indoor level. More...

#include <OgreBspLevel.h>

+ Inheritance diagram for Ogre::BspLevel:

Public Member Functions

 BspLevel (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
 Default constructor - used by BspResourceManager (do not call directly) More...
 
 ~BspLevel ()
 
void _notifyObjectDetached (const MovableObject *mov)
 Internal method, makes sure an object is removed from the leaves when detached from a node. More...
 
void _notifyObjectMoved (const MovableObject *mov, const Vector3 &pos)
 Ensures that the MovableObject is attached to the right leaves of the BSP tree. More...
 
BspNodefindLeaf (const Vector3 &point) const
 Walks the entire BSP tree and returns the leaf which contains the given point. More...
 
BspNodegetLeafStart (void)
 Gets a pointer to the start of the leaf nodes. More...
 
const LightListgetLights () const override
 Gets a list of lights, ordered relative to how close they are to this renderable. More...
 
const MaterialPtrgetMaterial (void) const override
 Retrieves a weak reference to the material this renderable object uses. More...
 
int getNumLeaves (void) const
 Gets the number of leaf nodes. More...
 
void getRenderOperation (RenderOperation &op) override
 Gets the render operation required to send this object to the frame buffer. More...
 
const BspNodegetRootNode (void)
 Returns a pointer to the root node (BspNode) of the BSP tree. More...
 
Real getSkyCurvature (void) const
 Get sky curvature. More...
 
const StringgetSkyMaterialName (void) const
 Get Sky material name. More...
 
Real getSquaredViewDepth (const Camera *cam) const override
 Returns the camera-relative squared depth of this renderable. More...
 
void getWorldTransforms (Matrix4 *xform) const override
 Gets the world transform matrix / matrices for this renderable object. More...
 
bool isLeafVisible (const BspNode *from, const BspNode *to) const
 Determines if one leaf node is visible from another. More...
 
bool isSkyEnabled (void) const
 Is sky enabled? More...
 
void load (DataStreamPtr &stream)
 Load direct from stream. More...
 
- Public Member Functions inherited from Ogre::Resource
 Resource (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
 Standard constructor. More...
 
virtual ~Resource ()
 Virtual destructor. More...
 
virtual void _dirtyState ()
 Manually mark the state of this resource as having been changed. More...
 
void _fireLoadingComplete (bool wasBackgroundLoaded)
 Firing of loading complete event. More...
 
void _firePreparingComplete (bool wasBackgroundLoaded)
 Firing of preparing complete event. More...
 
void _fireUnloadingComplete (void)
 Firing of unloading complete event. More...
 
void _notifyOrigin (const String &origin)
 Notify this resource of it's origin. More...
 
virtual void addListener (Listener *lis)
 Register a listener on this resource. More...
 
virtual void changeGroupOwnership (const String &newGroup)
 Change the resource group ownership of a Resource. More...
 
virtual void escalateLoading ()
 Escalates the loading of a background loaded resource. More...
 
ResourceManagergetCreator (void)
 Gets the manager which created this resource. More...
 
const StringgetGroup (void) const
 Gets the group which this resource is a member of. More...
 
ResourceHandle getHandle (void) const
 
LoadingState getLoadingState () const
 Returns the current loading state. More...
 
const StringgetName (void) const
 Gets resource name. More...
 
const StringgetOrigin (void) const
 Get the origin of this resource, e.g. More...
 
size_t getSize (void) const
 Retrieves info about the size of the resource. More...
 
virtual size_t getStateCount () const
 Returns the number of times this resource has changed state, which generally means the number of times it has been loaded. More...
 
bool isBackgroundLoaded (void) const
 Returns whether this Resource has been earmarked for background loading. More...
 
bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise. More...
 
bool isLoading () const
 Returns whether the resource is currently in the process of background loading. More...
 
bool isManuallyLoaded (void) const
 Is this resource manually loaded? More...
 
bool isPrepared (void) const
 Returns true if the Resource has been prepared, false otherwise. More...
 
bool isReloadable (void) const
 Returns true if the Resource is reloadable, false otherwise. More...
 
virtual void load (bool backgroundThread=false)
 Loads the resource, if it is not already. More...
 
virtual void prepare (bool backgroundThread=false)
 Prepares the resource for load, if it is not already. More...
 
virtual void reload (LoadingFlags flags=LF_DEFAULT)
 Reloads the resource, if it is already loaded. More...
 
virtual void removeListener (Listener *lis)
 Remove a listener on this resource. More...
 
void setBackgroundLoaded (bool bl)
 Tells the resource whether it is background loaded or not. More...
 
virtual void touch (void)
 'Touches' the resource to indicate it has been used. More...
 
virtual void unload (void)
 Unloads the resource; this is not permanent, the resource can be reloaded later if required. More...
 
- Public Member Functions inherited from Ogre::StringInterface
 StringInterface ()
 
virtual ~StringInterface ()
 Virtual destructor, see Effective C++. More...
 
void copyParametersTo (StringInterface *dest) const
 Method for copying this object's parameters to another object. More...
 
ParamDictionarygetParamDictionary (void)
 Retrieves the parameter dictionary for this class. More...
 
const ParamDictionarygetParamDictionary (void) const
 
String getParameter (const String &name) const
 Generic parameter retrieval method. More...
 
const ParameterListgetParameters (void) const
 Retrieves a list of parameters valid for this object. More...
 
bool setParameter (const String &name, const String &value)
 Generic parameter setting method. More...
 
void setParameterList (const NameValuePairList &paramList)
 Generic multiple parameter setting method. More...
 
- Public Member Functions inherited from Ogre::Renderable
 Renderable ()
 
virtual ~Renderable ()
 Virtual destructor needed as class has virtual methods. More...
 
virtual void _updateCustomGpuParameter (const GpuProgramParameters::AutoConstantEntry &constantEntry, GpuProgramParameters *params) const
 Update a custom GpuProgramParameters constant which is derived from information only this Renderable knows. More...
 
virtual bool getCastsShadows (void) const
 Method which reports whether this renderable would normally cast a shadow. More...
 
const Vector4getCustomParameter (size_t index) const
 Gets the custom value associated with this Renderable at the given index. More...
 
virtual unsigned short getNumWorldTransforms (void) const
 Returns the number of world transform matrices this renderable requires. More...
 
bool getPolygonModeOverrideable (void) const
 Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting. More...
 
const RenderSystemDataPtrgetRenderSystemData () const
 
virtual TechniquegetTechnique (void) const
 Retrieves a pointer to the Material Technique this renderable object uses. More...
 
bool getUseIdentityProjection (void) const
 Returns whether or not to use an 'identity' projection. More...
 
bool getUseIdentityView (void) const
 Returns whether or not to use an 'identity' view. More...
 
const AnygetUserAny (void) const
 
UserObjectBindingsgetUserObjectBindings ()
 Return an instance of user objects binding associated with this class. More...
 
const UserObjectBindingsgetUserObjectBindings () const
 Return an instance of user objects binding associated with this class. More...
 
bool hasCustomParameter (size_t index) const
 Checks whether a custom value is associated with this Renderable at the given index. More...
 
virtual void postRender (SceneManager *sm, RenderSystem *rsys)
 Called immediately after the Renderable has been rendered. More...
 
virtual bool preRender (SceneManager *sm, RenderSystem *rsys)
 Called just prior to the Renderable being rendered. More...
 
void removeCustomParameter (size_t index)
 Removes a custom value which is associated with this Renderable at the given index. More...
 
void setCustomParameter (size_t index, const Vector4 &value)
 Sets a custom parameter for this Renderable, which may be used to drive calculations for this specific Renderable, like GPU program parameters. More...
 
void setPolygonModeOverrideable (bool override)
 Sets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting. More...
 
void setRenderSystemData (RenderSystemDataPtr val) const
 
void setUseIdentityProjection (bool useIdentityProjection)
 Sets whether or not to use an 'identity' projection. More...
 
void setUseIdentityView (bool useIdentityView)
 Sets whether or not to use an 'identity' view. More...
 
void setUserAny (const Any &anything)
 

Static Public Member Functions

static size_t calculateLoadingStages (const String &levelName)
 Calculate the number of loading stages required for a given level. More...
 
static size_t calculateLoadingStages (DataStreamPtr &stream)
 Calculate the number of loading stages required for a given level. More...
 
- Static Public Member Functions inherited from Ogre::StringInterface
static void cleanupDictionary ()
 Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g. More...
 

Additional Inherited Members

- Public Types inherited from Ogre::Resource
enum  LoadingFlags {
  LF_DEFAULT = 0, LF_INCLUDE_NON_RELOADABLE = 1, LF_ONLY_UNREFERENCED = 2, LF_ONLY_UNREFERENCED_INCLUDE_NON_RELOADABLE = 3,
  LF_PRESERVE_STATE = 4
}
 Enum that allow to choose subset of unloaded/reloaded resources and to adjust reloading behavior. More...
 
enum  LoadingState {
  LOADSTATE_UNLOADED, LOADSTATE_LOADING, LOADSTATE_LOADED, LOADSTATE_UNLOADING,
  LOADSTATE_PREPARED, LOADSTATE_PREPARING
}
 Enum identifying the loading state of the resource. More...
 
- Public Types inherited from Ogre::Renderable
enum  { DEFAULT_PRIORITY = 100 }
 
typedef SharedPtr< RenderSystemDataRenderSystemDataPtr
 

Detailed Description

Holds all the data associated with a Binary Space Parition (BSP) based indoor level.

The data used here is populated by loading level files via the BspLevelManager::load method, although application users are more likely to call SceneManager::setWorldGeometry which will automatically arrange the loading of the level. Note that this assumes that you have asked for an indoor-specialised SceneManager (specify ST_INDOOR when calling Root::getSceneManager). Ogre currently only supports loading from Quake3 Arena level files, although any source that can be converted into this classes structure could also be used. The Quake3 level load process is in a different class called Quake3Level to keep the specifics separate.

Constructor & Destructor Documentation

◆ BspLevel()

Ogre::BspLevel::BspLevel ( ResourceManager creator,
const String name,
ResourceHandle  handle,
const String group,
bool  isManual = false,
ManualResourceLoader loader = 0 
)

Default constructor - used by BspResourceManager (do not call directly)

◆ ~BspLevel()

Ogre::BspLevel::~BspLevel ( )

Member Function Documentation

◆ isLeafVisible()

bool Ogre::BspLevel::isLeafVisible ( const BspNode from,
const BspNode to 
) const

Determines if one leaf node is visible from another.

◆ getRootNode()

const BspNode* Ogre::BspLevel::getRootNode ( void  )

Returns a pointer to the root node (BspNode) of the BSP tree.

◆ findLeaf()

BspNode* Ogre::BspLevel::findLeaf ( const Vector3 point) const

Walks the entire BSP tree and returns the leaf which contains the given point.

◆ _notifyObjectMoved()

void Ogre::BspLevel::_notifyObjectMoved ( const MovableObject mov,
const Vector3 pos 
)

Ensures that the MovableObject is attached to the right leaves of the BSP tree.

◆ _notifyObjectDetached()

void Ogre::BspLevel::_notifyObjectDetached ( const MovableObject mov)

Internal method, makes sure an object is removed from the leaves when detached from a node.

◆ getLeafStart()

BspNode* Ogre::BspLevel::getLeafStart ( void  )
inline

Gets a pointer to the start of the leaf nodes.

◆ getNumLeaves()

int Ogre::BspLevel::getNumLeaves ( void  ) const
inline

Gets the number of leaf nodes.

◆ calculateLoadingStages() [1/2]

static size_t Ogre::BspLevel::calculateLoadingStages ( const String levelName)
static

Calculate the number of loading stages required for a given level.

◆ calculateLoadingStages() [2/2]

static size_t Ogre::BspLevel::calculateLoadingStages ( DataStreamPtr stream)
static

Calculate the number of loading stages required for a given level.

◆ load()

void Ogre::BspLevel::load ( DataStreamPtr stream)

Load direct from stream.

◆ isSkyEnabled()

bool Ogre::BspLevel::isSkyEnabled ( void  ) const

Is sky enabled?

◆ getSkyMaterialName()

const String& Ogre::BspLevel::getSkyMaterialName ( void  ) const

Get Sky material name.

◆ getSkyCurvature()

Real Ogre::BspLevel::getSkyCurvature ( void  ) const

Get sky curvature.

◆ getRenderOperation()

void Ogre::BspLevel::getRenderOperation ( RenderOperation op)
inlineoverridevirtual

Gets the render operation required to send this object to the frame buffer.

Implements Ogre::Renderable.

◆ getWorldTransforms()

void Ogre::BspLevel::getWorldTransforms ( Matrix4 xform) const
inlineoverridevirtual

Gets the world transform matrix / matrices for this renderable object.

Remarks
If the object has any derived transforms, these are expected to be up to date as long as all the SceneNode structures have been updated before this is called.
This method will populate transform with 1 matrix if it does not use vertex blending. If it does use vertex blending it will fill the passed in pointer with an array of matrices, the length being the value returned from getNumWorldTransforms.
Note
Internal Ogre never supports non-affine matrix for world transform matrix/matrices, the behavior is undefined if returns non-affine matrix here.

Implements Ogre::Renderable.

References Ogre::Matrix4::IDENTITY.

◆ getSquaredViewDepth()

Real Ogre::BspLevel::getSquaredViewDepth ( const Camera cam) const
inlineoverridevirtual

Returns the camera-relative squared depth of this renderable.

Remarks
Used to sort transparent objects. Squared depth is used rather than actual depth to avoid having to perform a square root on the result.

Implements Ogre::Renderable.

◆ getLights()

const LightList& Ogre::BspLevel::getLights ( ) const
inlineoverridevirtual

Gets a list of lights, ordered relative to how close they are to this renderable.

Remarks
Directional lights, which have no position, will always be first on this list.

Implements Ogre::Renderable.

◆ getMaterial()

const MaterialPtr& Ogre::BspLevel::getMaterial ( void  ) const
inlineoverridevirtual

Retrieves a weak reference to the material this renderable object uses.

Remarks
Note that the Renderable also has the option to override the getTechnique method to specify a particular Technique to use instead of the best one available.

Implements Ogre::Renderable.


The documentation for this class was generated from the following file: