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-2012 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 "OgreInstanceManager.h"
    00057 #include "OgreRenderSystem.h"
    00058 namespace Ogre {
    00067     struct ViewPoint
    00068     {
    00069         Vector3 position;
    00070         Quaternion orientation;
    00071     };
    00072
    00073     // Forward declarations
    00074     class DefaultIntersectionSceneQuery;
    00075     class DefaultRaySceneQuery;
    00076     class DefaultSphereSceneQuery;
    00077     class DefaultAxisAlignedBoxSceneQuery;
    00078     class CompositorChain;
    00079
    00083     struct _OgreExport VisibleObjectsBoundsInfo
    00084     {
    00086         AxisAlignedBox aabb;
    00088         AxisAlignedBox receiverAabb;
    00090         Real minDistance;
    00092         Real maxDistance;
    00094         Real minDistanceInFrustum;
    00096         Real maxDistanceInFrustum;
    00097
    00098         VisibleObjectsBoundsInfo();
    00099         void reset();
    00100         void merge(const AxisAlignedBox& boxBounds, const Sphere& sphereBounds,
    00101             const Camera* cam, bool receiver=true);
    00105         void mergeNonRenderedButInFrustum(const AxisAlignedBox& boxBounds,
    00106             const Sphere& sphereBounds, const Camera* cam);
    00107
    00108
    00109     };
    00110
    00140     class _OgreExport SceneManager : public SceneMgtAlloc
    00141     {
    00142     public:
    00144         static uint32 WORLD_GEOMETRY_TYPE_MASK;
    00146         static uint32 ENTITY_TYPE_MASK;
    00148         static uint32 FX_TYPE_MASK;
    00150         static uint32 STATICGEOMETRY_TYPE_MASK;
    00152         static uint32 LIGHT_TYPE_MASK;
    00154         static uint32 FRUSTUM_TYPE_MASK;
    00156         static uint32 USER_TYPE_MASK_LIMIT;
    00159         struct materialLess
    00160         {
    00161             _OgreExport bool operator()(const Material* x, const Material* y) const;
    00162         };
    00164         struct lightLess
    00165         {
    00166             _OgreExport bool operator()(const Light* a, const Light* b) const;
    00167         };
    00168
    00170         enum IlluminationRenderStage
    00171         {
    00173             IRS_NONE,
    00175             IRS_RENDER_TO_TEXTURE,
    00177             IRS_RENDER_RECEIVER_PASS
    00178         };
    00179
    00184         enum SpecialCaseRenderQueueMode
    00185         {
    00187             SCRQM_INCLUDE,
    00189             SCRQM_EXCLUDE
    00190         };
    00191
    00192         struct SkyDomeGenParameters
    00193         {
    00194             Real skyDomeCurvature;
    00195             Real skyDomeTiling;
    00196             Real skyDomeDistance;
    00197             int skyDomeXSegments;
    00198             int skyDomeYSegments;
    00199             int skyDomeYSegments_keep;
    00200         };
    00201
    00202         struct SkyPlaneGenParameters
    00203         {
    00204             Real skyPlaneScale;
    00205             Real skyPlaneTiling;
    00206             Real skyPlaneBow;
    00207             int skyPlaneXSegments;
    00208             int skyPlaneYSegments;
    00209         };
    00210
    00211         struct SkyBoxGenParameters
    00212         {
    00213             Real skyBoxDistance;
    00214         };
    00215
    00219         class Listener
    00220         {
    00221         public:
    00222             Listener() {}
    00223             virtual ~Listener() {}
    00224
    00231             virtual void preUpdateSceneGraph(SceneManager* source, Camera* camera)
    00232                         { (void)source; (void)camera; }
    00233
    00240             virtual void postUpdateSceneGraph(SceneManager* source, Camera* camera)
    00241                         { (void)source; (void)camera; }
    00242
    00252             virtual void preFindVisibleObjects(SceneManager* source,
    00253                 IlluminationRenderStage irs, Viewport* v)
    00254                         { (void)source; (void)irs; (void)v; }
    00255
    00266             virtual void postFindVisibleObjects(SceneManager* source,
    00267                 IlluminationRenderStage irs, Viewport* v)
    00268                         { (void)source; (void)irs; (void)v; }
    00269
    00284             virtual void shadowTexturesUpdated(size_t numberOfShadowTextures)
    00285                         { (void)numberOfShadowTextures; }
    00286
    00300             virtual void shadowTextureCasterPreViewProj(Light* light,
    00301                 Camera* camera, size_t iteration)
    00302                         { (void)light; (void)camera; (void)iteration; }
    00303
    00317             virtual void shadowTextureReceiverPreViewProj(Light* light,
    00318                 Frustum* frustum)
    00319                         { (void)light; (void)frustum; }
    00320
    00343             virtual bool sortLightsAffectingFrustum(LightList& lightList)
    00344                         { (void)lightList; return false; }
    00345
    00347             virtual void sceneManagerDestroyed(SceneManager* source)
    00348                         { (void)source; }
    00349         };
    00350
    00354         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
    00355         {
    00356         protected:
    00358             const Pass* mUsedPass;
    00359         public:
    00360             SceneMgrQueuedRenderableVisitor()
    00361                 :transparentShadowCastersMode(false) {}
    00362             ~SceneMgrQueuedRenderableVisitor() {}
    00363             void visit(Renderable* r);
    00364             bool visit(const Pass* p);
    00365             void visit(RenderablePass* rp);
    00366
    00368             SceneManager* targetSceneMgr;
    00370             bool transparentShadowCastersMode;
    00372             bool autoLights;
    00374             const LightList* manualLightList;
    00376             bool scissoring;
    00377
    00378         };
    00380         friend class SceneMgrQueuedRenderableVisitor;
    00381
    00382     protected:
    00383
    00385         virtual SceneNode* createSceneNodeImpl(void);
    00387         virtual SceneNode* createSceneNodeImpl(const String& name);
    00388
    00390         String mName;
    00391
    00393         RenderQueue* mRenderQueue;
    00394         bool mLastRenderQueueInvocationCustom;
    00395
    00397         ColourValue mAmbientLight;
    00398
    00400         RenderSystem *mDestRenderSystem;
    00401
    00402         typedef map<String, Camera* >::type CameraList;
    00403
    00406         CameraList mCameras;
    00407
    00408         typedef map<String, StaticGeometry* >::type StaticGeometryList;
    00409         StaticGeometryList mStaticGeometryList;
    00410         typedef map<String, InstancedGeometry* >::type InstancedGeometryList;
    00411         InstancedGeometryList mInstancedGeometryList;
    00412
    00413         typedef map<String, InstanceManager*>::type InstanceManagerMap;
    00414         InstanceManagerMap  mInstanceManagerMap;
    00415
    00416         typedef map<String, SceneNode*>::type SceneNodeList;
    00417
    00424         SceneNodeList mSceneNodes;
    00425
    00427         Camera* mCameraInProgress;
    00429         Viewport* mCurrentViewport;
    00430
    00432         SceneNode* mSceneRoot;
    00433
    00435         typedef set<SceneNode*>::type AutoTrackingSceneNodes;
    00436         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
    00437
    00438         // Sky params
    00439         // Sky plane
    00440         Entity* mSkyPlaneEntity;
    00441         Entity* mSkyDomeEntity[5];
    00442         ManualObject* mSkyBoxObj;
    00443
    00444         SceneNode* mSkyPlaneNode;
    00445         SceneNode* mSkyDomeNode;
    00446         SceneNode* mSkyBoxNode;
    00447
    00448         // Sky plane
    00449         bool mSkyPlaneEnabled;
    00450         uint8 mSkyPlaneRenderQueue;
    00451         Plane mSkyPlane;
    00452         SkyPlaneGenParameters mSkyPlaneGenParameters;
    00453         // Sky box
    00454         bool mSkyBoxEnabled;
    00455         uint8 mSkyBoxRenderQueue;
    00456         Quaternion mSkyBoxOrientation;
    00457         SkyBoxGenParameters mSkyBoxGenParameters;
    00458         // Sky dome
    00459         bool mSkyDomeEnabled;
    00460         uint8 mSkyDomeRenderQueue;
    00461         Quaternion mSkyDomeOrientation;
    00462         SkyDomeGenParameters mSkyDomeGenParameters;
    00463
    00464         // Fog
    00465         FogMode mFogMode;
    00466         ColourValue mFogColour;
    00467         Real mFogStart;
    00468         Real mFogEnd;
    00469         Real mFogDensity;
    00470
    00471         typedef set<uint8>::type SpecialCaseRenderQueueList;
    00472         SpecialCaseRenderQueueList mSpecialCaseQueueList;
    00473         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
    00474         uint8 mWorldGeometryRenderQueue;
    00475
    00476         unsigned long mLastFrameNumber;
    00477         Matrix4 mTempXform[256];
    00478         bool mResetIdentityView;
    00479         bool mResetIdentityProj;
    00480
    00481         bool mNormaliseNormalsOnScale;
    00482         bool mFlipCullingOnNegativeScale;
    00483         CullingMode mPassCullingMode;
    00484
    00485     protected:
    00486
    00494         typedef map< const Camera*, VisibleObjectsBoundsInfo>::type CamVisibleObjectsMap;
    00495         CamVisibleObjectsMap mCamVisibleObjectsMap;
    00496
    00498         typedef map< const Camera*, const Light* >::type ShadowCamLightMapping;
    00499         ShadowCamLightMapping mShadowCamLightMapping;
    00500
    00502         size_t mShadowTextureCountPerType[3];
    00503
    00505         vector<size_t>::type mShadowTextureIndexLightList;
    00506
    00508         struct _OgreExport LightInfo
    00509         {
    00510             Light* light;       // Just a pointer for comparison, the light might destroyed for some reason
    00511             int type;           // Use int instead of Light::LightTypes to avoid header file dependence
    00512             Real range;         // Sets to zero if directional light
    00513             Vector3 position;   // Sets to zero if directional light
    00514             uint32 lightMask;   // Light mask
    00515
    00516             bool operator== (const LightInfo& rhs) const
    00517             {
    00518                 return light == rhs.light && type == rhs.type &&
    00519                     range == rhs.range && position == rhs.position && lightMask == rhs.lightMask;
    00520             }
    00521
    00522             bool operator!= (const LightInfo& rhs) const
    00523             {
    00524                 return !(*this == rhs);
    00525             }
    00526         };
    00527
    00528         typedef vector<LightInfo>::type LightInfoList;
    00529
    00530         LightList mLightsAffectingFrustum;
    00531         LightInfoList mCachedLightInfos;
    00532         LightInfoList mTestLightInfos; // potentially new list
    00533         ulong mLightsDirtyCounter;
    00534         LightList mShadowTextureCurrentCasterLightList;
    00535
    00536         typedef map<String, MovableObject*>::type MovableObjectMap;
    00538         struct MovableObjectCollection
    00539         {
    00540             MovableObjectMap map;
    00541             OGRE_MUTEX(mutex)
    00542         };
    00543         typedef map<String, MovableObjectCollection*>::type MovableObjectCollectionMap;
    00544         MovableObjectCollectionMap mMovableObjectCollectionMap;
    00545         NameGenerator mMovableNameGenerator;
    00550         MovableObjectCollection* getMovableObjectCollection(const String& typeName);
    00555         const MovableObjectCollection* getMovableObjectCollection(const String& typeName) const;
    00557         OGRE_MUTEX(mMovableObjectCollectionMapMutex)
    00558
    00559
    00563         virtual void initRenderQueue(void);
    00565         Pass* mShadowCasterPlainBlackPass;
    00567         Pass* mShadowReceiverPass;
    00577         virtual const Pass* deriveShadowCasterPass(const Pass* pass);
    00586         virtual const Pass* deriveShadowReceiverPass(const Pass* pass);
    00587
    00594         virtual bool validatePassForRendering(const Pass* pass);
    00595
    00602         virtual bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
    00603
    00604         enum BoxPlane
    00605         {
    00606             BP_FRONT = 0,
    00607             BP_BACK = 1,
    00608             BP_LEFT = 2,
    00609             BP_RIGHT = 3,
    00610             BP_UP = 4,
    00611             BP_DOWN = 5
    00612         };
    00613
    00614         /* Internal utility method for creating the planes of a skybox.
    00615         */
    00616         virtual MeshPtr createSkyboxPlane(
    00617             BoxPlane bp,
    00618             Real distance,
    00619             const Quaternion& orientation,
    00620             const String& groupName);
    00621
    00622         /* Internal utility method for creating the planes of a skydome.
    00623         */
    00624         virtual MeshPtr createSkydomePlane(
    00625             BoxPlane bp,
    00626             Real curvature, Real tiling, Real distance,
    00627             const Quaternion& orientation,
    00628             int xsegments, int ysegments, int ySegmentsToKeep,
    00629             const String& groupName);
    00630
    00631         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
    00632         bool mDisplayNodes;
    00633
    00635         typedef map<String, Animation*>::type AnimationList;
    00636         AnimationList mAnimationsList;
    00637         OGRE_MUTEX(mAnimationsListMutex)
    00638         AnimationStateSet mAnimationStates;
    00639
    00640
    00643         virtual void useRenderableViewProjMode(const Renderable* pRend, bool fixedFunction);
    00644
    00647         virtual void resetViewProjMode(bool fixedFunction);
    00648
    00649         typedef vector<RenderQueueListener*>::type RenderQueueListenerList;
    00650         RenderQueueListenerList mRenderQueueListeners;
    00651
    00652         typedef vector<RenderObjectListener*>::type RenderObjectListenerList;
    00653         RenderObjectListenerList mRenderObjectListeners;
    00654         typedef vector<Listener*>::type ListenerList;
    00655         ListenerList mListeners;
    00657         virtual void firePreRenderQueues();
    00659         virtual void firePostRenderQueues();
    00661         virtual bool fireRenderQueueStarted(uint8 id, const String& invocation);
    00663         virtual bool fireRenderQueueEnded(uint8 id, const String& invocation);
    00665         virtual void fireRenderSingleObject(Renderable* rend, const Pass* pass, const AutoParamDataSource* source,
    00666             const LightList* pLightList, bool suppressRenderStateChanges);
    00667
    00669         virtual void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
    00671         virtual void fireShadowTexturesPreCaster(Light* light, Camera* camera, size_t iteration);
    00673         virtual void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
    00675         virtual void firePreUpdateSceneGraph(Camera* camera);
    00677         virtual void firePostUpdateSceneGraph(Camera* camera);
    00679         virtual void firePreFindVisibleObjects(Viewport* v);
    00681         virtual void firePostFindVisibleObjects(Viewport* v);
    00683         virtual void fireSceneManagerDestroyed();
    00685         virtual void setViewport(Viewport *vp);
    00686
    00688         bool mShowBoundingBoxes;
    00689
    00691         virtual void renderVisibleObjectsDefaultSequence(void);
    00693         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
    00695         virtual void prepareRenderQueue(void);
    00696
    00697
    00713         virtual void renderSingleObject(Renderable* rend, const Pass* pass,
    00714             bool lightScissoringClipping, bool doLightIteration, const LightList* manualLightList = 0);
    00715
    00717         virtual AutoParamDataSource* createAutoParamDataSource(void) const
    00718         {
    00719             return OGRE_NEW AutoParamDataSource();
    00720         }
    00721
    00723         AutoParamDataSource* mAutoParamDataSource;
    00724
    00725         CompositorChain* mActiveCompositorChain;
    00726         bool mLateMaterialResolving;
    00727
    00728         ShadowTechnique mShadowTechnique;
    00729         bool mDebugShadows;
    00730         ColourValue mShadowColour;
    00731         Pass* mShadowDebugPass;
    00732         Pass* mShadowStencilPass;
    00733         Pass* mShadowModulativePass;
    00734         bool mShadowMaterialInitDone;
    00735         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
    00736         size_t mShadowIndexBufferSize;
    00737         Rectangle2D* mFullScreenQuad;
    00738         Real mShadowDirLightExtrudeDist;
    00739         IlluminationRenderStage mIlluminationStage;
    00740         ShadowTextureConfigList mShadowTextureConfigList;
    00741         bool mShadowTextureConfigDirty;
    00742         ShadowTextureList mShadowTextures;
    00743         TexturePtr mNullShadowTexture;
    00744         typedef vector<Camera*>::type ShadowTextureCameraList;
    00745         ShadowTextureCameraList mShadowTextureCameras;
    00746         Texture* mCurrentShadowTexture;
    00747         bool mShadowUseInfiniteFarPlane;
    00748         bool mShadowCasterRenderBackFaces;
    00749         bool mShadowAdditiveLightClip;
    00751         struct LightClippingInfo
    00752         {
    00753             RealRect scissorRect;
    00754             PlaneList clipPlanes;
    00755             bool scissorValid;
    00756             unsigned long clipPlanesValid;
    00757             LightClippingInfo() : scissorValid(false), clipPlanesValid(false) {}
    00758
    00759         };
    00760         typedef map<Light*, LightClippingInfo>::type LightClippingInfoMap;
    00761         LightClippingInfoMap mLightClippingInfoMap;
    00762         unsigned long mLightClippingInfoMapFrameNumber;
    00763
    00765         ShadowCameraSetupPtr mDefaultShadowCameraSetup;
    00766
    00775         struct lightsForShadowTextureLess
    00776         {
    00777             _OgreExport bool operator()(const Light* l1, const Light* l2) const;
    00778         };
    00779
    00780
    00787         virtual void findLightsAffectingFrustum(const Camera* camera);
    00789         virtual void initShadowVolumeMaterials(void);
    00791         virtual void ensureShadowTexturesCreated();
    00793         virtual void destroyShadowTextures(void);
    00794
    00795         typedef vector<InstanceManager*>::type      InstanceManagerVec;
    00796         InstanceManagerVec mDirtyInstanceManagers;
    00797         InstanceManagerVec mDirtyInstanceMgrsTmp;
    00798
    00800         void updateDirtyInstanceManagers(void);
    00801
    00802     public:
    00806         virtual void prepareShadowTextures(Camera* cam, Viewport* vp, const LightList* lightList = 0);
    00807
    00808         //A render context, used to store internal data for pausing/resuming rendering
    00809         struct RenderContext
    00810         {
    00811             RenderQueue* renderQueue;
    00812             Viewport* viewport;
    00813             Camera* camera;
    00814             CompositorChain* activeChain;
    00815             RenderSystem::RenderSystemContext* rsContext;
    00816         };
    00817
    00821         virtual RenderContext* _pauseRendering();
    00825         virtual void _resumeRendering(RenderContext* context);
    00826
    00827     protected:
    00835         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam,
    00836             bool calcScissor);
    00842         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
    00844         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
    00845             Pass* pass, const LightList *manualLightList, unsigned long flags,
    00846             bool secondpass, bool zfail, bool twosided);
    00847         typedef vector<ShadowCaster*>::type ShadowCasterList;
    00848         ShadowCasterList mShadowCasterList;
    00849         SphereSceneQuery* mShadowCasterSphereQuery;
    00850         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
    00851         Real mDefaultShadowFarDist;
    00852         Real mDefaultShadowFarDistSquared;
    00853         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
    00854         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
    00855         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
    00856         bool mShadowTextureSelfShadow;
    00857         Pass* mShadowTextureCustomCasterPass;
    00858         Pass* mShadowTextureCustomReceiverPass;
    00859         String mShadowTextureCustomCasterVertexProgram;
    00860         String mShadowTextureCustomCasterFragmentProgram;
    00861         String mShadowTextureCustomReceiverVertexProgram;
    00862         String mShadowTextureCustomReceiverFragmentProgram;
    00863         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
    00864         GpuProgramParametersSharedPtr mShadowTextureCustomCasterFPParams;
    00865         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
    00866         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
    00867
    00869         uint32 mVisibilityMask;
    00870         bool mFindVisibleObjects;
    00871
    00873         bool mSuppressRenderStateChanges;
    00875         bool mSuppressShadows;
    00876
    00877
    00878         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
    00879         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
    00880
    00882         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener, public SceneMgtAlloc
    00883         {
    00884         protected:
    00885             SceneManager* mSceneMgr;
    00886             ShadowCasterList* mCasterList;
    00887             bool mIsLightInFrustum;
    00888             const PlaneBoundedVolumeList* mLightClipVolumeList;
    00889             const Camera* mCamera;
    00890             const Light* mLight;
    00891             Real mFarDistSquared;
    00892         public:
    00893             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
    00894                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0),
    00895                 mCamera(0) {}
    00896             // Prepare the listener for use with a set of parameters
    00897             void prepare(bool lightInFrustum,
    00898                 const PlaneBoundedVolumeList* lightClipVolumes,
    00899                 const Light* light, const Camera* cam, ShadowCasterList* casterList,
    00900                 Real farDistSquared)
    00901             {
    00902                 mCasterList = casterList;
    00903                 mIsLightInFrustum = lightInFrustum;
    00904                 mLightClipVolumeList = lightClipVolumes;
    00905                 mCamera = cam;
    00906                 mLight = light;
    00907                 mFarDistSquared = farDistSquared;
    00908             }
    00909             bool queryResult(MovableObject* object);
    00910             bool queryResult(SceneQuery::WorldFragment* fragment);
    00911         };
    00912
    00913         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
    00914
    00921         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light,
    00922             const Camera* camera);
    00924         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,
    00925             QueuedRenderableCollection::OrganisationMode om);
    00927         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00928             QueuedRenderableCollection::OrganisationMode om);
    00930         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00931             QueuedRenderableCollection::OrganisationMode om);
    00933         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group,
    00934             QueuedRenderableCollection::OrganisationMode om);
    00936         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group,
    00937             QueuedRenderableCollection::OrganisationMode om);
    00939         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00940             QueuedRenderableCollection::OrganisationMode om);
    00941
    00943         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00944             QueuedRenderableCollection::OrganisationMode om);
    00946         virtual void renderObjects(const QueuedRenderableCollection& objs,
    00947             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
    00948             bool doLightIteration, const LightList* manualLightList = 0);
    00954         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs,
    00955             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
    00956             bool doLightIteration, const LightList* manualLightList = 0);
    00957
    00960         virtual void updateRenderQueueSplitOptions(void);
    00963         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group,
    00964             bool suppressShadows, bool suppressRenderState);
    00965
    00967         virtual ClipResult buildAndSetScissor(const LightList& ll, const Camera* cam);
    00969         virtual void buildScissor(const Light* l, const Camera* cam, RealRect& rect);
    00970         virtual void resetScissor();
    00972         virtual ClipResult buildAndSetLightClip(const LightList& ll);
    00973         virtual void buildLightClip(const Light* l, PlaneList& planes);
    00974         virtual void resetLightClip();
    00975         virtual void checkCachedLightClippingInfo();
    00976
    00978         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
    00980         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
    00981
    00983         bool mCameraRelativeRendering;
    00984         Matrix4 mCachedViewMatrix;
    00985         Vector3 mCameraRelativePosition;
    00986
    00988         uint32 mLastLightHash;
    00989         unsigned short mLastLightLimit;
    00990         uint32 mLastLightHashGpuProgram;
    00992         uint16 mGpuParamsDirty;
    00993
    00994         virtual void useLights(const LightList& lights, unsigned short limit);
    00995         virtual void setViewMatrix(const Matrix4& m);
    00996         virtual void useLightsGpuProgram(const Pass* pass, const LightList* lights);
    00997         virtual void bindGpuProgram(GpuProgram* prog);
    00998         virtual void updateGpuProgramParameters(const Pass* p);
    00999
    01000
    01001
    01002
    01003
    01004
    01005
    01006
    01008         typedef set<LodListener*>::type LodListenerSet;
    01009         LodListenerSet mLodListeners;
    01010
    01012         typedef vector<MovableObjectLodChangedEvent>::type MovableObjectLodChangedEventList;
    01013         MovableObjectLodChangedEventList mMovableObjectLodChangedEvents;
    01014
    01016         typedef vector<EntityMeshLodChangedEvent>::type EntityMeshLodChangedEventList;
    01017         EntityMeshLodChangedEventList mEntityMeshLodChangedEvents;
    01018
    01020         typedef vector<EntityMaterialLodChangedEvent>::type EntityMaterialLodChangedEventList;
    01021         EntityMaterialLodChangedEventList mEntityMaterialLodChangedEvents;
    01022
    01023     public:
    01026         SceneManager(const String& instanceName);
    01027
    01030         virtual ~SceneManager();
    01031
    01032
    01058         OGRE_MUTEX(sceneGraphMutex)
    01059
    01060
    01061         const String& getName(void) const { return mName; }
    01062
    01069         virtual const String& getTypeName(void) const = 0;
    01070
    01078         virtual Camera* createCamera(const String& name);
    01079
    01083         virtual Camera* getCamera(const String& name) const;
    01084
    01087         virtual bool hasCamera(const String& name) const;
    01088
    01097         virtual void destroyCamera(Camera *cam);
    01098
    01104         virtual void destroyCamera(const String& name);
    01105
    01114         virtual void destroyAllCameras(void);
    01115
    01126         virtual Light* createLight(const String& name);
    01127
    01129         virtual Light* createLight();
    01130
    01134         virtual Light* getLight(const String& name) const;
    01135
    01138         virtual bool hasLight(const String& name) const;
    01139
    01142         virtual const PlaneList& getLightClippingPlanes(Light* l);
    01143
    01146         virtual const RealRect& getLightScissorRect(Light* l, const Camera* cam);
    01147
    01152         virtual void destroyLight(const String& name);
    01153
    01158         virtual void destroyLight(Light* light);
    01161         virtual void destroyAllLights(void);
    01162
    01173         virtual void _notifyLightsDirty(void);
    01174
    01187         ulong _getLightsDirtyCounter(void) const { return mLightsDirtyCounter; }
    01188
    01195         virtual const LightList& _getLightsAffectingFrustum(void) const;
    01196
    01219         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
    01220
    01249         virtual void _populateLightList(const SceneNode* sn, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
    01250
    01267         virtual SceneNode* createSceneNode(void);
    01268
    01283         virtual SceneNode* createSceneNode(const String& name);
    01284
    01291         virtual void destroySceneNode(const String& name);
    01292
    01299         virtual void destroySceneNode(SceneNode* sn);
    01315         virtual SceneNode* getRootSceneNode(void);
    01316
    01324         virtual SceneNode* getSceneNode(const String& name) const;
    01325
    01328         virtual bool hasSceneNode(const String& name) const;
    01329
    01330
    01338         virtual Entity* createEntity(const String& entityName, const String& meshName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
    01339
    01346         virtual Entity* createEntity(const String& entityName, const MeshPtr& pMesh );
    01347
    01353         virtual Entity* createEntity(const String& meshName);
    01354
    01359         virtual Entity* createEntity(const MeshPtr& pMesh);
    01360
    01367         enum PrefabType {
    01368             PT_PLANE,
    01369             PT_CUBE,
    01370             PT_SPHERE
    01371         };
    01372
    01379         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
    01380
    01384         virtual Entity* createEntity(PrefabType ptype);
    01388         virtual Entity* getEntity(const String& name) const;
    01391         virtual bool hasEntity(const String& name) const;
    01392
    01401         virtual void destroyEntity(Entity* ent);
    01402
    01411         virtual void destroyEntity(const String& name);
    01412
    01422         virtual void destroyAllEntities(void);
    01423
    01429         virtual ManualObject* createManualObject(const String& name);
    01433         virtual ManualObject* createManualObject();
    01437         virtual ManualObject* getManualObject(const String& name) const;
    01440         virtual bool hasManualObject(const String& name) const;
    01441
    01444         virtual void destroyManualObject(ManualObject* obj);
    01447         virtual void destroyManualObject(const String& name);
    01450         virtual void destroyAllManualObjects(void);
    01456         virtual BillboardChain* createBillboardChain(const String& name);
    01460         virtual BillboardChain* createBillboardChain();
    01464         virtual BillboardChain* getBillboardChain(const String& name) const;
    01467         virtual bool hasBillboardChain(const String& name) const;
    01468
    01471         virtual void destroyBillboardChain(BillboardChain* obj);
    01474         virtual void destroyBillboardChain(const String& name);
    01477         virtual void destroyAllBillboardChains(void);
    01483         virtual RibbonTrail* createRibbonTrail(const String& name);
    01487         virtual RibbonTrail* createRibbonTrail();
    01491         virtual RibbonTrail* getRibbonTrail(const String& name) const;
    01494         virtual bool hasRibbonTrail(const String& name) const;
    01495
    01498         virtual void destroyRibbonTrail(RibbonTrail* obj);
    01501         virtual void destroyRibbonTrail(const String& name);
    01504         virtual void destroyAllRibbonTrails(void);
    01505
    01526         virtual ParticleSystem* createParticleSystem(const String& name,
    01527             const String& templateName);
    01547         virtual ParticleSystem* createParticleSystem(const String& name,
    01548             size_t quota = 500,
    01549             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01550
    01568         virtual ParticleSystem* createParticleSystem(size_t quota = 500,
    01569             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01573         virtual ParticleSystem* getParticleSystem(const String& name) const;
    01576         virtual bool hasParticleSystem(const String& name) const;
    01577
    01580         virtual void destroyParticleSystem(ParticleSystem* obj);
    01583         virtual void destroyParticleSystem(const String& name);
    01586         virtual void destroyAllParticleSystems(void);
    01587
    01593         virtual void clearScene(void);
    01594
    01607         void setAmbientLight(const ColourValue& colour);
    01608
    01611         const ColourValue& getAmbientLight(void) const;
    01612
    01628         virtual void prepareWorldGeometry(const String& filename);
    01629
    01647         virtual void prepareWorldGeometry(DataStreamPtr& stream,
    01648             const String& typeName = StringUtil::BLANK);
    01649
    01662         virtual void setWorldGeometry(const String& filename);
    01663
    01679         virtual void setWorldGeometry(DataStreamPtr& stream,
    01680             const String& typeName = StringUtil::BLANK);
    01681
    01694         virtual size_t estimateWorldGeometry(const String& filename)
    01695         { (void)filename; return 0; }
    01696
    01709         virtual size_t estimateWorldGeometry(DataStreamPtr& stream,
    01710             const String& typeName = StringUtil::BLANK)
    01711         { (void)stream; (void)typeName; return 0; }
    01712
    01727         virtual ViewPoint getSuggestedViewpoint(bool random = false);
    01728
    01742         virtual bool setOption( const String& strKey, const void* pValue )
    01743         { (void)strKey; (void)pValue; return false; }
    01744
    01758         virtual bool getOption( const String& strKey, void* pDestValue )
    01759         { (void)strKey; (void)pDestValue; return false; }
    01760
    01770         virtual bool hasOption( const String& strKey ) const
    01771         { (void)strKey; return false; }
    01772
    01787         virtual bool getOptionValues( const String& strKey, StringVector& refValueList )
    01788         { (void)strKey; (void)refValueList; return false; }
    01789
    01796         virtual bool getOptionKeys( StringVector& refKeys )
    01797         { (void)refKeys; return false; }
    01798
    01807         virtual void _updateSceneGraph(Camera* cam);
    01808
    01820         virtual void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters);
    01821
    01826         virtual void _applySceneAnimations(void);
    01827
    01830         virtual void _renderVisibleObjects(void);
    01831
    01845         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
    01846
    01850         virtual void _queueSkiesForRendering(Camera* cam);
    01851
    01852
    01853
    01862         virtual void _setDestinationRenderSystem(RenderSystem* sys);
    01863
    01917         virtual void setSkyPlane(
    01918             bool enable,
    01919             const Plane& plane, const String& materialName, Real scale = 1000,
    01920             Real tiling = 10, bool drawFirst = true, Real bow = 0,
    01921             int xsegments = 1, int ysegments = 1,
    01922             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01966         virtual void _setSkyPlane(
    01967             bool enable,
    01968             const Plane& plane, const String& materialName, Real scale = 1000,
    01969             Real tiling = 10, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, Real bow = 0,
    01970             int xsegments = 1, int ysegments = 1,
    01971             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01972
    01974         virtual void setSkyPlaneEnabled(bool enable) { mSkyPlaneEnabled = enable; }
    01975
    01977         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
    01978
    01980         virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
    01981
    01983         virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
    01984
    02026         virtual void setSkyBox(
    02027             bool enable, const String& materialName, Real distance = 5000,
    02028             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
    02029             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02030
    02063         virtual void _setSkyBox(
    02064             bool enable, const String& materialName, Real distance = 5000,
    02065             uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, const Quaternion& orientation = Quaternion::IDENTITY,
    02066             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02067
    02069         virtual void setSkyBoxEnabled(bool enable) { mSkyBoxEnabled = enable; }
    02070
    02072         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
    02073
    02075         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
    02076
    02078         virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
    02079
    02135         virtual void setSkyDome(
    02136             bool enable, const String& materialName, Real curvature = 10,
    02137             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
    02138             const Quaternion& orientation = Quaternion::IDENTITY,
    02139             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
    02140             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02141
    02188         virtual void _setSkyDome(
    02189             bool enable, const String& materialName, Real curvature = 10,
    02190             Real tiling = 8, Real distance = 4000, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY,
    02191             const Quaternion& orientation = Quaternion::IDENTITY,
    02192             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
    02193             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    02194
    02196         virtual void setSkyDomeEnabled(bool enable) { mSkyDomeEnabled = enable; }
    02197
    02199         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
    02200
    02202         virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
    02203
    02205         virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
    02206
    02231         void setFog(
    02232             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
    02233             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
    02234
    02237         virtual FogMode getFogMode(void) const;
    02238
    02241         virtual const ColourValue& getFogColour(void) const;
    02242
    02245         virtual Real getFogStart(void) const;
    02246
    02249         virtual Real getFogEnd(void) const;
    02250
    02253         virtual Real getFogDensity(void) const;
    02254
    02255
    02273         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
    02274
    02281         virtual BillboardSet* createBillboardSet(unsigned int poolSize = 20);
    02285         virtual BillboardSet* getBillboardSet(const String& name) const;
    02288         virtual bool hasBillboardSet(const String& name) const;
    02289
    02296         virtual void destroyBillboardSet(BillboardSet* set);
    02297
    02304         virtual void destroyBillboardSet(const String& name);
    02305
    02315         virtual void destroyAllBillboardSets(void);
    02316
    02324         virtual void setDisplaySceneNodes(bool display);
    02326         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
    02327
    02348         virtual Animation* createAnimation(const String& name, Real length);
    02349
    02353         virtual Animation* getAnimation(const String& name) const;
    02356         virtual bool hasAnimation(const String& name) const;
    02357
    02363         virtual void destroyAnimation(const String& name);
    02364
    02366         virtual void destroyAllAnimations(void);
    02367
    02395         virtual AnimationState* createAnimationState(const String& animName);
    02396
    02400         virtual AnimationState* getAnimationState(const String& animName) const;
    02403         virtual bool hasAnimationState(const String& name) const;
    02404
    02410         virtual void destroyAnimationState(const String& name);
    02411
    02413         virtual void destroyAllAnimationStates(void);
    02414
    02438         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp,
    02439             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix,
    02440             bool doBeginEndFrame = false) ;
    02441
    02462         virtual void manualRender(Renderable* rend, const Pass* pass, Viewport* vp,
    02463             const Matrix4& viewMatrix, const Matrix4& projMatrix, bool doBeginEndFrame = false, bool lightScissoringClipping = true,
    02464             bool doLightIteration = true, const LightList* manualLightList = 0);
    02465
    02476         virtual RenderQueue* getRenderQueue(void);
    02477
    02481         virtual void addRenderQueueListener(RenderQueueListener* newListener);
    02482
    02484         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
    02485
    02488         virtual void addRenderObjectListener(RenderObjectListener* newListener);
    02490         virtual void removeRenderObjectListener(RenderObjectListener* delListener);
    02491
    02505         virtual void addSpecialCaseRenderQueue(uint8 qid);
    02511         virtual void removeSpecialCaseRenderQueue(uint8 qid);
    02515         virtual void clearSpecialCaseRenderQueues(void);
    02520         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
    02522         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
    02529         virtual bool isRenderQueueToBeProcessed(uint8 qid);
    02530
    02546         virtual void setWorldGeometryRenderQueue(uint8 qid);
    02557         virtual uint8 getWorldGeometryRenderQueue(void);
    02558
    02560         virtual void showBoundingBoxes(bool bShow);
    02561
    02563         virtual bool getShowBoundingBoxes() const;
    02564
    02566         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
    02567
    02568
    02581         virtual AxisAlignedBoxSceneQuery*
    02582             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
    02595         virtual SphereSceneQuery*
    02596             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
    02609         virtual PlaneBoundedVolumeListSceneQuery*
    02610             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
    02611
    02612
    02625         virtual RaySceneQuery*
    02626             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
    02627         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
    02639         virtual IntersectionSceneQuery*
    02640             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
    02641
    02643         virtual void destroyQuery(SceneQuery* query);
    02644
    02645         typedef MapIterator<CameraList> CameraIterator;
    02646         typedef MapIterator<AnimationList> AnimationIterator;
    02647
    02650         CameraIterator getCameraIterator(void) {
    02651             return CameraIterator(mCameras.begin(), mCameras.end());
    02652         }
    02655         const CameraList& getCameras() const { return mCameras; }
    02657         AnimationIterator getAnimationIterator(void) {
    02658             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
    02659         }
    02662         const AnimationList& getAnimations() const { return mAnimationsList; }
    02664         AnimationStateIterator getAnimationStateIterator(void) {
    02665             return mAnimationStates.getAnimationStateIterator();
    02666         }
    02667
    02700         virtual void setShadowTechnique(ShadowTechnique technique);
    02701
    02703         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
    02704
    02706         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
    02708         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
    02709
    02716         virtual void setShadowColour(const ColourValue& colour);
    02723         virtual const ColourValue& getShadowColour(void) const;
    02735         virtual void setShadowDirectionalLightExtrusionDistance(Real dist);
    02738         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
    02755         virtual void setShadowFarDistance(Real distance);
    02759         virtual Real getShadowFarDistance(void) const
    02760         { return mDefaultShadowFarDist; }
    02761         virtual Real getShadowFarDistanceSquared(void) const
    02762         { return mDefaultShadowFarDistSquared; }
    02763
    02789         virtual void setShadowIndexBufferSize(size_t size);
    02791         virtual size_t getShadowIndexBufferSize(void) const
    02792         { return mShadowIndexBufferSize; }
    02801         virtual void setShadowTextureSize(unsigned short size);
    02802
    02811         virtual void setShadowTextureConfig(size_t shadowIndex, unsigned short width,
    02812             unsigned short height, PixelFormat format, unsigned short fsaa = 0, uint16 depthBufferPoolId=1);
    02818         virtual void setShadowTextureConfig(size_t shadowIndex,
    02819             const ShadowTextureConfig& config);
    02820
    02822         ConstShadowTextureConfigIterator getShadowTextureConfigIterator() const;
    02823
    02835         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
    02842         virtual void setShadowTextureFSAA(unsigned short fsaa);
    02843
    02851         virtual void setShadowTextureCount(size_t count);
    02853         size_t getShadowTextureCount(void) const {return mShadowTextureConfigList.size(); }
    02854
    02864         void setShadowTextureCountPerLightType(Light::LightTypes type, size_t count)
    02865         { mShadowTextureCountPerType[type] = count; }
    02867         size_t getShadowTextureCountPerLightType(Light::LightTypes type) const
    02868         {return mShadowTextureCountPerType[type]; }
    02869
    02878         virtual void setShadowTextureSettings(unsigned short size, unsigned short count,
    02879             PixelFormat fmt = PF_X8R8G8B8, unsigned short fsaa = 0, uint16 depthBufferPoolId=1);
    02880
    02887         virtual const TexturePtr& getShadowTexture(size_t shadowIndex);
    02888
    02903         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
    02907         virtual Real getShadowDirLightTextureOffset(void)  const { return mShadowTextureOffset; }
    02915         virtual void setShadowTextureFadeStart(Real fadeStart)
    02916         { mShadowTextureFadeStart = fadeStart; }
    02924         virtual void setShadowTextureFadeEnd(Real fadeEnd)
    02925         { mShadowTextureFadeEnd = fadeEnd; }
    02926
    02939         virtual void setShadowTextureSelfShadow(bool selfShadow);
    02940
    02942         virtual bool getShadowTextureSelfShadow(void) const
    02943         { return mShadowTextureSelfShadow; }
    02964         virtual void setShadowTextureCasterMaterial(const String& name);
    02986         virtual void setShadowTextureReceiverMaterial(const String& name);
    02987
    02998         virtual void setShadowCasterRenderBackFaces(bool bf) { mShadowCasterRenderBackFaces = bf; }
    02999
    03003         virtual bool getShadowCasterRenderBackFaces() const { return mShadowCasterRenderBackFaces; }
    03004
    03009         virtual void setShadowCameraSetup(const ShadowCameraSetupPtr& shadowSetup);
    03010
    03015         virtual const ShadowCameraSetupPtr& getShadowCameraSetup() const;
    03016
    03053         virtual void setShadowUseInfiniteFarPlane(bool enable) {
    03054             mShadowUseInfiniteFarPlane = enable; }
    03055
    03057         virtual bool isShadowTechniqueStencilBased(void) const
    03058         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
    03060         virtual bool isShadowTechniqueTextureBased(void) const
    03061         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
    03063         virtual bool isShadowTechniqueModulative(void) const
    03064         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
    03066         virtual bool isShadowTechniqueAdditive(void) const
    03067         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
    03069         virtual bool isShadowTechniqueIntegrated(void) const
    03070         { return (mShadowTechnique & SHADOWDETAILTYPE_INTEGRATED) != 0; }
    03072         virtual bool isShadowTechniqueInUse(void) const
    03073         { return mShadowTechnique != SHADOWTYPE_NONE; }
    03077         virtual void setShadowUseLightClipPlanes(bool enabled) { mShadowAdditiveLightClip = enabled; }
    03081         virtual bool getShadowUseLightClipPlanes() const { return mShadowAdditiveLightClip; }
    03082
    03086         virtual void _setActiveCompositorChain(CompositorChain* chain) { mActiveCompositorChain = chain; }
    03087
    03093         virtual void setLateMaterialResolving(bool isLate) { mLateMaterialResolving = isLate; }
    03094
    03097         virtual bool isLateMaterialResolving() const { return mLateMaterialResolving; }
    03098
    03100         virtual CompositorChain* _getActiveCompositorChain() const { return mActiveCompositorChain; }
    03101
    03104         virtual void addListener(Listener* s);
    03107         virtual void removeListener(Listener* s);
    03108
    03118         virtual StaticGeometry* createStaticGeometry(const String& name);
    03122         virtual StaticGeometry* getStaticGeometry(const String& name) const;
    03124         virtual bool hasStaticGeometry(const String& name) const;
    03126         virtual void destroyStaticGeometry(StaticGeometry* geom);
    03128         virtual void destroyStaticGeometry(const String& name);
    03130         virtual void destroyAllStaticGeometry(void);
    03131
    03141         virtual InstancedGeometry* createInstancedGeometry(const String& name);
    03143         virtual InstancedGeometry* getInstancedGeometry(const String& name) const;
    03145         virtual void destroyInstancedGeometry(InstancedGeometry* geom);
    03147         virtual void destroyInstancedGeometry(const String& name);
    03149         virtual void destroyAllInstancedGeometry(void);
    03150
    03169         virtual InstanceManager* createInstanceManager( const String &customName, const String &meshName,
    03170                                                         const String &groupName,
    03171                                                         InstanceManager::InstancingTechnique technique,
    03172                                                         size_t numInstancesPerBatch, uint16 flags=0,
    03173                                                         unsigned short subMeshIdx=0 );
    03174
    03178         virtual InstanceManager* getInstanceManager( const String &managerName ) const;
    03179
    03181     virtual bool hasInstanceManager( const String &managerName ) const;
    03182
    03189         virtual void destroyInstanceManager( const String &name );
    03190         virtual void destroyInstanceManager( InstanceManager *instanceManager );
    03191
    03192         virtual void destroyAllInstanceManagers(void);
    03193
    03206         virtual size_t getNumInstancesPerBatch( const String &meshName, const String &groupName,
    03207                                                 const String &materialName,
    03208                                                 InstanceManager::InstancingTechnique technique,
    03209                                                 size_t numInstancesPerBatch, uint16 flags=0,
    03210                                                 unsigned short subMeshIdx=0 );
    03211
    03223         virtual InstancedEntity* createInstancedEntity( const String &materialName,
    03224                                                         const String &managerName );
    03225
    03230         virtual void destroyInstancedEntity( InstancedEntity *instancedEntity );
    03231
    03236         void _addDirtyInstanceManager( InstanceManager *dirtyManager );
    03237
    03248         virtual MovableObject* createMovableObject(const String& name,
    03249             const String& typeName, const NameValuePairList* params = 0);
    03259         virtual MovableObject* createMovableObject(const String& typeName, const NameValuePairList* params = 0);
    03265         virtual void destroyMovableObject(const String& name, const String& typeName);
    03271         virtual void destroyMovableObject(MovableObject* m);
    03273         virtual void destroyAllMovableObjectsByType(const String& typeName);
    03275         virtual void destroyAllMovableObjects(void);
    03279         virtual MovableObject* getMovableObject(const String& name, const String& typeName) const;
    03281         virtual bool hasMovableObject(const String& name, const String& typeName) const;
    03282         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
    03288         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
    03300         virtual void injectMovableObject(MovableObject* m);
    03307         virtual void extractMovableObject(const String& name, const String& typeName);
    03314         virtual void extractMovableObject(MovableObject* m);
    03321         virtual void extractAllMovableObjectsByType(const String& typeName);
    03322
    03329         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
    03330
    03334         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
    03335
    03339         uint32 _getCombinedVisibilityMask(void) const;
    03340
    03347         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
    03348
    03352         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
    03353
    03362         virtual void setNormaliseNormalsOnScale(bool n) { mNormaliseNormalsOnScale = n; }
    03363
    03367         virtual bool getNormaliseNormalsOnScale() const { return mNormaliseNormalsOnScale; }
    03368
    03377         virtual void setFlipCullingOnNegativeScale(bool n) { mFlipCullingOnNegativeScale = n; }
    03378
    03382         virtual bool getFlipCullingOnNegativeScale() const { return mFlipCullingOnNegativeScale; }
    03383
    03389         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true,
    03390             bool doLightIteration = false, const LightList* manualLightList = 0);
    03391
    03410         virtual void _suppressRenderStateChanges(bool suppress);
    03411
    03415         virtual bool _areRenderStateChangesSuppressed(void) const
    03416         { return mSuppressRenderStateChanges; }
    03417
    03430         virtual const Pass* _setPass(const Pass* pass,
    03431             bool evenIfSuppressed = false, bool shadowDerivation = true);
    03432
    03440         virtual void _markGpuParamsDirty(uint16 mask);
    03441
    03442
    03452         virtual void _suppressShadows(bool suppress);
    03453
    03457         virtual bool _areShadowsSuppressed(void) const
    03458         { return mSuppressShadows; }
    03459
    03463         virtual void _renderQueueGroupObjects(RenderQueueGroup* group,
    03464             QueuedRenderableCollection::OrganisationMode om);
    03465
    03481         void setQueuedRenderableVisitor(SceneMgrQueuedRenderableVisitor* visitor);
    03482
    03484         SceneMgrQueuedRenderableVisitor* getQueuedRenderableVisitor(void) const;
    03485
    03486
    03490         RenderSystem *getDestinationRenderSystem();
    03491
    03494         Viewport* getCurrentViewport(void) const { return mCurrentViewport; }
    03495
    03497         const VisibleObjectsBoundsInfo& getVisibleObjectsBoundsInfo(const Camera* cam) const;
    03498
    03500         const VisibleObjectsBoundsInfo& getShadowCasterBoundsInfo(const Light* light, size_t iteration = 0) const;
    03501
    03516         virtual void setCameraRelativeRendering(bool rel) { mCameraRelativeRendering = rel; }
    03517
    03521         virtual bool getCameraRelativeRendering() const { return mCameraRelativeRendering; }
    03522
    03523
    03525         void addLodListener(LodListener *listener);
    03526
    03532         void removeLodListener(LodListener *listener);
    03533
    03535         void _notifyMovableObjectLodChanged(MovableObjectLodChangedEvent& evt);
    03536
    03538         void _notifyEntityMeshLodChanged(EntityMeshLodChangedEvent& evt);
    03539
    03541         void _notifyEntityMaterialLodChanged(EntityMaterialLodChangedEvent& evt);
    03542
    03544         void _handleLodEvents();
    03545     };
    03546
    03548     class _OgreExport DefaultIntersectionSceneQuery :
    03549         public IntersectionSceneQuery
    03550     {
    03551     public:
    03552         DefaultIntersectionSceneQuery(SceneManager* creator);
    03553         ~DefaultIntersectionSceneQuery();
    03554
    03556         void execute(IntersectionSceneQueryListener* listener);
    03557     };
    03558
    03560     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
    03561     {
    03562     public:
    03563         DefaultRaySceneQuery(SceneManager* creator);
    03564         ~DefaultRaySceneQuery();
    03565
    03567         void execute(RaySceneQueryListener* listener);
    03568     };
    03570     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
    03571     {
    03572     public:
    03573         DefaultSphereSceneQuery(SceneManager* creator);
    03574         ~DefaultSphereSceneQuery();
    03575
    03577         void execute(SceneQueryListener* listener);
    03578     };
    03580     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
    03581     {
    03582     public:
    03583         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
    03584         ~DefaultPlaneBoundedVolumeListSceneQuery();
    03585
    03587         void execute(SceneQueryListener* listener);
    03588     };
    03590     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
    03591     {
    03592     public:
    03593         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
    03594         ~DefaultAxisAlignedBoxSceneQuery();
    03595
    03597         void execute(SceneQueryListener* listener);
    03598     };
    03599
    03600
    03602     typedef uint16 SceneTypeMask;
    03603
    03607     enum SceneType
    03608     {
    03609         ST_GENERIC = 1,
    03610         ST_EXTERIOR_CLOSE = 2,
    03611         ST_EXTERIOR_FAR = 4,
    03612         ST_EXTERIOR_REAL_FAR = 8,
    03613         ST_INTERIOR = 16
    03614     };
    03615
    03617     struct SceneManagerMetaData
    03618     {
    03620         String typeName;
    03622         String description;
    03624         SceneTypeMask sceneTypeMask;
    03626         bool worldGeometrySupported;
    03627     };
    03628
    03629
    03630
    03632     class _OgreExport SceneManagerFactory : public SceneMgtAlloc
    03633     {
    03634     protected:
    03635         mutable SceneManagerMetaData mMetaData;
    03636         mutable bool mMetaDataInit;
    03638         virtual void initMetaData(void) const = 0;
    03639     public:
    03640         SceneManagerFactory() : mMetaDataInit(true) {}
    03641         virtual ~SceneManagerFactory() {}
    03643         virtual const SceneManagerMetaData& getMetaData(void) const
    03644         {
    03645             if (mMetaDataInit)
    03646             {
    03647                 initMetaData();
    03648                 mMetaDataInit = false;
    03649             }
    03650             return mMetaData;
    03651         }
    03656         virtual SceneManager* createInstance(const String& instanceName) = 0;
    03658         virtual void destroyInstance(SceneManager* instance) = 0;
    03659
    03660     };
    03661
    03666 } // Namespace
    03667
    03668
    03669
    03670 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:23