OGRE: OgreSceneManager.h Source File - OGRE Documentation

# OgreSceneManager.h

Go to the documentation of this file.

    00001 /*-------------------------------------------------------------------------
    00002 This source file is a part of OGRE
    00003 (Object-oriented Graphics Rendering Engine)
    00004
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2009 Torus Knot Software Ltd
    00008 Permission is hereby granted, free of charge, to any person obtaining a copy
    00009 of this software and associated documentation files (the "Software"), to deal
    00010 in the Software without restriction, including without limitation the rights
    00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00012 copies of the Software, and to permit persons to whom the Software is
    00013 furnished to do so, subject to the following conditions:
    00014
    00015 The above copyright notice and this permission notice shall be included in
    00016 all copies or substantial portions of the Software.
    00017
    00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00024 THE SOFTWARE
    00025
    00026 You may alternatively use this source under the terms of a specific version of
    00027 the OGRE Unrestricted License provided you have obtained such a license from
    00028 Torus Knot Software Ltd.
    00029 -------------------------------------------------------------------------*/
    00030 #ifndef __SceneManager_H__
    00031 #define __SceneManager_H__
    00032
    00033 // Precompiler options
    00034 #include "OgrePrerequisites.h"
    00035
    00036 #include "OgreString.h"
    00037 #include "OgreSceneNode.h"
    00038 #include "OgrePlane.h"
    00039 #include "OgreQuaternion.h"
    00040 #include "OgreColourValue.h"
    00041 #include "OgreCommon.h"
    00042 #include "OgreSceneQuery.h"
    00043 #include "OgreAutoParamDataSource.h"
    00044 #include "OgreAnimationState.h"
    00045 #include "OgreRenderQueue.h"
    00046 #include "OgreRenderQueueSortingGrouping.h"
    00047 #include "OgreRectangle2D.h"
    00048 #include "OgrePixelFormat.h"
    00049 #include "OgreResourceGroupManager.h"
    00050 #include "OgreTexture.h"
    00051 #include "OgreShadowCameraSetup.h"
    00052 #include "OgreShadowTextureManager.h"
    00053 #include "OgreCamera.h"
    00054 #include "OgreInstancedGeometry.h"
    00055 #include "OgreLodListener.h"
    00056 #include "OgreRenderSystem.h"
    00057 namespace Ogre {
    00066     struct ViewPoint
    00067     {
    00068         Vector3 position;
    00069         Quaternion orientation;
    00070     };
    00071
    00072     // Forward declarations
    00073     class DefaultIntersectionSceneQuery;
    00074     class DefaultRaySceneQuery;
    00075     class DefaultSphereSceneQuery;
    00076     class DefaultAxisAlignedBoxSceneQuery;
    00077     class CompositorChain;
    00078
    00082     struct _OgreExport VisibleObjectsBoundsInfo
    00083     {
    00085         AxisAlignedBox aabb;
    00087         AxisAlignedBox receiverAabb;
    00089         Real minDistance;
    00091         Real maxDistance;
    00093         Real minDistanceInFrustum;
    00095         Real maxDistanceInFrustum;
    00096
    00097         VisibleObjectsBoundsInfo();
    00098         void reset();
    00099         void merge(const AxisAlignedBox& boxBounds, const Sphere& sphereBounds,
    00100             const Camera* cam, bool receiver=true);
    00104         void mergeNonRenderedButInFrustum(const AxisAlignedBox& boxBounds,
    00105             const Sphere& sphereBounds, const Camera* cam);
    00106
    00107
    00108     };
    00109
    00139     class _OgreExport SceneManager : public SceneMgtAlloc
    00140     {
    00141     public:
    00143         static uint32 WORLD_GEOMETRY_TYPE_MASK;
    00145         static uint32 ENTITY_TYPE_MASK;
    00147         static uint32 FX_TYPE_MASK;
    00149         static uint32 STATICGEOMETRY_TYPE_MASK;
    00151         static uint32 LIGHT_TYPE_MASK;
    00153         static uint32 FRUSTUM_TYPE_MASK;
    00155         static uint32 USER_TYPE_MASK_LIMIT;
    00158         struct materialLess
    00159         {
    00160             _OgreExport bool operator()(const Material* x, const Material* y) const;
    00161         };
    00163         struct lightLess
    00164         {
    00165             _OgreExport bool operator()(const Light* a, const Light* b) const;
    00166         };
    00167
    00169         enum IlluminationRenderStage
    00170         {
    00172             IRS_NONE,
    00174             IRS_RENDER_TO_TEXTURE,
    00176             IRS_RENDER_RECEIVER_PASS
    00177         };
    00178
    00183         enum SpecialCaseRenderQueueMode
    00184         {
    00186             SCRQM_INCLUDE,
    00188             SCRQM_EXCLUDE
    00189         };
    00190
    00191         struct SkyDomeGenParameters
    00192         {
    00193             Real skyDomeCurvature;
    00194             Real skyDomeTiling;
    00195             Real skyDomeDistance;
    00196             int skyDomeXSegments;
    00197             int skyDomeYSegments;
    00198             int skyDomeYSegments_keep;
    00199         };
    00200
    00201         struct SkyPlaneGenParameters
    00202         {
    00203             Real skyPlaneScale;
    00204             Real skyPlaneTiling;
    00205             Real skyPlaneBow;
    00206             int skyPlaneXSegments;
    00207             int skyPlaneYSegments;
    00208         };
    00209
    00210         struct SkyBoxGenParameters
    00211         {
    00212             Real skyBoxDistance;
    00213         };
    00214
    00218         class Listener
    00219         {
    00220         public:
    00221             Listener() {}
    00222             virtual ~Listener() {}
    00223
    00233             virtual void preFindVisibleObjects(SceneManager* source,
    00234                 IlluminationRenderStage irs, Viewport* v)
    00235                         { (void)source; (void)irs; (void)v; }
    00236
    00247             virtual void postFindVisibleObjects(SceneManager* source,
    00248                 IlluminationRenderStage irs, Viewport* v)
    00249                         { (void)source; (void)irs; (void)v; }
    00250
    00265             virtual void shadowTexturesUpdated(size_t numberOfShadowTextures)
    00266                         { (void)numberOfShadowTextures; }
    00267
    00281             virtual void shadowTextureCasterPreViewProj(Light* light,
    00282                 Camera* camera, size_t iteration)
    00283                         { (void)light; (void)camera; (void)iteration; }
    00284
    00298             virtual void shadowTextureReceiverPreViewProj(Light* light,
    00299                 Frustum* frustum)
    00300                         { (void)light; (void)frustum; }
    00301
    00324             virtual bool sortLightsAffectingFrustum(LightList& lightList)
    00325                         { (void)lightList; return false; }
    00326
    00328             virtual void sceneManagerDestroyed(SceneManager* source)
    00329                         { (void)source; }
    00330         };
    00331
    00335         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
    00336         {
    00337         protected:
    00339             const Pass* mUsedPass;
    00340         public:
    00341             SceneMgrQueuedRenderableVisitor()
    00342                 :transparentShadowCastersMode(false) {}
    00343             ~SceneMgrQueuedRenderableVisitor() {}
    00344             void visit(Renderable* r);
    00345             bool visit(const Pass* p);
    00346             void visit(RenderablePass* rp);
    00347
    00349             SceneManager* targetSceneMgr;
    00351             bool transparentShadowCastersMode;
    00353             bool autoLights;
    00355             const LightList* manualLightList;
    00357             bool scissoring;
    00358
    00359         };
    00361         friend class SceneMgrQueuedRenderableVisitor;
    00362
    00363     protected:
    00364
    00366         virtual SceneNode* createSceneNodeImpl(void);
    00368         virtual SceneNode* createSceneNodeImpl(const String& name);
    00369
    00371         String mName;
    00372
    00374         RenderQueue* mRenderQueue;
    00375         bool mLastRenderQueueInvocationCustom;
    00376
    00378         ColourValue mAmbientLight;
    00379
    00381         RenderSystem *mDestRenderSystem;
    00382
    00383         typedef map<String, Camera* >::type CameraList;
    00384
    00387         CameraList mCameras;
    00388
    00389         typedef map<String, StaticGeometry* >::type StaticGeometryList;
    00390         StaticGeometryList mStaticGeometryList;
    00391         typedef map<String, InstancedGeometry* >::type InstancedGeometryList;
    00392         InstancedGeometryList mInstancedGeometryList;
    00393
    00394         typedef map<String, SceneNode*>::type SceneNodeList;
    00395
    00402         SceneNodeList mSceneNodes;
    00403
    00405         Camera* mCameraInProgress;
    00407         Viewport* mCurrentViewport;
    00408
    00410         SceneNode* mSceneRoot;
    00411
    00413         typedef set<SceneNode*>::type AutoTrackingSceneNodes;
    00414         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
    00415
    00416         // Sky params
    00417         // Sky plane
    00418         Entity* mSkyPlaneEntity;
    00419         Entity* mSkyDomeEntity[5];
    00420         ManualObject* mSkyBoxObj;
    00421
    00422         SceneNode* mSkyPlaneNode;
    00423         SceneNode* mSkyDomeNode;
    00424         SceneNode* mSkyBoxNode;
    00425
    00426         // Sky plane
    00427         bool mSkyPlaneEnabled;
    00428         uint8 mSkyPlaneRenderQueue;
    00429         Plane mSkyPlane;
    00430         SkyPlaneGenParameters mSkyPlaneGenParameters;
    00431         // Sky box
    00432         bool mSkyBoxEnabled;
    00433         uint8 mSkyBoxRenderQueue;
    00434         Quaternion mSkyBoxOrientation;
    00435         SkyBoxGenParameters mSkyBoxGenParameters;
    00436         // Sky dome
    00437         bool mSkyDomeEnabled;
    00438         uint8 mSkyDomeRenderQueue;
    00439         Quaternion mSkyDomeOrientation;
    00440         SkyDomeGenParameters mSkyDomeGenParameters;
    00441
    00442         // Fog
    00443         FogMode mFogMode;
    00444         ColourValue mFogColour;
    00445         Real mFogStart;
    00446         Real mFogEnd;
    00447         Real mFogDensity;
    00448
    00449         typedef set<uint8>::type SpecialCaseRenderQueueList;
    00450         SpecialCaseRenderQueueList mSpecialCaseQueueList;
    00451         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
    00452         uint8 mWorldGeometryRenderQueue;
    00453
    00454         unsigned long mLastFrameNumber;
    00455         Matrix4 mTempXform[256];
    00456         bool mResetIdentityView;
    00457         bool mResetIdentityProj;
    00458
    00459         bool mNormaliseNormalsOnScale;
    00460         bool mFlipCullingOnNegativeScale;
    00461         CullingMode mPassCullingMode;
    00462
    00463     protected:
    00464
    00472         typedef map< const Camera*, VisibleObjectsBoundsInfo>::type CamVisibleObjectsMap;
    00473         CamVisibleObjectsMap mCamVisibleObjectsMap;
    00474
    00476         typedef map< const Camera*, const Light* >::type ShadowCamLightMapping;
    00477         ShadowCamLightMapping mShadowCamLightMapping;
    00478
    00480         size_t mShadowTextureCountPerType[3];
    00481
    00483         vector<size_t>::type mShadowTextureIndexLightList;
    00484
    00486         struct _OgreExport LightInfo
    00487         {
    00488             Light* light;       // Just a pointer for comparison, the light might destroyed for some reason
    00489             int type;           // Use int instead of Light::LightTypes to avoid header file dependence
    00490             Real range;         // Sets to zero if directional light
    00491             Vector3 position;   // Sets to zero if directional light
    00492             uint32 lightMask;   // Light mask
    00493
    00494             bool operator== (const LightInfo& rhs) const
    00495             {
    00496                 return light == rhs.light && type == rhs.type &&
    00497                     range == rhs.range && position == rhs.position && lightMask == rhs.lightMask;
    00498             }
    00499
    00500             bool operator!= (const LightInfo& rhs) const
    00501             {
    00502                 return !(*this == rhs);
    00503             }
    00504         };
    00505
    00506         typedef vector<LightInfo>::type LightInfoList;
    00507
    00508         LightList mLightsAffectingFrustum;
    00509         LightInfoList mCachedLightInfos;
    00510         LightInfoList mTestLightInfos; // potentially new list
    00511         ulong mLightsDirtyCounter;
    00512         LightList mShadowTextureCurrentCasterLightList;
    00513
    00514         typedef map<String, MovableObject*>::type MovableObjectMap;
    00516         struct MovableObjectCollection
    00517         {
    00518             MovableObjectMap map;
    00519             OGRE_MUTEX(mutex)
    00520         };
    00521         typedef map<String, MovableObjectCollection*>::type MovableObjectCollectionMap;
    00522         MovableObjectCollectionMap mMovableObjectCollectionMap;
    00523         NameGenerator mMovableNameGenerator;
    00528         MovableObjectCollection* getMovableObjectCollection(const String& typeName);
    00533         const MovableObjectCollection* getMovableObjectCollection(const String& typeName) const;
    00535         OGRE_MUTEX(mMovableObjectCollectionMapMutex)
    00536
    00537
    00541         virtual void initRenderQueue(void);
    00543         Pass* mShadowCasterPlainBlackPass;
    00545         Pass* mShadowReceiverPass;
    00555         virtual const Pass* deriveShadowCasterPass(const Pass* pass);
    00564         virtual const Pass* deriveShadowReceiverPass(const Pass* pass);
    00565
    00572         virtual bool validatePassForRendering(const Pass* pass);
    00573
    00580         virtual bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
    00581
    00582         enum BoxPlane
    00583         {
    00584             BP_FRONT = 0,
    00585             BP_BACK = 1,
    00586             BP_LEFT = 2,
    00587             BP_RIGHT = 3,
    00588             BP_UP = 4,
    00589             BP_DOWN = 5
    00590         };
    00591
    00592         /* Internal utility method for creating the planes of a skybox.
    00593         */
    00594         virtual MeshPtr createSkyboxPlane(
    00595             BoxPlane bp,
    00596             Real distance,
    00597             const Quaternion& orientation,
    00598             const String& groupName);
    00599
    00600         /* Internal utility method for creating the planes of a skydome.
    00601         */
    00602         virtual MeshPtr createSkydomePlane(
    00603             BoxPlane bp,
    00604             Real curvature, Real tiling, Real distance,
    00605             const Quaternion& orientation,
    00606             int xsegments, int ysegments, int ySegmentsToKeep,
    00607             const String& groupName);
    00608
    00609         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
    00610         bool mDisplayNodes;
    00611
    00613         typedef map<String, Animation*>::type AnimationList;
    00614         AnimationList mAnimationsList;
    00615         OGRE_MUTEX(mAnimationsListMutex)
    00616         AnimationStateSet mAnimationStates;
    00617
    00618
    00621         virtual void useRenderableViewProjMode(const Renderable* pRend, bool fixedFunction);
    00622
    00625         virtual void resetViewProjMode(bool fixedFunction);
    00626
    00627         typedef vector<RenderQueueListener*>::type RenderQueueListenerList;
    00628         RenderQueueListenerList mRenderQueueListeners;
    00629
    00630         typedef vector<RenderObjectListener*>::type RenderObjectListenerList;
    00631         RenderObjectListenerList mRenderObjectListeners;
    00632         typedef vector<Listener*>::type ListenerList;
    00633         ListenerList mListeners;
    00635         virtual void firePreRenderQueues();
    00637         virtual void firePostRenderQueues();
    00639         virtual bool fireRenderQueueStarted(uint8 id, const String& invocation);
    00641         virtual bool fireRenderQueueEnded(uint8 id, const String& invocation);
    00643         virtual void fireRenderSingleObject(Renderable* rend, const Pass* pass, const AutoParamDataSource* source,
    00644             const LightList* pLightList, bool suppressRenderStateChanges);
    00645
    00647         virtual void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
    00649         virtual void fireShadowTexturesPreCaster(Light* light, Camera* camera, size_t iteration);
    00651         virtual void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
    00653         virtual void firePreFindVisibleObjects(Viewport* v);
    00655         virtual void firePostFindVisibleObjects(Viewport* v);
    00657         virtual void fireSceneManagerDestroyed();
    00659         virtual void setViewport(Viewport *vp);
    00660
    00662         bool mShowBoundingBoxes;
    00663
    00665         virtual void renderVisibleObjectsDefaultSequence(void);
    00667         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
    00669         virtual void prepareRenderQueue(void);
    00670
    00671
    00687         virtual void renderSingleObject(Renderable* rend, const Pass* pass,
    00688             bool lightScissoringClipping, bool doLightIteration, const LightList* manualLightList = 0);
    00689
    00691         virtual AutoParamDataSource* createAutoParamDataSource(void) const
    00692         {
    00693             return OGRE_NEW AutoParamDataSource();
    00694         }
    00695
    00697         AutoParamDataSource* mAutoParamDataSource;
    00698
    00699         CompositorChain* mActiveCompositorChain;
    00700         bool mLateMaterialResolving;
    00701
    00702         ShadowTechnique mShadowTechnique;
    00703         bool mDebugShadows;
    00704         ColourValue mShadowColour;
    00705         Pass* mShadowDebugPass;
    00706         Pass* mShadowStencilPass;
    00707         Pass* mShadowModulativePass;
    00708         bool mShadowMaterialInitDone;
    00709         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
    00710         size_t mShadowIndexBufferSize;
    00711         Rectangle2D* mFullScreenQuad;
    00712         Real mShadowDirLightExtrudeDist;
    00713         IlluminationRenderStage mIlluminationStage;
    00714         ShadowTextureConfigList mShadowTextureConfigList;
    00715         bool mShadowTextureConfigDirty;
    00716         ShadowTextureList mShadowTextures;
    00717         TexturePtr mNullShadowTexture;
    00718         typedef vector<Camera*>::type ShadowTextureCameraList;
    00719         ShadowTextureCameraList mShadowTextureCameras;
    00720         Texture* mCurrentShadowTexture;
    00721         bool mShadowUseInfiniteFarPlane;
    00722         bool mShadowCasterRenderBackFaces;
    00723         bool mShadowAdditiveLightClip;
    00725         struct LightClippingInfo
    00726         {
    00727             RealRect scissorRect;
    00728             PlaneList clipPlanes;
    00729             bool scissorValid;
    00730             unsigned long clipPlanesValid;
    00731             LightClippingInfo() : scissorValid(false), clipPlanesValid(false) {}
    00732
    00733         };
    00734         typedef map<Light*, LightClippingInfo>::type LightClippingInfoMap;
    00735         LightClippingInfoMap mLightClippingInfoMap;
    00736         unsigned long mLightClippingInfoMapFrameNumber;
    00737
    00739         ShadowCameraSetupPtr mDefaultShadowCameraSetup;
    00740
    00749         struct lightsForShadowTextureLess
    00750         {
    00751             _OgreExport bool operator()(const Light* l1, const Light* l2) const;
    00752         };
    00753
    00754
    00761         virtual void findLightsAffectingFrustum(const Camera* camera);
    00763         virtual void initShadowVolumeMaterials(void);
    00765         virtual void ensureShadowTexturesCreated();
    00767         virtual void destroyShadowTextures(void);
    00768
    00769     public:
    00773         virtual void prepareShadowTextures(Camera* cam, Viewport* vp, const LightList* lightList = 0);
    00774
    00775         //A render context, used to store internal data for pausing/resuming rendering
    00776         struct RenderContext
    00777         {
    00778             RenderQueue* renderQueue;
    00779             Viewport* viewport;
    00780             Camera* camera;
    00781             CompositorChain* activeChain;
    00782             RenderSystem::RenderSystemContext* rsContext;
    00783         };
    00784
    00788         virtual RenderContext* _pauseRendering();
    00792         virtual void _resumeRendering(RenderContext* context);
    00793
    00794     protected:
    00802         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam,
    00803             bool calcScissor);
    00809         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
    00811         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
    00812             Pass* pass, const LightList *manualLightList, unsigned long flags,
    00813             bool secondpass, bool zfail, bool twosided);
    00814         typedef vector<ShadowCaster*>::type ShadowCasterList;
    00815         ShadowCasterList mShadowCasterList;
    00816         SphereSceneQuery* mShadowCasterSphereQuery;
    00817         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
    00818         Real mDefaultShadowFarDist;
    00819         Real mDefaultShadowFarDistSquared;
    00820         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
    00821         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
    00822         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
    00823         bool mShadowTextureSelfShadow;
    00824         Pass* mShadowTextureCustomCasterPass;
    00825         Pass* mShadowTextureCustomReceiverPass;
    00826         String mShadowTextureCustomCasterVertexProgram;
    00827         String mShadowTextureCustomReceiverVertexProgram;
    00828         String mShadowTextureCustomReceiverFragmentProgram;
    00829         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
    00830         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
    00831         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
    00832
    00834         uint32 mVisibilityMask;
    00835         bool mFindVisibleObjects;
    00836
    00838         bool mSuppressRenderStateChanges;
    00840         bool mSuppressShadows;
    00841
    00842
    00843         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
    00844         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
    00845
    00847         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener, public SceneMgtAlloc
    00848         {
    00849         protected:
    00850             SceneManager* mSceneMgr;
    00851             ShadowCasterList* mCasterList;
    00852             bool mIsLightInFrustum;
    00853             const PlaneBoundedVolumeList* mLightClipVolumeList;
    00854             const Camera* mCamera;
    00855             const Light* mLight;
    00856             Real mFarDistSquared;
    00857         public:
    00858             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
    00859                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0),
    00860                 mCamera(0) {}
    00861             // Prepare the listener for use with a set of parameters
    00862             void prepare(bool lightInFrustum,
    00863                 const PlaneBoundedVolumeList* lightClipVolumes,
    00864                 const Light* light, const Camera* cam, ShadowCasterList* casterList,
    00865                 Real farDistSquared)
    00866             {
    00867                 mCasterList = casterList;
    00868                 mIsLightInFrustum = lightInFrustum;
    00869                 mLightClipVolumeList = lightClipVolumes;
    00870                 mCamera = cam;
    00871                 mLight = light;
    00872                 mFarDistSquared = farDistSquared;
    00873             }
    00874             bool queryResult(MovableObject* object);
    00875             bool queryResult(SceneQuery::WorldFragment* fragment);
    00876         };
    00877
    00878         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
    00879
    00886         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light,
    00887             const Camera* camera);
    00889         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,
    00890             QueuedRenderableCollection::OrganisationMode om);
    00892         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00893             QueuedRenderableCollection::OrganisationMode om);
    00895         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00896             QueuedRenderableCollection::OrganisationMode om);
    00898         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group,
    00899             QueuedRenderableCollection::OrganisationMode om);
    00901         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group,
    00902             QueuedRenderableCollection::OrganisationMode om);
    00904         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00905             QueuedRenderableCollection::OrganisationMode om);
    00906
    00908         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00909             QueuedRenderableCollection::OrganisationMode om);
    00911         virtual void renderObjects(const QueuedRenderableCollection& objs,
    00912             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
    00913             bool doLightIteration, const LightList* manualLightList = 0);
    00919         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs,
    00920             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
    00921             bool doLightIteration, const LightList* manualLightList = 0);
    00922
    00925         virtual void updateRenderQueueSplitOptions(void);
    00928         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group,
    00929             bool suppressShadows, bool suppressRenderState);
    00930
    00932         virtual ClipResult buildAndSetScissor(const LightList& ll, const Camera* cam);
    00934         virtual void buildScissor(const Light* l, const Camera* cam, RealRect& rect);
    00935         virtual void resetScissor();
    00937         virtual ClipResult buildAndSetLightClip(const LightList& ll);
    00938         virtual void buildLightClip(const Light* l, PlaneList& planes);
    00939         virtual void resetLightClip();
    00940         virtual void checkCachedLightClippingInfo();
    00941
    00943         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
    00945         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
    00946
    00948         bool mCameraRelativeRendering;
    00949         Matrix4 mCachedViewMatrix;
    00950         Vector3 mCameraRelativePosition;
    00951
    00953         uint32 mLastLightHash;
    00954         unsigned short mLastLightLimit;
    00955         uint32 mLastLightHashGpuProgram;
    00957         uint16 mGpuParamsDirty;
    00958
    00959         virtual void useLights(const LightList& lights, unsigned short limit);
    00960         virtual void setViewMatrix(const Matrix4& m);
    00961         virtual void useLightsGpuProgram(const Pass* pass, const LightList* lights);
    00962         virtual void bindGpuProgram(GpuProgram* prog);
    00963         virtual void updateGpuProgramParameters(const Pass* p);
    00964
    00965
    00966
    00967
    00968
    00969
    00970
    00971
    00973         typedef set<LodListener*>::type LodListenerSet;
    00974         LodListenerSet mLodListeners;
    00975
    00977         typedef vector<MovableObjectLodChangedEvent>::type MovableObjectLodChangedEventList;
    00978         MovableObjectLodChangedEventList mMovableObjectLodChangedEvents;
    00979
    00981         typedef vector<EntityMeshLodChangedEvent>::type EntityMeshLodChangedEventList;
    00982         EntityMeshLodChangedEventList mEntityMeshLodChangedEvents;
    00983
    00985         typedef vector<EntityMaterialLodChangedEvent>::type EntityMaterialLodChangedEventList;
    00986         EntityMaterialLodChangedEventList mEntityMaterialLodChangedEvents;
    00987
    00988     public:
    00991         SceneManager(const String& instanceName);
    00992
    00995         virtual ~SceneManager();
    00996
    00997
    01023         OGRE_MUTEX(sceneGraphMutex)
    01024
    01025
    01026         const String& getName(void) const { return mName; }
    01027
    01034         virtual const String& getTypeName(void) const = 0;
    01035
    01043         virtual Camera* createCamera(const String& name);
    01044
    01048         virtual Camera* getCamera(const String& name) const;
    01049
    01052         virtual bool hasCamera(const String& name) const;
    01053
    01062         virtual void destroyCamera(Camera *cam);
    01063
    01069         virtual void destroyCamera(const String& name);
    01070
    01079         virtual void destroyAllCameras(void);
    01080
    01091         virtual Light* createLight(const String& name);
    01092
    01094         virtual Light* createLight();
    01095
    01099         virtual Light* getLight(const String& name) const;
    01100
    01103         virtual bool hasLight(const String& name) const;
    01104
    01107         virtual const PlaneList& getLightClippingPlanes(Light* l);
    01108
    01111         virtual const RealRect& getLightScissorRect(Light* l, const Camera* cam);
    01112
    01117         virtual void destroyLight(const String& name);
    01118
    01123         virtual void destroyLight(Light* light);
    01126         virtual void destroyAllLights(void);
    01127
    01138         virtual void _notifyLightsDirty(void);
    01139
    01152         ulong _getLightsDirtyCounter(void) const { return mLightsDirtyCounter; }
    01153
    01160         virtual const LightList& _getLightsAffectingFrustum(void) const;
    01161
    01184         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
    01185
    01214         virtual void _populateLightList(const SceneNode* sn, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
    01215
    01232         virtual SceneNode* createSceneNode(void);
    01233
    01248         virtual SceneNode* createSceneNode(const String& name);
    01249
    01256         virtual void destroySceneNode(const String& name);
    01257
    01264         virtual void destroySceneNode(SceneNode* sn);
    01280         virtual SceneNode* getRootSceneNode(void);
    01281
    01289         virtual SceneNode* getSceneNode(const String& name) const;
    01290
    01293         virtual bool hasSceneNode(const String& name) const;
    01294
    01295
    01303         virtual Entity* createEntity(const String& entityName, const String& meshName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
    01304
    01310         virtual Entity* createEntity(const String& meshName);
    01317         enum PrefabType {
    01318             PT_PLANE,
    01319             PT_CUBE,
    01320             PT_SPHERE
    01321         };
    01322
    01329         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
    01330
    01334         virtual Entity* createEntity(PrefabType ptype);
    01338         virtual Entity* getEntity(const String& name) const;
    01341         virtual bool hasEntity(const String& name) const;
    01342
    01351         virtual void destroyEntity(Entity* ent);
    01352
    01361         virtual void destroyEntity(const String& name);
    01362
    01372         virtual void destroyAllEntities(void);
    01373
    01379         virtual ManualObject* createManualObject(const String& name);
    01383         virtual ManualObject* createManualObject();
    01387         virtual ManualObject* getManualObject(const String& name) const;
    01390         virtual bool hasManualObject(const String& name) const;
    01391
    01394         virtual void destroyManualObject(ManualObject* obj);
    01397         virtual void destroyManualObject(const String& name);
    01400         virtual void destroyAllManualObjects(void);
    01406         virtual BillboardChain* createBillboardChain(const String& name);
    01410         virtual BillboardChain* createBillboardChain();
    01414         virtual BillboardChain* getBillboardChain(const String& name) const;
    01417         virtual bool hasBillboardChain(const String& name) const;
    01418
    01421         virtual void destroyBillboardChain(BillboardChain* obj);
    01424         virtual void destroyBillboardChain(const String& name);
    01427         virtual void destroyAllBillboardChains(void);
    01433         virtual RibbonTrail* createRibbonTrail(const String& name);
    01437         virtual RibbonTrail* createRibbonTrail();
    01441         virtual RibbonTrail* getRibbonTrail(const String& name) const;
    01444         virtual bool hasRibbonTrail(const String& name) const;
    01445
    01448         virtual void destroyRibbonTrail(RibbonTrail* obj);
    01451         virtual void destroyRibbonTrail(const String& name);
    01454         virtual void destroyAllRibbonTrails(void);
    01455
    01476         virtual ParticleSystem* createParticleSystem(const String& name,
    01477             const String& templateName);
    01497         virtual ParticleSystem* createParticleSystem(const String& name,
    01498             size_t quota = 500,
    01499             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01500
    01518         virtual ParticleSystem* createParticleSystem(size_t quota = 500,
    01519             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01523         virtual ParticleSystem* getParticleSystem(const String& name) const;
    01526         virtual bool hasParticleSystem(const String& name) const;
    01527
    01530         virtual void destroyParticleSystem(ParticleSystem* obj);
    01533         virtual void destroyParticleSystem(const String& name);
    01536         virtual void destroyAllParticleSystems(void);
    01537
    01543         virtual void clearScene(void);
    01544
    01557         void setAmbientLight(const ColourValue& colour);
    01558
    01561         const ColourValue& getAmbientLight(void) const;
    01562
    01578         virtual void prepareWorldGeometry(const String& filename);
    01579
    01597         virtual void prepareWorldGeometry(DataStreamPtr& stream,
    01598             const String& typeName = StringUtil::BLANK);
    01599
    01612         virtual void setWorldGeometry(const String& filename);
    01613
    01629         virtual void setWorldGeometry(DataStreamPtr& stream,
    01630             const String& typeName = StringUtil::BLANK);
    01631
    01644         virtual size_t estimateWorldGeometry(const String& filename)
    01645         { (void)filename; return 0; }
    01646
    01659         virtual size_t estimateWorldGeometry(DataStreamPtr& stream,
    01660             const String& typeName = StringUtil::BLANK)
    01661         { (void)stream; (void)typeName; return 0; }
    01662
    01677         virtual ViewPoint getSuggestedViewpoint(bool random = false);
    01678
    01692         virtual bool setOption( const String& strKey, const void* pValue )
    01693         { (void)strKey; (void)pValue; return false; }
    01694
    01708         virtual bool getOption( const String& strKey, void* pDestValue )
    01709         { (void)strKey; (void)pDestValue; return false; }
    01710
    01720         virtual bool hasOption( const String& strKey ) const
    01721         { (void)strKey; return false; }
    01722
    01737         virtual bool getOptionValues( const String& strKey, StringVector& refValueList )
    01738         { (void)strKey; (void)refValueList; return false; }
    01739
    01746         virtual bool getOptionKeys( StringVector& refKeys )
    01747         { (void)refKeys; return false; }
    01748
    01757         virtual void _updateSceneGraph(Camera* cam);
    01758
    01770         virtual void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters);
    01771
    01776         virtual void _applySceneAnimations(void);
    01777
    01780         virtual void _renderVisibleObjects(void);
    01781
    01795         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
    01796
    01800         virtual void _queueSkiesForRendering(Camera* cam);
    01801
    01802
    01803
    01812         virtual void _setDestinationRenderSystem(RenderSystem* sys);
    01813
    01867         virtual void setSkyPlane(
    01868             bool enable,
    01869             const Plane& plane, const String& materialName, Real scale = 1000,
    01870             Real tiling = 10, bool drawFirst = true, Real bow = 0,
    01871             int xsegments = 1, int ysegments = 1,
    01872             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01916         virtual void _setSkyPlane(
    01917             bool enable,
    01918             const Plane& plane, const String& materialName, Real scale = 1000,
    01919             Real tiling = 10, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, Real bow = 0,
    01920             int xsegments = 1, int ysegments = 1,
    01921             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01922
    01924         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
    01925
    01927         virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
    01928
    01930         virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
    01931
    01973         virtual void setSkyBox(
    01974             bool enable, const String& materialName, Real distance = 5000,
    01975             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
    01976             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01977
    02010         virtual void _setSkyBox(
    02011             bool enable, const String& materialName, Real distance = 5000,
    02012             uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, const Quaternion& orientation = Quaternion::IDENTITY,
    02013             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02014
    02016         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
    02017
    02019         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
    02020
    02022         virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
    02023
    02079         virtual void setSkyDome(
    02080             bool enable, const String& materialName, Real curvature = 10,
    02081             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
    02082             const Quaternion& orientation = Quaternion::IDENTITY,
    02083             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
    02084             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02085
    02132         virtual void _setSkyDome(
    02133             bool enable, const String& materialName, Real curvature = 10,
    02134             Real tiling = 8, Real distance = 4000, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY,
    02135             const Quaternion& orientation = Quaternion::IDENTITY,
    02136             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
    02137             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02138
    02140         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
    02141
    02143         virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
    02144
    02146         virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
    02147
    02172         void setFog(
    02173             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
    02174             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
    02175
    02178         virtual FogMode getFogMode(void) const;
    02179
    02182         virtual const ColourValue& getFogColour(void) const;
    02183
    02186         virtual Real getFogStart(void) const;
    02187
    02190         virtual Real getFogEnd(void) const;
    02191
    02194         virtual Real getFogDensity(void) const;
    02195
    02196
    02214         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
    02215
    02222         virtual BillboardSet* createBillboardSet(unsigned int poolSize = 20);
    02226         virtual BillboardSet* getBillboardSet(const String& name) const;
    02229         virtual bool hasBillboardSet(const String& name) const;
    02230
    02237         virtual void destroyBillboardSet(BillboardSet* set);
    02238
    02245         virtual void destroyBillboardSet(const String& name);
    02246
    02256         virtual void destroyAllBillboardSets(void);
    02257
    02265         virtual void setDisplaySceneNodes(bool display);
    02267         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
    02268
    02289         virtual Animation* createAnimation(const String& name, Real length);
    02290
    02294         virtual Animation* getAnimation(const String& name) const;
    02297         virtual bool hasAnimation(const String& name) const;
    02298
    02304         virtual void destroyAnimation(const String& name);
    02305
    02307         virtual void destroyAllAnimations(void);
    02308
    02336         virtual AnimationState* createAnimationState(const String& animName);
    02337
    02341         virtual AnimationState* getAnimationState(const String& animName) const;
    02344         virtual bool hasAnimationState(const String& name) const;
    02345
    02351         virtual void destroyAnimationState(const String& name);
    02352
    02354         virtual void destroyAllAnimationStates(void);
    02355
    02379         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp,
    02380             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix,
    02381             bool doBeginEndFrame = false) ;
    02382
    02403         virtual void manualRender(Renderable* rend, const Pass* pass, Viewport* vp,
    02404             const Matrix4& viewMatrix, const Matrix4& projMatrix, bool doBeginEndFrame = false, bool lightScissoringClipping = true,
    02405             bool doLightIteration = true, const LightList* manualLightList = 0);
    02406
    02417         virtual RenderQueue* getRenderQueue(void);
    02418
    02422         virtual void addRenderQueueListener(RenderQueueListener* newListener);
    02423
    02425         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
    02426
    02429         virtual void addRenderObjectListener(RenderObjectListener* newListener);
    02431         virtual void removeRenderObjectListener(RenderObjectListener* delListener);
    02432
    02446         virtual void addSpecialCaseRenderQueue(uint8 qid);
    02452         virtual void removeSpecialCaseRenderQueue(uint8 qid);
    02456         virtual void clearSpecialCaseRenderQueues(void);
    02461         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
    02463         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
    02470         virtual bool isRenderQueueToBeProcessed(uint8 qid);
    02471
    02487         virtual void setWorldGeometryRenderQueue(uint8 qid);
    02498         virtual uint8 getWorldGeometryRenderQueue(void);
    02499
    02501         virtual void showBoundingBoxes(bool bShow);
    02502
    02504         virtual bool getShowBoundingBoxes() const;
    02505
    02507         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
    02508
    02509
    02522         virtual AxisAlignedBoxSceneQuery*
    02523             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
    02536         virtual SphereSceneQuery*
    02537             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
    02550         virtual PlaneBoundedVolumeListSceneQuery*
    02551             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
    02552
    02553
    02566         virtual RaySceneQuery*
    02567             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
    02568         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
    02580         virtual IntersectionSceneQuery*
    02581             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
    02582
    02584         virtual void destroyQuery(SceneQuery* query);
    02585
    02586         typedef MapIterator<CameraList> CameraIterator;
    02587         typedef MapIterator<AnimationList> AnimationIterator;
    02588
    02591         CameraIterator getCameraIterator(void) {
    02592             return CameraIterator(mCameras.begin(), mCameras.end());
    02593         }
    02596         const CameraList& getCameras() const { return mCameras; }
    02598         AnimationIterator getAnimationIterator(void) {
    02599             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
    02600         }
    02603         const AnimationList& getAnimations() const { return mAnimationsList; }
    02605         AnimationStateIterator getAnimationStateIterator(void) {
    02606             return mAnimationStates.getAnimationStateIterator();
    02607         }
    02608
    02641         virtual void setShadowTechnique(ShadowTechnique technique);
    02642
    02644         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
    02645
    02647         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
    02649         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
    02650
    02657         virtual void setShadowColour(const ColourValue& colour);
    02664         virtual const ColourValue& getShadowColour(void) const;
    02676         virtual void setShadowDirectionalLightExtrusionDistance(Real dist);
    02679         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
    02696         virtual void setShadowFarDistance(Real distance);
    02700         virtual Real getShadowFarDistance(void) const
    02701         { return mDefaultShadowFarDist; }
    02702         virtual Real getShadowFarDistanceSquared(void) const
    02703         { return mDefaultShadowFarDistSquared; }
    02704
    02730         virtual void setShadowIndexBufferSize(size_t size);
    02732         virtual size_t getShadowIndexBufferSize(void) const
    02733         { return mShadowIndexBufferSize; }
    02742         virtual void setShadowTextureSize(unsigned short size);
    02743
    02750         virtual void setShadowTextureConfig(size_t shadowIndex, unsigned short width,
    02751             unsigned short height, PixelFormat format);
    02757         virtual void setShadowTextureConfig(size_t shadowIndex,
    02758             const ShadowTextureConfig& config);
    02759
    02761         ConstShadowTextureConfigIterator getShadowTextureConfigIterator() const;
    02762
    02774         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
    02782         virtual void setShadowTextureCount(size_t count);
    02784         size_t getShadowTextureCount(void) const {return mShadowTextureConfigList.size(); }
    02785
    02795         void setShadowTextureCountPerLightType(Light::LightTypes type, size_t count)
    02796         { mShadowTextureCountPerType[type] = count; }
    02798         size_t getShadowTextureCountPerLightType(Light::LightTypes type) const
    02799         {return mShadowTextureCountPerType[type]; }
    02800
    02809         virtual void setShadowTextureSettings(unsigned short size, unsigned short count,
    02810             PixelFormat fmt = PF_X8R8G8B8);
    02811
    02818         virtual const TexturePtr& getShadowTexture(size_t shadowIndex);
    02819
    02834         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
    02838         virtual Real getShadowDirLightTextureOffset(void)  const { return mShadowTextureOffset; }
    02846         virtual void setShadowTextureFadeStart(Real fadeStart)
    02847         { mShadowTextureFadeStart = fadeStart; }
    02855         virtual void setShadowTextureFadeEnd(Real fadeEnd)
    02856         { mShadowTextureFadeEnd = fadeEnd; }
    02857
    02870         virtual void setShadowTextureSelfShadow(bool selfShadow);
    02871
    02873         virtual bool getShadowTextureSelfShadow(void) const
    02874         { return mShadowTextureSelfShadow; }
    02895         virtual void setShadowTextureCasterMaterial(const String& name);
    02917         virtual void setShadowTextureReceiverMaterial(const String& name);
    02918
    02929         virtual void setShadowCasterRenderBackFaces(bool bf) { mShadowCasterRenderBackFaces = bf; }
    02930
    02934         virtual bool getShadowCasterRenderBackFaces() const { return mShadowCasterRenderBackFaces; }
    02935
    02940         virtual void setShadowCameraSetup(const ShadowCameraSetupPtr& shadowSetup);
    02941
    02946         virtual const ShadowCameraSetupPtr& getShadowCameraSetup() const;
    02947
    02984         virtual void setShadowUseInfiniteFarPlane(bool enable) {
    02985             mShadowUseInfiniteFarPlane = enable; }
    02986
    02988         virtual bool isShadowTechniqueStencilBased(void) const
    02989         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
    02991         virtual bool isShadowTechniqueTextureBased(void) const
    02992         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
    02994         virtual bool isShadowTechniqueModulative(void) const
    02995         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
    02997         virtual bool isShadowTechniqueAdditive(void) const
    02998         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
    03000         virtual bool isShadowTechniqueIntegrated(void) const
    03001         { return (mShadowTechnique & SHADOWDETAILTYPE_INTEGRATED) != 0; }
    03003         virtual bool isShadowTechniqueInUse(void) const
    03004         { return mShadowTechnique != SHADOWTYPE_NONE; }
    03008         virtual void setShadowUseLightClipPlanes(bool enabled) { mShadowAdditiveLightClip = enabled; }
    03012         virtual bool getShadowUseLightClipPlanes() const { return mShadowAdditiveLightClip; }
    03013
    03017         virtual void _setActiveCompositorChain(CompositorChain* chain) { mActiveCompositorChain = chain; }
    03018
    03024         virtual void setLateMaterialResolving(bool isLate) { mLateMaterialResolving = isLate; }
    03025
    03028         virtual bool isLateMaterialResolving() const { return mLateMaterialResolving; }
    03029
    03031         virtual CompositorChain* _getActiveCompositorChain() const { return mActiveCompositorChain; }
    03032
    03035         virtual void addListener(Listener* s);
    03038         virtual void removeListener(Listener* s);
    03039
    03049         virtual StaticGeometry* createStaticGeometry(const String& name);
    03053         virtual StaticGeometry* getStaticGeometry(const String& name) const;
    03055         virtual bool hasStaticGeometry(const String& name) const;
    03057         virtual void destroyStaticGeometry(StaticGeometry* geom);
    03059         virtual void destroyStaticGeometry(const String& name);
    03061         virtual void destroyAllStaticGeometry(void);
    03062
    03072         virtual InstancedGeometry* createInstancedGeometry(const String& name);
    03074         virtual InstancedGeometry* getInstancedGeometry(const String& name) const;
    03076         virtual void destroyInstancedGeometry(InstancedGeometry* geom);
    03078         virtual void destroyInstancedGeometry(const String& name);
    03080         virtual void destroyAllInstancedGeometry(void);
    03081
    03082
    03093         virtual MovableObject* createMovableObject(const String& name,
    03094             const String& typeName, const NameValuePairList* params = 0);
    03104         virtual MovableObject* createMovableObject(const String& typeName, const NameValuePairList* params = 0);
    03110         virtual void destroyMovableObject(const String& name, const String& typeName);
    03116         virtual void destroyMovableObject(MovableObject* m);
    03118         virtual void destroyAllMovableObjectsByType(const String& typeName);
    03120         virtual void destroyAllMovableObjects(void);
    03124         virtual MovableObject* getMovableObject(const String& name, const String& typeName) const;
    03126         virtual bool hasMovableObject(const String& name, const String& typeName) const;
    03127         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
    03133         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
    03145         virtual void injectMovableObject(MovableObject* m);
    03152         virtual void extractMovableObject(const String& name, const String& typeName);
    03159         virtual void extractMovableObject(MovableObject* m);
    03166         virtual void extractAllMovableObjectsByType(const String& typeName);
    03167
    03174         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
    03175
    03179         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
    03180
    03184         uint32 _getCombinedVisibilityMask(void) const;
    03185
    03192         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
    03193
    03197         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
    03198
    03207         virtual void setNormaliseNormalsOnScale(bool n) { mNormaliseNormalsOnScale = n; }
    03208
    03212         virtual bool getNormaliseNormalsOnScale() const { return mNormaliseNormalsOnScale; }
    03213
    03222         virtual void setFlipCullingOnNegativeScale(bool n) { mFlipCullingOnNegativeScale = n; }
    03223
    03227         virtual bool getFlipCullingOnNegativeScale() const { return mFlipCullingOnNegativeScale; }
    03228
    03234         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true,
    03235             bool doLightIteration = false, const LightList* manualLightList = 0);
    03236
    03255         virtual void _suppressRenderStateChanges(bool suppress);
    03256
    03260         virtual bool _areRenderStateChangesSuppressed(void) const
    03261         { return mSuppressRenderStateChanges; }
    03262
    03275         virtual const Pass* _setPass(const Pass* pass,
    03276             bool evenIfSuppressed = false, bool shadowDerivation = true);
    03277
    03278
    03288         virtual void _suppressShadows(bool suppress);
    03289
    03293         virtual bool _areShadowsSuppressed(void) const
    03294         { return mSuppressShadows; }
    03295
    03299         virtual void _renderQueueGroupObjects(RenderQueueGroup* group,
    03300             QueuedRenderableCollection::OrganisationMode om);
    03301
    03317         void setQueuedRenderableVisitor(SceneMgrQueuedRenderableVisitor* visitor);
    03318
    03320         SceneMgrQueuedRenderableVisitor* getQueuedRenderableVisitor(void) const;
    03321
    03322
    03326         RenderSystem *getDestinationRenderSystem();
    03327
    03330         Viewport* getCurrentViewport(void) const { return mCurrentViewport; }
    03331
    03333         const VisibleObjectsBoundsInfo& getVisibleObjectsBoundsInfo(const Camera* cam) const;
    03334
    03336         const VisibleObjectsBoundsInfo& getShadowCasterBoundsInfo(const Light* light, size_t iteration = 0) const;
    03337
    03352         virtual void setCameraRelativeRendering(bool rel) { mCameraRelativeRendering = rel; }
    03353
    03357         virtual bool getCameraRelativeRendering() const { return mCameraRelativeRendering; }
    03358
    03359
    03361         void addLodListener(LodListener *listener);
    03362
    03368         void removeLodListener(LodListener *listener);
    03369
    03371         void _notifyMovableObjectLodChanged(MovableObjectLodChangedEvent& evt);
    03372
    03374         void _notifyEntityMeshLodChanged(EntityMeshLodChangedEvent& evt);
    03375
    03377         void _notifyEntityMaterialLodChanged(EntityMaterialLodChangedEvent& evt);
    03378
    03380         void _handleLodEvents();
    03381     };
    03382
    03384     class _OgreExport DefaultIntersectionSceneQuery :
    03385         public IntersectionSceneQuery
    03386     {
    03387     public:
    03388         DefaultIntersectionSceneQuery(SceneManager* creator);
    03389         ~DefaultIntersectionSceneQuery();
    03390
    03392         void execute(IntersectionSceneQueryListener* listener);
    03393     };
    03394
    03396     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
    03397     {
    03398     public:
    03399         DefaultRaySceneQuery(SceneManager* creator);
    03400         ~DefaultRaySceneQuery();
    03401
    03403         void execute(RaySceneQueryListener* listener);
    03404     };
    03406     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
    03407     {
    03408     public:
    03409         DefaultSphereSceneQuery(SceneManager* creator);
    03410         ~DefaultSphereSceneQuery();
    03411
    03413         void execute(SceneQueryListener* listener);
    03414     };
    03416     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
    03417     {
    03418     public:
    03419         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
    03420         ~DefaultPlaneBoundedVolumeListSceneQuery();
    03421
    03423         void execute(SceneQueryListener* listener);
    03424     };
    03426     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
    03427     {
    03428     public:
    03429         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
    03430         ~DefaultAxisAlignedBoxSceneQuery();
    03431
    03433         void execute(SceneQueryListener* listener);
    03434     };
    03435
    03436
    03438     typedef uint16 SceneTypeMask;
    03439
    03443     enum SceneType
    03444     {
    03445         ST_GENERIC = 1,
    03446         ST_EXTERIOR_CLOSE = 2,
    03447         ST_EXTERIOR_FAR = 4,
    03448         ST_EXTERIOR_REAL_FAR = 8,
    03449         ST_INTERIOR = 16
    03450     };
    03451
    03453     struct SceneManagerMetaData
    03454     {
    03456         String typeName;
    03458         String description;
    03460         SceneTypeMask sceneTypeMask;
    03462         bool worldGeometrySupported;
    03463     };
    03464
    03465
    03466
    03468     class _OgreExport SceneManagerFactory : public SceneMgtAlloc
    03469     {
    03470     protected:
    03471         mutable SceneManagerMetaData mMetaData;
    03472         mutable bool mMetaDataInit;
    03474         virtual void initMetaData(void) const = 0;
    03475     public:
    03476         SceneManagerFactory() : mMetaDataInit(true) {}
    03477         virtual ~SceneManagerFactory() {}
    03479         virtual const SceneManagerMetaData& getMetaData(void) const
    03480         {
    03481             if (mMetaDataInit)
    03482             {
    03483                 initMetaData();
    03484                 mMetaDataInit = false;
    03485             }
    03486             return mMetaData;
    03487         }
    03492         virtual SceneManager* createInstance(const String& instanceName) = 0;
    03494         virtual void destroyInstance(SceneManager* instance) = 0;
    03495
    03496     };
    03497
    03502 } // Namespace
    03503
    03504
    03505
    03506 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:52