source: OGRE/trunk/ogre_changes/obsolete/OgreMain/include/OgreSceneManager.h @ 657

Revision 657, 95.8 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

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