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 "OgreRenderQueue.h" |
---|
38 | #include "OgreAnimationState.h" |
---|
39 | #include "OgreSceneQuery.h" |
---|
40 | #include "OgreAutoParamDataSource.h" |
---|
41 | #include "OgreAnimationState.h" |
---|
42 | #include "OgreRenderQueue.h" |
---|
43 | #include "OgreRenderQueueSortingGrouping.h" |
---|
44 | #include "OgreRectangle2D.h" |
---|
45 | |
---|
46 | namespace Ogre { |
---|
47 | |
---|
48 | /** Structure for holding a position & orientation pair. */ |
---|
49 | struct ViewPoint |
---|
50 | { |
---|
51 | Vector3 position; |
---|
52 | Quaternion orientation; |
---|
53 | }; |
---|
54 | |
---|
55 | // Forward declarations |
---|
56 | class DefaultIntersectionSceneQuery; |
---|
57 | class DefaultRaySceneQuery; |
---|
58 | class DefaultSphereSceneQuery; |
---|
59 | class DefaultAxisAlignedBoxSceneQuery; |
---|
60 | |
---|
61 | /** Manages the rendering of a 'scene' i.e. a collection of primitives. |
---|
62 | @remarks |
---|
63 | This class defines the basic behaviour of the 'Scene Manager' family. These classes will |
---|
64 | organise the objects in the scene and send them to the rendering system, a subclass of |
---|
65 | RenderSystem. This basic superclass does no sorting, culling or organising of any sort. |
---|
66 | @par |
---|
67 | Subclasses may use various techniques to organise the scene depending on how they are |
---|
68 | designed (e.g. BSPs, octrees etc). As with other classes, methods preceded with '_' are |
---|
69 | designed to be called by other classes in the Ogre system, not by user applications, |
---|
70 | although this is not forbidden. |
---|
71 | @author |
---|
72 | Steve Streeting |
---|
73 | @version |
---|
74 | 1.0 |
---|
75 | */ |
---|
76 | class _OgreExport SceneManager |
---|
77 | { |
---|
78 | friend class DefaultIntersectionSceneQuery; |
---|
79 | friend class DefaultRaySceneQuery; |
---|
80 | friend class DefaultSphereSceneQuery; |
---|
81 | friend class DefaultAxisAlignedBoxSceneQuery; |
---|
82 | friend class DefaultPlaneBoundedVolumeListSceneQuery; |
---|
83 | public: |
---|
84 | /// Query mask which will be used for world geometry @see SceneQuery |
---|
85 | static unsigned long WORLD_GEOMETRY_QUERY_MASK; |
---|
86 | /** Comparator for material map, for sorting materials into render order (e.g. transparent last). |
---|
87 | */ |
---|
88 | struct materialLess |
---|
89 | { |
---|
90 | _OgreExport bool operator()(const Material* x, const Material* y) const; |
---|
91 | }; |
---|
92 | /// Comparator for sorting lights relative to a point |
---|
93 | struct lightLess |
---|
94 | { |
---|
95 | _OgreExport bool operator()(const Light* a, const Light* b) const; |
---|
96 | }; |
---|
97 | |
---|
98 | /// Describes the stage of rendering when performing complex illumination |
---|
99 | enum IlluminationRenderStage |
---|
100 | { |
---|
101 | /// No special illumination stage |
---|
102 | IRS_NONE, |
---|
103 | /// Ambient stage, when background light is added |
---|
104 | IRS_AMBIENT, |
---|
105 | /// Diffuse / specular stage, when individual light contributions are added |
---|
106 | IRS_PER_LIGHT, |
---|
107 | /// Decal stage, when texture detail is added to the lit base |
---|
108 | IRS_DECAL, |
---|
109 | /// Render to texture stage, used for texture based shadows |
---|
110 | IRS_RENDER_TO_TEXTURE, |
---|
111 | /// Modulative render from shadow texture stage |
---|
112 | IRS_RENDER_MODULATIVE_PASS |
---|
113 | }; |
---|
114 | |
---|
115 | /** Enumeration of the possible modes allowed for processing the special case |
---|
116 | render queue list. |
---|
117 | @see SceneManager::setSpecialCaseRenderQueueMode |
---|
118 | */ |
---|
119 | enum SpecialCaseRenderQueueMode |
---|
120 | { |
---|
121 | /// Render only the queues in the special case list |
---|
122 | SCRQM_INCLUDE, |
---|
123 | /// Render all except the queues in the special case list |
---|
124 | SCRQM_EXCLUDE |
---|
125 | }; |
---|
126 | #ifdef GTP_VISIBILITY_MODIFIED_OGRE |
---|
127 | /** added by matt: Render content of current scene node. |
---|
128 | @param node scene node to be rendered |
---|
129 | @param cam current camera |
---|
130 | */ |
---|
131 | void _renderSceneNode( Camera *cam, SceneNode *node ); |
---|
132 | |
---|
133 | /** deletes all queues which we were currently processing |
---|
134 | @remark clears renderqueue after rendering scene node |
---|
135 | */ |
---|
136 | void _deleteRenderedQueueGroups(); |
---|
137 | |
---|
138 | |
---|
139 | void myrenderSingleObject(Renderable* rend, Pass* pass, bool doLightIteration, |
---|
140 | const LightList* manualLightList = 0) |
---|
141 | { |
---|
142 | setPass(pass); |
---|
143 | renderSingleObject(rend, pass, doLightIteration, manualLightList);} |
---|
144 | |
---|
145 | #endif // GTP_VISIBILITY_MODIFIED_OGRE |
---|
146 | /** Internal method used by _renderVisibleObjects to deal with renderables |
---|
147 | which override the camera's own view / projection materices. made |
---|
148 | public by matt */ |
---|
149 | void useRenderableViewProjMode(Renderable* pRend); |
---|
150 | |
---|
151 | protected: |
---|
152 | |
---|
153 | /// Queue of objects for rendering |
---|
154 | RenderQueue* mRenderQueue; |
---|
155 | |
---|
156 | /// Current ambient light, cached for RenderSystem |
---|
157 | ColourValue mAmbientLight; |
---|
158 | |
---|
159 | /// The rendering system to send the scene to |
---|
160 | RenderSystem *mDestRenderSystem; |
---|
161 | |
---|
162 | typedef std::map<String, Camera* > CameraList; |
---|
163 | |
---|
164 | /** Central list of cameras - for easy memory management and lookup. |
---|
165 | */ |
---|
166 | CameraList mCameras; |
---|
167 | |
---|
168 | typedef std::map<String, Light* > SceneLightList; |
---|
169 | |
---|
170 | /** Central list of lights - for easy memory management and lookup. |
---|
171 | */ |
---|
172 | SceneLightList mLights; |
---|
173 | |
---|
174 | |
---|
175 | typedef std::map<String, Entity* > EntityList; |
---|
176 | |
---|
177 | /** Central list of entities - for easy memory management and lookup. |
---|
178 | */ |
---|
179 | EntityList mEntities; |
---|
180 | |
---|
181 | typedef std::map<String, BillboardSet* > BillboardSetList; |
---|
182 | |
---|
183 | /** Central list of billboard sets - for easy memory management and lookup. |
---|
184 | */ |
---|
185 | BillboardSetList mBillboardSets; |
---|
186 | |
---|
187 | typedef std::map<String, StaticGeometry* > StaticGeometryList; |
---|
188 | StaticGeometryList mStaticGeometryList; |
---|
189 | |
---|
190 | typedef std::map<String, SceneNode*> SceneNodeList; |
---|
191 | |
---|
192 | /** Central list of SceneNodes - for easy memory management. |
---|
193 | @note |
---|
194 | Note that this list is used only for memory management; the structure of the scene |
---|
195 | is held using the hierarchy of SceneNodes starting with the root node. However you |
---|
196 | can look up nodes this way. |
---|
197 | */ |
---|
198 | SceneNodeList mSceneNodes; |
---|
199 | |
---|
200 | /// Camera in progress |
---|
201 | Camera* mCameraInProgress; |
---|
202 | /// Current Viewport |
---|
203 | Viewport* mCurrentViewport; |
---|
204 | |
---|
205 | /// Root scene node |
---|
206 | SceneNode* mSceneRoot; |
---|
207 | |
---|
208 | /// Autotracking scene nodes |
---|
209 | typedef std::set<SceneNode*> AutoTrackingSceneNodes; |
---|
210 | AutoTrackingSceneNodes mAutoTrackingSceneNodes; |
---|
211 | |
---|
212 | // Sky params |
---|
213 | // Sky plane |
---|
214 | Entity* mSkyPlaneEntity; |
---|
215 | Entity* mSkyDomeEntity[5]; |
---|
216 | Entity* mSkyBoxEntity[6]; |
---|
217 | |
---|
218 | SceneNode* mSkyPlaneNode; |
---|
219 | SceneNode* mSkyDomeNode; |
---|
220 | SceneNode* mSkyBoxNode; |
---|
221 | |
---|
222 | bool mSkyPlaneEnabled; |
---|
223 | bool mSkyPlaneDrawFirst; |
---|
224 | Plane mSkyPlane; |
---|
225 | // Sky box |
---|
226 | bool mSkyBoxEnabled; |
---|
227 | bool mSkyBoxDrawFirst; |
---|
228 | Quaternion mSkyBoxOrientation; |
---|
229 | // Sky dome |
---|
230 | bool mSkyDomeEnabled; |
---|
231 | bool mSkyDomeDrawFirst; |
---|
232 | Quaternion mSkyDomeOrientation; |
---|
233 | // Fog |
---|
234 | FogMode mFogMode; |
---|
235 | ColourValue mFogColour; |
---|
236 | Real mFogStart; |
---|
237 | Real mFogEnd; |
---|
238 | Real mFogDensity; |
---|
239 | |
---|
240 | typedef std::set<RenderQueueGroupID> SpecialCaseRenderQueueList; |
---|
241 | SpecialCaseRenderQueueList mSpecialCaseQueueList; |
---|
242 | SpecialCaseRenderQueueMode mSpecialCaseQueueMode; |
---|
243 | RenderQueueGroupID mWorldGeometryRenderQueue; |
---|
244 | |
---|
245 | /** Internal method for initialising the render queue. |
---|
246 | @remarks |
---|
247 | Subclasses can use this to install their own RenderQueue implementation. |
---|
248 | */ |
---|
249 | virtual void initRenderQueue(void); |
---|
250 | /** Retrieves the internal render queue. */ |
---|
251 | virtual RenderQueue* getRenderQueue(void); |
---|
252 | /** Internal method for setting up the renderstate for a rendering pass. |
---|
253 | @param |
---|
254 | pass The Pass details to set. |
---|
255 | @returns |
---|
256 | A Pass object that was used instead of the one passed in, can |
---|
257 | happen when rendering shadow passes |
---|
258 | */ |
---|
259 | virtual Pass* setPass(Pass* pass); |
---|
260 | /// A pass designed to let us render shadow colour on white for texture shadows |
---|
261 | Pass* mShadowCasterPlainBlackPass; |
---|
262 | /// A pass designed to let us render shadow receivers for texture shadows |
---|
263 | Pass* mShadowReceiverPass; |
---|
264 | /** Internal method for turning a regular pass into a shadow caster pass. |
---|
265 | @remarks |
---|
266 | This is only used for texture shadows, basically we're trying to |
---|
267 | ensure that objects are rendered solid black. |
---|
268 | This method will usually return the standard solid black pass for |
---|
269 | all fixed function passes, but will merge in a vertex program |
---|
270 | and fudge the AutpoParamDataSource to set black lighting for |
---|
271 | passes with vertex programs. |
---|
272 | */ |
---|
273 | Pass* deriveShadowCasterPass(Pass* pass); |
---|
274 | /** Internal method for turning a regular pass into a shadow receiver pass. |
---|
275 | @remarks |
---|
276 | This is only used for texture shadows, basically we're trying to |
---|
277 | ensure that objects are rendered with a projective texture. |
---|
278 | This method will usually return a standard single-texture pass for |
---|
279 | all fixed function passes, but will merge in a vertex program |
---|
280 | for passes with vertex programs. |
---|
281 | */ |
---|
282 | Pass* deriveShadowReceiverPass(Pass* pass); |
---|
283 | |
---|
284 | /** Internal method to validate whether a Pass should be allowed to render. |
---|
285 | @remarks |
---|
286 | Called just before a pass is about to be used for rendering a group to |
---|
287 | allow the SceneManager to omit it if required. A return value of false |
---|
288 | skips this pass. |
---|
289 | */ |
---|
290 | bool validatePassForRendering(Pass* pass); |
---|
291 | |
---|
292 | /** Internal method to validate whether a Renderable should be allowed to render. |
---|
293 | @remarks |
---|
294 | Called just before a pass is about to be used for rendering a Renderable to |
---|
295 | allow the SceneManager to omit it if required. A return value of false |
---|
296 | skips it. |
---|
297 | */ |
---|
298 | bool validateRenderableForRendering(Pass* pass, Renderable* rend); |
---|
299 | |
---|
300 | enum BoxPlane |
---|
301 | { |
---|
302 | BP_FRONT = 0, |
---|
303 | BP_BACK = 1, |
---|
304 | BP_LEFT = 2, |
---|
305 | BP_RIGHT = 3, |
---|
306 | BP_UP = 4, |
---|
307 | BP_DOWN = 5 |
---|
308 | }; |
---|
309 | |
---|
310 | /* Internal utility method for creating the planes of a skybox. |
---|
311 | */ |
---|
312 | MeshPtr createSkyboxPlane( |
---|
313 | BoxPlane bp, |
---|
314 | Real distance, |
---|
315 | const Quaternion& orientation, |
---|
316 | const String& groupName); |
---|
317 | |
---|
318 | /* Internal utility method for creating the planes of a skydome. |
---|
319 | */ |
---|
320 | MeshPtr createSkydomePlane( |
---|
321 | BoxPlane bp, |
---|
322 | Real curvature, Real tiling, Real distance, |
---|
323 | const Quaternion& orientation, |
---|
324 | int xsegments, int ysegments, int ySegmentsToKeep, |
---|
325 | const String& groupName); |
---|
326 | |
---|
327 | // Flag indicating whether SceneNodes will be rendered as a set of 3 axes |
---|
328 | bool mDisplayNodes; |
---|
329 | |
---|
330 | /// Storage of animations, lookup by name |
---|
331 | typedef std::map<String, Animation*> AnimationList; |
---|
332 | AnimationList mAnimationsList; |
---|
333 | AnimationStateSet mAnimationStates; |
---|
334 | |
---|
335 | /// Controller flag for determining if we need to set view/proj matrices |
---|
336 | bool mCamChanged; |
---|
337 | |
---|
338 | typedef std::vector<RenderQueueListener*> RenderQueueListenerList; |
---|
339 | RenderQueueListenerList mRenderQueueListeners; |
---|
340 | |
---|
341 | /// Internal method for firing the queue start event, returns true if queue is to be skipped |
---|
342 | bool fireRenderQueueStarted(RenderQueueGroupID id); |
---|
343 | /// Internal method for firing the queue end event, returns true if queue is to be repeated |
---|
344 | bool fireRenderQueueEnded(RenderQueueGroupID id); |
---|
345 | |
---|
346 | /** Internal method for setting the destination viewport for the next render. */ |
---|
347 | virtual void setViewport(Viewport *vp); |
---|
348 | |
---|
349 | /** Flag that indicates if all of the scene node's bounding boxes should be shown as a wireframe. */ |
---|
350 | bool mShowBoundingBoxes; |
---|
351 | |
---|
352 | /** Internal utility method for rendering a single object. |
---|
353 | @remarks |
---|
354 | Assumes that the pass has already been set up. |
---|
355 | @param rend The renderable to issue to the pipeline |
---|
356 | @param pass The pass which is being used |
---|
357 | @param doLightIteration If true, this method will issue the renderable to |
---|
358 | the pipeline possibly multiple times, if the pass indicates it should be |
---|
359 | done once per light |
---|
360 | @param manualLightList Only applicable if doLightIteration is false, this |
---|
361 | method allows you to pass in a previously determined set of lights |
---|
362 | which will be used for a single render of this object. |
---|
363 | */ |
---|
364 | virtual void renderSingleObject(Renderable* rend, Pass* pass, bool doLightIteration, |
---|
365 | const LightList* manualLightList = 0); |
---|
366 | |
---|
367 | /// Utility class for calculating automatic parameters for gpu programs |
---|
368 | AutoParamDataSource mAutoParamDataSource; |
---|
369 | |
---|
370 | ShadowTechnique mShadowTechnique; |
---|
371 | bool mDebugShadows; |
---|
372 | ColourValue mShadowColour; |
---|
373 | Pass* mShadowDebugPass; |
---|
374 | Pass* mShadowStencilPass; |
---|
375 | Pass* mShadowModulativePass; |
---|
376 | bool mShadowMaterialInitDone; |
---|
377 | LightList mLightsAffectingFrustum; |
---|
378 | HardwareIndexBufferSharedPtr mShadowIndexBuffer; |
---|
379 | size_t mShadowIndexBufferSize; |
---|
380 | Rectangle2D* mFullScreenQuad; |
---|
381 | Real mShadowDirLightExtrudeDist; |
---|
382 | IlluminationRenderStage mIlluminationStage; |
---|
383 | unsigned short mShadowTextureSize; |
---|
384 | unsigned short mShadowTextureCount; |
---|
385 | PixelFormat mShadowTextureFormat; |
---|
386 | typedef std::vector<RenderTexture*> ShadowTextureList; |
---|
387 | ShadowTextureList mShadowTextures; |
---|
388 | RenderTexture* mCurrentShadowTexture; |
---|
389 | bool mShadowUseInfiniteFarPlane; |
---|
390 | /** Internal method for locating a list of lights which could be affecting the frustum. |
---|
391 | @remarks |
---|
392 | Custom scene managers are encouraged to override this method to make use of their |
---|
393 | scene partitioning scheme to more efficiently locate lights, and to eliminate lights |
---|
394 | which may be occluded by word geometry. |
---|
395 | */ |
---|
396 | virtual void findLightsAffectingFrustum(const Camera* camera); |
---|
397 | /// Internal method for setting up materials for shadows |
---|
398 | virtual void initShadowVolumeMaterials(void); |
---|
399 | /// Internal method for creating shadow textures (texture-based shadows) |
---|
400 | virtual void createShadowTextures(unsigned short size, unsigned short count, |
---|
401 | PixelFormat fmt); |
---|
402 | /// Internal method for preparing shadow textures ready for use in a regular render |
---|
403 | virtual void prepareShadowTextures(Camera* cam, Viewport* vp); |
---|
404 | |
---|
405 | /** Internal method for rendering all the objects for a given light into the |
---|
406 | stencil buffer. |
---|
407 | @param light The light source |
---|
408 | @param cam The camera being viewed from |
---|
409 | */ |
---|
410 | virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam); |
---|
411 | /** Internal utility method for setting stencil state for rendering shadow volumes. |
---|
412 | @param secondpass Is this the second pass? |
---|
413 | @param zfail Should we be using the zfail method? |
---|
414 | @param twosided Should we use a 2-sided stencil? |
---|
415 | */ |
---|
416 | virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided); |
---|
417 | /** Render a set of shadow renderables. */ |
---|
418 | void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables, |
---|
419 | Pass* pass, const LightList *manualLightList, unsigned long flags, |
---|
420 | bool secondpass, bool zfail, bool twosided); |
---|
421 | typedef std::vector<ShadowCaster*> ShadowCasterList; |
---|
422 | ShadowCasterList mShadowCasterList; |
---|
423 | SphereSceneQuery* mShadowCasterSphereQuery; |
---|
424 | AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery; |
---|
425 | Real mShadowFarDist; |
---|
426 | Real mShadowFarDistSquared; |
---|
427 | Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4 |
---|
428 | Real mShadowTextureFadeStart; // as a proportion e.g. 0.6 |
---|
429 | Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9 |
---|
430 | bool mShadowTextureSelfShadow; |
---|
431 | Pass* mShadowTextureCustomCasterPass; |
---|
432 | Pass* mShadowTextureCustomReceiverPass; |
---|
433 | String mShadowTextureCustomCasterVertexProgram; |
---|
434 | String mShadowTextureCustomReceiverVertexProgram; |
---|
435 | GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams; |
---|
436 | GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams; |
---|
437 | bool mShadowTextureCasterVPDirty; |
---|
438 | bool mShadowTextureReceiverVPDirty; |
---|
439 | |
---|
440 | |
---|
441 | GpuProgramParametersSharedPtr mInfiniteExtrusionParams; |
---|
442 | GpuProgramParametersSharedPtr mFiniteExtrusionParams; |
---|
443 | |
---|
444 | /// Inner class to use as callback for shadow caster scene query |
---|
445 | class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener |
---|
446 | { |
---|
447 | protected: |
---|
448 | SceneManager* mSceneMgr; |
---|
449 | ShadowCasterList* mCasterList; |
---|
450 | bool mIsLightInFrustum; |
---|
451 | const PlaneBoundedVolumeList* mLightClipVolumeList; |
---|
452 | const Camera* mCamera; |
---|
453 | const Light* mLight; |
---|
454 | Real mFarDistSquared; |
---|
455 | public: |
---|
456 | ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm), |
---|
457 | mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0), |
---|
458 | mCamera(0) {} |
---|
459 | // Prepare the listener for use with a set of parameters |
---|
460 | void prepare(bool lightInFrustum, |
---|
461 | const PlaneBoundedVolumeList* lightClipVolumes, |
---|
462 | const Light* light, const Camera* cam, ShadowCasterList* casterList, |
---|
463 | Real farDistSquared) |
---|
464 | { |
---|
465 | mCasterList = casterList; |
---|
466 | mIsLightInFrustum = lightInFrustum; |
---|
467 | mLightClipVolumeList = lightClipVolumes; |
---|
468 | mCamera = cam; |
---|
469 | mLight = light; |
---|
470 | mFarDistSquared = farDistSquared; |
---|
471 | } |
---|
472 | bool queryResult(MovableObject* object); |
---|
473 | bool queryResult(SceneQuery::WorldFragment* fragment); |
---|
474 | }; |
---|
475 | |
---|
476 | ShadowCasterSceneQueryListener* mShadowCasterQueryListener; |
---|
477 | |
---|
478 | /** Internal method for locating a list of shadow casters which |
---|
479 | could be affecting the frustum for a given light. |
---|
480 | @remarks |
---|
481 | Custom scene managers are encouraged to override this method to add optimisations, |
---|
482 | and to add their own custom shadow casters (perhaps for world geometry) |
---|
483 | */ |
---|
484 | virtual const ShadowCasterList& findShadowCastersForLight(const Light* light, |
---|
485 | const Camera* camera); |
---|
486 | /** Render the objects in a given queue group |
---|
487 | */ |
---|
488 | virtual void renderQueueGroupObjects(RenderQueueGroup* group); |
---|
489 | /** Render a group in the ordinary way */ |
---|
490 | virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup); |
---|
491 | /** Render a group with the added complexity of additive stencil shadows. */ |
---|
492 | virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group); |
---|
493 | /** Render a group with the added complexity of additive stencil shadows. */ |
---|
494 | virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group); |
---|
495 | /** Render a group rendering only shadow casters. */ |
---|
496 | virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group); |
---|
497 | /** Render a group rendering only shadow receivers. */ |
---|
498 | virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group); |
---|
499 | /** Render a group with the added complexity of additive stencil shadows. */ |
---|
500 | virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group); |
---|
501 | /** Render a set of objects, see renderSingleObject for param definitions */ |
---|
502 | virtual void renderObjects(const RenderPriorityGroup::SolidRenderablePassMap& objs, |
---|
503 | bool doLightIteration, const LightList* manualLightList = 0); |
---|
504 | /** Render a set of objects, see renderSingleObject for param definitions */ |
---|
505 | virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs, |
---|
506 | bool doLightIteration, const LightList* manualLightList = 0); |
---|
507 | /** Render those objects in the transparent pass list which have shadow casting forced on |
---|
508 | @remarks |
---|
509 | This function is intended to be used to render the shadows of transparent objects which have |
---|
510 | transparency_casts_shadows set to 'on' in their material |
---|
511 | */ |
---|
512 | virtual void renderTransparentShadowCasterObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs, |
---|
513 | bool doLightIteration, const LightList* manualLightList = 0); |
---|
514 | |
---|
515 | public: |
---|
516 | /** Default constructor. |
---|
517 | */ |
---|
518 | SceneManager(); |
---|
519 | |
---|
520 | /** Default destructor. |
---|
521 | */ |
---|
522 | virtual ~SceneManager(); |
---|
523 | |
---|
524 | /** Creates a camera to be managed by this scene manager. |
---|
525 | @remarks |
---|
526 | This camera must be added to the scene at a later time using |
---|
527 | the attachObject method of the SceneNode class. |
---|
528 | @param |
---|
529 | name Name to give the new camera. |
---|
530 | */ |
---|
531 | virtual Camera* createCamera(const String& name); |
---|
532 | |
---|
533 | /** Retrieves a pointer to the named camera. |
---|
534 | */ |
---|
535 | virtual Camera* getCamera(const String& name); |
---|
536 | |
---|
537 | /** Removes a camera from the scene. |
---|
538 | @remarks |
---|
539 | This method removes a previously added camera from the scene. |
---|
540 | The camera is deleted so the caller must ensure no references |
---|
541 | to it's previous instance (e.g. in a SceneNode) are used. |
---|
542 | @param |
---|
543 | cam Pointer to the camera to remove |
---|
544 | */ |
---|
545 | virtual void removeCamera(Camera *cam); |
---|
546 | |
---|
547 | /** Removes a camera from the scene. |
---|
548 | @remarks |
---|
549 | This method removes an camera from the scene based on the |
---|
550 | camera's name rather than a pointer. |
---|
551 | */ |
---|
552 | virtual void removeCamera(const String& name); |
---|
553 | |
---|
554 | /** Removes (and destroys) all cameras from the scene. |
---|
555 | */ |
---|
556 | virtual void removeAllCameras(void); |
---|
557 | |
---|
558 | /** Creates a light for use in the scene. |
---|
559 | @remarks |
---|
560 | Lights can either be in a fixed position and independent of the |
---|
561 | scene graph, or they can be attached to SceneNodes so they derive |
---|
562 | their position from the parent node. Either way, they are created |
---|
563 | using this method so that the SceneManager manages their |
---|
564 | existence. |
---|
565 | @param |
---|
566 | name The name of the new light, to identify it later. |
---|
567 | */ |
---|
568 | virtual Light* createLight(const String& name); |
---|
569 | |
---|
570 | /** Returns a pointer to the named Light which has previously been added to the scene. |
---|
571 | */ |
---|
572 | virtual Light* getLight(const String& name); |
---|
573 | |
---|
574 | /** Removes the named light from the scene and destroys it. |
---|
575 | @remarks |
---|
576 | Any pointers held to this light after calling this method will be invalid. |
---|
577 | */ |
---|
578 | virtual void removeLight(const String& name); |
---|
579 | |
---|
580 | /** Removes the light from the scene and destroys it based on a pointer. |
---|
581 | @remarks |
---|
582 | Any pointers held to this light after calling this method will be invalid. |
---|
583 | */ |
---|
584 | virtual void removeLight(Light* light); |
---|
585 | /** Removes and destroys all lights in the scene. |
---|
586 | */ |
---|
587 | virtual void removeAllLights(void); |
---|
588 | |
---|
589 | /** Populate a light list with an ordered set of the lights which are closest |
---|
590 | to the position specified. |
---|
591 | @remarks |
---|
592 | Note that since directional lights have no position, they are always considered |
---|
593 | closer than any point lights and as such will always take precedence. |
---|
594 | @par |
---|
595 | Subclasses of the default SceneManager may wish to take into account other issues |
---|
596 | such as possible visibility of the light if that information is included in their |
---|
597 | data structures. This basic scenemanager simply orders by distance, eliminating |
---|
598 | those lights which are out of range. |
---|
599 | @par |
---|
600 | The number of items in the list max exceed the maximum number of lights supported |
---|
601 | by the renderer, but the extraneous ones will never be used. In fact the limit will |
---|
602 | be imposed by Pass::getMaxSimultaneousLights. |
---|
603 | @param position The position at which to evaluate the list of lights |
---|
604 | @param radius The bounding radius to test |
---|
605 | @param destList List to be populated with ordered set of lights; will be cleared by |
---|
606 | this method before population. |
---|
607 | */ |
---|
608 | virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList); |
---|
609 | |
---|
610 | |
---|
611 | /** Creates an instance of a SceneNode. |
---|
612 | @remarks |
---|
613 | Note that this does not add the SceneNode to the scene hierarchy. |
---|
614 | This method is for convenience, since it allows an instance to |
---|
615 | be created for which the SceneManager is responsible for |
---|
616 | allocating and releasing memory, which is convenient in complex |
---|
617 | scenes. |
---|
618 | @par |
---|
619 | To include the returned SceneNode in the scene, use the addChild |
---|
620 | method of the SceneNode which is to be it's parent. |
---|
621 | @par |
---|
622 | Note that this method takes no parameters, and the node created is unnamed (it is |
---|
623 | actually given a generated name, which you can retrieve if you want). |
---|
624 | If you wish to create a node with a specific name, call the alternative method |
---|
625 | which takes a name parameter. |
---|
626 | */ |
---|
627 | virtual SceneNode* createSceneNode(void); |
---|
628 | |
---|
629 | /** Creates an instance of a SceneNode with a given name. |
---|
630 | @remarks |
---|
631 | Note that this does not add the SceneNode to the scene hierarchy. |
---|
632 | This method is for convenience, since it allows an instance to |
---|
633 | be created for which the SceneManager is responsible for |
---|
634 | allocating and releasing memory, which is convenient in complex |
---|
635 | scenes. |
---|
636 | @par |
---|
637 | To include the returned SceneNode in the scene, use the addChild |
---|
638 | method of the SceneNode which is to be it's parent. |
---|
639 | @par |
---|
640 | Note that this method takes a name parameter, which makes the node easier to |
---|
641 | retrieve directly again later. |
---|
642 | */ |
---|
643 | virtual SceneNode* createSceneNode(const String& name); |
---|
644 | |
---|
645 | /** Destroys a SceneNode with a given name. |
---|
646 | @remarks |
---|
647 | This allows you to physically delete an individual SceneNode if you want to. |
---|
648 | Note that this is not normally recommended, it's better to allow SceneManager |
---|
649 | to delete the nodes when the scene is cleared. |
---|
650 | */ |
---|
651 | virtual void destroySceneNode(const String& name); |
---|
652 | |
---|
653 | /** Gets the SceneNode at the root of the scene hierarchy. |
---|
654 | @remarks |
---|
655 | The entire scene is held as a hierarchy of nodes, which |
---|
656 | allows things like relative transforms, general changes in |
---|
657 | rendering state etc (See the SceneNode class for more info). |
---|
658 | In this basic SceneManager class, the application using |
---|
659 | Ogre is free to structure this hierarchy however it likes, |
---|
660 | since it has no real significance apart from making transforms |
---|
661 | relative to each node (more specialised subclasses will |
---|
662 | provide utility methods for building specific node structures |
---|
663 | e.g. loading a BSP tree). |
---|
664 | @par |
---|
665 | However, in all cases there is only ever one root node of |
---|
666 | the hierarchy, and this method returns a pointer to it. |
---|
667 | */ |
---|
668 | virtual SceneNode* getRootSceneNode(void) const; |
---|
669 | |
---|
670 | /** Retrieves a named SceneNode from the scene graph. |
---|
671 | @remarks |
---|
672 | If you chose to name a SceneNode as you created it, or if you |
---|
673 | happened to make a note of the generated name, you can look it |
---|
674 | up wherever it is in the scene graph using this method. |
---|
675 | */ |
---|
676 | virtual SceneNode* getSceneNode(const String& name) const; |
---|
677 | |
---|
678 | /** Create an Entity (instance of a discrete mesh). |
---|
679 | @param |
---|
680 | entityName The name to be given to the entity (must be unique). |
---|
681 | @param |
---|
682 | meshName The name of the Mesh it is to be based on (e.g. 'knot.oof'). The |
---|
683 | mesh will be loaded if it is not already. |
---|
684 | */ |
---|
685 | virtual Entity* createEntity(const String& entityName, const String& meshName); |
---|
686 | |
---|
687 | /** Prefab shapes available without loading a model. |
---|
688 | @note |
---|
689 | Minimal implementation at present. |
---|
690 | @todo |
---|
691 | Add more prefabs (teapots, teapots!!!) |
---|
692 | */ |
---|
693 | enum PrefabType { |
---|
694 | PT_PLANE |
---|
695 | }; |
---|
696 | |
---|
697 | /** Create an Entity (instance of a discrete mesh) from a range of prefab shapes. |
---|
698 | @param |
---|
699 | entityName The name to be given to the entity (must be unique). |
---|
700 | @param |
---|
701 | ptype The prefab type. |
---|
702 | */ |
---|
703 | virtual Entity* createEntity(const String& entityName, PrefabType ptype); |
---|
704 | /** Retrieves a pointer to the named Entity. */ |
---|
705 | virtual Entity* getEntity(const String& name); |
---|
706 | |
---|
707 | /** Removes & destroys an Entity from the SceneManager. |
---|
708 | @warning |
---|
709 | Must only be done if the Entity is not attached |
---|
710 | to a SceneNode. It may be safer to wait to clear the whole |
---|
711 | scene if you are unsure use clearScene. |
---|
712 | @see |
---|
713 | SceneManager::clearScene |
---|
714 | */ |
---|
715 | virtual void removeEntity(Entity* ent); |
---|
716 | |
---|
717 | /** Removes & destroys an Entity from the SceneManager by name. |
---|
718 | @warning |
---|
719 | Must only be done if the Entity is not attached |
---|
720 | to a SceneNode. It may be safer to wait to clear the whole |
---|
721 | scene if you are unsure use clearScene. |
---|
722 | @see |
---|
723 | SceneManager::clearScene |
---|
724 | */ |
---|
725 | virtual void removeEntity(const String& name); |
---|
726 | |
---|
727 | /** Removes & destroys all Entities. |
---|
728 | @warning |
---|
729 | Again, use caution since no Entity must be referred to |
---|
730 | elsewhere e.g. attached to a SceneNode otherwise a crash |
---|
731 | is likely. Use clearScene if you are unsure (it clears SceneNode |
---|
732 | entries too.) |
---|
733 | @see |
---|
734 | SceneManager::clearScene |
---|
735 | */ |
---|
736 | virtual void removeAllEntities(void); |
---|
737 | |
---|
738 | /** Empties the entire scene, inluding all SceneNodes, Entities, Lights, |
---|
739 | BillboardSets etc. Cameras are not deleted at this stage since |
---|
740 | they are still referenced by viewports, which are not destroyed during |
---|
741 | this process. |
---|
742 | */ |
---|
743 | virtual void clearScene(void); |
---|
744 | |
---|
745 | /** Sets the ambient light level to be used for the scene. |
---|
746 | @remarks |
---|
747 | This sets the colour and intensity of the ambient light in the scene, i.e. the |
---|
748 | light which is 'sourceless' and illuminates all objects equally. |
---|
749 | The colour of an object is affected by a combination of the light in the scene, |
---|
750 | and the amount of light that object reflects (in this case based on the Material::ambient |
---|
751 | property). |
---|
752 | @remarks |
---|
753 | By default the ambient light in the scene is ColourValue::Black, i.e. no ambient light. This |
---|
754 | means that any objects rendered with a Material which has lighting enabled (see Material::setLightingEnabled) |
---|
755 | will not be visible unless you have some dynamic lights in your scene. |
---|
756 | */ |
---|
757 | void setAmbientLight(const ColourValue& colour); |
---|
758 | |
---|
759 | /** Returns the ambient light level to be used for the scene. |
---|
760 | */ |
---|
761 | const ColourValue& getAmbientLight(void) const; |
---|
762 | |
---|
763 | /** Sets the source of the 'world' geometry, i.e. the large, mainly static geometry |
---|
764 | making up the world e.g. rooms, landscape etc. |
---|
765 | @remarks |
---|
766 | Depending on the type of SceneManager (subclasses will be specialised |
---|
767 | for particular world geometry types) you have requested via the Root or |
---|
768 | SceneManagerEnumerator classes, you can pass a filename to this method and it |
---|
769 | will attempt to load the world-level geometry for use. If you try to load |
---|
770 | an inappropriate type of world data an exception will be thrown. The default |
---|
771 | SceneManager cannot handle any sort of world geometry and so will always |
---|
772 | throw an exception. However subclasses like BspSceneManager can load |
---|
773 | particular types of world geometry e.g. "q3dm1.bsp". |
---|
774 | @par |
---|
775 | World geometry will be loaded via the 'common' resource paths and archives set in the |
---|
776 | ResourceManager class. |
---|
777 | */ |
---|
778 | virtual void setWorldGeometry(const String& filename); |
---|
779 | |
---|
780 | /** Estimate the number of loading stages required to load the named |
---|
781 | world geometry. |
---|
782 | @remarks |
---|
783 | This method should be overridden by SceneManagers that provide |
---|
784 | custom world geometry that can take some time to load. They should |
---|
785 | return from this method a count of the number of stages of progress |
---|
786 | they can report on whilst loading. During real loading (setWorldGeomtry), |
---|
787 | they should call ResourceGroupManager::_notifyWorldGeometryProgress exactly |
---|
788 | that number of times when loading the geometry for real. |
---|
789 | @note |
---|
790 | The default is to return 0, ie to not report progress. |
---|
791 | */ |
---|
792 | virtual size_t estimateWorldGeometry(const String& filename) { return 0; } |
---|
793 | |
---|
794 | /** Asks the SceneManager to provide a suggested viewpoint from which the scene should be viewed. |
---|
795 | @remarks |
---|
796 | Typically this method returns the origin unless a) world geometry has been loaded using |
---|
797 | SceneManager::setWorldGeometry and b) that world geometry has suggested 'start' points. |
---|
798 | If there is more than one viewpoint which the scene manager can suggest, it will always suggest |
---|
799 | the first one unless the random parameter is true. |
---|
800 | @param |
---|
801 | random If true, and there is more than one possible suggestion, a random one will be used. If false |
---|
802 | the same one will always be suggested. |
---|
803 | @return |
---|
804 | On success, true is returned. |
---|
805 | @par |
---|
806 | On failiure, false is returned. |
---|
807 | */ |
---|
808 | virtual ViewPoint getSuggestedViewpoint(bool random = false); |
---|
809 | |
---|
810 | /** Method for setting a specific option of the Scene Manager. These options are usually |
---|
811 | specific for a certain implemntation of the Scene Manager class, and may (and probably |
---|
812 | will) not exist across different implementations. |
---|
813 | @param |
---|
814 | strKey The name of the option to set |
---|
815 | @param |
---|
816 | pValue A pointer to the value - the size should be calculated by the scene manager |
---|
817 | based on the key |
---|
818 | @return |
---|
819 | On success, true is returned. |
---|
820 | @par |
---|
821 | On failiure, false is returned. |
---|
822 | */ |
---|
823 | virtual bool setOption( const String& strKey, const void* pValue ) { return false; } |
---|
824 | |
---|
825 | /** Method for getting the value of an implementation-specific Scene Manager option. |
---|
826 | @param |
---|
827 | strKey The name of the option |
---|
828 | @param |
---|
829 | pDestValue A pointer to a memory location where the value will |
---|
830 | be copied. Currently, the memory will be allocated by the |
---|
831 | scene manager, but this may change |
---|
832 | @return |
---|
833 | On success, true is returned and pDestValue points to the value of the given |
---|
834 | option. |
---|
835 | @par |
---|
836 | On failiure, false is returned and pDestValue is set to NULL. |
---|
837 | */ |
---|
838 | virtual bool getOption( const String& strKey, void* pDestValue ) { return false; } |
---|
839 | |
---|
840 | /** Method for verifying wether the scene manager has an implementation-specific |
---|
841 | option. |
---|
842 | @param |
---|
843 | strKey The name of the option to check for. |
---|
844 | @return |
---|
845 | If the scene manager contains the given option, true is returned. |
---|
846 | @remarks |
---|
847 | If it does not, false is returned. |
---|
848 | */ |
---|
849 | virtual bool hasOption( const String& strKey ) const { return false; } |
---|
850 | /** Method for getting all possible values for a specific option. When this list is too large |
---|
851 | (i.e. the option expects, for example, a float), the return value will be true, but the |
---|
852 | list will contain just one element whose size will be set to 0. |
---|
853 | Otherwise, the list will be filled with all the possible values the option can |
---|
854 | accept. |
---|
855 | @param |
---|
856 | strKey The name of the option to get the values for. |
---|
857 | @param |
---|
858 | refValueList A reference to a list that will be filled with the available values. |
---|
859 | @return |
---|
860 | On success (the option exists), true is returned. |
---|
861 | @par |
---|
862 | On failure, false is returned. |
---|
863 | */ |
---|
864 | virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; } |
---|
865 | |
---|
866 | /** Method for getting all the implementation-specific options of the scene manager. |
---|
867 | @param |
---|
868 | refKeys A reference to a list that will be filled with all the available options. |
---|
869 | @return |
---|
870 | On success, true is returned. On failiure, false is returned. |
---|
871 | */ |
---|
872 | virtual bool getOptionKeys( StringVector& refKeys ) { return false; } |
---|
873 | |
---|
874 | /** Internal method for updating the scene graph ie the tree of SceneNode instances managed by this class. |
---|
875 | @remarks |
---|
876 | This must be done before issuing objects to the rendering pipeline, since derived transformations from |
---|
877 | parent nodes are not updated until required. This SceneManager is a basic implementation which simply |
---|
878 | updates all nodes from the root. This ensures the scene is up to date but requires all the nodes |
---|
879 | to be updated even if they are not visible. Subclasses could trim this such that only potentially visible |
---|
880 | nodes are updated. |
---|
881 | */ |
---|
882 | virtual void _updateSceneGraph(Camera* cam); |
---|
883 | |
---|
884 | /** Internal method which parses the scene to find visible objects to render. |
---|
885 | @remarks |
---|
886 | If you're implementing a custom scene manager, this is the most important method to |
---|
887 | override since it's here you can apply your custom world partitioning scheme. Once you |
---|
888 | have added the appropriate objects to the render queue, you can let the default |
---|
889 | SceneManager objects _renderVisibleObjects handle the actual rendering of the objects |
---|
890 | you pick. |
---|
891 | @par |
---|
892 | Any visible objects will be added to a rendering queue, which is indexed by material in order |
---|
893 | to ensure objects with the same material are rendered together to minimise render state changes. |
---|
894 | */ |
---|
895 | virtual void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); |
---|
896 | |
---|
897 | /** Internal method for applying animations to scene nodes. |
---|
898 | @remarks |
---|
899 | Uses the internally stored AnimationState objects to apply animation to SceneNodes. |
---|
900 | */ |
---|
901 | virtual void _applySceneAnimations(void); |
---|
902 | |
---|
903 | /** Sends visible objects found in _findVisibleObjects to the rendering engine. |
---|
904 | */ |
---|
905 | virtual void _renderVisibleObjects(void); |
---|
906 | |
---|
907 | /** Prompts the class to send its contents to the renderer. |
---|
908 | @remarks |
---|
909 | This method prompts the scene manager to send the |
---|
910 | contents of the scene it manages to the rendering |
---|
911 | pipeline, possibly preceded by some sorting, culling |
---|
912 | or other scene management tasks. Note that this method is not normally called |
---|
913 | directly by the user application; it is called automatically |
---|
914 | by the Ogre rendering loop. |
---|
915 | @param camera Pointer to a camera from whose viewpoint the scene is to |
---|
916 | be rendered. |
---|
917 | @param vp The target viewport |
---|
918 | @param includeOverlays Whether or not overlay objects should be rendered |
---|
919 | */ |
---|
920 | virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays); |
---|
921 | |
---|
922 | /** Internal method for queueing the sky objects with the params as |
---|
923 | previously set through setSkyBox, setSkyPlane and setSkyDome. |
---|
924 | */ |
---|
925 | virtual void _queueSkiesForRendering(Camera* cam); |
---|
926 | |
---|
927 | |
---|
928 | |
---|
929 | /** Notifies the scene manager of its destination render system |
---|
930 | @remarks |
---|
931 | Called automatically by RenderSystem::addSceneManager |
---|
932 | this method simply notifies the manager of the render |
---|
933 | system to which its output must be directed. |
---|
934 | @param |
---|
935 | sys Pointer to the RenderSystem subclass to be used as a render target. |
---|
936 | */ |
---|
937 | virtual void _setDestinationRenderSystem(RenderSystem* sys); |
---|
938 | |
---|
939 | /** Enables / disables a 'sky plane' i.e. a plane at constant |
---|
940 | distance from the camera representing the sky. |
---|
941 | @remarks |
---|
942 | You can create sky planes yourself using the standard mesh and |
---|
943 | entity methods, but this creates a plane which the camera can |
---|
944 | never get closer or further away from - it moves with the camera. |
---|
945 | (NB you could create this effect by creating a world plane which |
---|
946 | was attached to the same SceneNode as the Camera too, but this |
---|
947 | would only apply to a single camera whereas this plane applies to |
---|
948 | any camera using this scene manager). |
---|
949 | @note |
---|
950 | To apply scaling, scrolls etc to the sky texture(s) you |
---|
951 | should use the TextureUnitState class methods. |
---|
952 | @param |
---|
953 | enable True to enable the plane, false to disable it |
---|
954 | @param |
---|
955 | plane Details of the plane, i.e. it's normal and it's |
---|
956 | distance from the camera. |
---|
957 | @param |
---|
958 | materialName The name of the material the plane will use |
---|
959 | @param |
---|
960 | scale The scaling applied to the sky plane - higher values |
---|
961 | mean a bigger sky plane - you may want to tweak this |
---|
962 | depending on the size of plane.d and the other |
---|
963 | characteristics of your scene |
---|
964 | @param |
---|
965 | tiling How many times to tile the texture across the sky. |
---|
966 | Applies to all texture layers. If you need finer control use |
---|
967 | the TextureUnitState texture coordinate transformation methods. |
---|
968 | @param |
---|
969 | drawFirst If true, the plane is drawn before all other |
---|
970 | geometry in the scene, without updating the depth buffer. |
---|
971 | This is the safest rendering method since all other objects |
---|
972 | will always appear in front of the sky. However this is not |
---|
973 | the most efficient way if most of the sky is often occluded |
---|
974 | by other objects. If this is the case, you can set this |
---|
975 | parameter to false meaning it draws <em>after</em> all other |
---|
976 | geometry which can be an optimisation - however you must |
---|
977 | ensure that the plane.d value is large enough that no objects |
---|
978 | will 'poke through' the sky plane when it is rendered. |
---|
979 | @param |
---|
980 | bow If zero, the plane will be completely flat (like previous |
---|
981 | versions. If above zero, the plane will be curved, allowing |
---|
982 | the sky to appear below camera level. Curved sky planes are |
---|
983 | simular to skydomes, but are more compatable with fog. |
---|
984 | @param xsegments, ysegments |
---|
985 | Determines the number of segments the plane will have to it. This |
---|
986 | is most important when you are bowing the plane, but may also be useful |
---|
987 | if you need tesselation on the plane to perform per-vertex effects. |
---|
988 | @param groupName |
---|
989 | The name of the resource group to which to assign the plane mesh. |
---|
990 | */ |
---|
991 | virtual void setSkyPlane( |
---|
992 | bool enable, |
---|
993 | const Plane& plane, const String& materialName, Real scale = 1000, |
---|
994 | Real tiling = 10, bool drawFirst = true, Real bow = 0, |
---|
995 | int xsegments = 1, int ysegments = 1, |
---|
996 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); |
---|
997 | |
---|
998 | /** Enables / disables a 'sky box' i.e. a 6-sided box at constant |
---|
999 | distance from the camera representing the sky. |
---|
1000 | @remarks |
---|
1001 | You could create a sky box yourself using the standard mesh and |
---|
1002 | entity methods, but this creates a plane which the camera can |
---|
1003 | never get closer or further away from - it moves with the camera. |
---|
1004 | (NB you could create this effect by creating a world box which |
---|
1005 | was attached to the same SceneNode as the Camera too, but this |
---|
1006 | would only apply to a single camera whereas this skybox applies |
---|
1007 | to any camera using this scene manager). |
---|
1008 | @par |
---|
1009 | The material you use for the skybox can either contain layers |
---|
1010 | which are single textures, or they can be cubic textures, i.e. |
---|
1011 | made up of 6 images, one for each plane of the cube. See the |
---|
1012 | TextureUnitState class for more information. |
---|
1013 | @param |
---|
1014 | enable True to enable the skybox, false to disable it |
---|
1015 | @param |
---|
1016 | materialName The name of the material the box will use |
---|
1017 | @param |
---|
1018 | distance Distance in world coorinates from the camera to |
---|
1019 | each plane of the box. The default is normally OK. |
---|
1020 | @param |
---|
1021 | drawFirst If true, the box is drawn before all other |
---|
1022 | geometry in the scene, without updating the depth buffer. |
---|
1023 | This is the safest rendering method since all other objects |
---|
1024 | will always appear in front of the sky. However this is not |
---|
1025 | the most efficient way if most of the sky is often occluded |
---|
1026 | by other objects. If this is the case, you can set this |
---|
1027 | parameter to false meaning it draws <em>after</em> all other |
---|
1028 | geometry which can be an optimisation - however you must |
---|
1029 | ensure that the distance value is large enough that no |
---|
1030 | objects will 'poke through' the sky box when it is rendered. |
---|
1031 | @param |
---|
1032 | orientation Optional parameter to specify the orientation |
---|
1033 | of the box. By default the 'top' of the box is deemed to be |
---|
1034 | in the +y direction, and the 'front' at the -z direction. |
---|
1035 | You can use this parameter to rotate the sky if you want. |
---|
1036 | @param groupName |
---|
1037 | The name of the resource group to which to assign the plane mesh. |
---|
1038 | */ |
---|
1039 | virtual void setSkyBox( |
---|
1040 | bool enable, const String& materialName, Real distance = 5000, |
---|
1041 | bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY, |
---|
1042 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); |
---|
1043 | |
---|
1044 | /** Enables / disables a 'sky dome' i.e. an illusion of a curved sky. |
---|
1045 | @remarks |
---|
1046 | A sky dome is actually formed by 5 sides of a cube, but with |
---|
1047 | texture coordinates generated such that the surface appears |
---|
1048 | curved like a dome. Sky domes are appropriate where you need a |
---|
1049 | realistic looking sky where the scene is not going to be |
---|
1050 | 'fogged', and there is always a 'floor' of some sort to prevent |
---|
1051 | the viewer looking below the horizon (the distortion effect below |
---|
1052 | the horizon can be pretty horrible, and there is never anyhting |
---|
1053 | directly below the viewer). If you need a complete wrap-around |
---|
1054 | background, use the setSkyBox method instead. You can actually |
---|
1055 | combine a sky box and a sky dome if you want, to give a positional |
---|
1056 | backdrop with an overlayed curved cloud layer. |
---|
1057 | @par |
---|
1058 | Sky domes work well with 2D repeating textures like clouds. You |
---|
1059 | can change the apparant 'curvature' of the sky depending on how |
---|
1060 | your scene is viewed - lower curvatures are better for 'open' |
---|
1061 | scenes like landscapes, whilst higher curvatures are better for |
---|
1062 | say FPS levels where you don't see a lot of the sky at once and |
---|
1063 | the exaggerated curve looks good. |
---|
1064 | @param |
---|
1065 | enable True to enable the skydome, false to disable it |
---|
1066 | @param |
---|
1067 | materialName The name of the material the dome will use |
---|
1068 | @param |
---|
1069 | curvature The curvature of the dome. Good values are |
---|
1070 | between 2 and 65. Higher values are more curved leading to |
---|
1071 | a smoother effect, lower values are less curved meaning |
---|
1072 | more distortion at the horizons but a better distance effect. |
---|
1073 | @param |
---|
1074 | tiling How many times to tile the texture(s) across the |
---|
1075 | dome. |
---|
1076 | @param |
---|
1077 | distance Distance in world coorinates from the camera to |
---|
1078 | each plane of the box the dome is rendered on. The default |
---|
1079 | is normally OK. |
---|
1080 | @param |
---|
1081 | drawFirst If true, the dome is drawn before all other |
---|
1082 | geometry in the scene, without updating the depth buffer. |
---|
1083 | This is the safest rendering method since all other objects |
---|
1084 | will always appear in front of the sky. However this is not |
---|
1085 | the most efficient way if most of the sky is often occluded |
---|
1086 | by other objects. If this is the case, you can set this |
---|
1087 | parameter to false meaning it draws <em>after</em> all other |
---|
1088 | geometry which can be an optimisation - however you must |
---|
1089 | ensure that the distance value is large enough that no |
---|
1090 | objects will 'poke through' the sky when it is rendered. |
---|
1091 | @param |
---|
1092 | orientation Optional parameter to specify the orientation |
---|
1093 | of the dome. By default the 'top' of the dome is deemed to |
---|
1094 | be in the +y direction, and the 'front' at the -z direction. |
---|
1095 | You can use this parameter to rotate the sky if you want. |
---|
1096 | @param groupName |
---|
1097 | The name of the resource group to which to assign the plane mesh. |
---|
1098 | */ |
---|
1099 | virtual void setSkyDome( |
---|
1100 | bool enable, const String& materialName, Real curvature = 10, |
---|
1101 | Real tiling = 8, Real distance = 4000, bool drawFirst = true, |
---|
1102 | const Quaternion& orientation = Quaternion::IDENTITY, |
---|
1103 | int xsegments = 16, int ysegments = 16, int ysegments_keep = -1, |
---|
1104 | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); |
---|
1105 | |
---|
1106 | /** Sets the fogging mode applied to the scene. |
---|
1107 | @remarks |
---|
1108 | This method sets up the scene-wide fogging effect. These settings |
---|
1109 | apply to all geometry rendered, UNLESS the material with which it |
---|
1110 | is rendered has it's own fog settings (see Material::setFog). |
---|
1111 | @param |
---|
1112 | mode Set up the mode of fog as described in the FogMode |
---|
1113 | enum, or set to FOG_NONE to turn off. |
---|
1114 | @param |
---|
1115 | colour The colour of the fog. Either set this to the same |
---|
1116 | as your viewport background colour, or to blend in with a |
---|
1117 | skydome or skybox. |
---|
1118 | @param |
---|
1119 | expDensity The density of the fog in FOG_EXP or FOG_EXP2 |
---|
1120 | mode, as a value between 0 and 1. The default is 0.001. |
---|
1121 | @param |
---|
1122 | linearStart Distance in world units at which linear fog starts to |
---|
1123 | encroach. Only applicable if mode is |
---|
1124 | FOG_LINEAR. |
---|
1125 | @param |
---|
1126 | linearEnd Distance in world units at which linear fog becomes completely |
---|
1127 | opaque. Only applicable if mode is |
---|
1128 | FOG_LINEAR. |
---|
1129 | */ |
---|
1130 | void setFog( |
---|
1131 | FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, |
---|
1132 | Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0); |
---|
1133 | |
---|
1134 | /** Returns the fog mode for the scene. |
---|
1135 | */ |
---|
1136 | virtual FogMode getFogMode(void) const; |
---|
1137 | |
---|
1138 | /** Returns the fog colour for the scene. |
---|
1139 | */ |
---|
1140 | virtual const ColourValue& getFogColour(void) const; |
---|
1141 | |
---|
1142 | /** Returns the fog start distance for the scene. |
---|
1143 | */ |
---|
1144 | virtual Real getFogStart(void) const; |
---|
1145 | |
---|
1146 | /** Returns the fog end distance for the scene. |
---|
1147 | */ |
---|
1148 | virtual Real getFogEnd(void) const; |
---|
1149 | |
---|
1150 | /** Returns the fog density for the scene. |
---|
1151 | */ |
---|
1152 | virtual Real getFogDensity(void) const; |
---|
1153 | |
---|
1154 | |
---|
1155 | /** Creates a new BillboardSet for use with this scene manager. |
---|
1156 | @remarks |
---|
1157 | This method creates a new BillboardSet which is registered with |
---|
1158 | the SceneManager. The SceneManager will destroy this object when |
---|
1159 | it shuts down or when the SceneManager::clearScene method is |
---|
1160 | called, so the caller does not have to worry about destroying |
---|
1161 | this object (in fact, it definitely should not do this). |
---|
1162 | @par |
---|
1163 | See the BillboardSet documentations for full details of the |
---|
1164 | returned class. |
---|
1165 | @param |
---|
1166 | name The name to give to this billboard set. Must be unique. |
---|
1167 | @param |
---|
1168 | poolSize The initial size of the pool of billboards (see BillboardSet for more information) |
---|
1169 | @see |
---|
1170 | BillboardSet |
---|
1171 | */ |
---|
1172 | virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20); |
---|
1173 | |
---|
1174 | /** Retrieves a pointer to the named BillboardSet. |
---|
1175 | */ |
---|
1176 | virtual BillboardSet* getBillboardSet(const String& name); |
---|
1177 | |
---|
1178 | /** Removes & destroys an BillboardSet from the SceneManager. |
---|
1179 | @warning |
---|
1180 | Must only be done if the BillboardSet is not attached |
---|
1181 | to a SceneNode. It may be safer to wait to clear the whole |
---|
1182 | scene. If you are unsure, use clearScene. |
---|
1183 | */ |
---|
1184 | virtual void removeBillboardSet(BillboardSet* set); |
---|
1185 | |
---|
1186 | /** Removes & destroys an BillboardSet from the SceneManager by name. |
---|
1187 | @warning |
---|
1188 | Must only be done if the BillboardSet is not attached |
---|
1189 | to a SceneNode. It may be safer to wait to clear the whole |
---|
1190 | scene. If you are unsure, use clearScene. |
---|
1191 | */ |
---|
1192 | virtual void removeBillboardSet(const String& name); |
---|
1193 | |
---|
1194 | /** Removes & destroys all BillboardSets. |
---|
1195 | @warning |
---|
1196 | Again, use caution since no BillboardSet must be referred to |
---|
1197 | elsewhere e.g. attached to a SceneNode otherwise a crash |
---|
1198 | is likely. Use clearScene if you are unsure (it clears SceneNode |
---|
1199 | entries too.) |
---|
1200 | @see |
---|
1201 | SceneManager::clearScene |
---|
1202 | */ |
---|
1203 | virtual void removeAllBillboardSets(void); |
---|
1204 | |
---|
1205 | /** Tells the SceneManager whether it should render the SceneNodes which |
---|
1206 | make up the scene as well as the objects in the scene. |
---|
1207 | @remarks |
---|
1208 | This method is mainly for debugging purposes. If you set this to 'true', |
---|
1209 | each node will be rendered as a set of 3 axes to allow you to easily see |
---|
1210 | the orientation of the nodes. |
---|
1211 | */ |
---|
1212 | virtual void setDisplaySceneNodes(bool display); |
---|
1213 | |
---|
1214 | /** Creates an animation which can be used to animate scene nodes. |
---|
1215 | @remarks |
---|
1216 | An animation is a collection of 'tracks' which over time change the position / orientation |
---|
1217 | of Node objects. In this case, the animation will likely have tracks to modify the position |
---|
1218 | / orientation of SceneNode objects, e.g. to make objects move along a path. |
---|
1219 | @par |
---|
1220 | You don't need to use an Animation object to move objects around - you can do it yourself |
---|
1221 | using the methods of the Node in your FrameListener class. However, when you need relatively |
---|
1222 | complex scripted animation, this is the class to use since it will interpolate between |
---|
1223 | keyframes for you and generally make the whole process easier to manage. |
---|
1224 | @par |
---|
1225 | A single animation can affect multiple Node objects (each AnimationTrack affects a single Node). |
---|
1226 | In addition, through animation blending a single Node can be affected by multiple animations, |
---|
1227 | athough this is more useful when performing skeletal animation (see Skeleton::createAnimation). |
---|
1228 | @par |
---|
1229 | Note that whilst it uses the same classes, the animations created here are kept separate from the |
---|
1230 | skeletal animations of meshes (each Skeleton owns those animations). |
---|
1231 | @param name The name of the animation, must be unique within this SceneManager. |
---|
1232 | @param length The total length of the animation. |
---|
1233 | */ |
---|
1234 | virtual Animation* createAnimation(const String& name, Real length); |
---|
1235 | |
---|
1236 | /** Looks up an Animation object previously created with createAnimation. */ |
---|
1237 | virtual Animation* getAnimation(const String& name) const; |
---|
1238 | |
---|
1239 | /** Destroys an Animation. |
---|
1240 | @remarks |
---|
1241 | You should ensure that none of your code is referencing this animation objects since the |
---|
1242 | memory will be freed. |
---|
1243 | */ |
---|
1244 | virtual void destroyAnimation(const String& name); |
---|
1245 | |
---|
1246 | /** Removes all animations created using this SceneManager. */ |
---|
1247 | virtual void destroyAllAnimations(void); |
---|
1248 | |
---|
1249 | /** Create an AnimationState object for managing application of animations. |
---|
1250 | @remarks |
---|
1251 | You can create Animation objects for animating SceneNode obejcts using the |
---|
1252 | createAnimation method. However, in order to actually apply those animations |
---|
1253 | you have to call methods on Node and Animation in a particular order (namely |
---|
1254 | Node::resetToInitialState and Animation::apply). To make this easier and to |
---|
1255 | help track the current time position of animations, the AnimationState object |
---|
1256 | is provided. </p> |
---|
1257 | So if you don't want to control animation application manually, call this method, |
---|
1258 | update the returned object as you like every frame and let SceneManager apply |
---|
1259 | the animation state for you. |
---|
1260 | @par |
---|
1261 | Remember, AnimationState objects are disabled by default at creation time. |
---|
1262 | Turn them on when you want them using their setEnabled method. |
---|
1263 | @par |
---|
1264 | Note that any SceneNode affected by this automatic animation will have it's state |
---|
1265 | reset to it's initial position before application of the animation. Unless specifically |
---|
1266 | modified using Node::setInitialState the Node assumes it's initial state is at the |
---|
1267 | origin. If you want the base state of the SceneNode to be elsewhere, make your changes |
---|
1268 | to the node using the standard transform methods, then call setInitialState to |
---|
1269 | 'bake' this reference position into the node. |
---|
1270 | @param animName The name of an animation created already with createAnimation. |
---|
1271 | */ |
---|
1272 | virtual AnimationState* createAnimationState(const String& animName); |
---|
1273 | |
---|
1274 | /** Retrieves animation state as previously created using createAnimationState */ |
---|
1275 | virtual AnimationState* getAnimationState(const String& animName); |
---|
1276 | |
---|
1277 | /** Destroys an AnimationState. |
---|
1278 | @remarks |
---|
1279 | You should ensure that none of your code is referencing this animation |
---|
1280 | state object since the memory will be freed. |
---|
1281 | */ |
---|
1282 | virtual void destroyAnimationState(const String& name); |
---|
1283 | |
---|
1284 | /** Removes all animation states created using this SceneManager. */ |
---|
1285 | virtual void destroyAllAnimationStates(void); |
---|
1286 | |
---|
1287 | /** Manual rendering method, for advanced users only. |
---|
1288 | @remarks |
---|
1289 | This method allows you to send rendering commands through the pipeline on |
---|
1290 | demand, bypassing OGRE's normal world processing. You should only use this if you |
---|
1291 | really know what you're doing; OGRE does lots of things for you that you really should |
---|
1292 | let it do. However, there are times where it may be useful to have this manual interface, |
---|
1293 | for example overlaying something on top of the scene rendered by OGRE. |
---|
1294 | @par |
---|
1295 | Because this is an instant rendering method, timing is important. The best |
---|
1296 | time to call it is from a RenderTargetListener event handler. |
---|
1297 | @par |
---|
1298 | Don't call this method a lot, it's designed for rare (1 or 2 times per frame) use. |
---|
1299 | Calling it regularly per frame will cause frame rate drops! |
---|
1300 | @param rend A RenderOperation object describing the rendering op |
---|
1301 | @param pass The Pass to use for this render |
---|
1302 | @param vp Pointer to the viewport to render to |
---|
1303 | @param worldMatrix The transform to apply from object to world space |
---|
1304 | @param viewMatrix The transform to apply from world to view space |
---|
1305 | @param projMatrix The transform to apply from view to screen space |
---|
1306 | @param doBeginEndFrame If true, beginFrame() and endFrame() are called, |
---|
1307 | otherwise not. You should leave this as false if you are calling |
---|
1308 | this within the main render loop. |
---|
1309 | */ |
---|
1310 | virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, |
---|
1311 | const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, |
---|
1312 | bool doBeginEndFrame = false) ; |
---|
1313 | |
---|
1314 | /** Registers a new RenderQueueListener which will be notified when render queues |
---|
1315 | are processed. |
---|
1316 | */ |
---|
1317 | virtual void addRenderQueueListener(RenderQueueListener* newListener); |
---|
1318 | |
---|
1319 | /** Removes a listener previously added with addRenderQueueListener. */ |
---|
1320 | virtual void removeRenderQueueListener(RenderQueueListener* delListener); |
---|
1321 | |
---|
1322 | /** Adds an item to the 'special case' render queue list. |
---|
1323 | @remarks |
---|
1324 | Normally all render queues are rendered, in their usual sequence, |
---|
1325 | only varying if a RenderQueueListener nominates for the queue to be |
---|
1326 | repeated or skipped. This method allows you to add a render queue to |
---|
1327 | a 'special case' list, which varies the behaviour. The effect of this |
---|
1328 | list depends on the 'mode' in which this list is in, which might be |
---|
1329 | to exclude these render queues, or to include them alone (excluding |
---|
1330 | all other queues). This allows you to perform broad selective |
---|
1331 | rendering without requiring a RenderQueueListener. |
---|
1332 | @param qid The identifier of the queue which should be added to the |
---|
1333 | special case list. Nothing happens if the queue is already in the list. |
---|
1334 | */ |
---|
1335 | virtual void addSpecialCaseRenderQueue(RenderQueueGroupID qid); |
---|
1336 | /** Removes an item to the 'special case' render queue list. |
---|
1337 | @see SceneManager::addSpecialCaseRenderQueue |
---|
1338 | @param qid The identifier of the queue which should be removed from the |
---|
1339 | special case list. Nothing happens if the queue is not in the list. |
---|
1340 | */ |
---|
1341 | virtual void removeSpecialCaseRenderQueue(RenderQueueGroupID qid); |
---|
1342 | /** Clears the 'special case' render queue list. |
---|
1343 | @see SceneManager::addSpecialCaseRenderQueue |
---|
1344 | */ |
---|
1345 | virtual void clearSpecialCaseRenderQueues(void); |
---|
1346 | /** Sets the way the special case render queue list is processed. |
---|
1347 | @see SceneManager::addSpecialCaseRenderQueue |
---|
1348 | @param mode The mode of processing |
---|
1349 | */ |
---|
1350 | virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode); |
---|
1351 | /** Gets the way the special case render queue list is processed. */ |
---|
1352 | virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void); |
---|
1353 | /** Returns whether or not the named queue will be rendered based on the |
---|
1354 | current 'special case' render queue list and mode. |
---|
1355 | @see SceneManager::addSpecialCaseRenderQueue |
---|
1356 | @param qid The identifier of the queue which should be tested |
---|
1357 | @returns true if the queue will be rendered, false otherwise |
---|
1358 | */ |
---|
1359 | virtual bool isRenderQueueToBeProcessed(RenderQueueGroupID qid); |
---|
1360 | |
---|
1361 | /** Sets the render queue that the world geometry (if any) this SceneManager |
---|
1362 | renders will be associated with. |
---|
1363 | @remarks |
---|
1364 | SceneManagers which provide 'world geometry' should place it in a |
---|
1365 | specialised render queue in order to make it possible to enable / |
---|
1366 | disable it easily using the addSpecialCaseRenderQueue method. Even |
---|
1367 | if the SceneManager does not use the render queues to render the |
---|
1368 | world geometry, it should still pick a queue to represent it's manual |
---|
1369 | rendering, and check isRenderQueueToBeProcessed before rendering. |
---|
1370 | @note |
---|
1371 | Setting this may not affect the actual ordering of rendering the |
---|
1372 | world geometry, if the world geometry is being rendered manually |
---|
1373 | by the SceneManager. If the SceneManager feeds world geometry into |
---|
1374 | the queues, however, the ordering will be affected. |
---|
1375 | */ |
---|
1376 | virtual void setWorldGeometryRenderQueue(RenderQueueGroupID qid); |
---|
1377 | /** Gets the render queue that the world geometry (if any) this SceneManager |
---|
1378 | renders will be associated with. |
---|
1379 | @remarks |
---|
1380 | SceneManagers which provide 'world geometry' should place it in a |
---|
1381 | specialised render queue in order to make it possible to enable / |
---|
1382 | disable it easily using the addSpecialCaseRenderQueue method. Even |
---|
1383 | if the SceneManager does not use the render queues to render the |
---|
1384 | world geometry, it should still pick a queue to represent it's manual |
---|
1385 | rendering, and check isRenderQueueToBeProcessed before rendering. |
---|
1386 | */ |
---|
1387 | virtual RenderQueueGroupID getWorldGeometryRenderQueue(void); |
---|
1388 | |
---|
1389 | /** Allows all bounding boxes of scene nodes to be displayed. */ |
---|
1390 | virtual void showBoundingBoxes(bool bShow); |
---|
1391 | |
---|
1392 | /** Returns if all bounding boxes of scene nodes are to be displayed */ |
---|
1393 | virtual bool getShowBoundingBoxes() const; |
---|
1394 | |
---|
1395 | /** Internal method for notifying the manager that a SceneNode is autotracking. */ |
---|
1396 | virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack); |
---|
1397 | |
---|
1398 | |
---|
1399 | /** Creates an AxisAlignedBoxSceneQuery for this scene manager. |
---|
1400 | @remarks |
---|
1401 | This method creates a new instance of a query object for this scene manager, |
---|
1402 | for an axis aligned box region. See SceneQuery and AxisAlignedBoxSceneQuery |
---|
1403 | for full details. |
---|
1404 | @par |
---|
1405 | The instance returned from this method must be destroyed by calling |
---|
1406 | SceneManager::destroyQuery when it is no longer required. |
---|
1407 | @param box Details of the box which describes the region for this query. |
---|
1408 | @param mask The query mask to apply to this query; can be used to filter out |
---|
1409 | certain objects; see SceneQuery for details. |
---|
1410 | */ |
---|
1411 | virtual AxisAlignedBoxSceneQuery* |
---|
1412 | createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF); |
---|
1413 | /** Creates a SphereSceneQuery for this scene manager. |
---|
1414 | @remarks |
---|
1415 | This method creates a new instance of a query object for this scene manager, |
---|
1416 | for a spherical region. See SceneQuery and SphereSceneQuery |
---|
1417 | for full details. |
---|
1418 | @par |
---|
1419 | The instance returned from this method must be destroyed by calling |
---|
1420 | SceneManager::destroyQuery when it is no longer required. |
---|
1421 | @param sphere Details of the sphere which describes the region for this query. |
---|
1422 | @param mask The query mask to apply to this query; can be used to filter out |
---|
1423 | certain objects; see SceneQuery for details. |
---|
1424 | */ |
---|
1425 | virtual SphereSceneQuery* |
---|
1426 | createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF); |
---|
1427 | /** Creates a PlaneBoundedVolumeListSceneQuery for this scene manager. |
---|
1428 | @remarks |
---|
1429 | This method creates a new instance of a query object for this scene manager, |
---|
1430 | for a region enclosed by a set of planes (normals pointing inwards). |
---|
1431 | See SceneQuery and PlaneBoundedVolumeListSceneQuery for full details. |
---|
1432 | @par |
---|
1433 | The instance returned from this method must be destroyed by calling |
---|
1434 | SceneManager::destroyQuery when it is no longer required. |
---|
1435 | @param volumes Details of the volumes which describe the region for this query. |
---|
1436 | @param mask The query mask to apply to this query; can be used to filter out |
---|
1437 | certain objects; see SceneQuery for details. |
---|
1438 | */ |
---|
1439 | virtual PlaneBoundedVolumeListSceneQuery* |
---|
1440 | createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF); |
---|
1441 | |
---|
1442 | |
---|
1443 | /** Creates a RaySceneQuery for this scene manager. |
---|
1444 | @remarks |
---|
1445 | This method creates a new instance of a query object for this scene manager, |
---|
1446 | looking for objects which fall along a ray. See SceneQuery and RaySceneQuery |
---|
1447 | for full details. |
---|
1448 | @par |
---|
1449 | The instance returned from this method must be destroyed by calling |
---|
1450 | SceneManager::destroyQuery when it is no longer required. |
---|
1451 | @param ray Details of the ray which describes the region for this query. |
---|
1452 | @param mask The query mask to apply to this query; can be used to filter out |
---|
1453 | certain objects; see SceneQuery for details. |
---|
1454 | */ |
---|
1455 | virtual RaySceneQuery* |
---|
1456 | createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF); |
---|
1457 | //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF); |
---|
1458 | /** Creates an IntersectionSceneQuery for this scene manager. |
---|
1459 | @remarks |
---|
1460 | This method creates a new instance of a query object for locating |
---|
1461 | intersecting objects. See SceneQuery and IntersectionSceneQuery |
---|
1462 | for full details. |
---|
1463 | @par |
---|
1464 | The instance returned from this method must be destroyed by calling |
---|
1465 | SceneManager::destroyQuery when it is no longer required. |
---|
1466 | @param mask The query mask to apply to this query; can be used to filter out |
---|
1467 | certain objects; see SceneQuery for details. |
---|
1468 | */ |
---|
1469 | virtual IntersectionSceneQuery* |
---|
1470 | createIntersectionQuery(unsigned long mask = 0xFFFFFFFF); |
---|
1471 | |
---|
1472 | /** Destroys a scene query of any type. */ |
---|
1473 | virtual void destroyQuery(SceneQuery* query); |
---|
1474 | |
---|
1475 | typedef MapIterator<SceneLightList> LightIterator; |
---|
1476 | typedef MapIterator<EntityList> EntityIterator; |
---|
1477 | typedef MapIterator<CameraList> CameraIterator; |
---|
1478 | typedef MapIterator<BillboardSetList> BillboardSetIterator; |
---|
1479 | typedef MapIterator<AnimationList> AnimationIterator; |
---|
1480 | |
---|
1481 | /** Returns a specialised MapIterator over all lights in the scene. */ |
---|
1482 | LightIterator getLightIterator(void) { |
---|
1483 | return LightIterator(mLights.begin(), mLights.end()); |
---|
1484 | } |
---|
1485 | /** Returns a specialised MapIterator over all entities in the scene. */ |
---|
1486 | EntityIterator getEntityIterator(void) { |
---|
1487 | return EntityIterator(mEntities.begin(), mEntities.end()); |
---|
1488 | } |
---|
1489 | /** Returns a specialised MapIterator over all cameras in the scene. */ |
---|
1490 | CameraIterator getCameraIterator(void) { |
---|
1491 | return CameraIterator(mCameras.begin(), mCameras.end()); |
---|
1492 | } |
---|
1493 | /** Returns a specialised MapIterator over all BillboardSets in the scene. */ |
---|
1494 | BillboardSetIterator getBillboardSetIterator(void) { |
---|
1495 | return BillboardSetIterator(mBillboardSets.begin(), mBillboardSets.end()); |
---|
1496 | } |
---|
1497 | /** Returns a specialised MapIterator over all animations in the scene. */ |
---|
1498 | AnimationIterator getAnimationIterator(void) { |
---|
1499 | return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end()); |
---|
1500 | } |
---|
1501 | /** Returns a specialised MapIterator over all animation states in the scene. */ |
---|
1502 | AnimationStateIterator getAnimationStateIterator(void) { |
---|
1503 | return AnimationStateIterator(mAnimationStates.begin(), mAnimationStates.end()); |
---|
1504 | } |
---|
1505 | |
---|
1506 | /** Sets the general shadow technique to be used in this scene. |
---|
1507 | @remarks |
---|
1508 | There are multiple ways to generate shadows in a scene, and each has |
---|
1509 | strengths and weaknesses. |
---|
1510 | <ul><li>Stencil-based approaches can be used to |
---|
1511 | draw very long, extreme shadows without loss of precision and the 'additive' |
---|
1512 | version can correctly show the shadowing of complex effects like bump mapping |
---|
1513 | because they physically exclude the light from those areas. However, the edges |
---|
1514 | are very sharp and stencils cannot handle transparency, and they involve a |
---|
1515 | fair amount of CPU work in order to calculate the shadow volumes, especially |
---|
1516 | when animated objects are involved.</li> |
---|
1517 | <li>Texture-based approaches are good for handling transparency (they can, for |
---|
1518 | example, correctly shadow a mesh which uses alpha to represent holes), and they |
---|
1519 | require little CPU overhead, and can happily shadow geometry which is deformed |
---|
1520 | by a vertex program, unlike stencil shadows. However, they have a fixed precision |
---|
1521 | which can introduce 'jaggies' at long range and have fillrate issues of their own.</li> |
---|
1522 | </ul> |
---|
1523 | @par |
---|
1524 | We support 2 kinds of stencil shadows, and 2 kinds of texture-based shadows, and one |
---|
1525 | simple decal approach. The 2 stencil approaches differ in the amount of multipass work |
---|
1526 | that is required - the modulative approach simply 'darkens' areas in shadow after the |
---|
1527 | main render, which is the least expensive, whilst the additive approach has to perform |
---|
1528 | a render per light and adds the cumulative effect, whcih is more expensive but more |
---|
1529 | accurate. The texture based shadows both work in roughly the same way, the only difference is |
---|
1530 | that the shadowmap approach is slightly more accurate, but requires a more recent |
---|
1531 | graphics card. |
---|
1532 | @par |
---|
1533 | Note that because mixing many shadow techniques can cause problems, only one technique |
---|
1534 | is supported at once. Also, you should call this method at the start of the |
---|
1535 | scene setup. |
---|
1536 | @param technique The shadowing technique to use for the scene. |
---|
1537 | */ |
---|
1538 | virtual void setShadowTechnique(ShadowTechnique technique); |
---|
1539 | |
---|
1540 | /** Gets the current shadow technique. */ |
---|
1541 | virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; } |
---|
1542 | |
---|
1543 | /** Enables / disables the rendering of debug information for shadows. */ |
---|
1544 | virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; } |
---|
1545 | /** Are debug shadows shown? */ |
---|
1546 | virtual bool getShowDebugShadows(void ) const { return mDebugShadows; } |
---|
1547 | |
---|
1548 | /** Set the colour used to modulate areas in shadow. |
---|
1549 | @remarks This is only applicable for shadow techniques which involve |
---|
1550 | darkening the area in shadow, as opposed to masking out the light. |
---|
1551 | This colour provided is used as a modulative value to darken the |
---|
1552 | areas. |
---|
1553 | */ |
---|
1554 | virtual void setShadowColour(const ColourValue& colour); |
---|
1555 | /** Get the colour used to modulate areas in shadow. |
---|
1556 | @remarks This is only applicable for shadow techniques which involve |
---|
1557 | darkening the area in shadow, as opposed to masking out the light. |
---|
1558 | This colour provided is used as a modulative value to darken the |
---|
1559 | areas. |
---|
1560 | */ |
---|
1561 | virtual const ColourValue& getShadowColour(void) const; |
---|
1562 | /** Sets the distance a shadow volume is extruded for a directional light. |
---|
1563 | @remarks |
---|
1564 | Although directional lights are essentially infinite, there are many |
---|
1565 | reasons to limit the shadow extrusion distance to a finite number, |
---|
1566 | not least of which is compatibility with older cards (which do not |
---|
1567 | support infinite positions), and shadow caster elimination. |
---|
1568 | @par |
---|
1569 | The default value is 10,000 world units. This does not apply to |
---|
1570 | point lights or spotlights, since they extrude up to their |
---|
1571 | attenuation range. |
---|
1572 | */ |
---|
1573 | virtual void setShadowDirectionalLightExtrusionDistance(Real dist); |
---|
1574 | /** Gets the distance a shadow volume is extruded for a directional light. |
---|
1575 | */ |
---|
1576 | virtual Real getShadowDirectionalLightExtrusionDistance(void) const; |
---|
1577 | /** Sets the maximum distance away from the camera that shadows |
---|
1578 | will be visible. |
---|
1579 | @remarks |
---|
1580 | Shadow techniques can be expensive, therefore it is a good idea |
---|
1581 | to limit them to being rendered close to the camera if possible, |
---|
1582 | and to skip the expense of rendering shadows for distance objects. |
---|
1583 | This method allows you to set the distance at which shadows will no |
---|
1584 | longer be rendered. |
---|
1585 | @note |
---|
1586 | Each shadow technique can interpret this subtely differently. |
---|
1587 | For example, one technique may use this to eliminate casters, |
---|
1588 | another might use it to attenuate the shadows themselves. |
---|
1589 | You should tweak this value to suit your chosen shadow technique |
---|
1590 | and scene setup. |
---|
1591 | */ |
---|
1592 | virtual void setShadowFarDistance(Real distance); |
---|
1593 | /** Gets the maximum distance away from the camera that shadows |
---|
1594 | will be visible. |
---|
1595 | */ |
---|
1596 | virtual Real getShadowFarDistance(void) const |
---|
1597 | { return mShadowFarDist; } |
---|
1598 | |
---|
1599 | /** Sets the maximum size of the index buffer used to render shadow |
---|
1600 | primitives. |
---|
1601 | @remarks |
---|
1602 | This method allows you to tweak the size of the index buffer used |
---|
1603 | to render shadow primitives (including stencil shadow volumes). The |
---|
1604 | default size is 51,200 entries, which is 100k of GPU memory, or |
---|
1605 | enough to render approximately 17,000 triangles. You can reduce this |
---|
1606 | as long as you do not have any models / world geometry chunks which |
---|
1607 | could require more than the amount you set. |
---|
1608 | @par |
---|
1609 | The maximum number of triangles required to render a single shadow |
---|
1610 | volume (including light and dark caps when needed) will be 3x the |
---|
1611 | number of edges on the light silhouette, plus the number of |
---|
1612 | light-facing triangles. On average, half the |
---|
1613 | triangles will be facing toward the light, but the number of |
---|
1614 | triangles in the silhouette entirely depends on the mesh - |
---|
1615 | angular meshes will have a higher silhouette tris/mesh tris |
---|
1616 | ratio than a smooth mesh. You can estimate the requirements for |
---|
1617 | your particular mesh by rendering it alone in a scene with shadows |
---|
1618 | enabled and a single light - rotate it or the light and make a note |
---|
1619 | of how high the triangle count goes (remembering to subtract the |
---|
1620 | mesh triangle count) |
---|
1621 | @param size The number of indexes; divide this by 3 to determine the |
---|
1622 | number of triangles. |
---|
1623 | */ |
---|
1624 | virtual void setShadowIndexBufferSize(size_t size); |
---|
1625 | /// Get the size of the shadow index buffer |
---|
1626 | virtual size_t getShadowIndexBufferSize(void) const |
---|
1627 | { return mShadowIndexBufferSize; } |
---|
1628 | /** Set the size of the texture used for texture-based shadows. |
---|
1629 | @remarks |
---|
1630 | The larger the shadow texture, the better the detail on |
---|
1631 | texture based shadows, but obviously this takes more memory. |
---|
1632 | The default size is 512. Sizes must be a power of 2. |
---|
1633 | */ |
---|
1634 | virtual void setShadowTextureSize(unsigned short size); |
---|
1635 | /// Get the size of the texture used for texture based shadows |
---|
1636 | unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; } |
---|
1637 | /** Set the pixel format of the textures used for texture-based shadows. |
---|
1638 | @remarks |
---|
1639 | By default, a colour texture is used (PF_X8R8G8B8) for texture shadows, |
---|
1640 | but if you want to use more advanced texture shadow types you can |
---|
1641 | alter this. If you do, you will have to also call |
---|
1642 | setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial |
---|
1643 | to provide shader-based materials to use these customised shadow |
---|
1644 | texture formats. |
---|
1645 | */ |
---|
1646 | virtual void setShadowTexturePixelFormat(PixelFormat fmt); |
---|
1647 | /// Get the format of the textures used for texture based shadows |
---|
1648 | PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; } |
---|
1649 | /** Set the number of textures allocated for texture-based shadows. |
---|
1650 | @remarks |
---|
1651 | The default number of textures assigned to deal with texture based |
---|
1652 | shadows is 1; however this means you can only have one light casting |
---|
1653 | shadows at the same time. You can increase this number in order to |
---|
1654 | make this more flexible, but be aware of the texture memory it will use. |
---|
1655 | */ |
---|
1656 | virtual void setShadowTextureCount(unsigned short count); |
---|
1657 | /// Get the number of the textures allocated for texture based shadows |
---|
1658 | unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; } |
---|
1659 | /** Sets the size and count of textures used in texture-based shadows. |
---|
1660 | @remarks |
---|
1661 | @see setShadowTextureSize and setShadowTextureCount for details, this |
---|
1662 | method just allows you to change both at once, which can save on |
---|
1663 | reallocation if the textures have already been created. |
---|
1664 | */ |
---|
1665 | virtual void setShadowTextureSettings(unsigned short size, unsigned short count, |
---|
1666 | PixelFormat fmt = PF_X8R8G8B8); |
---|
1667 | /** Sets the proportional distance which a texture shadow which is generated from a |
---|
1668 | directional light will be offset into the camera view to make best use of texture space. |
---|
1669 | @remarks |
---|
1670 | When generating a shadow texture from a directional light, an approximation is used |
---|
1671 | since it is not possible to render the entire scene to one texture. |
---|
1672 | The texture is projected onto an area centred on the camera, and is |
---|
1673 | the shadow far distance * 2 in length (it is square). This wastes |
---|
1674 | a lot of texture space outside the frustum though, so this offset allows |
---|
1675 | you to move the texture in front of the camera more. However, be aware |
---|
1676 | that this can cause a little shadow 'jittering' during rotation, and |
---|
1677 | that if you move it too far then you'll start to get artefacts close |
---|
1678 | to the camera. The value is represented as a proportion of the shadow |
---|
1679 | far distance, and the default is 0.6. |
---|
1680 | */ |
---|
1681 | virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;} |
---|
1682 | /** Sets the proportional distance at which texture shadows begin to fade out. |
---|
1683 | @remarks |
---|
1684 | To hide the edges where texture shadows end (in directional lights) |
---|
1685 | Ogre will fade out the shadow in the distance. This value is a proportional |
---|
1686 | distance of the entire shadow visibility distance at which the shadow |
---|
1687 | begins to fade out. The default is 0.7 |
---|
1688 | */ |
---|
1689 | virtual void setShadowTextureFadeStart(Real fadeStart) |
---|
1690 | { mShadowTextureFadeStart = fadeStart; } |
---|
1691 | /** Sets the proportional distance at which texture shadows finish to fading out. |
---|
1692 | @remarks |
---|
1693 | To hide the edges where texture shadows end (in directional lights) |
---|
1694 | Ogre will fade out the shadow in the distance. This value is a proportional |
---|
1695 | distance of the entire shadow visibility distance at which the shadow |
---|
1696 | is completely invisible. The default is 0.9. |
---|
1697 | */ |
---|
1698 | virtual void setShadowTextureFadeEnd(Real fadeEnd) |
---|
1699 | { mShadowTextureFadeEnd = fadeEnd; } |
---|
1700 | |
---|
1701 | /** Sets whether or not texture shadows should attempt to self-shadow. |
---|
1702 | @remarks |
---|
1703 | The default implementation of texture shadows uses a fixed-function |
---|
1704 | colour texture projection approach for maximum compatibility, and |
---|
1705 | as such cannot support self-shadowing. However, if you decide to |
---|
1706 | implement a more complex shadowing technique using the |
---|
1707 | setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial |
---|
1708 | there is a possibility you may be able to support |
---|
1709 | self-shadowing (e.g by implementing a shader-based shadow map). In |
---|
1710 | this case you might want to enable this option. |
---|
1711 | @param selfShadow Whether to attempt self-shadowing with texture shadows |
---|
1712 | */ |
---|
1713 | virtual void setShadowTextureSelfShadow(bool selfShadow) |
---|
1714 | { mShadowTextureSelfShadow = selfShadow; } |
---|
1715 | /// Gets whether or not texture shadows attempt to self-shadow. |
---|
1716 | virtual bool getShadowTextureSelfShadow(void) const |
---|
1717 | { return mShadowTextureSelfShadow; } |
---|
1718 | /** Sets the default material to use for rendering shadow casters. |
---|
1719 | @remarks |
---|
1720 | By default shadow casters are rendered into the shadow texture using |
---|
1721 | an automatically generated fixed-function pass. This allows basic |
---|
1722 | projective texture shadows, but it's possible to use more advanced |
---|
1723 | shadow techniques by overriding the caster and receiver materials, for |
---|
1724 | example providing vertex and fragment programs to implement shadow |
---|
1725 | maps. |
---|
1726 | @par |
---|
1727 | You can rely on the ambient light in the scene being set to the |
---|
1728 | requested texture shadow colour, if that's useful. |
---|
1729 | @note |
---|
1730 | Individual objects may also override the vertex program in |
---|
1731 | your default material if their materials include |
---|
1732 | shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref |
---|
1733 | entries, so if you use both make sure they are compatible. |
---|
1734 | @note |
---|
1735 | Only a single pass is allowed in your material, although multiple |
---|
1736 | techniques may be used for hardware fallback. |
---|
1737 | */ |
---|
1738 | virtual void setShadowTextureCasterMaterial(const String& name); |
---|
1739 | /** Sets the default material to use for rendering shadow receivers. |
---|
1740 | @remarks |
---|
1741 | By default shadow receivers are rendered as a post-pass using basic |
---|
1742 | modulation. This allows basic projective texture shadows, but it's |
---|
1743 | possible to use more advanced shadow techniques by overriding the |
---|
1744 | caster and receiver materials, for example providing vertex and |
---|
1745 | fragment programs to implement shadow maps. |
---|
1746 | @par |
---|
1747 | You can rely on texture unit 0 containing the shadow texture, and |
---|
1748 | for the unit to be set to use projective texturing from the light |
---|
1749 | (only useful if you're using fixed-function, which is unlikely; |
---|
1750 | otherwise you should rely on the texture_viewproj_matrix auto binding) |
---|
1751 | @note |
---|
1752 | Individual objects may also override the vertex program in |
---|
1753 | your default material if their materials include |
---|
1754 | shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref |
---|
1755 | entries, so if you use both make sure they are compatible. |
---|
1756 | @note |
---|
1757 | Only a single pass is allowed in your material, although multiple |
---|
1758 | techniques may be used for hardware fallback. |
---|
1759 | */ |
---|
1760 | virtual void setShadowTextureReceiverMaterial(const String& name); |
---|
1761 | |
---|
1762 | /** Sets whether we should use an inifinite camera far plane |
---|
1763 | when rendering stencil shadows. |
---|
1764 | @remarks |
---|
1765 | Stencil shadow coherency is very reliant on the shadow volume |
---|
1766 | not being clipped by the far plane. If this clipping happens, you |
---|
1767 | get a kind of 'negative' shadow effect. The best way to achieve |
---|
1768 | coherency is to move the far plane of the camera out to infinity, |
---|
1769 | thus preventing the far plane from clipping the shadow volumes. |
---|
1770 | When combined with vertex program extrusion of the volume to |
---|
1771 | infinity, which Ogre does when available, this results in very |
---|
1772 | robust shadow volumes. For this reason, when you enable stencil |
---|
1773 | shadows, Ogre automatically changes your camera settings to |
---|
1774 | project to infinity if the card supports it. You can disable this |
---|
1775 | behaviour if you like by calling this method; although you can |
---|
1776 | never enable infinite projection if the card does not support it. |
---|
1777 | @par |
---|
1778 | If you disable infinite projection, or it is not available, |
---|
1779 | you need to be far more careful with your light attenuation / |
---|
1780 | directional light extrusion distances to avoid clipping artefacts |
---|
1781 | at the far plane. |
---|
1782 | @note |
---|
1783 | Recent cards will generally support infinite far plane projection. |
---|
1784 | However, we have found some cases where they do not, especially |
---|
1785 | on Direct3D. There is no standard capability we can check to |
---|
1786 | validate this, so we use some heuristics based on experience: |
---|
1787 | <UL> |
---|
1788 | <LI>OpenGL always seems to support it no matter what the card</LI> |
---|
1789 | <LI>Direct3D on non-vertex program capable systems (including |
---|
1790 | vertex program capable cards on Direct3D7) does not |
---|
1791 | support it</LI> |
---|
1792 | <LI>Direct3D on GeForce3 and GeForce4 Ti does not seem to support |
---|
1793 | infinite projection<LI> |
---|
1794 | </UL> |
---|
1795 | Therefore in the RenderSystem implementation, we may veto the use |
---|
1796 | of an infinite far plane based on these heuristics. |
---|
1797 | */ |
---|
1798 | virtual void setShadowUseInfiniteFarPlane(bool enable) { |
---|
1799 | mShadowUseInfiniteFarPlane = enable; } |
---|
1800 | |
---|
1801 | /** Creates a StaticGeometry instance suitable for use with this |
---|
1802 | SceneManager. |
---|
1803 | @remarks |
---|
1804 | StaticGeometry is a way of batching up geometry into a more |
---|
1805 | efficient form at the expense of being able to move it. Please |
---|
1806 | read the StaticGeometry class documentation for full information. |
---|
1807 | @param name The name to give the new object |
---|
1808 | @returns The new StaticGeometry instance |
---|
1809 | */ |
---|
1810 | virtual StaticGeometry* createStaticGeometry(const String& name); |
---|
1811 | /** Retrieve a previously created StaticGeometry instance. */ |
---|
1812 | virtual StaticGeometry* getStaticGeometry(const String& name) const; |
---|
1813 | /** Remove & destroy a StaticGeometry instance. */ |
---|
1814 | virtual void removeStaticGeometry(StaticGeometry* geom); |
---|
1815 | /** Remove & destroy a StaticGeometry instance. */ |
---|
1816 | virtual void removeStaticGeometry(const String& name); |
---|
1817 | /** Remove & destroy all StaticGeometry instances. */ |
---|
1818 | virtual void removeAllStaticGeometry(void); |
---|
1819 | |
---|
1820 | |
---|
1821 | }; |
---|
1822 | |
---|
1823 | /** Default implementation of IntersectionSceneQuery. */ |
---|
1824 | class _OgreExport DefaultIntersectionSceneQuery : |
---|
1825 | public IntersectionSceneQuery |
---|
1826 | { |
---|
1827 | public: |
---|
1828 | DefaultIntersectionSceneQuery(SceneManager* creator); |
---|
1829 | ~DefaultIntersectionSceneQuery(); |
---|
1830 | |
---|
1831 | /** See IntersectionSceneQuery. */ |
---|
1832 | void execute(IntersectionSceneQueryListener* listener); |
---|
1833 | }; |
---|
1834 | |
---|
1835 | /** Default implementation of RaySceneQuery. */ |
---|
1836 | class _OgreExport DefaultRaySceneQuery : public RaySceneQuery |
---|
1837 | { |
---|
1838 | public: |
---|
1839 | DefaultRaySceneQuery(SceneManager* creator); |
---|
1840 | ~DefaultRaySceneQuery(); |
---|
1841 | |
---|
1842 | /** See RayScenQuery. */ |
---|
1843 | void execute(RaySceneQueryListener* listener); |
---|
1844 | }; |
---|
1845 | /** Default implementation of SphereSceneQuery. */ |
---|
1846 | class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery |
---|
1847 | { |
---|
1848 | public: |
---|
1849 | DefaultSphereSceneQuery(SceneManager* creator); |
---|
1850 | ~DefaultSphereSceneQuery(); |
---|
1851 | |
---|
1852 | /** See SceneQuery. */ |
---|
1853 | void execute(SceneQueryListener* listener); |
---|
1854 | }; |
---|
1855 | /** Default implementation of PlaneBoundedVolumeListSceneQuery. */ |
---|
1856 | class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery |
---|
1857 | { |
---|
1858 | public: |
---|
1859 | DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator); |
---|
1860 | ~DefaultPlaneBoundedVolumeListSceneQuery(); |
---|
1861 | |
---|
1862 | /** See SceneQuery. */ |
---|
1863 | void execute(SceneQueryListener* listener); |
---|
1864 | }; |
---|
1865 | /** Default implementation of AxisAlignedBoxSceneQuery. */ |
---|
1866 | class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery |
---|
1867 | { |
---|
1868 | public: |
---|
1869 | DefaultAxisAlignedBoxSceneQuery(SceneManager* creator); |
---|
1870 | ~DefaultAxisAlignedBoxSceneQuery(); |
---|
1871 | |
---|
1872 | /** See RayScenQuery. */ |
---|
1873 | void execute(SceneQueryListener* listener); |
---|
1874 | }; |
---|
1875 | |
---|
1876 | |
---|
1877 | |
---|
1878 | } // Namespace |
---|
1879 | |
---|
1880 | |
---|
1881 | |
---|
1882 | #endif |
---|