source: trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h @ 139

Revision 139, 93.8 KB checked in by mattausch, 19 years ago (diff)

fixed bug with tight octree boxes
added more flexible renderqueue (can delete per flag)
reordered functions in visibility terrain scene manager

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