[1809] | 1 | /*-------------------------------------------------------------------------
|
---|
| 2 | This source file is a part of OGRE
|
---|
| 3 | (Object-oriented Graphics Rendering Engine)
|
---|
| 4 |
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This library is free software; you can redistribute it and/or modify it
|
---|
| 11 | under the terms of the GNU Lesser General Public License (LGPL) as
|
---|
| 12 | published by the Free Software Foundation; either version 2.1 of the
|
---|
| 13 | License, or (at your option) any later version.
|
---|
| 14 |
|
---|
| 15 | This library is distributed in the hope that it will be useful, but
|
---|
| 16 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
---|
| 17 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
---|
| 18 | License for more details.
|
---|
| 19 |
|
---|
| 20 | You should have received a copy of the GNU Lesser General Public License
|
---|
| 21 | along with this library; if not, write to the Free Software Foundation,
|
---|
| 22 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or go to
|
---|
| 23 | http://www.gnu.org/copyleft/lesser.txt
|
---|
| 24 | -------------------------------------------------------------------------*/
|
---|
| 25 | #ifndef __SceneManager_H__
|
---|
| 26 | #define __SceneManager_H__
|
---|
| 27 |
|
---|
| 28 | // Precompiler options
|
---|
| 29 | #include "OgrePrerequisites.h"
|
---|
| 30 |
|
---|
| 31 | #include "OgreString.h"
|
---|
| 32 | #include "OgreSceneNode.h"
|
---|
| 33 | #include "OgrePlane.h"
|
---|
| 34 | #include "OgreQuaternion.h"
|
---|
| 35 | #include "OgreColourValue.h"
|
---|
| 36 | #include "OgreCommon.h"
|
---|
| 37 | #include "OgreSceneQuery.h"
|
---|
| 38 | #include "OgreAutoParamDataSource.h"
|
---|
| 39 | #include "OgreAnimationState.h"
|
---|
| 40 | #include "OgreRenderQueue.h"
|
---|
| 41 | #include "OgreRenderQueueSortingGrouping.h"
|
---|
| 42 | #include "OgreRectangle2D.h"
|
---|
| 43 | #include "OgrePixelFormat.h"
|
---|
| 44 | #include "OgreResourceGroupManager.h"
|
---|
| 45 | #include "OgreTexture.h"
|
---|
| 46 |
|
---|
| 47 | namespace Ogre {
|
---|
| 48 |
|
---|
| 49 | /** Structure for holding a position & orientation pair. */
|
---|
| 50 | struct ViewPoint
|
---|
| 51 | {
|
---|
| 52 | Vector3 position;
|
---|
| 53 | Quaternion orientation;
|
---|
| 54 | };
|
---|
| 55 |
|
---|
| 56 | // Forward declarations
|
---|
| 57 | class DefaultIntersectionSceneQuery;
|
---|
| 58 | class DefaultRaySceneQuery;
|
---|
| 59 | class DefaultSphereSceneQuery;
|
---|
| 60 | class DefaultAxisAlignedBoxSceneQuery;
|
---|
| 61 |
|
---|
| 62 | /** Interface definition for classes which can listen in on the process
|
---|
| 63 | of rendering shadows, in order to implement custom behaviour.
|
---|
| 64 | */
|
---|
| 65 | class _OgreExport ShadowListener
|
---|
| 66 | {
|
---|
| 67 | public:
|
---|
| 68 | ShadowListener() {}
|
---|
| 69 | virtual ~ShadowListener() {}
|
---|
| 70 |
|
---|
| 71 | /** Event raised after all shadow textures have been rendered into for
|
---|
| 72 | all queues / targets but before any other geometry has been rendered
|
---|
| 73 | (including main scene geometry and any additional shadow receiver
|
---|
| 74 | passes).
|
---|
| 75 | @remarks
|
---|
| 76 | This callback is useful for those that wish to perform some
|
---|
| 77 | additional processing on shadow textures before they are used to
|
---|
| 78 | render shadows. For example you could perform some filtering by
|
---|
| 79 | rendering the existing shadow textures into another alternative
|
---|
| 80 | shadow texture with a shader.]
|
---|
| 81 | @note
|
---|
| 82 | This event will only be fired when texture shadows are in use.
|
---|
| 83 | @param numberOfShadowTextures The number of shadow textures in use
|
---|
| 84 | */
|
---|
| 85 | virtual void shadowTexturesUpdated(size_t numberOfShadowTextures) = 0;
|
---|
| 86 |
|
---|
| 87 | /** This event occurs just before the view & projection matrices are
|
---|
| 88 | set for rendering into a shadow texture.
|
---|
| 89 | @remarks
|
---|
| 90 | You can use this event hook to perform some custom processing,
|
---|
| 91 | such as altering the camera being used for rendering the light's
|
---|
| 92 | view, including setting custom view & projection matrices if you
|
---|
| 93 | want to perform an advanced shadow technique.
|
---|
| 94 | @note
|
---|
| 95 | This event will only be fired when texture shadows are in use.
|
---|
| 96 | @param light Pointer to the light for which shadows are being rendered
|
---|
| 97 | @param camera Pointer to the camera being used to render
|
---|
| 98 | */
|
---|
| 99 | virtual void shadowTextureCasterPreViewProj(Light* light,
|
---|
| 100 | Camera* camera) = 0;
|
---|
| 101 | /** This event occurs just before the view & projection matrices are
|
---|
| 102 | set for re-rendering a shadow receiver.
|
---|
| 103 | @remarks
|
---|
| 104 | You can use this event hook to perform some custom processing,
|
---|
| 105 | such as altering the projection frustum being used for rendering
|
---|
| 106 | the shadow onto the receiver to perform an advanced shadow
|
---|
| 107 | technique.
|
---|
| 108 | @note
|
---|
| 109 | This event will only be fired when texture shadows are in use.
|
---|
| 110 | @param light Pointer to the light for which shadows are being rendered
|
---|
| 111 | @param frustum Pointer to the projection frustum being used to project
|
---|
| 112 | the shadow texture
|
---|
| 113 | */
|
---|
| 114 | virtual void shadowTextureReceiverPreViewProj(Light* light,
|
---|
| 115 | Frustum* frustum) = 0;
|
---|
| 116 |
|
---|
| 117 | };
|
---|
| 118 |
|
---|
| 119 | /** Manages the organisation and rendering of a 'scene' i.e. a collection
|
---|
| 120 | of objects and potentially world geometry.
|
---|
| 121 | @remarks
|
---|
| 122 | This class defines the interface and the basic behaviour of a
|
---|
| 123 | 'Scene Manager'. A SceneManager organises the culling and rendering of
|
---|
| 124 | the scene, in conjunction with the RenderQueue. This class is designed
|
---|
| 125 | to be extended through subclassing in order to provide more specialised
|
---|
| 126 | scene organisation structures for particular needs. The default
|
---|
| 127 | SceneManager culls based on a hierarchy of node bounding boxes, other
|
---|
| 128 | implementations can use an octree (@see OctreeSceneManager), a BSP
|
---|
| 129 | tree (@see BspSceneManager), and many other options. New SceneManager
|
---|
| 130 | implementations can be added at runtime by plugins, see
|
---|
| 131 | SceneManagerEnumerator for the interfaces for adding new SceneManager
|
---|
| 132 | types.
|
---|
| 133 | @par
|
---|
| 134 | There is a distinction between 'objects' (which subclass MovableObject,
|
---|
| 135 | and are movable, discrete objects in the world), and 'world geometry',
|
---|
| 136 | which is large, generally static geometry. World geometry tends to
|
---|
| 137 | influence the SceneManager organisational structure (e.g. lots of indoor
|
---|
| 138 | static geometry might result in a spatial tree structure) and as such
|
---|
| 139 | world geometry is generally tied to a given SceneManager implementation,
|
---|
| 140 | whilst MovableObject instances can be used with any SceneManager.
|
---|
| 141 | Subclasses are free to define world geometry however they please.
|
---|
| 142 | @par
|
---|
| 143 | Multiple SceneManager instances can exist at one time, each one with
|
---|
| 144 | a distinct scene. Which SceneManager is used to render a scene is
|
---|
| 145 | dependent on the Camera, which will always call back the SceneManager
|
---|
| 146 | which created it to render the scene.
|
---|
| 147 | */
|
---|
| 148 | class _OgreExport SceneManager
|
---|
| 149 | {
|
---|
| 150 | public:
|
---|
| 151 | /// Query type mask which will be used for world geometry @see SceneQuery
|
---|
| 152 | static uint32 WORLD_GEOMETRY_TYPE_MASK;
|
---|
| 153 | /// Query type mask which will be used for entities @see SceneQuery
|
---|
| 154 | static uint32 ENTITY_TYPE_MASK;
|
---|
| 155 | /// Query type mask which will be used for effects like billboardsets / particle systems @see SceneQuery
|
---|
| 156 | static uint32 FX_TYPE_MASK;
|
---|
| 157 | /// Query type mask which will be used for StaticGeometry @see SceneQuery
|
---|
| 158 | static uint32 STATICGEOMETRY_TYPE_MASK;
|
---|
| 159 | /// Query type mask which will be used for lights @see SceneQuery
|
---|
| 160 | static uint32 LIGHT_TYPE_MASK;
|
---|
| 161 | /// User type mask limit
|
---|
| 162 | static uint32 USER_TYPE_MASK_LIMIT;
|
---|
| 163 | /** Comparator for material map, for sorting materials into render order (e.g. transparent last).
|
---|
| 164 | */
|
---|
| 165 | struct materialLess
|
---|
| 166 | {
|
---|
| 167 | _OgreExport bool operator()(const Material* x, const Material* y) const;
|
---|
| 168 | };
|
---|
| 169 | /// Comparator for sorting lights relative to a point
|
---|
| 170 | struct lightLess
|
---|
| 171 | {
|
---|
| 172 | _OgreExport bool operator()(const Light* a, const Light* b) const;
|
---|
| 173 | };
|
---|
| 174 |
|
---|
| 175 | /// Describes the stage of rendering when performing complex illumination
|
---|
| 176 | enum IlluminationRenderStage
|
---|
| 177 | {
|
---|
| 178 | /// No special illumination stage
|
---|
| 179 | IRS_NONE,
|
---|
| 180 | /// Render to texture stage, used for texture based shadows
|
---|
| 181 | IRS_RENDER_TO_TEXTURE,
|
---|
| 182 | /// Render from shadow texture to receivers stage
|
---|
| 183 | IRS_RENDER_RECEIVER_PASS
|
---|
| 184 | };
|
---|
| 185 |
|
---|
| 186 | /** Enumeration of the possible modes allowed for processing the special case
|
---|
| 187 | render queue list.
|
---|
| 188 | @see SceneManager::setSpecialCaseRenderQueueMode
|
---|
| 189 | */
|
---|
| 190 | enum SpecialCaseRenderQueueMode
|
---|
| 191 | {
|
---|
| 192 | /// Render only the queues in the special case list
|
---|
| 193 | SCRQM_INCLUDE,
|
---|
| 194 | /// Render all except the queues in the special case list
|
---|
| 195 | SCRQM_EXCLUDE
|
---|
| 196 | };
|
---|
| 197 |
|
---|
| 198 | struct SkyDomeGenParameters
|
---|
| 199 | {
|
---|
| 200 | Real skyDomeCurvature;
|
---|
| 201 | Real skyDomeTiling;
|
---|
| 202 | Real skyDomeDistance;
|
---|
| 203 | int skyDomeXSegments;
|
---|
| 204 | int skyDomeYSegments;
|
---|
| 205 | int skyDomeYSegments_keep;
|
---|
| 206 | };
|
---|
| 207 |
|
---|
| 208 | struct SkyPlaneGenParameters
|
---|
| 209 | {
|
---|
| 210 | Real skyPlaneScale;
|
---|
| 211 | Real skyPlaneTiling;
|
---|
| 212 | Real skyPlaneBow;
|
---|
| 213 | int skyPlaneXSegments;
|
---|
| 214 | int skyPlaneYSegments;
|
---|
| 215 | };
|
---|
| 216 |
|
---|
| 217 | struct SkyBoxGenParameters
|
---|
| 218 | {
|
---|
| 219 | Real skyBoxDistance;
|
---|
| 220 | };
|
---|
| 221 |
|
---|
| 222 | protected:
|
---|
| 223 | /// Instance name
|
---|
| 224 | String mName;
|
---|
| 225 |
|
---|
| 226 | /// Queue of objects for rendering
|
---|
| 227 | RenderQueue* mRenderQueue;
|
---|
| 228 |
|
---|
| 229 | /// Current ambient light, cached for RenderSystem
|
---|
| 230 | ColourValue mAmbientLight;
|
---|
| 231 |
|
---|
| 232 | /// The rendering system to send the scene to
|
---|
| 233 | RenderSystem *mDestRenderSystem;
|
---|
| 234 |
|
---|
| 235 | typedef std::map<String, Camera* > CameraList;
|
---|
| 236 |
|
---|
| 237 | /** Central list of cameras - for easy memory management and lookup.
|
---|
| 238 | */
|
---|
| 239 | CameraList mCameras;
|
---|
| 240 |
|
---|
| 241 | typedef std::map<String, StaticGeometry* > StaticGeometryList;
|
---|
| 242 | StaticGeometryList mStaticGeometryList;
|
---|
| 243 |
|
---|
| 244 | typedef std::map<String, SceneNode*> SceneNodeList;
|
---|
| 245 |
|
---|
| 246 | /** Central list of SceneNodes - for easy memory management.
|
---|
| 247 | @note
|
---|
| 248 | Note that this list is used only for memory management; the structure of the scene
|
---|
| 249 | is held using the hierarchy of SceneNodes starting with the root node. However you
|
---|
| 250 | can look up nodes this way.
|
---|
| 251 | */
|
---|
| 252 | SceneNodeList mSceneNodes;
|
---|
| 253 |
|
---|
| 254 | /// Camera in progress
|
---|
| 255 | Camera* mCameraInProgress;
|
---|
| 256 | /// Current Viewport
|
---|
| 257 | Viewport* mCurrentViewport;
|
---|
| 258 |
|
---|
| 259 | /// Root scene node
|
---|
| 260 | SceneNode* mSceneRoot;
|
---|
| 261 |
|
---|
| 262 | /// Autotracking scene nodes
|
---|
| 263 | typedef std::set<SceneNode*> AutoTrackingSceneNodes;
|
---|
| 264 | AutoTrackingSceneNodes mAutoTrackingSceneNodes;
|
---|
| 265 |
|
---|
| 266 | // Sky params
|
---|
| 267 | // Sky plane
|
---|
| 268 | Entity* mSkyPlaneEntity;
|
---|
| 269 | Entity* mSkyDomeEntity[5];
|
---|
| 270 | Entity* mSkyBoxEntity[6];
|
---|
| 271 |
|
---|
| 272 | SceneNode* mSkyPlaneNode;
|
---|
| 273 | SceneNode* mSkyDomeNode;
|
---|
| 274 | SceneNode* mSkyBoxNode;
|
---|
| 275 |
|
---|
| 276 | // Sky plane
|
---|
| 277 | bool mSkyPlaneEnabled;
|
---|
| 278 | bool mSkyPlaneDrawFirst;
|
---|
| 279 | Plane mSkyPlane;
|
---|
| 280 | SkyPlaneGenParameters mSkyPlaneGenParameters;
|
---|
| 281 | // Sky box
|
---|
| 282 | bool mSkyBoxEnabled;
|
---|
| 283 | bool mSkyBoxDrawFirst;
|
---|
| 284 | Quaternion mSkyBoxOrientation;
|
---|
| 285 | SkyBoxGenParameters mSkyBoxGenParameters;
|
---|
| 286 | // Sky dome
|
---|
| 287 | bool mSkyDomeEnabled;
|
---|
| 288 | bool mSkyDomeDrawFirst;
|
---|
| 289 | Quaternion mSkyDomeOrientation;
|
---|
| 290 | SkyDomeGenParameters mSkyDomeGenParameters;
|
---|
| 291 |
|
---|
| 292 | // Fog
|
---|
| 293 | FogMode mFogMode;
|
---|
| 294 | ColourValue mFogColour;
|
---|
| 295 | Real mFogStart;
|
---|
| 296 | Real mFogEnd;
|
---|
| 297 | Real mFogDensity;
|
---|
| 298 |
|
---|
| 299 | typedef std::set<uint8> SpecialCaseRenderQueueList;
|
---|
| 300 | SpecialCaseRenderQueueList mSpecialCaseQueueList;
|
---|
| 301 | SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
|
---|
| 302 | uint8 mWorldGeometryRenderQueue;
|
---|
| 303 |
|
---|
| 304 | unsigned long mLastFrameNumber;
|
---|
| 305 | Matrix4 mTempXform[256];
|
---|
| 306 | bool mResetIdentityView;
|
---|
| 307 | bool mResetIdentityProj;
|
---|
| 308 |
|
---|
| 309 | typedef std::map<String, MovableObject*> MovableObjectMap;
|
---|
| 310 | typedef std::map<String, MovableObjectMap*> MovableObjectCollectionMap;
|
---|
| 311 | MovableObjectCollectionMap mMovableObjectCollectionMap;
|
---|
| 312 | MovableObjectMap* getMovableObjectMap(const String& typeName);
|
---|
| 313 |
|
---|
| 314 | /** Internal method for initialising the render queue.
|
---|
| 315 | @remarks
|
---|
| 316 | Subclasses can use this to install their own RenderQueue implementation.
|
---|
| 317 | */
|
---|
| 318 | virtual void initRenderQueue(void);
|
---|
| 319 | /// A pass designed to let us render shadow colour on white for texture shadows
|
---|
| 320 | Pass* mShadowCasterPlainBlackPass;
|
---|
| 321 | /// A pass designed to let us render shadow receivers for texture shadows
|
---|
| 322 | Pass* mShadowReceiverPass;
|
---|
| 323 | /** Internal method for turning a regular pass into a shadow caster pass.
|
---|
| 324 | @remarks
|
---|
| 325 | This is only used for texture shadows, basically we're trying to
|
---|
| 326 | ensure that objects are rendered solid black.
|
---|
| 327 | This method will usually return the standard solid black pass for
|
---|
| 328 | all fixed function passes, but will merge in a vertex program
|
---|
| 329 | and fudge the AutpoParamDataSource to set black lighting for
|
---|
| 330 | passes with vertex programs.
|
---|
| 331 | */
|
---|
| 332 | const Pass* deriveShadowCasterPass(const Pass* pass);
|
---|
| 333 | /** Internal method for turning a regular pass into a shadow receiver pass.
|
---|
| 334 | @remarks
|
---|
| 335 | This is only used for texture shadows, basically we're trying to
|
---|
| 336 | ensure that objects are rendered with a projective texture.
|
---|
| 337 | This method will usually return a standard single-texture pass for
|
---|
| 338 | all fixed function passes, but will merge in a vertex program
|
---|
| 339 | for passes with vertex programs.
|
---|
| 340 | */
|
---|
| 341 | const Pass* deriveShadowReceiverPass(const Pass* pass);
|
---|
| 342 |
|
---|
| 343 | /** Internal method to validate whether a Pass should be allowed to render.
|
---|
| 344 | @remarks
|
---|
| 345 | Called just before a pass is about to be used for rendering a group to
|
---|
| 346 | allow the SceneManager to omit it if required. A return value of false
|
---|
| 347 | skips this pass.
|
---|
| 348 | */
|
---|
| 349 | bool validatePassForRendering(const Pass* pass);
|
---|
| 350 |
|
---|
| 351 | /** Internal method to validate whether a Renderable should be allowed to render.
|
---|
| 352 | @remarks
|
---|
| 353 | Called just before a pass is about to be used for rendering a Renderable to
|
---|
| 354 | allow the SceneManager to omit it if required. A return value of false
|
---|
| 355 | skips it.
|
---|
| 356 | */
|
---|
| 357 | bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
|
---|
| 358 |
|
---|
| 359 | enum BoxPlane
|
---|
| 360 | {
|
---|
| 361 | BP_FRONT = 0,
|
---|
| 362 | BP_BACK = 1,
|
---|
| 363 | BP_LEFT = 2,
|
---|
| 364 | BP_RIGHT = 3,
|
---|
| 365 | BP_UP = 4,
|
---|
| 366 | BP_DOWN = 5
|
---|
| 367 | };
|
---|
| 368 |
|
---|
| 369 | /* Internal utility method for creating the planes of a skybox.
|
---|
| 370 | */
|
---|
| 371 | MeshPtr createSkyboxPlane(
|
---|
| 372 | BoxPlane bp,
|
---|
| 373 | Real distance,
|
---|
| 374 | const Quaternion& orientation,
|
---|
| 375 | const String& groupName);
|
---|
| 376 |
|
---|
| 377 | /* Internal utility method for creating the planes of a skydome.
|
---|
| 378 | */
|
---|
| 379 | MeshPtr createSkydomePlane(
|
---|
| 380 | BoxPlane bp,
|
---|
| 381 | Real curvature, Real tiling, Real distance,
|
---|
| 382 | const Quaternion& orientation,
|
---|
| 383 | int xsegments, int ysegments, int ySegmentsToKeep,
|
---|
| 384 | const String& groupName);
|
---|
| 385 |
|
---|
| 386 | // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
|
---|
| 387 | bool mDisplayNodes;
|
---|
| 388 |
|
---|
| 389 | /// Storage of animations, lookup by name
|
---|
| 390 | typedef std::map<String, Animation*> AnimationList;
|
---|
| 391 | AnimationList mAnimationsList;
|
---|
| 392 | AnimationStateSet mAnimationStates;
|
---|
| 393 |
|
---|
| 394 | /** Internal method used by _renderSingleObject to deal with renderables
|
---|
| 395 | which override the camera's own view / projection materices. */
|
---|
| 396 | void useRenderableViewProjMode(const Renderable* pRend);
|
---|
| 397 |
|
---|
| 398 | /** Internal method used by _renderSingleObject to deal with renderables
|
---|
| 399 | which override the camera's own view / projection matrices. */
|
---|
| 400 | void resetViewProjMode(void);
|
---|
| 401 |
|
---|
| 402 | typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
|
---|
| 403 | RenderQueueListenerList mRenderQueueListeners;
|
---|
| 404 |
|
---|
| 405 | typedef std::vector<ShadowListener*> ShadowListenerList;
|
---|
| 406 | ShadowListenerList mShadowListeners;
|
---|
| 407 | /// Internal method for firing the queue start event, returns true if queue is to be skipped
|
---|
| 408 | bool fireRenderQueueStarted(uint8 id, const String& invocation);
|
---|
| 409 | /// Internal method for firing the queue end event, returns true if queue is to be repeated
|
---|
| 410 | bool fireRenderQueueEnded(uint8 id, const String& invocation);
|
---|
| 411 |
|
---|
| 412 | /// Internal method for firing the texture shadows updated event
|
---|
| 413 | void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
|
---|
| 414 | /// Internal method for firing the pre caster texture shadows event
|
---|
| 415 | void fireShadowTexturesPreCaster(Light* light, Camera* camera);
|
---|
| 416 | /// Internal method for firing the pre receiver texture shadows event
|
---|
| 417 | void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
|
---|
| 418 | /** Internal method for setting the destination viewport for the next render. */
|
---|
| 419 | virtual void setViewport(Viewport *vp);
|
---|
| 420 |
|
---|
| 421 | /** Flag that indicates if all of the scene node's bounding boxes should be shown as a wireframe. */
|
---|
| 422 | bool mShowBoundingBoxes;
|
---|
| 423 |
|
---|
| 424 | /** Internal method for rendering all objects using the default queue sequence. */
|
---|
| 425 | virtual void renderVisibleObjectsDefaultSequence(void);
|
---|
| 426 | /** Internal method for rendering all objects using a custom queue sequence. */
|
---|
| 427 | virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
|
---|
| 428 | /** Internal method for preparing the render queue for use with each render. */
|
---|
| 429 | virtual void prepareRenderQueue(void);
|
---|
| 430 |
|
---|
| 431 |
|
---|
| 432 | /** Internal utility method for rendering a single object.
|
---|
| 433 | @remarks
|
---|
| 434 | Assumes that the pass has already been set up.
|
---|
| 435 | @param rend The renderable to issue to the pipeline
|
---|
| 436 | @param pass The pass which is being used
|
---|
| 437 | @param doLightIteration If true, this method will issue the renderable to
|
---|
| 438 | the pipeline possibly multiple times, if the pass indicates it should be
|
---|
| 439 | done once per light
|
---|
| 440 | @param manualLightList Only applicable if doLightIteration is false, this
|
---|
| 441 | method allows you to pass in a previously determined set of lights
|
---|
| 442 | which will be used for a single render of this object.
|
---|
| 443 | */
|
---|
| 444 | virtual void renderSingleObject(const Renderable* rend, const Pass* pass,
|
---|
| 445 | bool doLightIteration, const LightList* manualLightList = 0);
|
---|
| 446 |
|
---|
| 447 | /// Utility class for calculating automatic parameters for gpu programs
|
---|
| 448 | AutoParamDataSource mAutoParamDataSource;
|
---|
| 449 |
|
---|
| 450 | ShadowTechnique mShadowTechnique;
|
---|
| 451 | bool mDebugShadows;
|
---|
| 452 | ColourValue mShadowColour;
|
---|
| 453 | Pass* mShadowDebugPass;
|
---|
| 454 | Pass* mShadowStencilPass;
|
---|
| 455 | Pass* mShadowModulativePass;
|
---|
| 456 | bool mShadowMaterialInitDone;
|
---|
| 457 | LightList mLightsAffectingFrustum;
|
---|
| 458 | HardwareIndexBufferSharedPtr mShadowIndexBuffer;
|
---|
| 459 | size_t mShadowIndexBufferSize;
|
---|
| 460 | Rectangle2D* mFullScreenQuad;
|
---|
| 461 | Real mShadowDirLightExtrudeDist;
|
---|
| 462 | IlluminationRenderStage mIlluminationStage;
|
---|
| 463 | unsigned short mShadowTextureSize;
|
---|
| 464 | unsigned short mShadowTextureCount;
|
---|
| 465 | PixelFormat mShadowTextureFormat;
|
---|
| 466 | typedef std::vector<TexturePtr> ShadowTextureList;
|
---|
| 467 | ShadowTextureList mShadowTextures;
|
---|
| 468 | typedef std::vector<Camera*> ShadowTextureCameraList;
|
---|
| 469 | ShadowTextureCameraList mShadowTextureCameras;
|
---|
| 470 | Texture* mCurrentShadowTexture;
|
---|
| 471 | bool mShadowUseInfiniteFarPlane;
|
---|
| 472 |
|
---|
| 473 | /** Internal method for locating a list of lights which could be affecting the frustum.
|
---|
| 474 | @remarks
|
---|
| 475 | Custom scene managers are encouraged to override this method to make use of their
|
---|
| 476 | scene partitioning scheme to more efficiently locate lights, and to eliminate lights
|
---|
| 477 | which may be occluded by word geometry.
|
---|
| 478 | */
|
---|
| 479 | virtual void findLightsAffectingFrustum(const Camera* camera);
|
---|
| 480 | /// Internal method for setting up materials for shadows
|
---|
| 481 | virtual void initShadowVolumeMaterials(void);
|
---|
| 482 | /// Internal method for creating shadow textures (texture-based shadows)
|
---|
| 483 | virtual void createShadowTextures(unsigned short size, unsigned short count,
|
---|
| 484 | PixelFormat fmt);
|
---|
| 485 | /// Internal method for destroying shadow textures (texture-based shadows)
|
---|
| 486 | virtual void destroyShadowTextures(void);
|
---|
| 487 | /// Internal method for preparing shadow textures ready for use in a regular render
|
---|
| 488 | virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
|
---|
| 489 |
|
---|
| 490 | /** Internal method for rendering all the objects for a given light into the
|
---|
| 491 | stencil buffer.
|
---|
| 492 | @param light The light source
|
---|
| 493 | @param cam The camera being viewed from
|
---|
| 494 | */
|
---|
| 495 | virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam);
|
---|
| 496 | /** Internal utility method for setting stencil state for rendering shadow volumes.
|
---|
| 497 | @param secondpass Is this the second pass?
|
---|
| 498 | @param zfail Should we be using the zfail method?
|
---|
| 499 | @param twosided Should we use a 2-sided stencil?
|
---|
| 500 | */
|
---|
| 501 | virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
|
---|
| 502 | /** Render a set of shadow renderables. */
|
---|
| 503 | void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
|
---|
| 504 | Pass* pass, const LightList *manualLightList, unsigned long flags,
|
---|
| 505 | bool secondpass, bool zfail, bool twosided);
|
---|
| 506 | typedef std::vector<ShadowCaster*> ShadowCasterList;
|
---|
| 507 | ShadowCasterList mShadowCasterList;
|
---|
| 508 | SphereSceneQuery* mShadowCasterSphereQuery;
|
---|
| 509 | AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
|
---|
| 510 | Real mShadowFarDist;
|
---|
| 511 | Real mShadowFarDistSquared;
|
---|
| 512 | Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
|
---|
| 513 | Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
|
---|
| 514 | Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
|
---|
| 515 | bool mShadowTextureSelfShadow;
|
---|
| 516 | Pass* mShadowTextureCustomCasterPass;
|
---|
| 517 | Pass* mShadowTextureCustomReceiverPass;
|
---|
| 518 | String mShadowTextureCustomCasterVertexProgram;
|
---|
| 519 | String mShadowTextureCustomReceiverVertexProgram;
|
---|
| 520 | String mShadowTextureCustomReceiverFragmentProgram;
|
---|
| 521 | GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
|
---|
| 522 | GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
|
---|
| 523 | GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
|
---|
| 524 |
|
---|
| 525 | /// Visibility mask used to show / hide objects
|
---|
| 526 | uint32 mVisibilityMask;
|
---|
| 527 | bool mFindVisibleObjects;
|
---|
| 528 |
|
---|
| 529 | /// Suppress render state changes?
|
---|
| 530 | bool mSuppressRenderStateChanges;
|
---|
| 531 | /// Suppress shadows?
|
---|
| 532 | bool mSuppressShadows;
|
---|
| 533 |
|
---|
| 534 |
|
---|
| 535 | GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
|
---|
| 536 | GpuProgramParametersSharedPtr mFiniteExtrusionParams;
|
---|
| 537 |
|
---|
| 538 | /// Inner class to use as callback for shadow caster scene query
|
---|
| 539 | class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener
|
---|
| 540 | {
|
---|
| 541 | protected:
|
---|
| 542 | SceneManager* mSceneMgr;
|
---|
| 543 | ShadowCasterList* mCasterList;
|
---|
| 544 | bool mIsLightInFrustum;
|
---|
| 545 | const PlaneBoundedVolumeList* mLightClipVolumeList;
|
---|
| 546 | const Camera* mCamera;
|
---|
| 547 | const Light* mLight;
|
---|
| 548 | Real mFarDistSquared;
|
---|
| 549 | public:
|
---|
| 550 | ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
|
---|
| 551 | mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0),
|
---|
| 552 | mCamera(0) {}
|
---|
| 553 | // Prepare the listener for use with a set of parameters
|
---|
| 554 | void prepare(bool lightInFrustum,
|
---|
| 555 | const PlaneBoundedVolumeList* lightClipVolumes,
|
---|
| 556 | const Light* light, const Camera* cam, ShadowCasterList* casterList,
|
---|
| 557 | Real farDistSquared)
|
---|
| 558 | {
|
---|
| 559 | mCasterList = casterList;
|
---|
| 560 | mIsLightInFrustum = lightInFrustum;
|
---|
| 561 | mLightClipVolumeList = lightClipVolumes;
|
---|
| 562 | mCamera = cam;
|
---|
| 563 | mLight = light;
|
---|
| 564 | mFarDistSquared = farDistSquared;
|
---|
| 565 | }
|
---|
| 566 | bool queryResult(MovableObject* object);
|
---|
| 567 | bool queryResult(SceneQuery::WorldFragment* fragment);
|
---|
| 568 | };
|
---|
| 569 |
|
---|
| 570 | ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
|
---|
| 571 |
|
---|
| 572 | /** Internal method for locating a list of shadow casters which
|
---|
| 573 | could be affecting the frustum for a given light.
|
---|
| 574 | @remarks
|
---|
| 575 | Custom scene managers are encouraged to override this method to add optimisations,
|
---|
| 576 | and to add their own custom shadow casters (perhaps for world geometry)
|
---|
| 577 | */
|
---|
| 578 | virtual const ShadowCasterList& findShadowCastersForLight(const Light* light,
|
---|
| 579 | const Camera* camera);
|
---|
| 580 | /** Render a group in the ordinary way */
|
---|
| 581 | virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,
|
---|
| 582 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 583 | /** Render a group with the added complexity of additive stencil shadows. */
|
---|
| 584 | virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 585 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 586 | /** Render a group with the added complexity of modulative stencil shadows. */
|
---|
| 587 | virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 588 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 589 | /** Render a group rendering only shadow casters. */
|
---|
| 590 | virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 591 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 592 | /** Render a group rendering only shadow receivers. */
|
---|
| 593 | virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 594 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 595 | /** Render a group with the added complexity of modulative texture shadows. */
|
---|
| 596 | virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 597 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 598 |
|
---|
| 599 | /** Render a group with additive texture shadows. */
|
---|
| 600 | virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 601 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 602 | /** Render a set of objects, see renderSingleObject for param definitions */
|
---|
| 603 | virtual void renderObjects(const QueuedRenderableCollection& objs,
|
---|
| 604 | QueuedRenderableCollection::OrganisationMode om,
|
---|
| 605 | bool doLightIteration, const LightList* manualLightList = 0);
|
---|
| 606 | /** Render those objects in the transparent pass list which have shadow casting forced on
|
---|
| 607 | @remarks
|
---|
| 608 | This function is intended to be used to render the shadows of transparent objects which have
|
---|
| 609 | transparency_casts_shadows set to 'on' in their material
|
---|
| 610 | */
|
---|
| 611 | virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs,
|
---|
| 612 | QueuedRenderableCollection::OrganisationMode om,
|
---|
| 613 | bool doLightIteration, const LightList* manualLightList = 0);
|
---|
| 614 |
|
---|
| 615 | /** Update the state of the global render queue splitting based on a shadow
|
---|
| 616 | option change. */
|
---|
| 617 | virtual void updateRenderQueueSplitOptions(void);
|
---|
| 618 | /** Update the state of the render queue group splitting based on a shadow
|
---|
| 619 | option change. */
|
---|
| 620 | virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group,
|
---|
| 621 | bool suppressShadows, bool suppressRenderState);
|
---|
| 622 |
|
---|
| 623 | /** Inner helper class to implement the visitor pattern for rendering objects
|
---|
| 624 | in a queue.
|
---|
| 625 | */
|
---|
| 626 | class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
|
---|
| 627 | {
|
---|
| 628 | protected:
|
---|
| 629 | /// Pass that was actually used at the grouping level
|
---|
| 630 | const Pass* mUsedPass;
|
---|
| 631 | public:
|
---|
| 632 | SceneMgrQueuedRenderableVisitor()
|
---|
| 633 | :transparentShadowCastersMode(false) {}
|
---|
| 634 | ~SceneMgrQueuedRenderableVisitor() {}
|
---|
| 635 | void visit(const Renderable* r);
|
---|
| 636 | bool visit(const Pass* p);
|
---|
| 637 | void visit(const RenderablePass* rp);
|
---|
| 638 |
|
---|
| 639 | /// Target SM to send renderables to
|
---|
| 640 | SceneManager* targetSceneMgr;
|
---|
| 641 | /// Are we in transparent shadow caster mode?
|
---|
| 642 | bool transparentShadowCastersMode;
|
---|
| 643 | /// Automatic light handling?
|
---|
| 644 | bool autoLights;
|
---|
| 645 | /// Manual light list
|
---|
| 646 | const LightList* manualLightList;
|
---|
| 647 |
|
---|
| 648 | };
|
---|
| 649 | /// Allow visitor helper to access protected methods
|
---|
| 650 | friend class SceneMgrQueuedRenderableVisitor;
|
---|
| 651 | /// The active renderable visitor class - subclasses could override this
|
---|
| 652 | SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
|
---|
| 653 | /// Storage for default renderable visitor
|
---|
| 654 | SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
|
---|
| 655 |
|
---|
| 656 | public:
|
---|
| 657 | /** Constructor.
|
---|
| 658 | */
|
---|
| 659 | SceneManager(const String& instanceName);
|
---|
| 660 |
|
---|
| 661 | /** Default destructor.
|
---|
| 662 | */
|
---|
| 663 | virtual ~SceneManager();
|
---|
| 664 |
|
---|
| 665 | /** Return the instance name of this SceneManager. */
|
---|
| 666 | const String& getName(void) const { return mName; }
|
---|
| 667 |
|
---|
| 668 | /** Retrieve the type name of this scene manager.
|
---|
| 669 | @remarks
|
---|
| 670 | This method has to be implemented by subclasses. It should
|
---|
| 671 | return the type name of this SceneManager which agrees with
|
---|
| 672 | the type name of the SceneManagerFactory which created it.
|
---|
| 673 | */
|
---|
| 674 | virtual const String& getTypeName(void) const = 0;
|
---|
| 675 |
|
---|
| 676 | /** Creates a camera to be managed by this scene manager.
|
---|
| 677 | @remarks
|
---|
| 678 | This camera must be added to the scene at a later time using
|
---|
| 679 | the attachObject method of the SceneNode class.
|
---|
| 680 | @param
|
---|
| 681 | name Name to give the new camera.
|
---|
| 682 | */
|
---|
| 683 | virtual Camera* createCamera(const String& name);
|
---|
| 684 |
|
---|
| 685 | /** Retrieves a pointer to the named camera.
|
---|
| 686 | @note Throws an exception if the named instance does not exist
|
---|
| 687 | */
|
---|
| 688 | virtual Camera* getCamera(const String& name);
|
---|
| 689 |
|
---|
| 690 | /** Returns whether a camera with the given name exists.
|
---|
| 691 | */
|
---|
| 692 | virtual bool hasCamera(const String& name) const;
|
---|
| 693 |
|
---|
| 694 | /** Removes a camera from the scene.
|
---|
| 695 | @remarks
|
---|
| 696 | This method removes a previously added camera from the scene.
|
---|
| 697 | The camera is deleted so the caller must ensure no references
|
---|
| 698 | to it's previous instance (e.g. in a SceneNode) are used.
|
---|
| 699 | @param
|
---|
| 700 | cam Pointer to the camera to remove
|
---|
| 701 | */
|
---|
| 702 | virtual void destroyCamera(Camera *cam);
|
---|
| 703 |
|
---|
| 704 | /** Removes a camera from the scene.
|
---|
| 705 | @remarks
|
---|
| 706 | This method removes an camera from the scene based on the
|
---|
| 707 | camera's name rather than a pointer.
|
---|
| 708 | */
|
---|
| 709 | virtual void destroyCamera(const String& name);
|
---|
| 710 |
|
---|
| 711 | /** Removes (and destroys) all cameras from the scene.
|
---|
| 712 | @remarks
|
---|
| 713 | Some cameras are internal created to dealing with texture shadow,
|
---|
| 714 | their aren't supposed to destroy outside. So, while you are using
|
---|
| 715 | texture shadow, don't call this method, or you can set the shadow
|
---|
| 716 | technique other than texture-based, which will destroy all internal
|
---|
| 717 | created shadow cameras and textures.
|
---|
| 718 | */
|
---|
| 719 | virtual void destroyAllCameras(void);
|
---|
| 720 |
|
---|
| 721 | /** Creates a light for use in the scene.
|
---|
| 722 | @remarks
|
---|
| 723 | Lights can either be in a fixed position and independent of the
|
---|
| 724 | scene graph, or they can be attached to SceneNodes so they derive
|
---|
| 725 | their position from the parent node. Either way, they are created
|
---|
| 726 | using this method so that the SceneManager manages their
|
---|
| 727 | existence.
|
---|
| 728 | @param
|
---|
| 729 | name The name of the new light, to identify it later.
|
---|
| 730 | */
|
---|
| 731 | virtual Light* createLight(const String& name);
|
---|
| 732 |
|
---|
| 733 | /** Returns a pointer to the named Light which has previously been added to the scene.
|
---|
| 734 | @note Throws an exception if the named instance does not exist
|
---|
| 735 | */
|
---|
| 736 | virtual Light* getLight(const String& name);
|
---|
| 737 |
|
---|
| 738 | /** Returns whether a light with the given name exists.
|
---|
| 739 | */
|
---|
| 740 | virtual bool hasLight(const String& name) const;
|
---|
| 741 |
|
---|
| 742 | /** Removes the named light from the scene and destroys it.
|
---|
| 743 | @remarks
|
---|
| 744 | Any pointers held to this light after calling this method will be invalid.
|
---|
| 745 | */
|
---|
| 746 | virtual void destroyLight(const String& name);
|
---|
| 747 |
|
---|
| 748 | /** Removes the light from the scene and destroys it based on a pointer.
|
---|
| 749 | @remarks
|
---|
| 750 | Any pointers held to this light after calling this method will be invalid.
|
---|
| 751 | */
|
---|
| 752 | virtual void destroyLight(Light* light);
|
---|
| 753 | /** Removes and destroys all lights in the scene.
|
---|
| 754 | */
|
---|
| 755 | virtual void destroyAllLights(void);
|
---|
| 756 |
|
---|
| 757 | /** Populate a light list with an ordered set of the lights which are closest
|
---|
| 758 | to the position specified.
|
---|
| 759 | @remarks
|
---|
| 760 | Note that since directional lights have no position, they are always considered
|
---|
| 761 | closer than any point lights and as such will always take precedence.
|
---|
| 762 | @par
|
---|
| 763 | Subclasses of the default SceneManager may wish to take into account other issues
|
---|
| 764 | such as possible visibility of the light if that information is included in their
|
---|
| 765 | data structures. This basic scenemanager simply orders by distance, eliminating
|
---|
| 766 | those lights which are out of range.
|
---|
| 767 | @par
|
---|
| 768 | The number of items in the list max exceed the maximum number of lights supported
|
---|
| 769 | by the renderer, but the extraneous ones will never be used. In fact the limit will
|
---|
| 770 | be imposed by Pass::getMaxSimultaneousLights.
|
---|
| 771 | @param position The position at which to evaluate the list of lights
|
---|
| 772 | @param radius The bounding radius to test
|
---|
| 773 | @param destList List to be populated with ordered set of lights; will be cleared by
|
---|
| 774 | this method before population.
|
---|
| 775 | */
|
---|
| 776 | virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
|
---|
| 777 |
|
---|
| 778 |
|
---|
| 779 | /** Creates an instance of a SceneNode.
|
---|
| 780 | @remarks
|
---|
| 781 | Note that this does not add the SceneNode to the scene hierarchy.
|
---|
| 782 | This method is for convenience, since it allows an instance to
|
---|
| 783 | be created for which the SceneManager is responsible for
|
---|
| 784 | allocating and releasing memory, which is convenient in complex
|
---|
| 785 | scenes.
|
---|
| 786 | @par
|
---|
| 787 | To include the returned SceneNode in the scene, use the addChild
|
---|
| 788 | method of the SceneNode which is to be it's parent.
|
---|
| 789 | @par
|
---|
| 790 | Note that this method takes no parameters, and the node created is unnamed (it is
|
---|
| 791 | actually given a generated name, which you can retrieve if you want).
|
---|
| 792 | If you wish to create a node with a specific name, call the alternative method
|
---|
| 793 | which takes a name parameter.
|
---|
| 794 | */
|
---|
| 795 | virtual SceneNode* createSceneNode(void);
|
---|
| 796 |
|
---|
| 797 | /** Creates an instance of a SceneNode with a given name.
|
---|
| 798 | @remarks
|
---|
| 799 | Note that this does not add the SceneNode to the scene hierarchy.
|
---|
| 800 | This method is for convenience, since it allows an instance to
|
---|
| 801 | be created for which the SceneManager is responsible for
|
---|
| 802 | allocating and releasing memory, which is convenient in complex
|
---|
| 803 | scenes.
|
---|
| 804 | @par
|
---|
| 805 | To include the returned SceneNode in the scene, use the addChild
|
---|
| 806 | method of the SceneNode which is to be it's parent.
|
---|
| 807 | @par
|
---|
| 808 | Note that this method takes a name parameter, which makes the node easier to
|
---|
| 809 | retrieve directly again later.
|
---|
| 810 | */
|
---|
| 811 | virtual SceneNode* createSceneNode(const String& name);
|
---|
| 812 |
|
---|
| 813 | /** Destroys a SceneNode with a given name.
|
---|
| 814 | @remarks
|
---|
| 815 | This allows you to physically delete an individual SceneNode if you want to.
|
---|
| 816 | Note that this is not normally recommended, it's better to allow SceneManager
|
---|
| 817 | to delete the nodes when the scene is cleared.
|
---|
| 818 | */
|
---|
| 819 | virtual void destroySceneNode(const String& name);
|
---|
| 820 |
|
---|
| 821 | /** Gets the SceneNode at the root of the scene hierarchy.
|
---|
| 822 | @remarks
|
---|
| 823 | The entire scene is held as a hierarchy of nodes, which
|
---|
| 824 | allows things like relative transforms, general changes in
|
---|
| 825 | rendering state etc (See the SceneNode class for more info).
|
---|
| 826 | In this basic SceneManager class, the application using
|
---|
| 827 | Ogre is free to structure this hierarchy however it likes,
|
---|
| 828 | since it has no real significance apart from making transforms
|
---|
| 829 | relative to each node (more specialised subclasses will
|
---|
| 830 | provide utility methods for building specific node structures
|
---|
| 831 | e.g. loading a BSP tree).
|
---|
| 832 | @par
|
---|
| 833 | However, in all cases there is only ever one root node of
|
---|
| 834 | the hierarchy, and this method returns a pointer to it.
|
---|
| 835 | */
|
---|
| 836 | virtual SceneNode* getRootSceneNode(void) const;
|
---|
| 837 |
|
---|
| 838 | /** Retrieves a named SceneNode from the scene graph.
|
---|
| 839 | @remarks
|
---|
| 840 | If you chose to name a SceneNode as you created it, or if you
|
---|
| 841 | happened to make a note of the generated name, you can look it
|
---|
| 842 | up wherever it is in the scene graph using this method.
|
---|
| 843 | @note Throws an exception if the named instance does not exist
|
---|
| 844 | */
|
---|
| 845 | virtual SceneNode* getSceneNode(const String& name) const;
|
---|
| 846 |
|
---|
| 847 | /** Returns whether a scene node with the given name exists.
|
---|
| 848 | */
|
---|
| 849 | virtual bool hasSceneNode(const String& name) const;
|
---|
| 850 |
|
---|
| 851 |
|
---|
| 852 | /** Create an Entity (instance of a discrete mesh).
|
---|
| 853 | @param
|
---|
| 854 | entityName The name to be given to the entity (must be unique).
|
---|
| 855 | @param
|
---|
| 856 | meshName The name of the Mesh it is to be based on (e.g. 'knot.oof'). The
|
---|
| 857 | mesh will be loaded if it is not already.
|
---|
| 858 | */
|
---|
| 859 | virtual Entity* createEntity(const String& entityName, const String& meshName);
|
---|
| 860 |
|
---|
| 861 | /** Prefab shapes available without loading a model.
|
---|
| 862 | @note
|
---|
| 863 | Minimal implementation at present.
|
---|
| 864 | @todo
|
---|
| 865 | Add more prefabs (teapots, teapots!!!)
|
---|
| 866 | */
|
---|
| 867 | enum PrefabType {
|
---|
| 868 | PT_PLANE
|
---|
| 869 | };
|
---|
| 870 |
|
---|
| 871 | /** Create an Entity (instance of a discrete mesh) from a range of prefab shapes.
|
---|
| 872 | @param
|
---|
| 873 | entityName The name to be given to the entity (must be unique).
|
---|
| 874 | @param
|
---|
| 875 | ptype The prefab type.
|
---|
| 876 | */
|
---|
| 877 | virtual Entity* createEntity(const String& entityName, PrefabType ptype);
|
---|
| 878 | /** Retrieves a pointer to the named Entity.
|
---|
| 879 | @note Throws an exception if the named instance does not exist
|
---|
| 880 | */
|
---|
| 881 | virtual Entity* getEntity(const String& name);
|
---|
| 882 | /** Returns whether an entity with the given name exists.
|
---|
| 883 | */
|
---|
| 884 | virtual bool hasEntity(const String& name) const;
|
---|
| 885 |
|
---|
| 886 | /** Removes & destroys an Entity from the SceneManager.
|
---|
| 887 | @warning
|
---|
| 888 | Must only be done if the Entity is not attached
|
---|
| 889 | to a SceneNode. It may be safer to wait to clear the whole
|
---|
| 890 | scene if you are unsure use clearScene.
|
---|
| 891 | @see
|
---|
| 892 | SceneManager::clearScene
|
---|
| 893 | */
|
---|
| 894 | virtual void destroyEntity(Entity* ent);
|
---|
| 895 |
|
---|
| 896 | /** Removes & destroys an Entity from the SceneManager by name.
|
---|
| 897 | @warning
|
---|
| 898 | Must only be done if the Entity is not attached
|
---|
| 899 | to a SceneNode. It may be safer to wait to clear the whole
|
---|
| 900 | scene if you are unsure use clearScene.
|
---|
| 901 | @see
|
---|
| 902 | SceneManager::clearScene
|
---|
| 903 | */
|
---|
| 904 | virtual void destroyEntity(const String& name);
|
---|
| 905 |
|
---|
| 906 | /** Removes & destroys all Entities.
|
---|
| 907 | @warning
|
---|
| 908 | Again, use caution since no Entity must be referred to
|
---|
| 909 | elsewhere e.g. attached to a SceneNode otherwise a crash
|
---|
| 910 | is likely. Use clearScene if you are unsure (it clears SceneNode
|
---|
| 911 | entries too.)
|
---|
| 912 | @see
|
---|
| 913 | SceneManager::clearScene
|
---|
| 914 | */
|
---|
| 915 | virtual void destroyAllEntities(void);
|
---|
| 916 |
|
---|
| 917 | /** Create a ManualObject, an object which you populate with geometry
|
---|
| 918 | manually through a GL immediate-mode style interface.
|
---|
| 919 | @param
|
---|
| 920 | name The name to be given to the object (must be unique).
|
---|
| 921 | */
|
---|
| 922 | virtual ManualObject* createManualObject(const String& name);
|
---|
| 923 | /** Retrieves a pointer to the named ManualObject.
|
---|
| 924 | @note Throws an exception if the named instance does not exist
|
---|
| 925 | */
|
---|
| 926 | virtual ManualObject* getManualObject(const String& name);
|
---|
| 927 | /** Returns whether a manual object with the given name exists.
|
---|
| 928 | */
|
---|
| 929 | virtual bool hasManualObject(const String& name) const;
|
---|
| 930 |
|
---|
| 931 | /** Removes & destroys a ManualObject from the SceneManager.
|
---|
| 932 | */
|
---|
| 933 | virtual void destroyManualObject(ManualObject* obj);
|
---|
| 934 | /** Removes & destroys a ManualObject from the SceneManager.
|
---|
| 935 | */
|
---|
| 936 | virtual void destroyManualObject(const String& name);
|
---|
| 937 | /** Removes & destroys all ManualObjects from the SceneManager.
|
---|
| 938 | */
|
---|
| 939 | virtual void destroyAllManualObjects(void);
|
---|
| 940 | /** Create a BillboardChain, an object which you can use to render
|
---|
| 941 | a linked chain of billboards.
|
---|
| 942 | @param
|
---|
| 943 | name The name to be given to the object (must be unique).
|
---|
| 944 | */
|
---|
| 945 | virtual BillboardChain* createBillboardChain(const String& name);
|
---|
| 946 | /** Retrieves a pointer to the named BillboardChain.
|
---|
| 947 | @note Throws an exception if the named instance does not exist
|
---|
| 948 | */
|
---|
| 949 | virtual BillboardChain* getBillboardChain(const String& name);
|
---|
| 950 | /** Returns whether a billboard chain with the given name exists.
|
---|
| 951 | */
|
---|
| 952 | virtual bool hasBillboardChain(const String& name) const;
|
---|
| 953 |
|
---|
| 954 | /** Removes & destroys a BillboardChain from the SceneManager.
|
---|
| 955 | */
|
---|
| 956 | virtual void destroyBillboardChain(BillboardChain* obj);
|
---|
| 957 | /** Removes & destroys a BillboardChain from the SceneManager.
|
---|
| 958 | */
|
---|
| 959 | virtual void destroyBillboardChain(const String& name);
|
---|
| 960 | /** Removes & destroys all BillboardChains from the SceneManager.
|
---|
| 961 | */
|
---|
| 962 | virtual void destroyAllBillboardChains(void);
|
---|
| 963 | /** Create a RibbonTrail, an object which you can use to render
|
---|
| 964 | a linked chain of billboards which follows one or more nodes.
|
---|
| 965 | @param
|
---|
| 966 | name The name to be given to the object (must be unique).
|
---|
| 967 | */
|
---|
| 968 | virtual RibbonTrail* createRibbonTrail(const String& name);
|
---|
| 969 | /** Retrieves a pointer to the named RibbonTrail.
|
---|
| 970 | @note Throws an exception if the named instance does not exist
|
---|
| 971 | */
|
---|
| 972 | virtual RibbonTrail* getRibbonTrail(const String& name);
|
---|
| 973 | /** Returns whether a ribbon trail with the given name exists.
|
---|
| 974 | */
|
---|
| 975 | virtual bool hasRibbonTrail(const String& name) const;
|
---|
| 976 |
|
---|
| 977 | /** Removes & destroys a RibbonTrail from the SceneManager.
|
---|
| 978 | */
|
---|
| 979 | virtual void destroyRibbonTrail(RibbonTrail* obj);
|
---|
| 980 | /** Removes & destroys a RibbonTrail from the SceneManager.
|
---|
| 981 | */
|
---|
| 982 | virtual void destroyRibbonTrail(const String& name);
|
---|
| 983 | /** Removes & destroys all RibbonTrails from the SceneManager.
|
---|
| 984 | */
|
---|
| 985 | virtual void destroyAllRibbonTrails(void);
|
---|
| 986 |
|
---|
| 987 | /** Creates a particle system based on a template.
|
---|
| 988 | @remarks
|
---|
| 989 | This method creates a new ParticleSystem instance based on the named template
|
---|
| 990 | (defined through ParticleSystemManager::createTemplate) and returns a
|
---|
| 991 | pointer to the caller. The caller should not delete this object, it will be freed at system shutdown,
|
---|
| 992 | or can be released earlier using the destroyParticleSystem method.
|
---|
| 993 | @par
|
---|
| 994 | Each system created from a template takes the template's settings at the time of creation,
|
---|
| 995 | but is completely separate from the template from there on.
|
---|
| 996 | @par
|
---|
| 997 | Creating a particle system does not make it a part of the scene. As with other MovableObject
|
---|
| 998 | subclasses, a ParticleSystem is not rendered until it is attached to a SceneNode.
|
---|
| 999 | @par
|
---|
| 1000 | This is probably the more useful particle system creation method since it does not require manual
|
---|
| 1001 | setup of the system. Note that the initial quota is based on the template but may be changed later.
|
---|
| 1002 | @param
|
---|
| 1003 | name The name to give the new particle system instance.
|
---|
| 1004 | @param
|
---|
| 1005 | templateName The name of the template to base the new instance on.
|
---|
| 1006 | */
|
---|
| 1007 | virtual ParticleSystem* createParticleSystem(const String& name,
|
---|
| 1008 | const String& templateName);
|
---|
| 1009 | /** Create a blank particle system.
|
---|
| 1010 | @remarks
|
---|
| 1011 | This method creates a new, blank ParticleSystem instance and returns a pointer to it.
|
---|
| 1012 | The caller should not delete this object, it will be freed at system shutdown, or can
|
---|
| 1013 | be released earlier using the destroyParticleSystem method.
|
---|
| 1014 | @par
|
---|
| 1015 | The instance returned from this method won't actually do anything because on creation a
|
---|
| 1016 | particle system has no emitters. The caller should manipulate the instance through it's
|
---|
| 1017 | ParticleSystem methods to actually create a real particle effect.
|
---|
| 1018 | @par
|
---|
| 1019 | Creating a particle system does not make it a part of the scene. As with other MovableObject
|
---|
| 1020 | subclasses, a ParticleSystem is not rendered until it is attached to a SceneNode.
|
---|
| 1021 | @param
|
---|
| 1022 | name The name to give the ParticleSystem.
|
---|
| 1023 | @param
|
---|
| 1024 | quota The maximum number of particles to allow in this system.
|
---|
| 1025 | @param
|
---|
| 1026 | resourceGroup The resource group which will be used to load dependent resources
|
---|
| 1027 | */
|
---|
| 1028 | virtual ParticleSystem* createParticleSystem(const String& name,
|
---|
| 1029 | size_t quota = 500,
|
---|
| 1030 | const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
|
---|
| 1031 | /** Retrieves a pointer to the named ParticleSystem.
|
---|
| 1032 | @note Throws an exception if the named instance does not exist
|
---|
| 1033 | */
|
---|
| 1034 | virtual ParticleSystem* getParticleSystem(const String& name);
|
---|
| 1035 | /** Returns whether a particle system with the given name exists.
|
---|
| 1036 | */
|
---|
| 1037 | virtual bool hasParticleSystem(const String& name) const;
|
---|
| 1038 |
|
---|
| 1039 | /** Removes & destroys a ParticleSystem from the SceneManager.
|
---|
| 1040 | */
|
---|
| 1041 | virtual void destroyParticleSystem(ParticleSystem* obj);
|
---|
| 1042 | /** Removes & destroys a ParticleSystem from the SceneManager.
|
---|
| 1043 | */
|
---|
| 1044 | virtual void destroyParticleSystem(const String& name);
|
---|
| 1045 | /** Removes & destroys all ParticleSystems from the SceneManager.
|
---|
| 1046 | */
|
---|
| 1047 | virtual void destroyAllParticleSystems(void);
|
---|
| 1048 |
|
---|
| 1049 | /** Empties the entire scene, inluding all SceneNodes, Entities, Lights,
|
---|
| 1050 | BillboardSets etc. Cameras are not deleted at this stage since
|
---|
| 1051 | they are still referenced by viewports, which are not destroyed during
|
---|
| 1052 | this process.
|
---|
| 1053 | */
|
---|
| 1054 | virtual void clearScene(void);
|
---|
| 1055 |
|
---|
| 1056 | /** Sets the ambient light level to be used for the scene.
|
---|
| 1057 | @remarks
|
---|
| 1058 | This sets the colour and intensity of the ambient light in the scene, i.e. the
|
---|
| 1059 | light which is 'sourceless' and illuminates all objects equally.
|
---|
| 1060 | The colour of an object is affected by a combination of the light in the scene,
|
---|
| 1061 | and the amount of light that object reflects (in this case based on the Material::ambient
|
---|
| 1062 | property).
|
---|
| 1063 | @remarks
|
---|
| 1064 | By default the ambient light in the scene is ColourValue::Black, i.e. no ambient light. This
|
---|
| 1065 | means that any objects rendered with a Material which has lighting enabled (see Material::setLightingEnabled)
|
---|
| 1066 | will not be visible unless you have some dynamic lights in your scene.
|
---|
| 1067 | */
|
---|
| 1068 | void setAmbientLight(const ColourValue& colour);
|
---|
| 1069 |
|
---|
| 1070 | /** Returns the ambient light level to be used for the scene.
|
---|
| 1071 | */
|
---|
| 1072 | const ColourValue& getAmbientLight(void) const;
|
---|
| 1073 |
|
---|
| 1074 | /** Sets the source of the 'world' geometry, i.e. the large, mainly static geometry
|
---|
| 1075 | making up the world e.g. rooms, landscape etc.
|
---|
| 1076 | @remarks
|
---|
| 1077 | Depending on the type of SceneManager (subclasses will be specialised
|
---|
| 1078 | for particular world geometry types) you have requested via the Root or
|
---|
| 1079 | SceneManagerEnumerator classes, you can pass a filename to this method and it
|
---|
| 1080 | will attempt to load the world-level geometry for use. If you try to load
|
---|
| 1081 | an inappropriate type of world data an exception will be thrown. The default
|
---|
| 1082 | SceneManager cannot handle any sort of world geometry and so will always
|
---|
| 1083 | throw an exception. However subclasses like BspSceneManager can load
|
---|
| 1084 | particular types of world geometry e.g. "q3dm1.bsp".
|
---|
| 1085 | */
|
---|
| 1086 | virtual void setWorldGeometry(const String& filename);
|
---|
| 1087 |
|
---|
| 1088 | /** Sets the source of the 'world' geometry, i.e. the large, mainly
|
---|
| 1089 | static geometry making up the world e.g. rooms, landscape etc.
|
---|
| 1090 | @remarks
|
---|
| 1091 | Depending on the type of SceneManager (subclasses will be
|
---|
| 1092 | specialised for particular world geometry types) you have
|
---|
| 1093 | requested via the Root or SceneManagerEnumerator classes, you
|
---|
| 1094 | can pass a stream to this method and it will attempt to load
|
---|
| 1095 | the world-level geometry for use. If the manager can only
|
---|
| 1096 | handle one input format the typeName parameter is not required.
|
---|
| 1097 | The stream passed will be read (and it's state updated).
|
---|
| 1098 | @param stream Data stream containing data to load
|
---|
| 1099 | @param typeName String identifying the type of world geometry
|
---|
| 1100 | contained in the stream - not required if this manager only
|
---|
| 1101 | supports one type of world geometry.
|
---|
| 1102 | */
|
---|
| 1103 | virtual void setWorldGeometry(DataStreamPtr& stream,
|
---|
| 1104 | const String& typeName = StringUtil::BLANK);
|
---|
| 1105 |
|
---|
| 1106 | /** Estimate the number of loading stages required to load the named
|
---|
| 1107 | world geometry.
|
---|
| 1108 | @remarks
|
---|
| 1109 | This method should be overridden by SceneManagers that provide
|
---|
| 1110 | custom world geometry that can take some time to load. They should
|
---|
| 1111 | return from this method a count of the number of stages of progress
|
---|
| 1112 | they can report on whilst loading. During real loading (setWorldGeomtry),
|
---|
| 1113 | they should call ResourceGroupManager::_notifyWorldGeometryProgress exactly
|
---|
| 1114 | that number of times when loading the geometry for real.
|
---|
| 1115 | @note
|
---|
| 1116 | The default is to return 0, ie to not report progress.
|
---|
| 1117 | */
|
---|
| 1118 | virtual size_t estimateWorldGeometry(const String& filename) { return 0; }
|
---|
| 1119 |
|
---|
| 1120 | /** Estimate the number of loading stages required to load the named
|
---|
| 1121 | world geometry.
|
---|
| 1122 | @remarks
|
---|
| 1123 | Operates just like the version of this method which takes a
|
---|
| 1124 | filename, but operates on a stream instead. Note that since the
|
---|
| 1125 | stream is updated, you'll need to reset the stream or reopen it
|
---|
| 1126 | when it comes to loading it for real.
|
---|
| 1127 | @param stream Data stream containing data to load
|
---|
| 1128 | @param typeName String identifying the type of world geometry
|
---|
| 1129 | contained in the stream - not required if this manager only
|
---|
| 1130 | supports one type of world geometry.
|
---|
| 1131 | */
|
---|
| 1132 | virtual size_t estimateWorldGeometry(DataStreamPtr& stream,
|
---|
| 1133 | const String& typeName = StringUtil::BLANK) { return 0; }
|
---|
| 1134 | /** Asks the SceneManager to provide a suggested viewpoint from which the scene should be viewed.
|
---|
| 1135 | @remarks
|
---|
| 1136 | Typically this method returns the origin unless a) world geometry has been loaded using
|
---|
| 1137 | SceneManager::setWorldGeometry and b) that world geometry has suggested 'start' points.
|
---|
| 1138 | If there is more than one viewpoint which the scene manager can suggest, it will always suggest
|
---|
| 1139 | the first one unless the random parameter is true.
|
---|
| 1140 | @param
|
---|
| 1141 | random If true, and there is more than one possible suggestion, a random one will be used. If false
|
---|
| 1142 | the same one will always be suggested.
|
---|
| 1143 | @return
|
---|
| 1144 | On success, true is returned.
|
---|
| 1145 | @par
|
---|
| 1146 | On failiure, false is returned.
|
---|
| 1147 | */
|
---|
| 1148 | virtual ViewPoint getSuggestedViewpoint(bool random = false);
|
---|
| 1149 |
|
---|
| 1150 | /** Method for setting a specific option of the Scene Manager. These options are usually
|
---|
| 1151 | specific for a certain implemntation of the Scene Manager class, and may (and probably
|
---|
| 1152 | will) not exist across different implementations.
|
---|
| 1153 | @param
|
---|
| 1154 | strKey The name of the option to set
|
---|
| 1155 | @param
|
---|
| 1156 | pValue A pointer to the value - the size should be calculated by the scene manager
|
---|
| 1157 | based on the key
|
---|
| 1158 | @return
|
---|
| 1159 | On success, true is returned.
|
---|
| 1160 | @par
|
---|
| 1161 | On failiure, false is returned.
|
---|
| 1162 | */
|
---|
| 1163 | virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
|
---|
| 1164 |
|
---|
| 1165 | /** Method for getting the value of an implementation-specific Scene Manager option.
|
---|
| 1166 | @param
|
---|
| 1167 | strKey The name of the option
|
---|
| 1168 | @param
|
---|
| 1169 | pDestValue A pointer to a memory location where the value will
|
---|
| 1170 | be copied. Currently, the memory will be allocated by the
|
---|
| 1171 | scene manager, but this may change
|
---|
| 1172 | @return
|
---|
| 1173 | On success, true is returned and pDestValue points to the value of the given
|
---|
| 1174 | option.
|
---|
| 1175 | @par
|
---|
| 1176 | On failiure, false is returned and pDestValue is set to NULL.
|
---|
| 1177 | */
|
---|
| 1178 | virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
|
---|
| 1179 |
|
---|
| 1180 | /** Method for verifying wether the scene manager has an implementation-specific
|
---|
| 1181 | option.
|
---|
| 1182 | @param
|
---|
| 1183 | strKey The name of the option to check for.
|
---|
| 1184 | @return
|
---|
| 1185 | If the scene manager contains the given option, true is returned.
|
---|
| 1186 | @remarks
|
---|
| 1187 | If it does not, false is returned.
|
---|
| 1188 | */
|
---|
| 1189 | virtual bool hasOption( const String& strKey ) const { return false; }
|
---|
| 1190 | /** Method for getting all possible values for a specific option. When this list is too large
|
---|
| 1191 | (i.e. the option expects, for example, a float), the return value will be true, but the
|
---|
| 1192 | list will contain just one element whose size will be set to 0.
|
---|
| 1193 | Otherwise, the list will be filled with all the possible values the option can
|
---|
| 1194 | accept.
|
---|
| 1195 | @param
|
---|
| 1196 | strKey The name of the option to get the values for.
|
---|
| 1197 | @param
|
---|
| 1198 | refValueList A reference to a list that will be filled with the available values.
|
---|
| 1199 | @return
|
---|
| 1200 | On success (the option exists), true is returned.
|
---|
| 1201 | @par
|
---|
| 1202 | On failure, false is returned.
|
---|
| 1203 | */
|
---|
| 1204 | virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; }
|
---|
| 1205 |
|
---|
| 1206 | /** Method for getting all the implementation-specific options of the scene manager.
|
---|
| 1207 | @param
|
---|
| 1208 | refKeys A reference to a list that will be filled with all the available options.
|
---|
| 1209 | @return
|
---|
| 1210 | On success, true is returned. On failiure, false is returned.
|
---|
| 1211 | */
|
---|
| 1212 | virtual bool getOptionKeys( StringVector& refKeys ) { return false; }
|
---|
| 1213 |
|
---|
| 1214 | /** Internal method for updating the scene graph ie the tree of SceneNode instances managed by this class.
|
---|
| 1215 | @remarks
|
---|
| 1216 | This must be done before issuing objects to the rendering pipeline, since derived transformations from
|
---|
| 1217 | parent nodes are not updated until required. This SceneManager is a basic implementation which simply
|
---|
| 1218 | updates all nodes from the root. This ensures the scene is up to date but requires all the nodes
|
---|
| 1219 | to be updated even if they are not visible. Subclasses could trim this such that only potentially visible
|
---|
| 1220 | nodes are updated.
|
---|
| 1221 | */
|
---|
| 1222 | virtual void _updateSceneGraph(Camera* cam);
|
---|
| 1223 |
|
---|
| 1224 | /** Internal method which parses the scene to find visible objects to render.
|
---|
| 1225 | @remarks
|
---|
| 1226 | If you're implementing a custom scene manager, this is the most important method to
|
---|
| 1227 | override since it's here you can apply your custom world partitioning scheme. Once you
|
---|
| 1228 | have added the appropriate objects to the render queue, you can let the default
|
---|
| 1229 | SceneManager objects _renderVisibleObjects handle the actual rendering of the objects
|
---|
| 1230 | you pick.
|
---|
| 1231 | @par
|
---|
| 1232 | Any visible objects will be added to a rendering queue, which is indexed by material in order
|
---|
| 1233 | to ensure objects with the same material are rendered together to minimise render state changes.
|
---|
| 1234 | */
|
---|
| 1235 | virtual void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
|
---|
| 1236 |
|
---|
| 1237 | /** Internal method for applying animations to scene nodes.
|
---|
| 1238 | @remarks
|
---|
| 1239 | Uses the internally stored AnimationState objects to apply animation to SceneNodes.
|
---|
| 1240 | */
|
---|
| 1241 | virtual void _applySceneAnimations(void);
|
---|
| 1242 |
|
---|
| 1243 | /** Sends visible objects found in _findVisibleObjects to the rendering engine.
|
---|
| 1244 | */
|
---|
| 1245 | virtual void _renderVisibleObjects(void);
|
---|
| 1246 |
|
---|
| 1247 | /** Prompts the class to send its contents to the renderer.
|
---|
| 1248 | @remarks
|
---|
| 1249 | This method prompts the scene manager to send the
|
---|
| 1250 | contents of the scene it manages to the rendering
|
---|
| 1251 | pipeline, possibly preceded by some sorting, culling
|
---|
| 1252 | or other scene management tasks. Note that this method is not normally called
|
---|
| 1253 | directly by the user application; it is called automatically
|
---|
| 1254 | by the Ogre rendering loop.
|
---|
| 1255 | @param camera Pointer to a camera from whose viewpoint the scene is to
|
---|
| 1256 | be rendered.
|
---|
| 1257 | @param vp The target viewport
|
---|
| 1258 | @param includeOverlays Whether or not overlay objects should be rendered
|
---|
| 1259 | */
|
---|
| 1260 | virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
|
---|
| 1261 |
|
---|
| 1262 | /** Internal method for queueing the sky objects with the params as
|
---|
| 1263 | previously set through setSkyBox, setSkyPlane and setSkyDome.
|
---|
| 1264 | */
|
---|
| 1265 | virtual void _queueSkiesForRendering(Camera* cam);
|
---|
| 1266 |
|
---|
| 1267 |
|
---|
| 1268 |
|
---|
| 1269 | /** Notifies the scene manager of its destination render system
|
---|
| 1270 | @remarks
|
---|
| 1271 | Called automatically by RenderSystem::addSceneManager
|
---|
| 1272 | this method simply notifies the manager of the render
|
---|
| 1273 | system to which its output must be directed.
|
---|
| 1274 | @param
|
---|
| 1275 | sys Pointer to the RenderSystem subclass to be used as a render target.
|
---|
| 1276 | */
|
---|
| 1277 | virtual void _setDestinationRenderSystem(RenderSystem* sys);
|
---|
| 1278 |
|
---|
| 1279 | /** Enables / disables a 'sky plane' i.e. a plane at constant
|
---|
| 1280 | distance from the camera representing the sky.
|
---|
| 1281 | @remarks
|
---|
| 1282 | You can create sky planes yourself using the standard mesh and
|
---|
| 1283 | entity methods, but this creates a plane which the camera can
|
---|
| 1284 | never get closer or further away from - it moves with the camera.
|
---|
| 1285 | (NB you could create this effect by creating a world plane which
|
---|
| 1286 | was attached to the same SceneNode as the Camera too, but this
|
---|
| 1287 | would only apply to a single camera whereas this plane applies to
|
---|
| 1288 | any camera using this scene manager).
|
---|
| 1289 | @note
|
---|
| 1290 | To apply scaling, scrolls etc to the sky texture(s) you
|
---|
| 1291 | should use the TextureUnitState class methods.
|
---|
| 1292 | @param
|
---|
| 1293 | enable True to enable the plane, false to disable it
|
---|
| 1294 | @param
|
---|
| 1295 | plane Details of the plane, i.e. it's normal and it's
|
---|
| 1296 | distance from the camera.
|
---|
| 1297 | @param
|
---|
| 1298 | materialName The name of the material the plane will use
|
---|
| 1299 | @param
|
---|
| 1300 | scale The scaling applied to the sky plane - higher values
|
---|
| 1301 | mean a bigger sky plane - you may want to tweak this
|
---|
| 1302 | depending on the size of plane.d and the other
|
---|
| 1303 | characteristics of your scene
|
---|
| 1304 | @param
|
---|
| 1305 | tiling How many times to tile the texture across the sky.
|
---|
| 1306 | Applies to all texture layers. If you need finer control use
|
---|
| 1307 | the TextureUnitState texture coordinate transformation methods.
|
---|
| 1308 | @param
|
---|
| 1309 | drawFirst If true, the plane is drawn before all other
|
---|
| 1310 | geometry in the scene, without updating the depth buffer.
|
---|
| 1311 | This is the safest rendering method since all other objects
|
---|
| 1312 | will always appear in front of the sky. However this is not
|
---|
| 1313 | the most efficient way if most of the sky is often occluded
|
---|
| 1314 | by other objects. If this is the case, you can set this
|
---|
| 1315 | parameter to false meaning it draws <em>after</em> all other
|
---|
| 1316 | geometry which can be an optimisation - however you must
|
---|
| 1317 | ensure that the plane.d value is large enough that no objects
|
---|
| 1318 | will 'poke through' the sky plane when it is rendered.
|
---|
| 1319 | @param
|
---|
| 1320 | bow If zero, the plane will be completely flat (like previous
|
---|
| 1321 | versions. If above zero, the plane will be curved, allowing
|
---|
| 1322 | the sky to appear below camera level. Curved sky planes are
|
---|
| 1323 | simular to skydomes, but are more compatable with fog.
|
---|
| 1324 | @param xsegments, ysegments
|
---|
| 1325 | Determines the number of segments the plane will have to it. This
|
---|
| 1326 | is most important when you are bowing the plane, but may also be useful
|
---|
| 1327 | if you need tesselation on the plane to perform per-vertex effects.
|
---|
| 1328 | @param groupName
|
---|
| 1329 | The name of the resource group to which to assign the plane mesh.
|
---|
| 1330 | */
|
---|
| 1331 | virtual void setSkyPlane(
|
---|
| 1332 | bool enable,
|
---|
| 1333 | const Plane& plane, const String& materialName, Real scale = 1000,
|
---|
| 1334 | Real tiling = 10, bool drawFirst = true, Real bow = 0,
|
---|
| 1335 | int xsegments = 1, int ysegments = 1,
|
---|
| 1336 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
|
---|
| 1337 |
|
---|
| 1338 | /** Return whether a key plane is enabled */
|
---|
| 1339 | virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
|
---|
| 1340 |
|
---|
| 1341 | /** Get the sky plane node, if enabled. */
|
---|
| 1342 | virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
|
---|
| 1343 |
|
---|
| 1344 | /** Get the parameters used to construct the SkyPlane, if any **/
|
---|
| 1345 | virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
|
---|
| 1346 |
|
---|
| 1347 | /** Enables / disables a 'sky box' i.e. a 6-sided box at constant
|
---|
| 1348 | distance from the camera representing the sky.
|
---|
| 1349 | @remarks
|
---|
| 1350 | You could create a sky box yourself using the standard mesh and
|
---|
| 1351 | entity methods, but this creates a plane which the camera can
|
---|
| 1352 | never get closer or further away from - it moves with the camera.
|
---|
| 1353 | (NB you could create this effect by creating a world box which
|
---|
| 1354 | was attached to the same SceneNode as the Camera too, but this
|
---|
| 1355 | would only apply to a single camera whereas this skybox applies
|
---|
| 1356 | to any camera using this scene manager).
|
---|
| 1357 | @par
|
---|
| 1358 | The material you use for the skybox can either contain layers
|
---|
| 1359 | which are single textures, or they can be cubic textures, i.e.
|
---|
| 1360 | made up of 6 images, one for each plane of the cube. See the
|
---|
| 1361 | TextureUnitState class for more information.
|
---|
| 1362 | @param
|
---|
| 1363 | enable True to enable the skybox, false to disable it
|
---|
| 1364 | @param
|
---|
| 1365 | materialName The name of the material the box will use
|
---|
| 1366 | @param
|
---|
| 1367 | distance Distance in world coorinates from the camera to
|
---|
| 1368 | each plane of the box. The default is normally OK.
|
---|
| 1369 | @param
|
---|
| 1370 | drawFirst If true, the box is drawn before all other
|
---|
| 1371 | geometry in the scene, without updating the depth buffer.
|
---|
| 1372 | This is the safest rendering method since all other objects
|
---|
| 1373 | will always appear in front of the sky. However this is not
|
---|
| 1374 | the most efficient way if most of the sky is often occluded
|
---|
| 1375 | by other objects. If this is the case, you can set this
|
---|
| 1376 | parameter to false meaning it draws <em>after</em> all other
|
---|
| 1377 | geometry which can be an optimisation - however you must
|
---|
| 1378 | ensure that the distance value is large enough that no
|
---|
| 1379 | objects will 'poke through' the sky box when it is rendered.
|
---|
| 1380 | @param
|
---|
| 1381 | orientation Optional parameter to specify the orientation
|
---|
| 1382 | of the box. By default the 'top' of the box is deemed to be
|
---|
| 1383 | in the +y direction, and the 'front' at the -z direction.
|
---|
| 1384 | You can use this parameter to rotate the sky if you want.
|
---|
| 1385 | @param groupName
|
---|
| 1386 | The name of the resource group to which to assign the plane mesh.
|
---|
| 1387 | */
|
---|
| 1388 | virtual void setSkyBox(
|
---|
| 1389 | bool enable, const String& materialName, Real distance = 5000,
|
---|
| 1390 | bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
|
---|
| 1391 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
|
---|
| 1392 |
|
---|
| 1393 | /** Return whether a skybox is enabled */
|
---|
| 1394 | virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
|
---|
| 1395 |
|
---|
| 1396 | /** Get the skybox node, if enabled. */
|
---|
| 1397 | virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
|
---|
| 1398 |
|
---|
| 1399 | /** Get the parameters used to generate the current SkyBox, if any */
|
---|
| 1400 | virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
|
---|
| 1401 |
|
---|
| 1402 | /** Enables / disables a 'sky dome' i.e. an illusion of a curved sky.
|
---|
| 1403 | @remarks
|
---|
| 1404 | A sky dome is actually formed by 5 sides of a cube, but with
|
---|
| 1405 | texture coordinates generated such that the surface appears
|
---|
| 1406 | curved like a dome. Sky domes are appropriate where you need a
|
---|
| 1407 | realistic looking sky where the scene is not going to be
|
---|
| 1408 | 'fogged', and there is always a 'floor' of some sort to prevent
|
---|
| 1409 | the viewer looking below the horizon (the distortion effect below
|
---|
| 1410 | the horizon can be pretty horrible, and there is never anyhting
|
---|
| 1411 | directly below the viewer). If you need a complete wrap-around
|
---|
| 1412 | background, use the setSkyBox method instead. You can actually
|
---|
| 1413 | combine a sky box and a sky dome if you want, to give a positional
|
---|
| 1414 | backdrop with an overlayed curved cloud layer.
|
---|
| 1415 | @par
|
---|
| 1416 | Sky domes work well with 2D repeating textures like clouds. You
|
---|
| 1417 | can change the apparant 'curvature' of the sky depending on how
|
---|
| 1418 | your scene is viewed - lower curvatures are better for 'open'
|
---|
| 1419 | scenes like landscapes, whilst higher curvatures are better for
|
---|
| 1420 | say FPS levels where you don't see a lot of the sky at once and
|
---|
| 1421 | the exaggerated curve looks good.
|
---|
| 1422 | @param
|
---|
| 1423 | enable True to enable the skydome, false to disable it
|
---|
| 1424 | @param
|
---|
| 1425 | materialName The name of the material the dome will use
|
---|
| 1426 | @param
|
---|
| 1427 | curvature The curvature of the dome. Good values are
|
---|
| 1428 | between 2 and 65. Higher values are more curved leading to
|
---|
| 1429 | a smoother effect, lower values are less curved meaning
|
---|
| 1430 | more distortion at the horizons but a better distance effect.
|
---|
| 1431 | @param
|
---|
| 1432 | tiling How many times to tile the texture(s) across the
|
---|
| 1433 | dome.
|
---|
| 1434 | @param
|
---|
| 1435 | distance Distance in world coorinates from the camera to
|
---|
| 1436 | each plane of the box the dome is rendered on. The default
|
---|
| 1437 | is normally OK.
|
---|
| 1438 | @param
|
---|
| 1439 | drawFirst If true, the dome is drawn before all other
|
---|
| 1440 | geometry in the scene, without updating the depth buffer.
|
---|
| 1441 | This is the safest rendering method since all other objects
|
---|
| 1442 | will always appear in front of the sky. However this is not
|
---|
| 1443 | the most efficient way if most of the sky is often occluded
|
---|
| 1444 | by other objects. If this is the case, you can set this
|
---|
| 1445 | parameter to false meaning it draws <em>after</em> all other
|
---|
| 1446 | geometry which can be an optimisation - however you must
|
---|
| 1447 | ensure that the distance value is large enough that no
|
---|
| 1448 | objects will 'poke through' the sky when it is rendered.
|
---|
| 1449 | @param
|
---|
| 1450 | orientation Optional parameter to specify the orientation
|
---|
| 1451 | of the dome. By default the 'top' of the dome is deemed to
|
---|
| 1452 | be in the +y direction, and the 'front' at the -z direction.
|
---|
| 1453 | You can use this parameter to rotate the sky if you want.
|
---|
| 1454 | @param groupName
|
---|
| 1455 | The name of the resource group to which to assign the plane mesh.
|
---|
| 1456 | */
|
---|
| 1457 | virtual void setSkyDome(
|
---|
| 1458 | bool enable, const String& materialName, Real curvature = 10,
|
---|
| 1459 | Real tiling = 8, Real distance = 4000, bool drawFirst = true,
|
---|
| 1460 | const Quaternion& orientation = Quaternion::IDENTITY,
|
---|
| 1461 | int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
|
---|
| 1462 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
|
---|
| 1463 |
|
---|
| 1464 | /** Return whether a skydome is enabled */
|
---|
| 1465 | virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
|
---|
| 1466 |
|
---|
| 1467 | /** Get the sky dome node, if enabled. */
|
---|
| 1468 | virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
|
---|
| 1469 |
|
---|
| 1470 | /** Get the parameters used to generate the current SkyDome, if any */
|
---|
| 1471 | virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
|
---|
| 1472 |
|
---|
| 1473 | /** Sets the fogging mode applied to the scene.
|
---|
| 1474 | @remarks
|
---|
| 1475 | This method sets up the scene-wide fogging effect. These settings
|
---|
| 1476 | apply to all geometry rendered, UNLESS the material with which it
|
---|
| 1477 | is rendered has it's own fog settings (see Material::setFog).
|
---|
| 1478 | @param
|
---|
| 1479 | mode Set up the mode of fog as described in the FogMode
|
---|
| 1480 | enum, or set to FOG_NONE to turn off.
|
---|
| 1481 | @param
|
---|
| 1482 | colour The colour of the fog. Either set this to the same
|
---|
| 1483 | as your viewport background colour, or to blend in with a
|
---|
| 1484 | skydome or skybox.
|
---|
| 1485 | @param
|
---|
| 1486 | expDensity The density of the fog in FOG_EXP or FOG_EXP2
|
---|
| 1487 | mode, as a value between 0 and 1. The default is 0.001.
|
---|
| 1488 | @param
|
---|
| 1489 | linearStart Distance in world units at which linear fog starts to
|
---|
| 1490 | encroach. Only applicable if mode is
|
---|
| 1491 | FOG_LINEAR.
|
---|
| 1492 | @param
|
---|
| 1493 | linearEnd Distance in world units at which linear fog becomes completely
|
---|
| 1494 | opaque. Only applicable if mode is
|
---|
| 1495 | FOG_LINEAR.
|
---|
| 1496 | */
|
---|
| 1497 | void setFog(
|
---|
| 1498 | FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
|
---|
| 1499 | Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
|
---|
| 1500 |
|
---|
| 1501 | /** Returns the fog mode for the scene.
|
---|
| 1502 | */
|
---|
| 1503 | virtual FogMode getFogMode(void) const;
|
---|
| 1504 |
|
---|
| 1505 | /** Returns the fog colour for the scene.
|
---|
| 1506 | */
|
---|
| 1507 | virtual const ColourValue& getFogColour(void) const;
|
---|
| 1508 |
|
---|
| 1509 | /** Returns the fog start distance for the scene.
|
---|
| 1510 | */
|
---|
| 1511 | virtual Real getFogStart(void) const;
|
---|
| 1512 |
|
---|
| 1513 | /** Returns the fog end distance for the scene.
|
---|
| 1514 | */
|
---|
| 1515 | virtual Real getFogEnd(void) const;
|
---|
| 1516 |
|
---|
| 1517 | /** Returns the fog density for the scene.
|
---|
| 1518 | */
|
---|
| 1519 | virtual Real getFogDensity(void) const;
|
---|
| 1520 |
|
---|
| 1521 |
|
---|
| 1522 | /** Creates a new BillboardSet for use with this scene manager.
|
---|
| 1523 | @remarks
|
---|
| 1524 | This method creates a new BillboardSet which is registered with
|
---|
| 1525 | the SceneManager. The SceneManager will destroy this object when
|
---|
| 1526 | it shuts down or when the SceneManager::clearScene method is
|
---|
| 1527 | called, so the caller does not have to worry about destroying
|
---|
| 1528 | this object (in fact, it definitely should not do this).
|
---|
| 1529 | @par
|
---|
| 1530 | See the BillboardSet documentations for full details of the
|
---|
| 1531 | returned class.
|
---|
| 1532 | @param
|
---|
| 1533 | name The name to give to this billboard set. Must be unique.
|
---|
| 1534 | @param
|
---|
| 1535 | poolSize The initial size of the pool of billboards (see BillboardSet for more information)
|
---|
| 1536 | @see
|
---|
| 1537 | BillboardSet
|
---|
| 1538 | */
|
---|
| 1539 | virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
|
---|
| 1540 |
|
---|
| 1541 | /** Retrieves a pointer to the named BillboardSet.
|
---|
| 1542 | @note Throws an exception if the named instance does not exist
|
---|
| 1543 | */
|
---|
| 1544 | virtual BillboardSet* getBillboardSet(const String& name);
|
---|
| 1545 | /** Returns whether a billboardset with the given name exists.
|
---|
| 1546 | */
|
---|
| 1547 | virtual bool hasBillboardSet(const String& name) const;
|
---|
| 1548 |
|
---|
| 1549 | /** Removes & destroys an BillboardSet from the SceneManager.
|
---|
| 1550 | @warning
|
---|
| 1551 | Must only be done if the BillboardSet is not attached
|
---|
| 1552 | to a SceneNode. It may be safer to wait to clear the whole
|
---|
| 1553 | scene. If you are unsure, use clearScene.
|
---|
| 1554 | */
|
---|
| 1555 | virtual void destroyBillboardSet(BillboardSet* set);
|
---|
| 1556 |
|
---|
| 1557 | /** Removes & destroys an BillboardSet from the SceneManager by name.
|
---|
| 1558 | @warning
|
---|
| 1559 | Must only be done if the BillboardSet is not attached
|
---|
| 1560 | to a SceneNode. It may be safer to wait to clear the whole
|
---|
| 1561 | scene. If you are unsure, use clearScene.
|
---|
| 1562 | */
|
---|
| 1563 | virtual void destroyBillboardSet(const String& name);
|
---|
| 1564 |
|
---|
| 1565 | /** Removes & destroys all BillboardSets.
|
---|
| 1566 | @warning
|
---|
| 1567 | Again, use caution since no BillboardSet must be referred to
|
---|
| 1568 | elsewhere e.g. attached to a SceneNode otherwise a crash
|
---|
| 1569 | is likely. Use clearScene if you are unsure (it clears SceneNode
|
---|
| 1570 | entries too.)
|
---|
| 1571 | @see
|
---|
| 1572 | SceneManager::clearScene
|
---|
| 1573 | */
|
---|
| 1574 | virtual void destroyAllBillboardSets(void);
|
---|
| 1575 |
|
---|
| 1576 | /** Tells the SceneManager whether it should render the SceneNodes which
|
---|
| 1577 | make up the scene as well as the objects in the scene.
|
---|
| 1578 | @remarks
|
---|
| 1579 | This method is mainly for debugging purposes. If you set this to 'true',
|
---|
| 1580 | each node will be rendered as a set of 3 axes to allow you to easily see
|
---|
| 1581 | the orientation of the nodes.
|
---|
| 1582 | */
|
---|
| 1583 | virtual void setDisplaySceneNodes(bool display);
|
---|
| 1584 | /** Returns true if all scene nodes axis are to be displayed */
|
---|
| 1585 | virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
|
---|
| 1586 |
|
---|
| 1587 | /** Creates an animation which can be used to animate scene nodes.
|
---|
| 1588 | @remarks
|
---|
| 1589 | An animation is a collection of 'tracks' which over time change the position / orientation
|
---|
| 1590 | of Node objects. In this case, the animation will likely have tracks to modify the position
|
---|
| 1591 | / orientation of SceneNode objects, e.g. to make objects move along a path.
|
---|
| 1592 | @par
|
---|
| 1593 | You don't need to use an Animation object to move objects around - you can do it yourself
|
---|
| 1594 | using the methods of the Node in your FrameListener class. However, when you need relatively
|
---|
| 1595 | complex scripted animation, this is the class to use since it will interpolate between
|
---|
| 1596 | keyframes for you and generally make the whole process easier to manage.
|
---|
| 1597 | @par
|
---|
| 1598 | A single animation can affect multiple Node objects (each AnimationTrack affects a single Node).
|
---|
| 1599 | In addition, through animation blending a single Node can be affected by multiple animations,
|
---|
| 1600 | athough this is more useful when performing skeletal animation (see Skeleton::createAnimation).
|
---|
| 1601 | @par
|
---|
| 1602 | Note that whilst it uses the same classes, the animations created here are kept separate from the
|
---|
| 1603 | skeletal animations of meshes (each Skeleton owns those animations).
|
---|
| 1604 | @param name The name of the animation, must be unique within this SceneManager.
|
---|
| 1605 | @param length The total length of the animation.
|
---|
| 1606 | */
|
---|
| 1607 | virtual Animation* createAnimation(const String& name, Real length);
|
---|
| 1608 |
|
---|
| 1609 | /** Looks up an Animation object previously created with createAnimation.
|
---|
| 1610 | @note Throws an exception if the named instance does not exist
|
---|
| 1611 | */
|
---|
| 1612 | virtual Animation* getAnimation(const String& name) const;
|
---|
| 1613 | /** Returns whether an animation with the given name exists.
|
---|
| 1614 | */
|
---|
| 1615 | virtual bool hasAnimation(const String& name) const;
|
---|
| 1616 |
|
---|
| 1617 | /** Destroys an Animation.
|
---|
| 1618 | @remarks
|
---|
| 1619 | You should ensure that none of your code is referencing this animation objects since the
|
---|
| 1620 | memory will be freed.
|
---|
| 1621 | */
|
---|
| 1622 | virtual void destroyAnimation(const String& name);
|
---|
| 1623 |
|
---|
| 1624 | /** Removes all animations created using this SceneManager. */
|
---|
| 1625 | virtual void destroyAllAnimations(void);
|
---|
| 1626 |
|
---|
| 1627 | /** Create an AnimationState object for managing application of animations.
|
---|
| 1628 | @remarks
|
---|
| 1629 | You can create Animation objects for animating SceneNode obejcts using the
|
---|
| 1630 | createAnimation method. However, in order to actually apply those animations
|
---|
| 1631 | you have to call methods on Node and Animation in a particular order (namely
|
---|
| 1632 | Node::resetToInitialState and Animation::apply). To make this easier and to
|
---|
| 1633 | help track the current time position of animations, the AnimationState object
|
---|
| 1634 | is provided. </p>
|
---|
| 1635 | So if you don't want to control animation application manually, call this method,
|
---|
| 1636 | update the returned object as you like every frame and let SceneManager apply
|
---|
| 1637 | the animation state for you.
|
---|
| 1638 | @par
|
---|
| 1639 | Remember, AnimationState objects are disabled by default at creation time.
|
---|
| 1640 | Turn them on when you want them using their setEnabled method.
|
---|
| 1641 | @par
|
---|
| 1642 | Note that any SceneNode affected by this automatic animation will have it's state
|
---|
| 1643 | reset to it's initial position before application of the animation. Unless specifically
|
---|
| 1644 | modified using Node::setInitialState the Node assumes it's initial state is at the
|
---|
| 1645 | origin. If you want the base state of the SceneNode to be elsewhere, make your changes
|
---|
| 1646 | to the node using the standard transform methods, then call setInitialState to
|
---|
| 1647 | 'bake' this reference position into the node.
|
---|
| 1648 | @par
|
---|
| 1649 | If the target of your animation is to be a generic AnimableValue, you
|
---|
| 1650 | should ensure that it has a base value set (unlike nodes this has no
|
---|
| 1651 | default). @see AnimableValue::setAsBaseValue.
|
---|
| 1652 | @param animName The name of an animation created already with createAnimation.
|
---|
| 1653 | */
|
---|
| 1654 | virtual AnimationState* createAnimationState(const String& animName);
|
---|
| 1655 |
|
---|
| 1656 | /** Retrieves animation state as previously created using createAnimationState.
|
---|
| 1657 | @note Throws an exception if the named instance does not exist
|
---|
| 1658 | */
|
---|
| 1659 | virtual AnimationState* getAnimationState(const String& animName);
|
---|
| 1660 | /** Returns whether an animation state with the given name exists.
|
---|
| 1661 | */
|
---|
| 1662 | virtual bool hasAnimationState(const String& name) const;
|
---|
| 1663 |
|
---|
| 1664 | /** Destroys an AnimationState.
|
---|
| 1665 | @remarks
|
---|
| 1666 | You should ensure that none of your code is referencing this animation
|
---|
| 1667 | state object since the memory will be freed.
|
---|
| 1668 | */
|
---|
| 1669 | virtual void destroyAnimationState(const String& name);
|
---|
| 1670 |
|
---|
| 1671 | /** Removes all animation states created using this SceneManager. */
|
---|
| 1672 | virtual void destroyAllAnimationStates(void);
|
---|
| 1673 |
|
---|
| 1674 | /** Manual rendering method, for advanced users only.
|
---|
| 1675 | @remarks
|
---|
| 1676 | This method allows you to send rendering commands through the pipeline on
|
---|
| 1677 | demand, bypassing OGRE's normal world processing. You should only use this if you
|
---|
| 1678 | really know what you're doing; OGRE does lots of things for you that you really should
|
---|
| 1679 | let it do. However, there are times where it may be useful to have this manual interface,
|
---|
| 1680 | for example overlaying something on top of the scene rendered by OGRE.
|
---|
| 1681 | @par
|
---|
| 1682 | Because this is an instant rendering method, timing is important. The best
|
---|
| 1683 | time to call it is from a RenderTargetListener event handler.
|
---|
| 1684 | @par
|
---|
| 1685 | Don't call this method a lot, it's designed for rare (1 or 2 times per frame) use.
|
---|
| 1686 | Calling it regularly per frame will cause frame rate drops!
|
---|
| 1687 | @param rend A RenderOperation object describing the rendering op
|
---|
| 1688 | @param pass The Pass to use for this render
|
---|
| 1689 | @param vp Pointer to the viewport to render to
|
---|
| 1690 | @param worldMatrix The transform to apply from object to world space
|
---|
| 1691 | @param viewMatrix The transform to apply from world to view space
|
---|
| 1692 | @param projMatrix The transform to apply from view to screen space
|
---|
| 1693 | @param doBeginEndFrame If true, beginFrame() and endFrame() are called,
|
---|
| 1694 | otherwise not. You should leave this as false if you are calling
|
---|
| 1695 | this within the main render loop.
|
---|
| 1696 | */
|
---|
| 1697 | virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp,
|
---|
| 1698 | const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix,
|
---|
| 1699 | bool doBeginEndFrame = false) ;
|
---|
| 1700 |
|
---|
| 1701 | /** Retrieves the internal render queue, for advanced users only.
|
---|
| 1702 | @remarks
|
---|
| 1703 | The render queue is mainly used internally to manage the scene object
|
---|
| 1704 | rendering queue, it also exports some methods to allow advanced users
|
---|
| 1705 | to configure the behavior of rendering process.
|
---|
| 1706 | Most methods provided by RenderQueue are supposed to be used
|
---|
| 1707 | internally only, you should reference to the RenderQueue API for
|
---|
| 1708 | more information. Do not access this directly unless you know what
|
---|
| 1709 | you are doing.
|
---|
| 1710 | */
|
---|
| 1711 | virtual RenderQueue* getRenderQueue(void);
|
---|
| 1712 |
|
---|
| 1713 | /** Registers a new RenderQueueListener which will be notified when render queues
|
---|
| 1714 | are processed.
|
---|
| 1715 | */
|
---|
| 1716 | virtual void addRenderQueueListener(RenderQueueListener* newListener);
|
---|
| 1717 |
|
---|
| 1718 | /** Removes a listener previously added with addRenderQueueListener. */
|
---|
| 1719 | virtual void removeRenderQueueListener(RenderQueueListener* delListener);
|
---|
| 1720 |
|
---|
| 1721 | /** Adds an item to the 'special case' render queue list.
|
---|
| 1722 | @remarks
|
---|
| 1723 | Normally all render queues are rendered, in their usual sequence,
|
---|
| 1724 | only varying if a RenderQueueListener nominates for the queue to be
|
---|
| 1725 | repeated or skipped. This method allows you to add a render queue to
|
---|
| 1726 | a 'special case' list, which varies the behaviour. The effect of this
|
---|
| 1727 | list depends on the 'mode' in which this list is in, which might be
|
---|
| 1728 | to exclude these render queues, or to include them alone (excluding
|
---|
| 1729 | all other queues). This allows you to perform broad selective
|
---|
| 1730 | rendering without requiring a RenderQueueListener.
|
---|
| 1731 | @param qid The identifier of the queue which should be added to the
|
---|
| 1732 | special case list. Nothing happens if the queue is already in the list.
|
---|
| 1733 | */
|
---|
| 1734 | virtual void addSpecialCaseRenderQueue(uint8 qid);
|
---|
| 1735 | /** Removes an item to the 'special case' render queue list.
|
---|
| 1736 | @see SceneManager::addSpecialCaseRenderQueue
|
---|
| 1737 | @param qid The identifier of the queue which should be removed from the
|
---|
| 1738 | special case list. Nothing happens if the queue is not in the list.
|
---|
| 1739 | */
|
---|
| 1740 | virtual void removeSpecialCaseRenderQueue(uint8 qid);
|
---|
| 1741 | /** Clears the 'special case' render queue list.
|
---|
| 1742 | @see SceneManager::addSpecialCaseRenderQueue
|
---|
| 1743 | */
|
---|
| 1744 | virtual void clearSpecialCaseRenderQueues(void);
|
---|
| 1745 | /** Sets the way the special case render queue list is processed.
|
---|
| 1746 | @see SceneManager::addSpecialCaseRenderQueue
|
---|
| 1747 | @param mode The mode of processing
|
---|
| 1748 | */
|
---|
| 1749 | virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
|
---|
| 1750 | /** Gets the way the special case render queue list is processed. */
|
---|
| 1751 | virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
|
---|
| 1752 | /** Returns whether or not the named queue will be rendered based on the
|
---|
| 1753 | current 'special case' render queue list and mode.
|
---|
| 1754 | @see SceneManager::addSpecialCaseRenderQueue
|
---|
| 1755 | @param qid The identifier of the queue which should be tested
|
---|
| 1756 | @returns true if the queue will be rendered, false otherwise
|
---|
| 1757 | */
|
---|
| 1758 | virtual bool isRenderQueueToBeProcessed(uint8 qid);
|
---|
| 1759 |
|
---|
| 1760 | /** Sets the render queue that the world geometry (if any) this SceneManager
|
---|
| 1761 | renders will be associated with.
|
---|
| 1762 | @remarks
|
---|
| 1763 | SceneManagers which provide 'world geometry' should place it in a
|
---|
| 1764 | specialised render queue in order to make it possible to enable /
|
---|
| 1765 | disable it easily using the addSpecialCaseRenderQueue method. Even
|
---|
| 1766 | if the SceneManager does not use the render queues to render the
|
---|
| 1767 | world geometry, it should still pick a queue to represent it's manual
|
---|
| 1768 | rendering, and check isRenderQueueToBeProcessed before rendering.
|
---|
| 1769 | @note
|
---|
| 1770 | Setting this may not affect the actual ordering of rendering the
|
---|
| 1771 | world geometry, if the world geometry is being rendered manually
|
---|
| 1772 | by the SceneManager. If the SceneManager feeds world geometry into
|
---|
| 1773 | the queues, however, the ordering will be affected.
|
---|
| 1774 | */
|
---|
| 1775 | virtual void setWorldGeometryRenderQueue(uint8 qid);
|
---|
| 1776 | /** Gets the render queue that the world geometry (if any) this SceneManager
|
---|
| 1777 | renders will be associated with.
|
---|
| 1778 | @remarks
|
---|
| 1779 | SceneManagers which provide 'world geometry' should place it in a
|
---|
| 1780 | specialised render queue in order to make it possible to enable /
|
---|
| 1781 | disable it easily using the addSpecialCaseRenderQueue method. Even
|
---|
| 1782 | if the SceneManager does not use the render queues to render the
|
---|
| 1783 | world geometry, it should still pick a queue to represent it's manual
|
---|
| 1784 | rendering, and check isRenderQueueToBeProcessed before rendering.
|
---|
| 1785 | */
|
---|
| 1786 | virtual uint8 getWorldGeometryRenderQueue(void);
|
---|
| 1787 |
|
---|
| 1788 | /** Allows all bounding boxes of scene nodes to be displayed. */
|
---|
| 1789 | virtual void showBoundingBoxes(bool bShow);
|
---|
| 1790 |
|
---|
| 1791 | /** Returns if all bounding boxes of scene nodes are to be displayed */
|
---|
| 1792 | virtual bool getShowBoundingBoxes() const;
|
---|
| 1793 |
|
---|
| 1794 | /** Internal method for notifying the manager that a SceneNode is autotracking. */
|
---|
| 1795 | virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
|
---|
| 1796 |
|
---|
| 1797 |
|
---|
| 1798 | /** Creates an AxisAlignedBoxSceneQuery for this scene manager.
|
---|
| 1799 | @remarks
|
---|
| 1800 | This method creates a new instance of a query object for this scene manager,
|
---|
| 1801 | for an axis aligned box region. See SceneQuery and AxisAlignedBoxSceneQuery
|
---|
| 1802 | for full details.
|
---|
| 1803 | @par
|
---|
| 1804 | The instance returned from this method must be destroyed by calling
|
---|
| 1805 | SceneManager::destroyQuery when it is no longer required.
|
---|
| 1806 | @param box Details of the box which describes the region for this query.
|
---|
| 1807 | @param mask The query mask to apply to this query; can be used to filter out
|
---|
| 1808 | certain objects; see SceneQuery for details.
|
---|
| 1809 | */
|
---|
| 1810 | virtual AxisAlignedBoxSceneQuery*
|
---|
| 1811 | createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
|
---|
| 1812 | /** Creates a SphereSceneQuery for this scene manager.
|
---|
| 1813 | @remarks
|
---|
| 1814 | This method creates a new instance of a query object for this scene manager,
|
---|
| 1815 | for a spherical region. See SceneQuery and SphereSceneQuery
|
---|
| 1816 | for full details.
|
---|
| 1817 | @par
|
---|
| 1818 | The instance returned from this method must be destroyed by calling
|
---|
| 1819 | SceneManager::destroyQuery when it is no longer required.
|
---|
| 1820 | @param sphere Details of the sphere which describes the region for this query.
|
---|
| 1821 | @param mask The query mask to apply to this query; can be used to filter out
|
---|
| 1822 | certain objects; see SceneQuery for details.
|
---|
| 1823 | */
|
---|
| 1824 | virtual SphereSceneQuery*
|
---|
| 1825 | createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
|
---|
| 1826 | /** Creates a PlaneBoundedVolumeListSceneQuery for this scene manager.
|
---|
| 1827 | @remarks
|
---|
| 1828 | This method creates a new instance of a query object for this scene manager,
|
---|
| 1829 | for a region enclosed by a set of planes (normals pointing inwards).
|
---|
| 1830 | See SceneQuery and PlaneBoundedVolumeListSceneQuery for full details.
|
---|
| 1831 | @par
|
---|
| 1832 | The instance returned from this method must be destroyed by calling
|
---|
| 1833 | SceneManager::destroyQuery when it is no longer required.
|
---|
| 1834 | @param volumes Details of the volumes which describe the region for this query.
|
---|
| 1835 | @param mask The query mask to apply to this query; can be used to filter out
|
---|
| 1836 | certain objects; see SceneQuery for details.
|
---|
| 1837 | */
|
---|
| 1838 | virtual PlaneBoundedVolumeListSceneQuery*
|
---|
| 1839 | createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
|
---|
| 1840 |
|
---|
| 1841 |
|
---|
| 1842 | /** Creates a RaySceneQuery for this scene manager.
|
---|
| 1843 | @remarks
|
---|
| 1844 | This method creates a new instance of a query object for this scene manager,
|
---|
| 1845 | looking for objects which fall along a ray. See SceneQuery and RaySceneQuery
|
---|
| 1846 | for full details.
|
---|
| 1847 | @par
|
---|
| 1848 | The instance returned from this method must be destroyed by calling
|
---|
| 1849 | SceneManager::destroyQuery when it is no longer required.
|
---|
| 1850 | @param ray Details of the ray which describes the region for this query.
|
---|
| 1851 | @param mask The query mask to apply to this query; can be used to filter out
|
---|
| 1852 | certain objects; see SceneQuery for details.
|
---|
| 1853 | */
|
---|
| 1854 | virtual RaySceneQuery*
|
---|
| 1855 | createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
|
---|
| 1856 | //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
|
---|
| 1857 | /** Creates an IntersectionSceneQuery for this scene manager.
|
---|
| 1858 | @remarks
|
---|
| 1859 | This method creates a new instance of a query object for locating
|
---|
| 1860 | intersecting objects. See SceneQuery and IntersectionSceneQuery
|
---|
| 1861 | for full details.
|
---|
| 1862 | @par
|
---|
| 1863 | The instance returned from this method must be destroyed by calling
|
---|
| 1864 | SceneManager::destroyQuery when it is no longer required.
|
---|
| 1865 | @param mask The query mask to apply to this query; can be used to filter out
|
---|
| 1866 | certain objects; see SceneQuery for details.
|
---|
| 1867 | */
|
---|
| 1868 | virtual IntersectionSceneQuery*
|
---|
| 1869 | createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
|
---|
| 1870 |
|
---|
| 1871 | /** Destroys a scene query of any type. */
|
---|
| 1872 | virtual void destroyQuery(SceneQuery* query);
|
---|
| 1873 |
|
---|
| 1874 | typedef MapIterator<CameraList> CameraIterator;
|
---|
| 1875 | typedef MapIterator<AnimationList> AnimationIterator;
|
---|
| 1876 |
|
---|
| 1877 | /** Returns a specialised MapIterator over all cameras in the scene. */
|
---|
| 1878 | CameraIterator getCameraIterator(void) {
|
---|
| 1879 | return CameraIterator(mCameras.begin(), mCameras.end());
|
---|
| 1880 | }
|
---|
| 1881 | /** Returns a specialised MapIterator over all animations in the scene. */
|
---|
| 1882 | AnimationIterator getAnimationIterator(void) {
|
---|
| 1883 | return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
|
---|
| 1884 | }
|
---|
| 1885 | /** Returns a specialised MapIterator over all animation states in the scene. */
|
---|
| 1886 | AnimationStateIterator getAnimationStateIterator(void) {
|
---|
| 1887 | return mAnimationStates.getAnimationStateIterator();
|
---|
| 1888 | }
|
---|
| 1889 |
|
---|
| 1890 | /** Sets the general shadow technique to be used in this scene.
|
---|
| 1891 | @remarks
|
---|
| 1892 | There are multiple ways to generate shadows in a scene, and each has
|
---|
| 1893 | strengths and weaknesses.
|
---|
| 1894 | <ul><li>Stencil-based approaches can be used to
|
---|
| 1895 | draw very long, extreme shadows without loss of precision and the 'additive'
|
---|
| 1896 | version can correctly show the shadowing of complex effects like bump mapping
|
---|
| 1897 | because they physically exclude the light from those areas. However, the edges
|
---|
| 1898 | are very sharp and stencils cannot handle transparency, and they involve a
|
---|
| 1899 | fair amount of CPU work in order to calculate the shadow volumes, especially
|
---|
| 1900 | when animated objects are involved.</li>
|
---|
| 1901 | <li>Texture-based approaches are good for handling transparency (they can, for
|
---|
| 1902 | example, correctly shadow a mesh which uses alpha to represent holes), and they
|
---|
| 1903 | require little CPU overhead, and can happily shadow geometry which is deformed
|
---|
| 1904 | by a vertex program, unlike stencil shadows. However, they have a fixed precision
|
---|
| 1905 | which can introduce 'jaggies' at long range and have fillrate issues of their own.</li>
|
---|
| 1906 | </ul>
|
---|
| 1907 | @par
|
---|
| 1908 | We support 2 kinds of stencil shadows, and 2 kinds of texture-based shadows, and one
|
---|
| 1909 | simple decal approach. The 2 stencil approaches differ in the amount of multipass work
|
---|
| 1910 | that is required - the modulative approach simply 'darkens' areas in shadow after the
|
---|
| 1911 | main render, which is the least expensive, whilst the additive approach has to perform
|
---|
| 1912 | a render per light and adds the cumulative effect, whcih is more expensive but more
|
---|
| 1913 | accurate. The texture based shadows both work in roughly the same way, the only difference is
|
---|
| 1914 | that the shadowmap approach is slightly more accurate, but requires a more recent
|
---|
| 1915 | graphics card.
|
---|
| 1916 | @par
|
---|
| 1917 | Note that because mixing many shadow techniques can cause problems, only one technique
|
---|
| 1918 | is supported at once. Also, you should call this method at the start of the
|
---|
| 1919 | scene setup.
|
---|
| 1920 | @param technique The shadowing technique to use for the scene.
|
---|
| 1921 | */
|
---|
| 1922 | virtual void setShadowTechnique(ShadowTechnique technique);
|
---|
| 1923 |
|
---|
| 1924 | /** Gets the current shadow technique. */
|
---|
| 1925 | virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
|
---|
| 1926 |
|
---|
| 1927 | /** Enables / disables the rendering of debug information for shadows. */
|
---|
| 1928 | virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
|
---|
| 1929 | /** Are debug shadows shown? */
|
---|
| 1930 | virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
|
---|
| 1931 |
|
---|
| 1932 | /** Set the colour used to modulate areas in shadow.
|
---|
| 1933 | @remarks This is only applicable for shadow techniques which involve
|
---|
| 1934 | darkening the area in shadow, as opposed to masking out the light.
|
---|
| 1935 | This colour provided is used as a modulative value to darken the
|
---|
| 1936 | areas.
|
---|
| 1937 | */
|
---|
| 1938 | virtual void setShadowColour(const ColourValue& colour);
|
---|
| 1939 | /** Get the colour used to modulate areas in shadow.
|
---|
| 1940 | @remarks This is only applicable for shadow techniques which involve
|
---|
| 1941 | darkening the area in shadow, as opposed to masking out the light.
|
---|
| 1942 | This colour provided is used as a modulative value to darken the
|
---|
| 1943 | areas.
|
---|
| 1944 | */
|
---|
| 1945 | virtual const ColourValue& getShadowColour(void) const;
|
---|
| 1946 | /** Sets the distance a shadow volume is extruded for a directional light.
|
---|
| 1947 | @remarks
|
---|
| 1948 | Although directional lights are essentially infinite, there are many
|
---|
| 1949 | reasons to limit the shadow extrusion distance to a finite number,
|
---|
| 1950 | not least of which is compatibility with older cards (which do not
|
---|
| 1951 | support infinite positions), and shadow caster elimination.
|
---|
| 1952 | @par
|
---|
| 1953 | The default value is 10,000 world units. This does not apply to
|
---|
| 1954 | point lights or spotlights, since they extrude up to their
|
---|
| 1955 | attenuation range.
|
---|
| 1956 | */
|
---|
| 1957 | virtual void setShadowDirectionalLightExtrusionDistance(Real dist);
|
---|
| 1958 | /** Gets the distance a shadow volume is extruded for a directional light.
|
---|
| 1959 | */
|
---|
| 1960 | virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
|
---|
| 1961 | /** Sets the maximum distance away from the camera that shadows
|
---|
| 1962 | will be visible.
|
---|
| 1963 | @remarks
|
---|
| 1964 | Shadow techniques can be expensive, therefore it is a good idea
|
---|
| 1965 | to limit them to being rendered close to the camera if possible,
|
---|
| 1966 | and to skip the expense of rendering shadows for distance objects.
|
---|
| 1967 | This method allows you to set the distance at which shadows will no
|
---|
| 1968 | longer be rendered.
|
---|
| 1969 | @note
|
---|
| 1970 | Each shadow technique can interpret this subtely differently.
|
---|
| 1971 | For example, one technique may use this to eliminate casters,
|
---|
| 1972 | another might use it to attenuate the shadows themselves.
|
---|
| 1973 | You should tweak this value to suit your chosen shadow technique
|
---|
| 1974 | and scene setup.
|
---|
| 1975 | */
|
---|
| 1976 | virtual void setShadowFarDistance(Real distance);
|
---|
| 1977 | /** Gets the maximum distance away from the camera that shadows
|
---|
| 1978 | will be visible.
|
---|
| 1979 | */
|
---|
| 1980 | virtual Real getShadowFarDistance(void) const
|
---|
| 1981 | { return mShadowFarDist; }
|
---|
| 1982 |
|
---|
| 1983 | /** Sets the maximum size of the index buffer used to render shadow
|
---|
| 1984 | primitives.
|
---|
| 1985 | @remarks
|
---|
| 1986 | This method allows you to tweak the size of the index buffer used
|
---|
| 1987 | to render shadow primitives (including stencil shadow volumes). The
|
---|
| 1988 | default size is 51,200 entries, which is 100k of GPU memory, or
|
---|
| 1989 | enough to render approximately 17,000 triangles. You can reduce this
|
---|
| 1990 | as long as you do not have any models / world geometry chunks which
|
---|
| 1991 | could require more than the amount you set.
|
---|
| 1992 | @par
|
---|
| 1993 | The maximum number of triangles required to render a single shadow
|
---|
| 1994 | volume (including light and dark caps when needed) will be 3x the
|
---|
| 1995 | number of edges on the light silhouette, plus the number of
|
---|
| 1996 | light-facing triangles. On average, half the
|
---|
| 1997 | triangles will be facing toward the light, but the number of
|
---|
| 1998 | triangles in the silhouette entirely depends on the mesh -
|
---|
| 1999 | angular meshes will have a higher silhouette tris/mesh tris
|
---|
| 2000 | ratio than a smooth mesh. You can estimate the requirements for
|
---|
| 2001 | your particular mesh by rendering it alone in a scene with shadows
|
---|
| 2002 | enabled and a single light - rotate it or the light and make a note
|
---|
| 2003 | of how high the triangle count goes (remembering to subtract the
|
---|
| 2004 | mesh triangle count)
|
---|
| 2005 | @param size The number of indexes; divide this by 3 to determine the
|
---|
| 2006 | number of triangles.
|
---|
| 2007 | */
|
---|
| 2008 | virtual void setShadowIndexBufferSize(size_t size);
|
---|
| 2009 | /// Get the size of the shadow index buffer
|
---|
| 2010 | virtual size_t getShadowIndexBufferSize(void) const
|
---|
| 2011 | { return mShadowIndexBufferSize; }
|
---|
| 2012 | /** Set the size of the texture used for texture-based shadows.
|
---|
| 2013 | @remarks
|
---|
| 2014 | The larger the shadow texture, the better the detail on
|
---|
| 2015 | texture based shadows, but obviously this takes more memory.
|
---|
| 2016 | The default size is 512. Sizes must be a power of 2.
|
---|
| 2017 | */
|
---|
| 2018 | virtual void setShadowTextureSize(unsigned short size);
|
---|
| 2019 | /// Get the size of the texture used for texture based shadows
|
---|
| 2020 | unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; }
|
---|
| 2021 | /** Set the pixel format of the textures used for texture-based shadows.
|
---|
| 2022 | @remarks
|
---|
| 2023 | By default, a colour texture is used (PF_X8R8G8B8) for texture shadows,
|
---|
| 2024 | but if you want to use more advanced texture shadow types you can
|
---|
| 2025 | alter this. If you do, you will have to also call
|
---|
| 2026 | setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial
|
---|
| 2027 | to provide shader-based materials to use these customised shadow
|
---|
| 2028 | texture formats.
|
---|
| 2029 | */
|
---|
| 2030 | virtual void setShadowTexturePixelFormat(PixelFormat fmt);
|
---|
| 2031 | /// Get the format of the textures used for texture based shadows
|
---|
| 2032 | PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; }
|
---|
| 2033 | /** Set the number of textures allocated for texture-based shadows.
|
---|
| 2034 | @remarks
|
---|
| 2035 | The default number of textures assigned to deal with texture based
|
---|
| 2036 | shadows is 1; however this means you can only have one light casting
|
---|
| 2037 | shadows at the same time. You can increase this number in order to
|
---|
| 2038 | make this more flexible, but be aware of the texture memory it will use.
|
---|
| 2039 | */
|
---|
| 2040 | virtual void setShadowTextureCount(unsigned short count);
|
---|
| 2041 | /// Get the number of the textures allocated for texture based shadows
|
---|
| 2042 | unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; }
|
---|
| 2043 | /** Sets the size and count of textures used in texture-based shadows.
|
---|
| 2044 | @remarks
|
---|
| 2045 | @see setShadowTextureSize and setShadowTextureCount for details, this
|
---|
| 2046 | method just allows you to change both at once, which can save on
|
---|
| 2047 | reallocation if the textures have already been created.
|
---|
| 2048 | */
|
---|
| 2049 | virtual void setShadowTextureSettings(unsigned short size, unsigned short count,
|
---|
| 2050 | PixelFormat fmt = PF_X8R8G8B8);
|
---|
| 2051 | /** Sets the proportional distance which a texture shadow which is generated from a
|
---|
| 2052 | directional light will be offset into the camera view to make best use of texture space.
|
---|
| 2053 | @remarks
|
---|
| 2054 | When generating a shadow texture from a directional light, an approximation is used
|
---|
| 2055 | since it is not possible to render the entire scene to one texture.
|
---|
| 2056 | The texture is projected onto an area centred on the camera, and is
|
---|
| 2057 | the shadow far distance * 2 in length (it is square). This wastes
|
---|
| 2058 | a lot of texture space outside the frustum though, so this offset allows
|
---|
| 2059 | you to move the texture in front of the camera more. However, be aware
|
---|
| 2060 | that this can cause a little shadow 'jittering' during rotation, and
|
---|
| 2061 | that if you move it too far then you'll start to get artefacts close
|
---|
| 2062 | to the camera. The value is represented as a proportion of the shadow
|
---|
| 2063 | far distance, and the default is 0.6.
|
---|
| 2064 | */
|
---|
| 2065 | virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
|
---|
| 2066 | /** Sets the proportional distance at which texture shadows begin to fade out.
|
---|
| 2067 | @remarks
|
---|
| 2068 | To hide the edges where texture shadows end (in directional lights)
|
---|
| 2069 | Ogre will fade out the shadow in the distance. This value is a proportional
|
---|
| 2070 | distance of the entire shadow visibility distance at which the shadow
|
---|
| 2071 | begins to fade out. The default is 0.7
|
---|
| 2072 | */
|
---|
| 2073 | virtual void setShadowTextureFadeStart(Real fadeStart)
|
---|
| 2074 | { mShadowTextureFadeStart = fadeStart; }
|
---|
| 2075 | /** Sets the proportional distance at which texture shadows finish to fading out.
|
---|
| 2076 | @remarks
|
---|
| 2077 | To hide the edges where texture shadows end (in directional lights)
|
---|
| 2078 | Ogre will fade out the shadow in the distance. This value is a proportional
|
---|
| 2079 | distance of the entire shadow visibility distance at which the shadow
|
---|
| 2080 | is completely invisible. The default is 0.9.
|
---|
| 2081 | */
|
---|
| 2082 | virtual void setShadowTextureFadeEnd(Real fadeEnd)
|
---|
| 2083 | { mShadowTextureFadeEnd = fadeEnd; }
|
---|
| 2084 |
|
---|
| 2085 | /** Sets whether or not texture shadows should attempt to self-shadow.
|
---|
| 2086 | @remarks
|
---|
| 2087 | The default implementation of texture shadows uses a fixed-function
|
---|
| 2088 | colour texture projection approach for maximum compatibility, and
|
---|
| 2089 | as such cannot support self-shadowing. However, if you decide to
|
---|
| 2090 | implement a more complex shadowing technique using the
|
---|
| 2091 | setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial
|
---|
| 2092 | there is a possibility you may be able to support
|
---|
| 2093 | self-shadowing (e.g by implementing a shader-based shadow map). In
|
---|
| 2094 | this case you might want to enable this option.
|
---|
| 2095 | @param selfShadow Whether to attempt self-shadowing with texture shadows
|
---|
| 2096 | */
|
---|
| 2097 | virtual void setShadowTextureSelfShadow(bool selfShadow);
|
---|
| 2098 |
|
---|
| 2099 | /// Gets whether or not texture shadows attempt to self-shadow.
|
---|
| 2100 | virtual bool getShadowTextureSelfShadow(void) const
|
---|
| 2101 | { return mShadowTextureSelfShadow; }
|
---|
| 2102 | /** Sets the default material to use for rendering shadow casters.
|
---|
| 2103 | @remarks
|
---|
| 2104 | By default shadow casters are rendered into the shadow texture using
|
---|
| 2105 | an automatically generated fixed-function pass. This allows basic
|
---|
| 2106 | projective texture shadows, but it's possible to use more advanced
|
---|
| 2107 | shadow techniques by overriding the caster and receiver materials, for
|
---|
| 2108 | example providing vertex and fragment programs to implement shadow
|
---|
| 2109 | maps.
|
---|
| 2110 | @par
|
---|
| 2111 | You can rely on the ambient light in the scene being set to the
|
---|
| 2112 | requested texture shadow colour, if that's useful.
|
---|
| 2113 | @note
|
---|
| 2114 | Individual objects may also override the vertex program in
|
---|
| 2115 | your default material if their materials include
|
---|
| 2116 | shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref
|
---|
| 2117 | entries, so if you use both make sure they are compatible.
|
---|
| 2118 | @note
|
---|
| 2119 | Only a single pass is allowed in your material, although multiple
|
---|
| 2120 | techniques may be used for hardware fallback.
|
---|
| 2121 | */
|
---|
| 2122 | virtual void setShadowTextureCasterMaterial(const String& name);
|
---|
| 2123 | /** Sets the default material to use for rendering shadow receivers.
|
---|
| 2124 | @remarks
|
---|
| 2125 | By default shadow receivers are rendered as a post-pass using basic
|
---|
| 2126 | modulation. This allows basic projective texture shadows, but it's
|
---|
| 2127 | possible to use more advanced shadow techniques by overriding the
|
---|
| 2128 | caster and receiver materials, for example providing vertex and
|
---|
| 2129 | fragment programs to implement shadow maps.
|
---|
| 2130 | @par
|
---|
| 2131 | You can rely on texture unit 0 containing the shadow texture, and
|
---|
| 2132 | for the unit to be set to use projective texturing from the light
|
---|
| 2133 | (only useful if you're using fixed-function, which is unlikely;
|
---|
| 2134 | otherwise you should rely on the texture_viewproj_matrix auto binding)
|
---|
| 2135 | @note
|
---|
| 2136 | Individual objects may also override the vertex program in
|
---|
| 2137 | your default material if their materials include
|
---|
| 2138 | shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref
|
---|
| 2139 | entries, so if you use both make sure they are compatible.
|
---|
| 2140 | @note
|
---|
| 2141 | Only a single pass is allowed in your material, although multiple
|
---|
| 2142 | techniques may be used for hardware fallback.
|
---|
| 2143 | */
|
---|
| 2144 | virtual void setShadowTextureReceiverMaterial(const String& name);
|
---|
| 2145 |
|
---|
| 2146 | /** Sets whether we should use an inifinite camera far plane
|
---|
| 2147 | when rendering stencil shadows.
|
---|
| 2148 | @remarks
|
---|
| 2149 | Stencil shadow coherency is very reliant on the shadow volume
|
---|
| 2150 | not being clipped by the far plane. If this clipping happens, you
|
---|
| 2151 | get a kind of 'negative' shadow effect. The best way to achieve
|
---|
| 2152 | coherency is to move the far plane of the camera out to infinity,
|
---|
| 2153 | thus preventing the far plane from clipping the shadow volumes.
|
---|
| 2154 | When combined with vertex program extrusion of the volume to
|
---|
| 2155 | infinity, which Ogre does when available, this results in very
|
---|
| 2156 | robust shadow volumes. For this reason, when you enable stencil
|
---|
| 2157 | shadows, Ogre automatically changes your camera settings to
|
---|
| 2158 | project to infinity if the card supports it. You can disable this
|
---|
| 2159 | behaviour if you like by calling this method; although you can
|
---|
| 2160 | never enable infinite projection if the card does not support it.
|
---|
| 2161 | @par
|
---|
| 2162 | If you disable infinite projection, or it is not available,
|
---|
| 2163 | you need to be far more careful with your light attenuation /
|
---|
| 2164 | directional light extrusion distances to avoid clipping artefacts
|
---|
| 2165 | at the far plane.
|
---|
| 2166 | @note
|
---|
| 2167 | Recent cards will generally support infinite far plane projection.
|
---|
| 2168 | However, we have found some cases where they do not, especially
|
---|
| 2169 | on Direct3D. There is no standard capability we can check to
|
---|
| 2170 | validate this, so we use some heuristics based on experience:
|
---|
| 2171 | <UL>
|
---|
| 2172 | <LI>OpenGL always seems to support it no matter what the card</LI>
|
---|
| 2173 | <LI>Direct3D on non-vertex program capable systems (including
|
---|
| 2174 | vertex program capable cards on Direct3D7) does not
|
---|
| 2175 | support it</LI>
|
---|
| 2176 | <LI>Direct3D on GeForce3 and GeForce4 Ti does not seem to support
|
---|
| 2177 | infinite projection<LI>
|
---|
| 2178 | </UL>
|
---|
| 2179 | Therefore in the RenderSystem implementation, we may veto the use
|
---|
| 2180 | of an infinite far plane based on these heuristics.
|
---|
| 2181 | */
|
---|
| 2182 | virtual void setShadowUseInfiniteFarPlane(bool enable) {
|
---|
| 2183 | mShadowUseInfiniteFarPlane = enable; }
|
---|
| 2184 |
|
---|
| 2185 | /** Is there a stencil shadow based shadowing technique in use? */
|
---|
| 2186 | virtual bool isShadowTechniqueStencilBased(void) const
|
---|
| 2187 | { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
|
---|
| 2188 | /** Is there a texture shadow based shadowing technique in use? */
|
---|
| 2189 | virtual bool isShadowTechniqueTextureBased(void) const
|
---|
| 2190 | { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
|
---|
| 2191 | /** Is there a modulative shadowing technique in use? */
|
---|
| 2192 | virtual bool isShadowTechniqueModulative(void) const
|
---|
| 2193 | { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
|
---|
| 2194 | /** Is there an additive shadowing technique in use? */
|
---|
| 2195 | virtual bool isShadowTechniqueAdditive(void) const
|
---|
| 2196 | { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
|
---|
| 2197 | /** Is there any shadowing technique in use? */
|
---|
| 2198 | virtual bool isShadowTechniqueInUse(void) const
|
---|
| 2199 | { return mShadowTechnique != SHADOWTYPE_NONE; }
|
---|
| 2200 |
|
---|
| 2201 | /** Add a shadow listener which will get called back on shadow
|
---|
| 2202 | events.
|
---|
| 2203 | */
|
---|
| 2204 | virtual void addShadowListener(ShadowListener* s);
|
---|
| 2205 | /** Remove a shadow listener
|
---|
| 2206 | */
|
---|
| 2207 | virtual void removeShadowListener(ShadowListener* s);
|
---|
| 2208 |
|
---|
| 2209 | /** Creates a StaticGeometry instance suitable for use with this
|
---|
| 2210 | SceneManager.
|
---|
| 2211 | @remarks
|
---|
| 2212 | StaticGeometry is a way of batching up geometry into a more
|
---|
| 2213 | efficient form at the expense of being able to move it. Please
|
---|
| 2214 | read the StaticGeometry class documentation for full information.
|
---|
| 2215 | @param name The name to give the new object
|
---|
| 2216 | @returns The new StaticGeometry instance
|
---|
| 2217 | */
|
---|
| 2218 | virtual StaticGeometry* createStaticGeometry(const String& name);
|
---|
| 2219 | /** Retrieve a previously created StaticGeometry instance.
|
---|
| 2220 | @note Throws an exception if the named instance does not exist
|
---|
| 2221 | */
|
---|
| 2222 | virtual StaticGeometry* getStaticGeometry(const String& name) const;
|
---|
| 2223 | /** Returns whether a static geometry instance with the given name exists. */
|
---|
| 2224 | virtual bool hasStaticGeometry(const String& name) const;
|
---|
| 2225 | /** Remove & destroy a StaticGeometry instance. */
|
---|
| 2226 | virtual void destroyStaticGeometry(StaticGeometry* geom);
|
---|
| 2227 | /** Remove & destroy a StaticGeometry instance. */
|
---|
| 2228 | virtual void destroyStaticGeometry(const String& name);
|
---|
| 2229 | /** Remove & destroy all StaticGeometry instances. */
|
---|
| 2230 | virtual void destroyAllStaticGeometry(void);
|
---|
| 2231 |
|
---|
| 2232 |
|
---|
| 2233 | /** Create a movable object of the type specified.
|
---|
| 2234 | @remarks
|
---|
| 2235 | This is the generalised form of MovableObject creation where you can
|
---|
| 2236 | create a MovableObject of any specialised type generically, including
|
---|
| 2237 | any new types registered using plugins.
|
---|
| 2238 | @param name The name to give the object. Must be unique within type.
|
---|
| 2239 | @param typeName The type of object to create
|
---|
| 2240 | @param params Optional name/value pair list to give extra parameters to
|
---|
| 2241 | the created object.
|
---|
| 2242 | */
|
---|
| 2243 | virtual MovableObject* createMovableObject(const String& name,
|
---|
| 2244 | const String& typeName, const NameValuePairList* params = 0);
|
---|
| 2245 | /** Destroys a MovableObject with the name specified, of the type specified.
|
---|
| 2246 | @remarks
|
---|
| 2247 | The MovableObject will automatically detach itself from any nodes
|
---|
| 2248 | on destruction.
|
---|
| 2249 | */
|
---|
| 2250 | virtual void destroyMovableObject(const String& name, const String& typeName);
|
---|
| 2251 | /** Destroys a MovableObject.
|
---|
| 2252 | @remarks
|
---|
| 2253 | The MovableObject will automatically detach itself from any nodes
|
---|
| 2254 | on destruction.
|
---|
| 2255 | */
|
---|
| 2256 | virtual void destroyMovableObject(MovableObject* m);
|
---|
| 2257 | /** Destroy all MovableObjects of a given type. */
|
---|
| 2258 | virtual void destroyAllMovableObjectsByType(const String& typeName);
|
---|
| 2259 | /** Destroy all MovableObjects. */
|
---|
| 2260 | virtual void destroyAllMovableObjects(void);
|
---|
| 2261 | /** Get a reference to a previously created MovableObject.
|
---|
| 2262 | @note Throws an exception if the named instance does not exist
|
---|
| 2263 | */
|
---|
| 2264 | virtual MovableObject* getMovableObject(const String& name, const String& typeName);
|
---|
| 2265 | /** Returns whether a movable object instance with the given name exists. */
|
---|
| 2266 | virtual bool hasMovableObject(const String& name, const String& typeName) const;
|
---|
| 2267 | typedef MapIterator<MovableObjectMap> MovableObjectIterator;
|
---|
| 2268 | /** Get an iterator over all MovableObect instances of a given type. */
|
---|
| 2269 | virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
|
---|
| 2270 | /** Inject a MovableObject instance created externally.
|
---|
| 2271 | @remarks
|
---|
| 2272 | This method 'injects' a MovableObject instance created externally into
|
---|
| 2273 | the MovableObject instance registry held in the SceneManager. You
|
---|
| 2274 | might want to use this if you have a MovableObject which you don't
|
---|
| 2275 | want to register a factory for; for example a MovableObject which
|
---|
| 2276 | cannot be generally constructed by clients.
|
---|
| 2277 | @note
|
---|
| 2278 | It is important that the MovableObject has a unique name for the type,
|
---|
| 2279 | and that its getMovableType() method returns a proper type name.
|
---|
| 2280 | */
|
---|
| 2281 | virtual void injectMovableObject(MovableObject* m);
|
---|
| 2282 | /** Extract a previously injected MovableObject.
|
---|
| 2283 | @remarks
|
---|
| 2284 | Essentially this does the same as destroyMovableObject, but only
|
---|
| 2285 | removes the instance from the internal lists, it does not attempt
|
---|
| 2286 | to destroy it.
|
---|
| 2287 | */
|
---|
| 2288 | virtual void extractMovableObject(const String& name, const String& typeName);
|
---|
| 2289 | /** Extract a previously injected MovableObject.
|
---|
| 2290 | @remarks
|
---|
| 2291 | Essentially this does the same as destroyMovableObject, but only
|
---|
| 2292 | removes the instance from the internal lists, it does not attempt
|
---|
| 2293 | to destroy it.
|
---|
| 2294 | */
|
---|
| 2295 | virtual void extractMovableObject(MovableObject* m);
|
---|
| 2296 | /** Extract all injected MovableObjects of a given type.
|
---|
| 2297 | @remarks
|
---|
| 2298 | Essentially this does the same as destroyAllMovableObjectsByType,
|
---|
| 2299 | but only removes the instances from the internal lists, it does not
|
---|
| 2300 | attempt to destroy them.
|
---|
| 2301 | */
|
---|
| 2302 | virtual void extractAllMovableObjectsByType(const String& typeName);
|
---|
| 2303 |
|
---|
| 2304 | /** Sets a mask which is bitwise 'and'ed with objects own visibility masks
|
---|
| 2305 | to determine if the object is visible.
|
---|
| 2306 | */
|
---|
| 2307 | virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
|
---|
| 2308 |
|
---|
| 2309 | /** Gets a mask which is bitwise 'and'ed with objects own visibility masks
|
---|
| 2310 | to determine if the object is visible.
|
---|
| 2311 | */
|
---|
| 2312 | virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
|
---|
| 2313 |
|
---|
| 2314 | /** Sets whether the SceneManager should search for visible objects, or
|
---|
| 2315 | whether they are being manually handled.
|
---|
| 2316 | @remarks
|
---|
| 2317 | This is an advanced function, you should not use this unless you know
|
---|
| 2318 | what you are doing.
|
---|
| 2319 | */
|
---|
| 2320 | virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
|
---|
| 2321 |
|
---|
| 2322 | /** Gets whether the SceneManager should search for visible objects, or
|
---|
| 2323 | whether they are being manually handled.
|
---|
| 2324 | */
|
---|
| 2325 | virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
|
---|
| 2326 |
|
---|
| 2327 | /** Render something as if it came from the current queue.
|
---|
| 2328 | @param pass Material pass to use for setting up this quad.
|
---|
| 2329 | @param rend Renderable to render
|
---|
| 2330 | @param shadowDerivation Whether passes should be replaced with shadow caster / receiver passes
|
---|
| 2331 | */
|
---|
| 2332 | virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true);
|
---|
| 2333 |
|
---|
| 2334 | /** Indicates to the SceneManager whether it should suppress changing
|
---|
| 2335 | the RenderSystem states when rendering objects.
|
---|
| 2336 | @remarks
|
---|
| 2337 | This method allows you to tell the SceneManager not to change any
|
---|
| 2338 | RenderSystem state until you tell it to. This method is only
|
---|
| 2339 | intended for advanced use, don't use it if you're unsure of the
|
---|
| 2340 | effect. The only RenderSystems calls made are to set the world
|
---|
| 2341 | matrix for each object (note - view an projection matrices are NOT
|
---|
| 2342 | SET - they are under your control) and to render the object; it is up to
|
---|
| 2343 | the caller to do everything else, including enabling any vertex /
|
---|
| 2344 | fragment programs and updating their parameter state, and binding
|
---|
| 2345 | parameters to the RenderSystem.
|
---|
| 2346 | @note
|
---|
| 2347 | Calling this implicitly disables shadow processing since no shadows
|
---|
| 2348 | can be rendered without changing state.
|
---|
| 2349 | @param suppress If true, no RenderSystem state changes will be issued
|
---|
| 2350 | until this method is called again with a parameter of false.
|
---|
| 2351 | */
|
---|
| 2352 | virtual void _suppressRenderStateChanges(bool suppress);
|
---|
| 2353 |
|
---|
| 2354 | /** Are render state changes suppressed?
|
---|
| 2355 | @see _suppressRenderStateChanges
|
---|
| 2356 | */
|
---|
| 2357 | virtual bool _areRenderStateChangesSuppressed(void) const
|
---|
| 2358 | { return mSuppressRenderStateChanges; }
|
---|
| 2359 |
|
---|
| 2360 | /** Internal method for setting up the renderstate for a rendering pass.
|
---|
| 2361 | @param pass The Pass details to set.
|
---|
| 2362 | @param evenIfSuppressed Sets the pass details even if render state
|
---|
| 2363 | changes are suppressed; if you are using this to manually set state
|
---|
| 2364 | when render state changes are suppressed, you should set this to
|
---|
| 2365 | true.
|
---|
| 2366 | @param shadowDerivation If false, disables the derivation of shadow
|
---|
| 2367 | passes from original passes
|
---|
| 2368 | @returns
|
---|
| 2369 | A Pass object that was used instead of the one passed in, can
|
---|
| 2370 | happen when rendering shadow passes
|
---|
| 2371 | */
|
---|
| 2372 | virtual const Pass* _setPass(const Pass* pass,
|
---|
| 2373 | bool evenIfSuppressed = false, bool shadowDerivation = true);
|
---|
| 2374 |
|
---|
| 2375 |
|
---|
| 2376 | /** Indicates to the SceneManager whether it should suppress the
|
---|
| 2377 | active shadow rendering technique until told otherwise.
|
---|
| 2378 | @remarks
|
---|
| 2379 | This is a temporary alternative to setShadowTechnique to suppress
|
---|
| 2380 | the rendering of shadows and forcing all processing down the
|
---|
| 2381 | standard rendering path. This is intended for internal use only.
|
---|
| 2382 | @param suppress If true, no shadow rendering will occur until this
|
---|
| 2383 | method is called again with a parameter of false.
|
---|
| 2384 | */
|
---|
| 2385 | virtual void _suppressShadows(bool suppress);
|
---|
| 2386 |
|
---|
| 2387 | /** Are shadows suppressed?
|
---|
| 2388 | @see _suppressShadows
|
---|
| 2389 | */
|
---|
| 2390 | virtual bool _areShadowsSuppressed(void) const
|
---|
| 2391 | { return mSuppressShadows; }
|
---|
| 2392 |
|
---|
| 2393 | /** Render the objects in a given queue group
|
---|
| 2394 | @remarks You should only call this from a RenderQueueInvocation implementation
|
---|
| 2395 | */
|
---|
| 2396 | virtual void _renderQueueGroupObjects(RenderQueueGroup* group,
|
---|
| 2397 | QueuedRenderableCollection::OrganisationMode om);
|
---|
| 2398 |
|
---|
| 2399 | /** Get the rendersystem subclass to which the output of this Scene Manager
|
---|
| 2400 | gets sent
|
---|
| 2401 | */
|
---|
| 2402 | RenderSystem *getDestinationRenderSystem();
|
---|
| 2403 |
|
---|
| 2404 | /** Gets the current viewport being rendered (advanced use only, only
|
---|
| 2405 | valid during viewport update. */
|
---|
| 2406 | Viewport* getCurrentViewport(void) { return mCurrentViewport; }
|
---|
| 2407 |
|
---|
| 2408 | };
|
---|
| 2409 |
|
---|
| 2410 | /** Default implementation of IntersectionSceneQuery. */
|
---|
| 2411 | class _OgreExport DefaultIntersectionSceneQuery :
|
---|
| 2412 | public IntersectionSceneQuery
|
---|
| 2413 | {
|
---|
| 2414 | public:
|
---|
| 2415 | DefaultIntersectionSceneQuery(SceneManager* creator);
|
---|
| 2416 | ~DefaultIntersectionSceneQuery();
|
---|
| 2417 |
|
---|
| 2418 | /** See IntersectionSceneQuery. */
|
---|
| 2419 | void execute(IntersectionSceneQueryListener* listener);
|
---|
| 2420 | };
|
---|
| 2421 |
|
---|
| 2422 | /** Default implementation of RaySceneQuery. */
|
---|
| 2423 | class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
|
---|
| 2424 | {
|
---|
| 2425 | public:
|
---|
| 2426 | DefaultRaySceneQuery(SceneManager* creator);
|
---|
| 2427 | ~DefaultRaySceneQuery();
|
---|
| 2428 |
|
---|
| 2429 | /** See RayScenQuery. */
|
---|
| 2430 | void execute(RaySceneQueryListener* listener);
|
---|
| 2431 | };
|
---|
| 2432 | /** Default implementation of SphereSceneQuery. */
|
---|
| 2433 | class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
|
---|
| 2434 | {
|
---|
| 2435 | public:
|
---|
| 2436 | DefaultSphereSceneQuery(SceneManager* creator);
|
---|
| 2437 | ~DefaultSphereSceneQuery();
|
---|
| 2438 |
|
---|
| 2439 | /** See SceneQuery. */
|
---|
| 2440 | void execute(SceneQueryListener* listener);
|
---|
| 2441 | };
|
---|
| 2442 | /** Default implementation of PlaneBoundedVolumeListSceneQuery. */
|
---|
| 2443 | class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
|
---|
| 2444 | {
|
---|
| 2445 | public:
|
---|
| 2446 | DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
|
---|
| 2447 | ~DefaultPlaneBoundedVolumeListSceneQuery();
|
---|
| 2448 |
|
---|
| 2449 | /** See SceneQuery. */
|
---|
| 2450 | void execute(SceneQueryListener* listener);
|
---|
| 2451 | };
|
---|
| 2452 | /** Default implementation of AxisAlignedBoxSceneQuery. */
|
---|
| 2453 | class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
|
---|
| 2454 | {
|
---|
| 2455 | public:
|
---|
| 2456 | DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
|
---|
| 2457 | ~DefaultAxisAlignedBoxSceneQuery();
|
---|
| 2458 |
|
---|
| 2459 | /** See RayScenQuery. */
|
---|
| 2460 | void execute(SceneQueryListener* listener);
|
---|
| 2461 | };
|
---|
| 2462 |
|
---|
| 2463 |
|
---|
| 2464 | /// Bitmask containing scene types
|
---|
| 2465 | typedef uint16 SceneTypeMask;
|
---|
| 2466 |
|
---|
| 2467 | /** Classification of a scene to allow a decision of what type of
|
---|
| 2468 | SceenManager to provide back to the application.
|
---|
| 2469 | */
|
---|
| 2470 | enum SceneType
|
---|
| 2471 | {
|
---|
| 2472 | ST_GENERIC = 1,
|
---|
| 2473 | ST_EXTERIOR_CLOSE = 2,
|
---|
| 2474 | ST_EXTERIOR_FAR = 4,
|
---|
| 2475 | ST_EXTERIOR_REAL_FAR = 8,
|
---|
| 2476 | ST_INTERIOR = 16
|
---|
| 2477 | };
|
---|
| 2478 |
|
---|
| 2479 | /** Structure containing information about a scene manager. */
|
---|
| 2480 | struct SceneManagerMetaData
|
---|
| 2481 | {
|
---|
| 2482 | /// A globally unique string identifying the scene manager type
|
---|
| 2483 | String typeName;
|
---|
| 2484 | /// A text description of the scene manager
|
---|
| 2485 | String description;
|
---|
| 2486 | /// A mask describing which sorts of scenes this manager can handle
|
---|
| 2487 | SceneTypeMask sceneTypeMask;
|
---|
| 2488 | /// Flag indicating whether world geometry is supported
|
---|
| 2489 | bool worldGeometrySupported;
|
---|
| 2490 | };
|
---|
| 2491 |
|
---|
| 2492 |
|
---|
| 2493 |
|
---|
| 2494 | /** Class which will create instances of a given SceneManager. */
|
---|
| 2495 | class _OgreExport SceneManagerFactory
|
---|
| 2496 | {
|
---|
| 2497 | protected:
|
---|
| 2498 | mutable SceneManagerMetaData mMetaData;
|
---|
| 2499 | mutable bool mMetaDataInit;
|
---|
| 2500 | /// Internal method to initialise the metadata, must be implemented
|
---|
| 2501 | virtual void initMetaData(void) const = 0;
|
---|
| 2502 | public:
|
---|
| 2503 | SceneManagerFactory() : mMetaDataInit(true) {}
|
---|
| 2504 | virtual ~SceneManagerFactory() {}
|
---|
| 2505 | /** Get information about the SceneManager type created by this factory. */
|
---|
| 2506 | virtual const SceneManagerMetaData& getMetaData(void) const
|
---|
| 2507 | {
|
---|
| 2508 | if (mMetaDataInit)
|
---|
| 2509 | {
|
---|
| 2510 | initMetaData();
|
---|
| 2511 | mMetaDataInit = false;
|
---|
| 2512 | }
|
---|
| 2513 | return mMetaData;
|
---|
| 2514 | }
|
---|
| 2515 | /** Create a new instance of a SceneManager.
|
---|
| 2516 | @remarks
|
---|
| 2517 | Don't call directly, use SceneManagerEnumerator::createSceneManager.
|
---|
| 2518 | */
|
---|
| 2519 | virtual SceneManager* createInstance(const String& instanceName) = 0;
|
---|
| 2520 | /** Destroy an instance of a SceneManager. */
|
---|
| 2521 | virtual void destroyInstance(SceneManager* instance) = 0;
|
---|
| 2522 |
|
---|
| 2523 | };
|
---|
| 2524 |
|
---|
| 2525 |
|
---|
| 2526 |
|
---|
| 2527 | } // Namespace
|
---|
| 2528 |
|
---|
| 2529 |
|
---|
| 2530 |
|
---|
| 2531 | #endif
|
---|