source: OGRE/trunk/ogrenew/OgreMain/include/OgreSceneManager.h @ 690

Revision 690, 93.9 KB checked in by mattausch, 19 years ago (diff)

added ogre 1.07 main

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