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-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This library is free software; you can redistribute it and/or modify it
00011 under the terms of the GNU Lesser General Public License (LGPL) as 
00012 published by the Free Software Foundation; either version 2.1 of the 
00013 License, or (at your option) any later version.
00014 
00015 This library is distributed in the hope that it will be useful, but 
00016 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
00017 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
00018 License for more details.
00019 
00020 You should have received a copy of the GNU Lesser General Public License 
00021 along with this library; if not, write to the Free Software Foundation, 
00022 Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
00023 http://www.gnu.org/copyleft/lesser.txt
00024 
00025 You may alternatively use this source under the terms of a specific version of
00026 the OGRE Unrestricted License provided you have obtained such a license from
00027 Torus Knot Software Ltd.
00028 -------------------------------------------------------------------------*/
00029 #ifndef __SceneManager_H__
00030 #define __SceneManager_H__
00031 
00032 // Precompiler options
00033 #include "OgrePrerequisites.h"
00034 
00035 #include "OgreString.h"
00036 #include "OgreSceneNode.h"
00037 #include "OgrePlane.h"
00038 #include "OgreQuaternion.h"
00039 #include "OgreColourValue.h"
00040 #include "OgreCommon.h"
00041 #include "OgreSceneQuery.h"
00042 #include "OgreAutoParamDataSource.h"
00043 #include "OgreAnimationState.h"
00044 #include "OgreRenderQueue.h"
00045 #include "OgreRenderQueueSortingGrouping.h"
00046 #include "OgreRectangle2D.h"
00047 #include "OgrePixelFormat.h"
00048 #include "OgreResourceGroupManager.h"
00049 #include "OgreTexture.h"
00050 #include "OgreShadowCameraSetup.h"
00051 #include "OgreShadowTextureManager.h"
00052 #include "OgreCamera.h"
00053 #include "OgreInstancedGeometry.h"
00054 
00055 namespace Ogre {
00056 
00058     struct ViewPoint
00059     {
00060         Vector3 position;
00061         Quaternion orientation;
00062     };
00063 
00064     // Forward declarations
00065     class DefaultIntersectionSceneQuery;
00066     class DefaultRaySceneQuery;
00067     class DefaultSphereSceneQuery;
00068     class DefaultAxisAlignedBoxSceneQuery;
00069 
00073     struct VisibleObjectsBoundsInfo
00074     {
00076         AxisAlignedBox aabb;
00078         AxisAlignedBox receiverAabb;
00080         Real minDistance;
00082         Real maxDistance;
00083 
00084         VisibleObjectsBoundsInfo()
00085         {
00086             reset();
00087         }
00088 
00089         void reset()
00090         {
00091             aabb.setNull();
00092             receiverAabb.setNull();
00093             minDistance = std::numeric_limits<Real>::infinity();
00094             maxDistance = 0;
00095         }
00096 
00097         void merge(const AxisAlignedBox& boxBounds, const Sphere& sphereBounds, 
00098             const Camera* cam, bool receiver=true)
00099         {
00100             aabb.merge(boxBounds);
00101             if (receiver)
00102                 receiverAabb.merge(boxBounds);
00103             Real camDistToCenter = 
00104                 (cam->getDerivedPosition() - sphereBounds.getCenter()).length();
00105             minDistance = (std::min)(minDistance, (std::max)((Real)0, camDistToCenter - sphereBounds.getRadius()));
00106             maxDistance = (std::max)(maxDistance, camDistToCenter + sphereBounds.getRadius());
00107         }
00108 
00109 
00110     };
00111 
00141     class _OgreExport SceneManager : public SceneMgtAlloc
00142     {
00143     public:
00145         static uint32 WORLD_GEOMETRY_TYPE_MASK;
00147         static uint32 ENTITY_TYPE_MASK;
00149         static uint32 FX_TYPE_MASK;
00151         static uint32 STATICGEOMETRY_TYPE_MASK;
00153         static uint32 LIGHT_TYPE_MASK;
00155         static uint32 FRUSTUM_TYPE_MASK;
00157         static uint32 USER_TYPE_MASK_LIMIT;
00160         struct materialLess
00161         {
00162             _OgreExport bool operator()(const Material* x, const Material* y) const;
00163         };
00165         struct lightLess
00166         {
00167             _OgreExport bool operator()(const Light* a, const Light* b) const;
00168         };
00169 
00171         enum IlluminationRenderStage
00172         {
00174             IRS_NONE,
00176             IRS_RENDER_TO_TEXTURE,
00178             IRS_RENDER_RECEIVER_PASS
00179         };
00180 
00185         enum SpecialCaseRenderQueueMode
00186         {
00188             SCRQM_INCLUDE,
00190             SCRQM_EXCLUDE
00191         };
00192 
00193         struct SkyDomeGenParameters
00194         {
00195             Real skyDomeCurvature;
00196             Real skyDomeTiling;
00197             Real skyDomeDistance;
00198             int skyDomeXSegments; 
00199             int skyDomeYSegments;
00200             int skyDomeYSegments_keep;
00201         };
00202 
00203         struct SkyPlaneGenParameters
00204         {
00205             Real skyPlaneScale;
00206             Real skyPlaneTiling; 
00207             Real skyPlaneBow; 
00208             int skyPlaneXSegments; 
00209             int skyPlaneYSegments; 
00210         };
00211 
00212         struct SkyBoxGenParameters
00213         {
00214             Real skyBoxDistance;
00215         };
00216 
00220         class Listener
00221         {
00222         public:
00223             Listener() {}
00224             virtual ~Listener() {}
00225 
00235             virtual void preFindVisibleObjects(SceneManager* source, 
00236                 IlluminationRenderStage irs, Viewport* v) = 0;
00247             virtual void postFindVisibleObjects(SceneManager* source, 
00248                 IlluminationRenderStage irs, Viewport* v) = 0;
00249 
00264             virtual void shadowTexturesUpdated(size_t numberOfShadowTextures) = 0;
00265 
00279             virtual void shadowTextureCasterPreViewProj(Light* light, 
00280                 Camera* camera, size_t iteration) = 0;
00294             virtual void shadowTextureReceiverPreViewProj(Light* light, 
00295                 Frustum* frustum) = 0;
00296 
00319             virtual bool sortLightsAffectingFrustum(LightList& lightList) { return false; }
00320 
00321 
00322 
00323         };
00324 
00325     protected:
00326 
00328         virtual SceneNode* createSceneNodeImpl(void);
00330         virtual SceneNode* createSceneNodeImpl(const String& name);
00331 
00333         String mName;
00334 
00336         RenderQueue* mRenderQueue;
00337         bool mLastRenderQueueInvocationCustom;
00338 
00340         ColourValue mAmbientLight;
00341 
00343         RenderSystem *mDestRenderSystem;
00344 
00345         typedef std::map<String, Camera* > CameraList;
00346 
00349         CameraList mCameras;
00350 
00351         typedef std::map<String, StaticGeometry* > StaticGeometryList;
00352         StaticGeometryList mStaticGeometryList;
00353         typedef std::map<String, InstancedGeometry* > InstancedGeometryList;
00354         InstancedGeometryList mInstancedGeometryList;
00355 
00356         typedef std::map<String, SceneNode*> SceneNodeList;
00357 
00364         SceneNodeList mSceneNodes;
00365 
00367         Camera* mCameraInProgress;
00369         Viewport* mCurrentViewport;
00370 
00372         SceneNode* mSceneRoot;
00373 
00375         typedef std::set<SceneNode*> AutoTrackingSceneNodes;
00376         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
00377 
00378         // Sky params
00379         // Sky plane
00380         Entity* mSkyPlaneEntity;
00381         Entity* mSkyDomeEntity[5];
00382         ManualObject* mSkyBoxObj;
00383 
00384         SceneNode* mSkyPlaneNode;
00385         SceneNode* mSkyDomeNode;
00386         SceneNode* mSkyBoxNode;
00387 
00388         // Sky plane
00389         bool mSkyPlaneEnabled;
00390         uint8 mSkyPlaneRenderQueue;
00391         Plane mSkyPlane;
00392         SkyPlaneGenParameters mSkyPlaneGenParameters;
00393         // Sky box
00394         bool mSkyBoxEnabled;
00395         uint8 mSkyBoxRenderQueue;
00396         Quaternion mSkyBoxOrientation;
00397         SkyBoxGenParameters mSkyBoxGenParameters;
00398         // Sky dome
00399         bool mSkyDomeEnabled;
00400         uint8 mSkyDomeRenderQueue;
00401         Quaternion mSkyDomeOrientation;
00402         SkyDomeGenParameters mSkyDomeGenParameters;
00403 
00404         // Fog
00405         FogMode mFogMode;
00406         ColourValue mFogColour;
00407         Real mFogStart;
00408         Real mFogEnd;
00409         Real mFogDensity;
00410 
00411         typedef std::set<uint8> SpecialCaseRenderQueueList;
00412         SpecialCaseRenderQueueList mSpecialCaseQueueList;
00413         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
00414         uint8 mWorldGeometryRenderQueue;
00415         
00416         unsigned long mLastFrameNumber;
00417         Matrix4 mTempXform[256];
00418         bool mResetIdentityView;
00419         bool mResetIdentityProj;
00420 
00421         bool mNormaliseNormalsOnScale;
00422         bool mFlipCullingOnNegativeScale;
00423         CullingMode mPassCullingMode;
00424 
00425     protected:
00426 
00434         typedef std::map< const Camera*, VisibleObjectsBoundsInfo> CamVisibleObjectsMap;
00435         CamVisibleObjectsMap mCamVisibleObjectsMap; 
00436 
00438         typedef std::map< const Camera*, const Light* > ShadowCamLightMapping;
00439         ShadowCamLightMapping mShadowCamLightMapping;
00440 
00442         size_t mShadowTextureCountPerType[3];
00443 
00445         std::vector<size_t> mShadowTextureIndexLightList;
00446 
00448         struct _OgreExport LightInfo
00449         {
00450             Light* light;       // Just a pointer for comparison, the light might destroyed for some reason
00451             int type;           // Use int instead of Light::LightTypes to avoid header file dependence
00452             Real range;         // Sets to zero if directional light
00453             Vector3 position;   // Sets to zero if directional light
00454 
00455             bool operator== (const LightInfo& rhs) const
00456             {
00457                 return light == rhs.light && type == rhs.type &&
00458                     range == rhs.range && position == rhs.position;
00459             }
00460 
00461             bool operator!= (const LightInfo& rhs) const
00462             {
00463                 return !(*this == rhs);
00464             }
00465         };
00466 
00467         typedef std::vector<LightInfo> LightInfoList;
00468 
00469         LightList mLightsAffectingFrustum;
00470         LightInfoList mCachedLightInfos;
00471         LightInfoList mTestLightInfos; // potentially new list
00472         ulong mLightsDirtyCounter;
00473 
00474         typedef std::map<String, MovableObject*> MovableObjectMap;
00476         struct MovableObjectCollection
00477         {
00478             MovableObjectMap map;
00479             OGRE_MUTEX(mutex)
00480         };
00481         typedef std::map<String, MovableObjectCollection*> MovableObjectCollectionMap;
00482         MovableObjectCollectionMap mMovableObjectCollectionMap;
00487         MovableObjectCollection* getMovableObjectCollection(const String& typeName);
00492         const MovableObjectCollection* getMovableObjectCollection(const String& typeName) const;
00494         OGRE_MUTEX(mMovableObjectCollectionMapMutex)
00495 
00496         
00500         virtual void initRenderQueue(void);
00502         Pass* mShadowCasterPlainBlackPass;
00504         Pass* mShadowReceiverPass;
00514         virtual const Pass* deriveShadowCasterPass(const Pass* pass);
00523         virtual const Pass* deriveShadowReceiverPass(const Pass* pass);
00524     
00531         virtual bool validatePassForRendering(const Pass* pass);
00532 
00539         virtual bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
00540 
00541         enum BoxPlane
00542         {
00543             BP_FRONT = 0,
00544             BP_BACK = 1,
00545             BP_LEFT = 2,
00546             BP_RIGHT = 3,
00547             BP_UP = 4,
00548             BP_DOWN = 5
00549         };
00550 
00551         /* Internal utility method for creating the planes of a skybox.
00552         */
00553         virtual MeshPtr createSkyboxPlane(
00554             BoxPlane bp,
00555             Real distance,
00556             const Quaternion& orientation,
00557             const String& groupName);
00558 
00559         /* Internal utility method for creating the planes of a skydome.
00560         */
00561         virtual MeshPtr createSkydomePlane(
00562             BoxPlane bp,
00563             Real curvature, Real tiling, Real distance,
00564             const Quaternion& orientation,
00565             int xsegments, int ysegments, int ySegmentsToKeep, 
00566             const String& groupName);
00567 
00568         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
00569         bool mDisplayNodes;
00570 
00572         typedef std::map<String, Animation*> AnimationList;
00573         AnimationList mAnimationsList;
00574         OGRE_MUTEX(mAnimationsListMutex)
00575         AnimationStateSet mAnimationStates;
00576 
00577 
00580         virtual void useRenderableViewProjMode(const Renderable* pRend);
00581         
00584         virtual void resetViewProjMode(void);
00585 
00586         typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
00587         RenderQueueListenerList mRenderQueueListeners;
00588 
00589         typedef std::vector<Listener*> ListenerList;
00590         ListenerList mListeners;
00592         virtual bool fireRenderQueueStarted(uint8 id, const String& invocation);
00594         virtual bool fireRenderQueueEnded(uint8 id, const String& invocation);
00595 
00597         virtual void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
00599         virtual void fireShadowTexturesPreCaster(Light* light, Camera* camera, size_t iteration);
00601         virtual void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
00603         virtual void firePreFindVisibleObjects(Viewport* v);
00605         virtual void firePostFindVisibleObjects(Viewport* v);
00607         virtual void setViewport(Viewport *vp);
00608 
00610         bool mShowBoundingBoxes;      
00611 
00613         virtual void renderVisibleObjectsDefaultSequence(void);
00615         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
00617         virtual void prepareRenderQueue(void);
00618 
00619 
00635         virtual void renderSingleObject(Renderable* rend, const Pass* pass, 
00636             bool lightScissoringClipping, bool doLightIteration, const LightList* manualLightList = 0);
00637 
00639         virtual AutoParamDataSource* createAutoParamDataSource(void) const
00640         {
00641             return OGRE_NEW AutoParamDataSource();
00642         }
00643 
00645         AutoParamDataSource* mAutoParamDataSource;
00646 
00647         ShadowTechnique mShadowTechnique;
00648         bool mDebugShadows;
00649         ColourValue mShadowColour;
00650         Pass* mShadowDebugPass;
00651         Pass* mShadowStencilPass;
00652         Pass* mShadowModulativePass;
00653         bool mShadowMaterialInitDone;
00654         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
00655         size_t mShadowIndexBufferSize;
00656         Rectangle2D* mFullScreenQuad;
00657         Real mShadowDirLightExtrudeDist;
00658         IlluminationRenderStage mIlluminationStage;
00659         ShadowTextureConfigList mShadowTextureConfigList;
00660         bool mShadowTextureConfigDirty;
00661         ShadowTextureList mShadowTextures;
00662         TexturePtr mNullShadowTexture;
00663         typedef std::vector<Camera*> ShadowTextureCameraList;
00664         ShadowTextureCameraList mShadowTextureCameras;
00665         Texture* mCurrentShadowTexture;
00666         bool mShadowUseInfiniteFarPlane;
00667         bool mShadowCasterRenderBackFaces;
00668         bool mShadowAdditiveLightClip;
00670         struct LightClippingInfo
00671         {
00672             RealRect scissorRect;
00673             PlaneList clipPlanes;
00674             bool scissorValid;
00675             unsigned long clipPlanesValid;
00676             LightClippingInfo() : scissorValid(false), clipPlanesValid(false) {}
00677 
00678         };
00679         typedef std::map<Light*, LightClippingInfo> LightClippingInfoMap;
00680         LightClippingInfoMap mLightClippingInfoMap;
00681         unsigned long mLightClippingInfoMapFrameNumber;
00682 
00684         ShadowCameraSetupPtr mDefaultShadowCameraSetup;
00685 
00694         struct lightsForShadowTextureLess
00695         {
00696             _OgreExport bool operator()(const Light* l1, const Light* l2) const;
00697         };
00698 
00699 
00706         virtual void findLightsAffectingFrustum(const Camera* camera);
00708         virtual void initShadowVolumeMaterials(void);
00710         virtual void ensureShadowTexturesCreated();
00712         virtual void destroyShadowTextures(void);
00714         virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
00715 
00723         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam, 
00724             bool calcScissor);
00730         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
00732         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
00733             Pass* pass, const LightList *manualLightList, unsigned long flags,
00734             bool secondpass, bool zfail, bool twosided);
00735         typedef std::vector<ShadowCaster*> ShadowCasterList;
00736         ShadowCasterList mShadowCasterList;
00737         SphereSceneQuery* mShadowCasterSphereQuery;
00738         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
00739         Real mDefaultShadowFarDist;
00740         Real mDefaultShadowFarDistSquared;
00741         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
00742         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
00743         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
00744         bool mShadowTextureSelfShadow;
00745         Pass* mShadowTextureCustomCasterPass;
00746         Pass* mShadowTextureCustomReceiverPass;
00747         String mShadowTextureCustomCasterVertexProgram;
00748         String mShadowTextureCustomReceiverVertexProgram;
00749         String mShadowTextureCustomReceiverFragmentProgram;
00750         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
00751         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
00752         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
00753 
00755         uint32 mVisibilityMask;
00756         bool mFindVisibleObjects;
00757 
00759         bool mSuppressRenderStateChanges;
00761         bool mSuppressShadows;
00762 
00763 
00764         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
00765         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
00766 
00768         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener, public SceneMgtAlloc
00769         {
00770         protected:
00771             SceneManager* mSceneMgr;
00772             ShadowCasterList* mCasterList;
00773             bool mIsLightInFrustum;
00774             const PlaneBoundedVolumeList* mLightClipVolumeList;
00775             const Camera* mCamera;
00776             const Light* mLight;
00777             Real mFarDistSquared;
00778         public:
00779             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
00780                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0), 
00781                 mCamera(0) {}
00782             // Prepare the listener for use with a set of parameters  
00783             void prepare(bool lightInFrustum, 
00784                 const PlaneBoundedVolumeList* lightClipVolumes, 
00785                 const Light* light, const Camera* cam, ShadowCasterList* casterList, 
00786                 Real farDistSquared) 
00787             {
00788                 mCasterList = casterList;
00789                 mIsLightInFrustum = lightInFrustum;
00790                 mLightClipVolumeList = lightClipVolumes;
00791                 mCamera = cam;
00792                 mLight = light;
00793                 mFarDistSquared = farDistSquared;
00794             }
00795             bool queryResult(MovableObject* object);
00796             bool queryResult(SceneQuery::WorldFragment* fragment);
00797         };
00798 
00799         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
00800 
00807         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light, 
00808             const Camera* camera);
00810         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 
00811             QueuedRenderableCollection::OrganisationMode om);
00813         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00814             QueuedRenderableCollection::OrganisationMode om);
00816         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00817             QueuedRenderableCollection::OrganisationMode om);
00819         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group, 
00820             QueuedRenderableCollection::OrganisationMode om);
00822         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group, 
00823             QueuedRenderableCollection::OrganisationMode om);
00825         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00826             QueuedRenderableCollection::OrganisationMode om);
00827 
00829         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00830             QueuedRenderableCollection::OrganisationMode om);
00832         virtual void renderObjects(const QueuedRenderableCollection& objs, 
00833             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
00834             bool doLightIteration, const LightList* manualLightList = 0);
00840         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs, 
00841             QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
00842             bool doLightIteration, const LightList* manualLightList = 0);
00843 
00846         virtual void updateRenderQueueSplitOptions(void);
00849         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group, 
00850             bool suppressShadows, bool suppressRenderState);
00851 
00853         virtual ClipResult buildAndSetScissor(const LightList& ll, const Camera* cam);
00855         virtual void buildScissor(const Light* l, const Camera* cam, RealRect& rect);
00856         virtual void resetScissor();
00858         virtual ClipResult buildAndSetLightClip(const LightList& ll);
00859         virtual void buildLightClip(const Light* l, PlaneList& planes);
00860         virtual void resetLightClip();
00861         virtual void checkCachedLightClippingInfo();
00862 
00866         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
00867         {
00868         protected:
00870             const Pass* mUsedPass;
00871         public:
00872             SceneMgrQueuedRenderableVisitor() 
00873                 :transparentShadowCastersMode(false) {}
00874             ~SceneMgrQueuedRenderableVisitor() {}
00875             void visit(Renderable* r);
00876             bool visit(const Pass* p);
00877             void visit(RenderablePass* rp);
00878 
00880             SceneManager* targetSceneMgr;
00882             bool transparentShadowCastersMode;
00884             bool autoLights;
00886             const LightList* manualLightList;
00888             bool scissoring;
00889 
00890         };
00892         friend class SceneMgrQueuedRenderableVisitor;
00894         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
00896         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
00897 
00899         bool mCameraRelativeRendering;
00900         Matrix4 mCachedViewMatrix;
00901         Vector3 mCameraRelativePosition;
00902 
00903     public:
00906         SceneManager(const String& instanceName);
00907 
00910         virtual ~SceneManager();
00911 
00912 
00938         OGRE_MUTEX(sceneGraphMutex)
00939 
00940         
00941         const String& getName(void) const { return mName; }
00942 
00949         virtual const String& getTypeName(void) const = 0;
00950 
00958         virtual Camera* createCamera(const String& name);
00959 
00963         virtual Camera* getCamera(const String& name) const;
00964 
00967         virtual bool hasCamera(const String& name) const;
00968 
00977         virtual void destroyCamera(Camera *cam);
00978 
00984         virtual void destroyCamera(const String& name);
00985 
00994         virtual void destroyAllCameras(void);
00995 
01006         virtual Light* createLight(const String& name);
01007 
01011         virtual Light* getLight(const String& name) const;
01012 
01015         virtual bool hasLight(const String& name) const;
01016 
01019         virtual const PlaneList& getLightClippingPlanes(Light* l);
01020 
01023         virtual const RealRect& getLightScissorRect(Light* l, const Camera* cam);
01024 
01029         virtual void destroyLight(const String& name);
01030 
01035         virtual void destroyLight(Light* light);
01038         virtual void destroyAllLights(void);
01039 
01050         virtual void _notifyLightsDirty(void);
01051 
01064         ulong _getLightsDirtyCounter(void) const { return mLightsDirtyCounter; }
01065 
01072         virtual const LightList& _getLightsAffectingFrustum(void) const;
01073 
01095         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
01096 
01097 
01114         virtual SceneNode* createSceneNode(void);
01115 
01130         virtual SceneNode* createSceneNode(const String& name);
01131 
01138         virtual void destroySceneNode(const String& name);
01139 
01146         virtual void destroySceneNode(SceneNode* sn);
01162         virtual SceneNode* getRootSceneNode(void);
01163 
01171         virtual SceneNode* getSceneNode(const String& name) const;
01172 
01175         virtual bool hasSceneNode(const String& name) const;
01176 
01177 
01185         virtual Entity* createEntity(const String& entityName, const String& meshName);
01186 
01193         enum PrefabType {
01194             PT_PLANE,
01195             PT_CUBE,
01196             PT_SPHERE
01197         };
01198 
01205         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
01209         virtual Entity* getEntity(const String& name) const;
01212         virtual bool hasEntity(const String& name) const;
01213 
01222         virtual void destroyEntity(Entity* ent);
01223 
01232         virtual void destroyEntity(const String& name);
01233 
01243         virtual void destroyAllEntities(void);
01244 
01250         virtual ManualObject* createManualObject(const String& name);
01254         virtual ManualObject* getManualObject(const String& name) const;
01257         virtual bool hasManualObject(const String& name) const;
01258 
01261         virtual void destroyManualObject(ManualObject* obj);
01264         virtual void destroyManualObject(const String& name);
01267         virtual void destroyAllManualObjects(void);
01273         virtual BillboardChain* createBillboardChain(const String& name);
01277         virtual BillboardChain* getBillboardChain(const String& name) const;
01280         virtual bool hasBillboardChain(const String& name) const;
01281 
01284         virtual void destroyBillboardChain(BillboardChain* obj);
01287         virtual void destroyBillboardChain(const String& name);
01290         virtual void destroyAllBillboardChains(void);       
01296         virtual RibbonTrail* createRibbonTrail(const String& name);
01300         virtual RibbonTrail* getRibbonTrail(const String& name) const;
01303         virtual bool hasRibbonTrail(const String& name) const;
01304 
01307         virtual void destroyRibbonTrail(RibbonTrail* obj);
01310         virtual void destroyRibbonTrail(const String& name);
01313         virtual void destroyAllRibbonTrails(void);      
01314 
01335         virtual ParticleSystem* createParticleSystem(const String& name,
01336             const String& templateName);
01356         virtual ParticleSystem* createParticleSystem(const String& name,
01357             size_t quota = 500, 
01358             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01362         virtual ParticleSystem* getParticleSystem(const String& name) const;
01365         virtual bool hasParticleSystem(const String& name) const;
01366 
01369         virtual void destroyParticleSystem(ParticleSystem* obj);
01372         virtual void destroyParticleSystem(const String& name);
01375         virtual void destroyAllParticleSystems(void);       
01376 
01382         virtual void clearScene(void);
01383 
01396         void setAmbientLight(const ColourValue& colour);
01397 
01400         const ColourValue& getAmbientLight(void) const;
01401 
01417         virtual void prepareWorldGeometry(const String& filename);
01418 
01436         virtual void prepareWorldGeometry(DataStreamPtr& stream, 
01437             const String& typeName = StringUtil::BLANK);
01438 
01451         virtual void setWorldGeometry(const String& filename);
01452 
01468         virtual void setWorldGeometry(DataStreamPtr& stream, 
01469             const String& typeName = StringUtil::BLANK);
01470 
01483         virtual size_t estimateWorldGeometry(const String& filename) { return 0; }
01484 
01497         virtual size_t estimateWorldGeometry(DataStreamPtr& stream, 
01498             const String& typeName = StringUtil::BLANK) { return 0; }
01513         virtual ViewPoint getSuggestedViewpoint(bool random = false);
01514 
01528         virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
01529 
01543         virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
01544 
01554         virtual bool hasOption( const String& strKey ) const { return false; }
01569         virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; }
01570 
01577         virtual bool getOptionKeys( StringVector& refKeys ) { return false; }
01578 
01587         virtual void _updateSceneGraph(Camera* cam);
01588 
01600         virtual void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters);
01601 
01606         virtual void _applySceneAnimations(void);
01607 
01610         virtual void _renderVisibleObjects(void);
01611 
01625         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
01626 
01630         virtual void _queueSkiesForRendering(Camera* cam);
01631 
01632 
01633 
01642         virtual void _setDestinationRenderSystem(RenderSystem* sys);
01643 
01697         virtual void setSkyPlane(
01698             bool enable,
01699             const Plane& plane, const String& materialName, Real scale = 1000,
01700             Real tiling = 10, bool drawFirst = true, Real bow = 0, 
01701             int xsegments = 1, int ysegments = 1, 
01702             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01746         virtual void _setSkyPlane(
01747             bool enable,
01748             const Plane& plane, const String& materialName, Real scale = 1000,
01749             Real tiling = 10, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, Real bow = 0, 
01750             int xsegments = 1, int ysegments = 1, 
01751             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01752 
01754         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
01755 
01757         virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
01758 
01760         virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
01761 
01803         virtual void setSkyBox(
01804             bool enable, const String& materialName, Real distance = 5000,
01805             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
01806             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01807 
01840         virtual void _setSkyBox(
01841             bool enable, const String& materialName, Real distance = 5000,
01842             uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, const Quaternion& orientation = Quaternion::IDENTITY,
01843             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01844 
01846         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
01847 
01849         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
01850 
01852         virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
01853 
01909         virtual void setSkyDome(
01910             bool enable, const String& materialName, Real curvature = 10,
01911             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
01912             const Quaternion& orientation = Quaternion::IDENTITY,
01913             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
01914             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01915 
01962         virtual void _setSkyDome(
01963             bool enable, const String& materialName, Real curvature = 10,
01964             Real tiling = 8, Real distance = 4000, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY,
01965             const Quaternion& orientation = Quaternion::IDENTITY,
01966             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
01967             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01968 
01970         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
01971 
01973         virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
01974 
01976         virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
01977 
02002         void setFog(
02003             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
02004             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
02005 
02008         virtual FogMode getFogMode(void) const;
02009 
02012         virtual const ColourValue& getFogColour(void) const;
02013 
02016         virtual Real getFogStart(void) const;
02017 
02020         virtual Real getFogEnd(void) const;
02021 
02024         virtual Real getFogDensity(void) const;
02025 
02026 
02044         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
02045 
02049         virtual BillboardSet* getBillboardSet(const String& name) const;
02052         virtual bool hasBillboardSet(const String& name) const;
02053 
02060         virtual void destroyBillboardSet(BillboardSet* set);
02061 
02068         virtual void destroyBillboardSet(const String& name);
02069 
02079         virtual void destroyAllBillboardSets(void);
02080 
02088         virtual void setDisplaySceneNodes(bool display);
02090         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
02091 
02112         virtual Animation* createAnimation(const String& name, Real length);
02113 
02117         virtual Animation* getAnimation(const String& name) const;
02120         virtual bool hasAnimation(const String& name) const;
02121 
02127         virtual void destroyAnimation(const String& name);
02128 
02130         virtual void destroyAllAnimations(void);
02131 
02159         virtual AnimationState* createAnimationState(const String& animName);
02160 
02164         virtual AnimationState* getAnimationState(const String& animName) const;
02167         virtual bool hasAnimationState(const String& name) const;
02168 
02174         virtual void destroyAnimationState(const String& name);
02175 
02177         virtual void destroyAllAnimationStates(void);
02178 
02202         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, 
02203             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, 
02204             bool doBeginEndFrame = false) ;
02205 
02216         virtual RenderQueue* getRenderQueue(void);
02217 
02221         virtual void addRenderQueueListener(RenderQueueListener* newListener);
02222 
02224         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
02225 
02239         virtual void addSpecialCaseRenderQueue(uint8 qid);
02245         virtual void removeSpecialCaseRenderQueue(uint8 qid);
02249         virtual void clearSpecialCaseRenderQueues(void);
02254         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
02256         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
02263         virtual bool isRenderQueueToBeProcessed(uint8 qid);
02264 
02280         virtual void setWorldGeometryRenderQueue(uint8 qid);
02291         virtual uint8 getWorldGeometryRenderQueue(void);
02292 
02294         virtual void showBoundingBoxes(bool bShow);
02295 
02297         virtual bool getShowBoundingBoxes() const;
02298 
02300         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
02301 
02302         
02315         virtual AxisAlignedBoxSceneQuery* 
02316             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
02329         virtual SphereSceneQuery* 
02330             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
02343         virtual PlaneBoundedVolumeListSceneQuery* 
02344             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
02345 
02346 
02359         virtual RaySceneQuery* 
02360             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
02361         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
02373         virtual IntersectionSceneQuery* 
02374             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
02375 
02377         virtual void destroyQuery(SceneQuery* query);
02378 
02379         typedef MapIterator<CameraList> CameraIterator;
02380         typedef MapIterator<AnimationList> AnimationIterator;
02381 
02384         CameraIterator getCameraIterator(void) {
02385             return CameraIterator(mCameras.begin(), mCameras.end());
02386         }
02388         AnimationIterator getAnimationIterator(void) {
02389             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
02390         }
02392         AnimationStateIterator getAnimationStateIterator(void) {
02393             return mAnimationStates.getAnimationStateIterator();
02394         }
02395 
02428         virtual void setShadowTechnique(ShadowTechnique technique);
02429         
02431         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
02432 
02434         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
02436         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
02437 
02444         virtual void setShadowColour(const ColourValue& colour);
02451         virtual const ColourValue& getShadowColour(void) const;
02463         virtual void setShadowDirectionalLightExtrusionDistance(Real dist); 
02466         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
02483         virtual void setShadowFarDistance(Real distance);
02487         virtual Real getShadowFarDistance(void) const
02488         { return mDefaultShadowFarDist; }
02489         virtual Real getShadowFarDistanceSquared(void) const
02490         { return mDefaultShadowFarDistSquared; }
02491 
02517         virtual void setShadowIndexBufferSize(size_t size);
02519         virtual size_t getShadowIndexBufferSize(void) const
02520         { return mShadowIndexBufferSize; }
02529         virtual void setShadowTextureSize(unsigned short size);
02530 
02537         virtual void setShadowTextureConfig(size_t shadowIndex, unsigned short width, 
02538             unsigned short height, PixelFormat format);
02544         virtual void setShadowTextureConfig(size_t shadowIndex, 
02545             const ShadowTextureConfig& config);
02546 
02548         ConstShadowTextureConfigIterator getShadowTextureConfigIterator() const;
02549 
02561         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
02569         virtual void setShadowTextureCount(size_t count);
02571         size_t getShadowTextureCount(void) const {return mShadowTextureConfigList.size(); }
02572 
02582         void setShadowTextureCountPerLightType(Light::LightTypes type, size_t count)
02583         { mShadowTextureCountPerType[type] = count; }
02585         size_t getShadowTextureCountPerLightType(Light::LightTypes type) const
02586         {return mShadowTextureCountPerType[type]; }
02587 
02596         virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
02597             PixelFormat fmt = PF_X8R8G8B8);
02598 
02605         virtual const TexturePtr& getShadowTexture(size_t shadowIndex);
02606 
02621         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
02625         virtual Real getShadowDirLightTextureOffset(void)  const { return mShadowTextureOffset; }
02633         virtual void setShadowTextureFadeStart(Real fadeStart) 
02634         { mShadowTextureFadeStart = fadeStart; }
02642         virtual void setShadowTextureFadeEnd(Real fadeEnd) 
02643         { mShadowTextureFadeEnd = fadeEnd; }
02644 
02657         virtual void setShadowTextureSelfShadow(bool selfShadow); 
02658 
02660         virtual bool getShadowTextureSelfShadow(void) const 
02661         { return mShadowTextureSelfShadow; }
02682         virtual void setShadowTextureCasterMaterial(const String& name);
02704         virtual void setShadowTextureReceiverMaterial(const String& name);
02705 
02716         virtual void setShadowCasterRenderBackFaces(bool bf) { mShadowCasterRenderBackFaces = bf; }
02717 
02721         virtual bool getShadowCasterRenderBackFaces() const { return mShadowCasterRenderBackFaces; }
02722 
02727         virtual void setShadowCameraSetup(const ShadowCameraSetupPtr& shadowSetup);
02728 
02733         virtual const ShadowCameraSetupPtr& getShadowCameraSetup() const;
02734 
02771         virtual void setShadowUseInfiniteFarPlane(bool enable) {
02772             mShadowUseInfiniteFarPlane = enable; }
02773 
02775         virtual bool isShadowTechniqueStencilBased(void) const 
02776         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
02778         virtual bool isShadowTechniqueTextureBased(void) const 
02779         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
02781         virtual bool isShadowTechniqueModulative(void) const 
02782         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
02784         virtual bool isShadowTechniqueAdditive(void) const 
02785         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
02787         virtual bool isShadowTechniqueIntegrated(void) const 
02788         { return (mShadowTechnique & SHADOWDETAILTYPE_INTEGRATED) != 0; }
02790         virtual bool isShadowTechniqueInUse(void) const 
02791         { return mShadowTechnique != SHADOWTYPE_NONE; }
02795         virtual void setShadowUseLightClipPlanes(bool enabled) { mShadowAdditiveLightClip = enabled; }
02799         virtual bool getShadowUseLightClipPlanes() const { return mShadowAdditiveLightClip; }
02800 
02803         virtual void addListener(Listener* s);
02806         virtual void removeListener(Listener* s);
02807 
02817         virtual StaticGeometry* createStaticGeometry(const String& name);
02821         virtual StaticGeometry* getStaticGeometry(const String& name) const;
02823         virtual bool hasStaticGeometry(const String& name) const;
02825         virtual void destroyStaticGeometry(StaticGeometry* geom);
02827         virtual void destroyStaticGeometry(const String& name);
02829         virtual void destroyAllStaticGeometry(void);
02830 
02840         virtual InstancedGeometry* createInstancedGeometry(const String& name);
02842         virtual InstancedGeometry* getInstancedGeometry(const String& name) const;
02844         virtual void destroyInstancedGeometry(InstancedGeometry* geom);
02846         virtual void destroyInstancedGeometry(const String& name);
02848         virtual void destroyAllInstancedGeometry(void);
02849 
02850 
02861         virtual MovableObject* createMovableObject(const String& name, 
02862             const String& typeName, const NameValuePairList* params = 0);
02868         virtual void destroyMovableObject(const String& name, const String& typeName);
02874         virtual void destroyMovableObject(MovableObject* m);
02876         virtual void destroyAllMovableObjectsByType(const String& typeName);
02878         virtual void destroyAllMovableObjects(void);
02882         virtual MovableObject* getMovableObject(const String& name, const String& typeName) const;
02884         virtual bool hasMovableObject(const String& name, const String& typeName) const;
02885         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
02891         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
02903         virtual void injectMovableObject(MovableObject* m);
02910         virtual void extractMovableObject(const String& name, const String& typeName);
02917         virtual void extractMovableObject(MovableObject* m);
02924         virtual void extractAllMovableObjectsByType(const String& typeName);
02925 
02932         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
02933 
02937         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
02938 
02942         uint32 _getCombinedVisibilityMask(void) const;
02943 
02950         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
02951 
02955         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
02956 
02965         virtual void setNormaliseNormalsOnScale(bool n) { mNormaliseNormalsOnScale = n; }
02966 
02970         virtual bool getNormaliseNormalsOnScale() const { return mNormaliseNormalsOnScale; }
02971 
02980         virtual void setFlipCullingOnNegativeScale(bool n) { mFlipCullingOnNegativeScale = n; }
02981 
02985         virtual bool getFlipCullingOnNegativeScale() const { return mFlipCullingOnNegativeScale; }
02986 
02992         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true);
02993 
03012         virtual void _suppressRenderStateChanges(bool suppress);
03013         
03017         virtual bool _areRenderStateChangesSuppressed(void) const
03018         { return mSuppressRenderStateChanges; }
03019 
03032         virtual const Pass* _setPass(const Pass* pass, 
03033             bool evenIfSuppressed = false, bool shadowDerivation = true);
03034 
03035 
03045         virtual void _suppressShadows(bool suppress); 
03046 
03050         virtual bool _areShadowsSuppressed(void) const
03051         { return mSuppressShadows; }
03052 
03056         virtual void _renderQueueGroupObjects(RenderQueueGroup* group, 
03057             QueuedRenderableCollection::OrganisationMode om);
03058 
03074         void setQueuedRenderableVisitor(SceneMgrQueuedRenderableVisitor* visitor);
03075 
03077         SceneMgrQueuedRenderableVisitor* getQueuedRenderableVisitor(void) const;
03078 
03079 
03083         RenderSystem *getDestinationRenderSystem();
03084 
03087         Viewport* getCurrentViewport(void) const { return mCurrentViewport; }
03088 
03090         const VisibleObjectsBoundsInfo& getVisibleObjectsBoundsInfo(const Camera* cam) const;
03091 
03093         const VisibleObjectsBoundsInfo& getShadowCasterBoundsInfo(const Light* light, size_t iteration = 0) const;
03094 
03109         virtual void setCameraRelativeRendering(bool rel) { mCameraRelativeRendering = rel; }
03110 
03114         virtual bool getCameraRelativeRendering() const { return mCameraRelativeRendering; }
03115     };
03116 
03118     class _OgreExport DefaultIntersectionSceneQuery : 
03119         public IntersectionSceneQuery
03120     {
03121     public:
03122         DefaultIntersectionSceneQuery(SceneManager* creator);
03123         ~DefaultIntersectionSceneQuery();
03124 
03126         void execute(IntersectionSceneQueryListener* listener);
03127     };
03128 
03130     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
03131     {
03132     public:
03133         DefaultRaySceneQuery(SceneManager* creator);
03134         ~DefaultRaySceneQuery();
03135 
03137         void execute(RaySceneQueryListener* listener);
03138     };
03140     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
03141     {
03142     public:
03143         DefaultSphereSceneQuery(SceneManager* creator);
03144         ~DefaultSphereSceneQuery();
03145 
03147         void execute(SceneQueryListener* listener);
03148     };
03150     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
03151     {
03152     public:
03153         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
03154         ~DefaultPlaneBoundedVolumeListSceneQuery();
03155 
03157         void execute(SceneQueryListener* listener);
03158     };
03160     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
03161     {
03162     public:
03163         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
03164         ~DefaultAxisAlignedBoxSceneQuery();
03165 
03167         void execute(SceneQueryListener* listener);
03168     };
03169     
03170 
03172     typedef uint16 SceneTypeMask;
03173 
03177     enum SceneType
03178     {
03179         ST_GENERIC = 1,
03180         ST_EXTERIOR_CLOSE = 2,
03181         ST_EXTERIOR_FAR = 4,
03182         ST_EXTERIOR_REAL_FAR = 8,
03183         ST_INTERIOR = 16
03184     };
03185 
03187     struct SceneManagerMetaData
03188     {
03190         String typeName;
03192         String description;
03194         SceneTypeMask sceneTypeMask;
03196         bool worldGeometrySupported;
03197     };
03198 
03199 
03200 
03202     class _OgreExport SceneManagerFactory : public SceneMgtAlloc
03203     {
03204     protected:
03205         mutable SceneManagerMetaData mMetaData;
03206         mutable bool mMetaDataInit;
03208         virtual void initMetaData(void) const = 0;
03209     public:
03210         SceneManagerFactory() : mMetaDataInit(true) {}
03211         virtual ~SceneManagerFactory() {}
03213         virtual const SceneManagerMetaData& getMetaData(void) const 
03214         {
03215             if (mMetaDataInit)
03216             {
03217                 initMetaData();
03218                 mMetaDataInit = false;
03219             }
03220             return mMetaData; 
03221         }
03226         virtual SceneManager* createInstance(const String& instanceName) = 0;
03228         virtual void destroyInstance(SceneManager* instance) = 0;
03229 
03230     };
03231 
03232 
03233 
03234 } // Namespace
03235 
03236 
03237 
03238 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Jan 22 21:26:12 2009