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

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 }
 

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 ( const 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.

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.

Note
Internal Ogre never supports non-affine matrix for world transform matrix/matrices, the behavior is undefined if returns non-affine matrix here.

This method will populate transform with 1 matrix if it does not use GPU vertex blending. If it does use GPU vertex blending it will fill the passed in pointer with an array of matrices, the length being the value returned from getNumWorldTransforms.

Note
If MeshManager::getBonesUseObjectSpace() is true, the first matrix must contain the world transform of the object, and the rest of the matrices must contain the bone transforms in object space.

Implements Ogre::Renderable.

References Ogre::Matrix4::IDENTITY.

◆ getSquaredViewDepth()

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

Returns the squared distance between the camera and this renderable.

Used to sort transparent objects. Squared distance is used 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.

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.

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: