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

Revision 74, 93.4 KB checked in by mattausch, 19 years ago (diff)

added support for release mode

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