source: OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/include/OgreSceneManager.h @ 768

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