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