📄 ogrepaginglandscapescenemanager.h
字号:
/***************************************************************************
OgrePagingLandScapeSceneManager.h - description
-------------------
begin : Mon May 12 2003
copyright : (C) 2003 by Jose A Milan
email : spoke2@supercable.es
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
#ifndef PAGINGLANDSCAPESCENEMANAGER_H
#define PAGINGLANDSCAPESCENEMANAGER_H
#include "OgrePagingLandScapePrerequisites.h"
namespace Ogre
{
class Image;
class PagingLandScapeIntersectionSceneQuery;
class PagingLandScapeRaySceneQuery;
/** This is a basic SceneManager for organizing PagingLandScapeRenderables into a total landscape.
It loads a LandScape from a .cfg file that specifices what textures/scale/mipmaps/etc to use.
*/
class PagingLandScapeSceneManager : public SceneManager
{
friend class PagingLandScapeIntersectionSceneQuery;
friend class PagingLandScapeRaySceneQuery;
public:
PagingLandScapeSceneManager( );
~PagingLandScapeSceneManager( );
/** Creates a specialized Camera */
virtual Camera * createCamera( const String &name );
/** Loads the LandScape using parameters int he given config file.
*/
void setWorldGeometry( const String& filename );
/** Empties the entire scene, inluding all SceneNodes, Cameras, Entities and Lights etc.
*/
void clearScene(void);
/** Method for setting a specific option of the Scene Manager. These options are usually
specific for a certain implemntation of the Scene Manager class, and may (and probably
will) not exist across different implementations.
@param
strKey The name of the option to set
@param
pValue A pointer to the value - the size should be calculated by the scene manager
based on the key
@return
On success, true is returned.
@par
On failiure, false is returned.
*/
bool setOption( const String& strKey, const void* pValue );
/** Method for getting the value of an implementation-specific Scene Manager option.
@param
strKey The name of the option
@param
pDestValue A pointer to a memory location where the value will
be copied. Currently, the memory will be allocated by the
scene manager, but this may change
@return
On success, true is returned and pDestValue points to the value of the given
option.
@par
On failiure, false is returned and pDestValue is set to NULL.
*/
bool getOption( const String& strKey, void* pDestValue );
/** Method for verifying wether the scene manager has an implementation-specific
option.
@param
strKey The name of the option to check for.
@return
If the scene manager contains the given option, true is returned.
@remarks
If it does not, false is returned.
*/
bool hasOption( const String& strKey );
/** Method for getting all possible values for a specific option. When this list is too large
(i.e. the option expects, for example, a float), the return value will be true, but the
list will contain just one element whose size will be set to 0.
Otherwise, the list will be filled with all the possible values the option can
accept.
@param
strKey The name of the option to get the values for.
@param
refValueList A reference to a list that will be filled with the available values.
@return
On success (the option exists), true is returned.
@par
On failiure, false is returned.
*/
bool getOptionValues( const String& strKey, std::list<SDDataChunk>& refValueList );
/** Method for getting all the implementation-specific options of the scene manager.
@param
refKeys A reference to a list that will be filled with all the available options.
@return
On success, true is returned. On failiure, false is returned.
*/
bool getOptionKeys( std::list<String>& refKeys );
/** Internal method for updating the scene graph ie the tree of SceneNode instances managed by this class.
@remarks
This must be done before issuing objects to the rendering pipeline, since derived transformations from
parent nodes are not updated until required. This SceneManager is a basic implementation which simply
updates all nodes from the root. This ensures the scene is up to date but requires all the nodes
to be updated even if they are not visible. Subclasses could trim this such that only potentially visible
nodes are updated.
*/
void _updateSceneGraph( Camera * cam );
/** Sends visible objects found in _findVisibleObjects to the rendering engine.
*/
//void _renderVisibleObjects( void );
/** Internal method which parses the scene to find visible objects to render.
@remarks
If you're implementing a custom scene manager, this is the most important method to
override since it's here you can apply your custom world partitioning scheme. Once you
have added the appropriate objects to the render queue, you can let the default
SceneManager objects _renderVisibleObjects handle the actual rendering of the objects
you pick.
@par
Any visible objects will be added to a rendering queue, which is indexed by material in order
to ensure objects with the same material are rendered together to minimise render state changes.
*/
//void _findVisibleObjects ( Camera * cam, bool onlyShadowCasters );
/** Creates a RaySceneQuery for this scene manager.
@remarks
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.
@par
The instance returned from this method must be destroyed by calling
SceneManager::destroyQuery when it is no longer required.
@param ray Details of the ray which describes the region for this query.
@param mask The query mask to apply to this query; can be used to filter out
certain objects; see SceneQuery for details.
*/
RaySceneQuery* createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
/** Creates an IntersectionSceneQuery for this scene manager.
@remarks
This method creates a new instance of a query object for locating
intersecting objects. See SceneQuery and IntersectionSceneQuery
for full details.
@par
The instance returned from this method must be destroyed by calling
SceneManager::destroyQuery when it is no longer required.
@param mask The query mask to apply to this query; can be used to filter out
certain objects; see SceneQuery for details.
*/
IntersectionSceneQuery* createIntersectionQuery(unsigned long mask);
/** intersectSegment
@remarks
Intersect mainly with Landscape
@param start
begining of the segment
@param end
where it ends
@param result
where it intersects with terrain
@param modif
If it does modify the terrain
*/
bool intersectSegment( const Vector3 & start,
const Vector3 & end,
Vector3 * result,
bool modif = false);
protected:
EntityList& getEntities() { return mEntities; }
/** All the plugin options are handle here.
*/
PagingLandScapeOptions mOptions;
/** LandScape 2D Data manager.
This class encapsulate the 2d data loading and unloading
*/
PagingLandScapeData2DManager* mData2DManager;
/** LandScape Texture manager.
This class encapsulate the texture loading and unloading
*/
PagingLandScapeTextureManager* mTextureManager;
/** LandScape tiles manager to avoid creating a deleting terrain tiles.
They are created at the plugin start and destroyed at the plugin unload.
*/
PagingLandScapeTileManager* mTileManager;
/** LandScape Renderable manager to avoid creating a deleting renderables.
They are created at the plugin start and destroyed at the plugin unload.
*/
PagingLandScapeRenderableManager* mRenderableManager;
/** LandScape pages for the terrain.
*/
PagingLandScapePageManager* mPageManager;
bool mNeedOptionsUpdate;
//JEFF - flag to indicate if the world geometry was setup
bool mWorldGeomIsSetup;
PagingLandScapeTileInfo *mImpactInfo;
Vector3 mImpact;
};
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -