OGRE: OgreSceneManager.h Source File - OGRE Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# 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         Real minDistance;
    00080         Real maxDistance;
    00081
    00082         VisibleObjectsBoundsInfo()
    00083         {
    00084             reset();
    00085         }
    00086
    00087         void reset()
    00088         {
    00089             aabb.setNull();
    00090             minDistance = std::numeric_limits<Real>::infinity();
    00091             maxDistance = 0;
    00092         }
    00093
    00094         void merge(const AxisAlignedBox& boxBounds, const Sphere& sphereBounds,
    00095             const Camera* cam)
    00096         {
    00097             aabb.merge(boxBounds);
    00098             Real camDistToCenter =
    00099                 (cam->getDerivedPosition() - sphereBounds.getCenter()).length();
    00100             minDistance = (std::min)(minDistance, (std::max)((Real)0, camDistToCenter - sphereBounds.getRadius()));
    00101             maxDistance = (std::max)(maxDistance, camDistToCenter + sphereBounds.getRadius());
    00102         }
    00103
    00104
    00105     };
    00106
    00110     class _OgreExport ShadowListener
    00111     {
    00112     public:
    00113         ShadowListener() {}
    00114         virtual ~ShadowListener() {}
    00115
    00130         virtual void shadowTexturesUpdated(size_t numberOfShadowTextures) = 0;
    00131
    00144         virtual void shadowTextureCasterPreViewProj(Light* light,
    00145             Camera* camera) = 0;
    00159         virtual void shadowTextureReceiverPreViewProj(Light* light,
    00160             Frustum* frustum) = 0;
    00161
    00184         virtual bool sortLightsAffectingFrustum(LightList& lightList) { return false; }
    00185
    00186
    00187     };
    00188
    00218     class _OgreExport SceneManager
    00219     {
    00220     public:
    00222         static uint32 WORLD_GEOMETRY_TYPE_MASK;
    00224         static uint32 ENTITY_TYPE_MASK;
    00226         static uint32 FX_TYPE_MASK;
    00228         static uint32 STATICGEOMETRY_TYPE_MASK;
    00230         static uint32 LIGHT_TYPE_MASK;
    00232         static uint32 USER_TYPE_MASK_LIMIT;
    00235         struct materialLess
    00236         {
    00237             _OgreExport bool operator()(const Material* x, const Material* y) const;
    00238         };
    00240         struct lightLess
    00241         {
    00242             _OgreExport bool operator()(const Light* a, const Light* b) const;
    00243         };
    00244
    00246         enum IlluminationRenderStage
    00247         {
    00249             IRS_NONE,
    00251             IRS_RENDER_TO_TEXTURE,
    00253             IRS_RENDER_RECEIVER_PASS
    00254         };
    00255
    00260         enum SpecialCaseRenderQueueMode
    00261         {
    00263             SCRQM_INCLUDE,
    00265             SCRQM_EXCLUDE
    00266         };
    00267
    00268         struct SkyDomeGenParameters
    00269         {
    00270             Real skyDomeCurvature;
    00271             Real skyDomeTiling;
    00272             Real skyDomeDistance;
    00273             int skyDomeXSegments;
    00274             int skyDomeYSegments;
    00275             int skyDomeYSegments_keep;
    00276         };
    00277
    00278         struct SkyPlaneGenParameters
    00279         {
    00280             Real skyPlaneScale;
    00281             Real skyPlaneTiling;
    00282             Real skyPlaneBow;
    00283             int skyPlaneXSegments;
    00284             int skyPlaneYSegments;
    00285         };
    00286
    00287         struct SkyBoxGenParameters
    00288         {
    00289             Real skyBoxDistance;
    00290         };
    00291
    00292     protected:
    00294         String mName;
    00295
    00297         RenderQueue* mRenderQueue;
    00298
    00300         ColourValue mAmbientLight;
    00301
    00303         RenderSystem *mDestRenderSystem;
    00304
    00305         typedef std::map<String, Camera* > CameraList;
    00306
    00309         CameraList mCameras;
    00310
    00311         typedef std::map<String, StaticGeometry* > StaticGeometryList;
    00312         StaticGeometryList mStaticGeometryList;
    00313         typedef std::map<String, InstancedGeometry* > InstancedGeometryList;
    00314         InstancedGeometryList mInstancedGeometryList;
    00315
    00316         typedef std::map<String, SceneNode*> SceneNodeList;
    00317
    00324         SceneNodeList mSceneNodes;
    00325
    00327         Camera* mCameraInProgress;
    00329         Viewport* mCurrentViewport;
    00330
    00332         SceneNode* mSceneRoot;
    00333
    00335         typedef std::set<SceneNode*> AutoTrackingSceneNodes;
    00336         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
    00337
    00338         // Sky params
    00339         // Sky plane
    00340         Entity* mSkyPlaneEntity;
    00341         Entity* mSkyDomeEntity[5];
    00342         Entity* mSkyBoxEntity[6];
    00343
    00344         SceneNode* mSkyPlaneNode;
    00345         SceneNode* mSkyDomeNode;
    00346         SceneNode* mSkyBoxNode;
    00347
    00348         // Sky plane
    00349         bool mSkyPlaneEnabled;
    00350         bool mSkyPlaneDrawFirst;
    00351         Plane mSkyPlane;
    00352         SkyPlaneGenParameters mSkyPlaneGenParameters;
    00353         // Sky box
    00354         bool mSkyBoxEnabled;
    00355         bool mSkyBoxDrawFirst;
    00356         Quaternion mSkyBoxOrientation;
    00357         SkyBoxGenParameters mSkyBoxGenParameters;
    00358         // Sky dome
    00359         bool mSkyDomeEnabled;
    00360         bool mSkyDomeDrawFirst;
    00361         Quaternion mSkyDomeOrientation;
    00362         SkyDomeGenParameters mSkyDomeGenParameters;
    00363
    00364         // Fog
    00365         FogMode mFogMode;
    00366         ColourValue mFogColour;
    00367         Real mFogStart;
    00368         Real mFogEnd;
    00369         Real mFogDensity;
    00370
    00371         typedef std::set<uint8> SpecialCaseRenderQueueList;
    00372         SpecialCaseRenderQueueList mSpecialCaseQueueList;
    00373         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
    00374         uint8 mWorldGeometryRenderQueue;
    00375
    00376         unsigned long mLastFrameNumber;
    00377         Matrix4 mTempXform[256];
    00378         bool mResetIdentityView;
    00379         bool mResetIdentityProj;
    00380
    00381     protected:
    00382
    00390         typedef std::map< const Camera*, VisibleObjectsBoundsInfo> CamVisibleObjectsMap;
    00391         CamVisibleObjectsMap mCamVisibleObjectsMap;
    00392
    00394         typedef std::map< const Camera*, const Light* > ShadowCamLightMapping;
    00395         ShadowCamLightMapping mShadowCamLightMapping;
    00396
    00398         struct _OgreExport LightInfo
    00399         {
    00400             Light* light;       // Just a pointer for comparison, the light might destroyed for some reason
    00401             int type;           // Use int instead of Light::LightTypes to avoid header file dependence
    00402             Real range;         // Sets to zero if directional light
    00403             Vector3 position;   // Sets to zero if directional light
    00404
    00405             bool operator== (const LightInfo& rhs) const
    00406             {
    00407                 return light == rhs.light && type == rhs.type &&
    00408                     range == rhs.range && position == rhs.position;
    00409             }
    00410
    00411             bool operator!= (const LightInfo& rhs) const
    00412             {
    00413                 return !(*this == rhs);
    00414             }
    00415         };
    00416
    00417         typedef std::vector<LightInfo> LightInfoList;
    00418
    00419         LightList mLightsAffectingFrustum;
    00420         LightInfoList mCachedLightInfos;
    00421         LightInfoList mTestLightInfos; // potentially new list
    00422         ulong mLightsDirtyCounter;
    00423
    00424         typedef std::map<String, MovableObject*> MovableObjectMap;
    00426         struct MovableObjectCollection
    00427         {
    00428             MovableObjectMap map;
    00429             OGRE_MUTEX(mutex)
    00430         };
    00431         typedef std::map<String, MovableObjectCollection*> MovableObjectCollectionMap;
    00432         MovableObjectCollectionMap mMovableObjectCollectionMap;
    00437         MovableObjectCollection* getMovableObjectCollection(const String& typeName);
    00442         const MovableObjectCollection* getMovableObjectCollection(const String& typeName) const;
    00444         OGRE_MUTEX(mMovableObjectCollectionMapMutex)
    00445
    00446
    00450         virtual void initRenderQueue(void);
    00452         Pass* mShadowCasterPlainBlackPass;
    00454         Pass* mShadowReceiverPass;
    00464         virtual const Pass* deriveShadowCasterPass(const Pass* pass);
    00473         virtual const Pass* deriveShadowReceiverPass(const Pass* pass);
    00474
    00481         virtual bool validatePassForRendering(const Pass* pass);
    00482
    00489         virtual bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
    00490
    00491         enum BoxPlane
    00492         {
    00493             BP_FRONT = 0,
    00494             BP_BACK = 1,
    00495             BP_LEFT = 2,
    00496             BP_RIGHT = 3,
    00497             BP_UP = 4,
    00498             BP_DOWN = 5
    00499         };
    00500
    00501         /* Internal utility method for creating the planes of a skybox.
    00502         */
    00503         virtual MeshPtr createSkyboxPlane(
    00504             BoxPlane bp,
    00505             Real distance,
    00506             const Quaternion& orientation,
    00507             const String& groupName);
    00508
    00509         /* Internal utility method for creating the planes of a skydome.
    00510         */
    00511         virtual MeshPtr createSkydomePlane(
    00512             BoxPlane bp,
    00513             Real curvature, Real tiling, Real distance,
    00514             const Quaternion& orientation,
    00515             int xsegments, int ysegments, int ySegmentsToKeep,
    00516             const String& groupName);
    00517
    00518         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
    00519         bool mDisplayNodes;
    00520
    00522         typedef std::map<String, Animation*> AnimationList;
    00523         AnimationList mAnimationsList;
    00524         OGRE_MUTEX(mAnimationsListMutex)
    00525         AnimationStateSet mAnimationStates;
    00526
    00527
    00530         virtual void useRenderableViewProjMode(const Renderable* pRend);
    00531
    00534         virtual void resetViewProjMode(void);
    00535
    00536         typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
    00537         RenderQueueListenerList mRenderQueueListeners;
    00538
    00539         typedef std::vector<ShadowListener*> ShadowListenerList;
    00540         ShadowListenerList mShadowListeners;
    00542         virtual bool fireRenderQueueStarted(uint8 id, const String& invocation);
    00544         virtual bool fireRenderQueueEnded(uint8 id, const String& invocation);
    00545
    00547         virtual void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
    00549         virtual void fireShadowTexturesPreCaster(Light* light, Camera* camera);
    00551         virtual void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
    00553         virtual void setViewport(Viewport *vp);
    00554
    00556         bool mShowBoundingBoxes;
    00557
    00559         virtual void renderVisibleObjectsDefaultSequence(void);
    00561         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
    00563         virtual void prepareRenderQueue(void);
    00564
    00565
    00578         virtual void renderSingleObject(const Renderable* rend, const Pass* pass,
    00579             bool doLightIteration, const LightList* manualLightList = 0);
    00580
    00582         AutoParamDataSource mAutoParamDataSource;
    00583
    00584         ShadowTechnique mShadowTechnique;
    00585         bool mDebugShadows;
    00586         ColourValue mShadowColour;
    00587         Pass* mShadowDebugPass;
    00588         Pass* mShadowStencilPass;
    00589         Pass* mShadowModulativePass;
    00590         bool mShadowMaterialInitDone;
    00591         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
    00592         size_t mShadowIndexBufferSize;
    00593         Rectangle2D* mFullScreenQuad;
    00594         Real mShadowDirLightExtrudeDist;
    00595         IlluminationRenderStage mIlluminationStage;
    00596         ShadowTextureConfigList mShadowTextureConfigList;
    00597         bool mShadowTextureConfigDirty;
    00598         ShadowTextureList mShadowTextures;
    00599         TexturePtr mNullShadowTexture;
    00600         typedef std::vector<Camera*> ShadowTextureCameraList;
    00601         ShadowTextureCameraList mShadowTextureCameras;
    00602         Texture* mCurrentShadowTexture;
    00603         bool mShadowUseInfiniteFarPlane;
    00604         bool mShadowCasterRenderBackFaces;
    00605
    00607         ShadowCameraSetupPtr mDefaultShadowCameraSetup;
    00608
    00617         struct lightsForShadowTextureLess
    00618         {
    00619             _OgreExport bool operator()(const Light* l1, const Light* l2) const;
    00620         };
    00621
    00622
    00629         virtual void findLightsAffectingFrustum(const Camera* camera);
    00631         virtual void initShadowVolumeMaterials(void);
    00633         virtual void ensureShadowTexturesCreated();
    00635         virtual void destroyShadowTextures(void);
    00637         virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
    00638
    00644         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam);
    00650         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
    00652         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
    00653             Pass* pass, const LightList *manualLightList, unsigned long flags,
    00654             bool secondpass, bool zfail, bool twosided);
    00655         typedef std::vector<ShadowCaster*> ShadowCasterList;
    00656         ShadowCasterList mShadowCasterList;
    00657         SphereSceneQuery* mShadowCasterSphereQuery;
    00658         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
    00659         Real mShadowFarDist;
    00660         Real mShadowFarDistSquared;
    00661         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
    00662         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
    00663         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
    00664         bool mShadowTextureSelfShadow;
    00665         Pass* mShadowTextureCustomCasterPass;
    00666         Pass* mShadowTextureCustomReceiverPass;
    00667         String mShadowTextureCustomCasterVertexProgram;
    00668         String mShadowTextureCustomReceiverVertexProgram;
    00669         String mShadowTextureCustomReceiverFragmentProgram;
    00670         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
    00671         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
    00672         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
    00673
    00675         uint32 mVisibilityMask;
    00676         bool mFindVisibleObjects;
    00677
    00679         bool mSuppressRenderStateChanges;
    00681         bool mSuppressShadows;
    00682
    00683
    00684         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
    00685         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
    00686
    00688         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener
    00689         {
    00690         protected:
    00691             SceneManager* mSceneMgr;
    00692             ShadowCasterList* mCasterList;
    00693             bool mIsLightInFrustum;
    00694             const PlaneBoundedVolumeList* mLightClipVolumeList;
    00695             const Camera* mCamera;
    00696             const Light* mLight;
    00697             Real mFarDistSquared;
    00698         public:
    00699             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
    00700                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0),
    00701                 mCamera(0) {}
    00702             // Prepare the listener for use with a set of parameters
    00703             void prepare(bool lightInFrustum,
    00704                 const PlaneBoundedVolumeList* lightClipVolumes,
    00705                 const Light* light, const Camera* cam, ShadowCasterList* casterList,
    00706                 Real farDistSquared)
    00707             {
    00708                 mCasterList = casterList;
    00709                 mIsLightInFrustum = lightInFrustum;
    00710                 mLightClipVolumeList = lightClipVolumes;
    00711                 mCamera = cam;
    00712                 mLight = light;
    00713                 mFarDistSquared = farDistSquared;
    00714             }
    00715             bool queryResult(MovableObject* object);
    00716             bool queryResult(SceneQuery::WorldFragment* fragment);
    00717         };
    00718
    00719         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
    00720
    00727         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light,
    00728             const Camera* camera);
    00730         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,
    00731             QueuedRenderableCollection::OrganisationMode om);
    00733         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00734             QueuedRenderableCollection::OrganisationMode om);
    00736         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group,
    00737             QueuedRenderableCollection::OrganisationMode om);
    00739         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group,
    00740             QueuedRenderableCollection::OrganisationMode om);
    00742         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group,
    00743             QueuedRenderableCollection::OrganisationMode om);
    00745         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00746             QueuedRenderableCollection::OrganisationMode om);
    00747
    00749         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group,
    00750             QueuedRenderableCollection::OrganisationMode om);
    00752         virtual void renderObjects(const QueuedRenderableCollection& objs,
    00753             QueuedRenderableCollection::OrganisationMode om,
    00754             bool doLightIteration, const LightList* manualLightList = 0);
    00760         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs,
    00761             QueuedRenderableCollection::OrganisationMode om,
    00762             bool doLightIteration, const LightList* manualLightList = 0);
    00763
    00766         virtual void updateRenderQueueSplitOptions(void);
    00769         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group,
    00770             bool suppressShadows, bool suppressRenderState);
    00771
    00775         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
    00776         {
    00777         protected:
    00779             const Pass* mUsedPass;
    00780         public:
    00781             SceneMgrQueuedRenderableVisitor()
    00782                 :transparentShadowCastersMode(false) {}
    00783             ~SceneMgrQueuedRenderableVisitor() {}
    00784             void visit(const Renderable* r);
    00785             bool visit(const Pass* p);
    00786             void visit(const RenderablePass* rp);
    00787
    00789             SceneManager* targetSceneMgr;
    00791             bool transparentShadowCastersMode;
    00793             bool autoLights;
    00795             const LightList* manualLightList;
    00796
    00797         };
    00799         friend class SceneMgrQueuedRenderableVisitor;
    00801         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
    00803         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
    00804
    00805     public:
    00808         SceneManager(const String& instanceName);
    00809
    00812         virtual ~SceneManager();
    00813
    00814
    00840         OGRE_MUTEX(sceneGraphMutex)
    00841
    00842
    00843         const String& getName(void) const { return mName; }
    00844
    00851         virtual const String& getTypeName(void) const = 0;
    00852
    00860         virtual Camera* createCamera(const String& name);
    00861
    00865         virtual Camera* getCamera(const String& name) const;
    00866
    00869         virtual bool hasCamera(const String& name) const;
    00870
    00879         virtual void destroyCamera(Camera *cam);
    00880
    00886         virtual void destroyCamera(const String& name);
    00887
    00896         virtual void destroyAllCameras(void);
    00897
    00908         virtual Light* createLight(const String& name);
    00909
    00913         virtual Light* getLight(const String& name) const;
    00914
    00917         virtual bool hasLight(const String& name) const;
    00918
    00923         virtual void destroyLight(const String& name);
    00924
    00929         virtual void destroyLight(Light* light);
    00932         virtual void destroyAllLights(void);
    00933
    00944         virtual void _notifyLightsDirty(void);
    00945
    00958         ulong _getLightsDirtyCounter(void) const { return mLightsDirtyCounter; }
    00959
    00966         virtual const LightList& _getLightsAffectingFrustum(void) const;
    00967
    00989         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
    00990
    00991
    01008         virtual SceneNode* createSceneNode(void);
    01009
    01024         virtual SceneNode* createSceneNode(const String& name);
    01025
    01032         virtual void destroySceneNode(const String& name);
    01033
    01049         virtual SceneNode* getRootSceneNode(void) const;
    01050
    01058         virtual SceneNode* getSceneNode(const String& name) const;
    01059
    01062         virtual bool hasSceneNode(const String& name) const;
    01063
    01064
    01072         virtual Entity* createEntity(const String& entityName, const String& meshName);
    01073
    01080         enum PrefabType {
    01081             PT_PLANE,
    01082             PT_CUBE,
    01083             PT_SPHERE
    01084         };
    01085
    01092         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
    01096         virtual Entity* getEntity(const String& name) const;
    01099         virtual bool hasEntity(const String& name) const;
    01100
    01109         virtual void destroyEntity(Entity* ent);
    01110
    01119         virtual void destroyEntity(const String& name);
    01120
    01130         virtual void destroyAllEntities(void);
    01131
    01137         virtual ManualObject* createManualObject(const String& name);
    01141         virtual ManualObject* getManualObject(const String& name) const;
    01144         virtual bool hasManualObject(const String& name) const;
    01145
    01148         virtual void destroyManualObject(ManualObject* obj);
    01151         virtual void destroyManualObject(const String& name);
    01154         virtual void destroyAllManualObjects(void);
    01160         virtual BillboardChain* createBillboardChain(const String& name);
    01164         virtual BillboardChain* getBillboardChain(const String& name) const;
    01167         virtual bool hasBillboardChain(const String& name) const;
    01168
    01171         virtual void destroyBillboardChain(BillboardChain* obj);
    01174         virtual void destroyBillboardChain(const String& name);
    01177         virtual void destroyAllBillboardChains(void);
    01183         virtual RibbonTrail* createRibbonTrail(const String& name);
    01187         virtual RibbonTrail* getRibbonTrail(const String& name) const;
    01190         virtual bool hasRibbonTrail(const String& name) const;
    01191
    01194         virtual void destroyRibbonTrail(RibbonTrail* obj);
    01197         virtual void destroyRibbonTrail(const String& name);
    01200         virtual void destroyAllRibbonTrails(void);
    01201
    01222         virtual ParticleSystem* createParticleSystem(const String& name,
    01223             const String& templateName);
    01243         virtual ParticleSystem* createParticleSystem(const String& name,
    01244             size_t quota = 500,
    01245             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01249         virtual ParticleSystem* getParticleSystem(const String& name) const;
    01252         virtual bool hasParticleSystem(const String& name) const;
    01253
    01256         virtual void destroyParticleSystem(ParticleSystem* obj);
    01259         virtual void destroyParticleSystem(const String& name);
    01262         virtual void destroyAllParticleSystems(void);
    01263
    01269         virtual void clearScene(void);
    01270
    01283         void setAmbientLight(const ColourValue& colour);
    01284
    01287         const ColourValue& getAmbientLight(void) const;
    01288
    01301         virtual void setWorldGeometry(const String& filename);
    01302
    01318         virtual void setWorldGeometry(DataStreamPtr& stream,
    01319             const String& typeName = StringUtil::BLANK);
    01320
    01333         virtual size_t estimateWorldGeometry(const String& filename) { return 0; }
    01334
    01347         virtual size_t estimateWorldGeometry(DataStreamPtr& stream,
    01348             const String& typeName = StringUtil::BLANK) { return 0; }
    01363         virtual ViewPoint getSuggestedViewpoint(bool random = false);
    01364
    01378         virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
    01379
    01393         virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
    01394
    01404         virtual bool hasOption( const String& strKey ) const { return false; }
    01419         virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; }
    01420
    01427         virtual bool getOptionKeys( StringVector& refKeys ) { return false; }
    01428
    01437         virtual void _updateSceneGraph(Camera* cam);
    01438
    01450         virtual void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters);
    01451
    01456         virtual void _applySceneAnimations(void);
    01457
    01460         virtual void _renderVisibleObjects(void);
    01461
    01475         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
    01476
    01480         virtual void _queueSkiesForRendering(Camera* cam);
    01481
    01482
    01483
    01492         virtual void _setDestinationRenderSystem(RenderSystem* sys);
    01493
    01546         virtual void setSkyPlane(
    01547             bool enable,
    01548             const Plane& plane, const String& materialName, Real scale = 1000,
    01549             Real tiling = 10, bool drawFirst = true, Real bow = 0,
    01550             int xsegments = 1, int ysegments = 1,
    01551             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01552
    01554         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
    01555
    01557         virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
    01558
    01560         virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
    01561
    01603         virtual void setSkyBox(
    01604             bool enable, const String& materialName, Real distance = 5000,
    01605             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
    01606             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01607
    01609         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
    01610
    01612         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
    01613
    01615         virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
    01616
    01672         virtual void setSkyDome(
    01673             bool enable, const String& materialName, Real curvature = 10,
    01674             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
    01675             const Quaternion& orientation = Quaternion::IDENTITY,
    01676             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
    01677             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    01678
    01680         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
    01681
    01683         virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
    01684
    01686         virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
    01687
    01712         void setFog(
    01713             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
    01714             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
    01715
    01718         virtual FogMode getFogMode(void) const;
    01719
    01722         virtual const ColourValue& getFogColour(void) const;
    01723
    01726         virtual Real getFogStart(void) const;
    01727
    01730         virtual Real getFogEnd(void) const;
    01731
    01734         virtual Real getFogDensity(void) const;
    01735
    01736
    01754         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
    01755
    01759         virtual BillboardSet* getBillboardSet(const String& name) const;
    01762         virtual bool hasBillboardSet(const String& name) const;
    01763
    01770         virtual void destroyBillboardSet(BillboardSet* set);
    01771
    01778         virtual void destroyBillboardSet(const String& name);
    01779
    01789         virtual void destroyAllBillboardSets(void);
    01790
    01798         virtual void setDisplaySceneNodes(bool display);
    01800         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
    01801
    01822         virtual Animation* createAnimation(const String& name, Real length);
    01823
    01827         virtual Animation* getAnimation(const String& name) const;
    01830         virtual bool hasAnimation(const String& name) const;
    01831
    01837         virtual void destroyAnimation(const String& name);
    01838
    01840         virtual void destroyAllAnimations(void);
    01841
    01869         virtual AnimationState* createAnimationState(const String& animName);
    01870
    01874         virtual AnimationState* getAnimationState(const String& animName) const;
    01877         virtual bool hasAnimationState(const String& name) const;
    01878
    01884         virtual void destroyAnimationState(const String& name);
    01885
    01887         virtual void destroyAllAnimationStates(void);
    01888
    01912         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp,
    01913             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix,
    01914             bool doBeginEndFrame = false) ;
    01915
    01926         virtual RenderQueue* getRenderQueue(void);
    01927
    01931         virtual void addRenderQueueListener(RenderQueueListener* newListener);
    01932
    01934         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
    01935
    01949         virtual void addSpecialCaseRenderQueue(uint8 qid);
    01955         virtual void removeSpecialCaseRenderQueue(uint8 qid);
    01959         virtual void clearSpecialCaseRenderQueues(void);
    01964         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
    01966         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
    01973         virtual bool isRenderQueueToBeProcessed(uint8 qid);
    01974
    01990         virtual void setWorldGeometryRenderQueue(uint8 qid);
    02001         virtual uint8 getWorldGeometryRenderQueue(void);
    02002
    02004         virtual void showBoundingBoxes(bool bShow);
    02005
    02007         virtual bool getShowBoundingBoxes() const;
    02008
    02010         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
    02011
    02012
    02025         virtual AxisAlignedBoxSceneQuery*
    02026             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
    02039         virtual SphereSceneQuery*
    02040             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
    02053         virtual PlaneBoundedVolumeListSceneQuery*
    02054             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
    02055
    02056
    02069         virtual RaySceneQuery*
    02070             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
    02071         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
    02083         virtual IntersectionSceneQuery*
    02084             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
    02085
    02087         virtual void destroyQuery(SceneQuery* query);
    02088
    02089         typedef MapIterator<CameraList> CameraIterator;
    02090         typedef MapIterator<AnimationList> AnimationIterator;
    02091
    02094         CameraIterator getCameraIterator(void) {
    02095             return CameraIterator(mCameras.begin(), mCameras.end());
    02096         }
    02098         AnimationIterator getAnimationIterator(void) {
    02099             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
    02100         }
    02102         AnimationStateIterator getAnimationStateIterator(void) {
    02103             return mAnimationStates.getAnimationStateIterator();
    02104         }
    02105
    02138         virtual void setShadowTechnique(ShadowTechnique technique);
    02139
    02141         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
    02142
    02144         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
    02146         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
    02147
    02154         virtual void setShadowColour(const ColourValue& colour);
    02161         virtual const ColourValue& getShadowColour(void) const;
    02173         virtual void setShadowDirectionalLightExtrusionDistance(Real dist);
    02176         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
    02192         virtual void setShadowFarDistance(Real distance);
    02196         virtual Real getShadowFarDistance(void) const
    02197         { return mShadowFarDist; }
    02198
    02224         virtual void setShadowIndexBufferSize(size_t size);
    02226         virtual size_t getShadowIndexBufferSize(void) const
    02227         { return mShadowIndexBufferSize; }
    02236         virtual void setShadowTextureSize(unsigned short size);
    02237
    02244         virtual void setShadowTextureConfig(size_t shadowIndex, unsigned short width,
    02245             unsigned short height, PixelFormat format);
    02251         virtual void setShadowTextureConfig(size_t shadowIndex,
    02252             const ShadowTextureConfig& config);
    02253
    02255         ConstShadowTextureConfigIterator getShadowTextureConfigIterator() const;
    02256
    02268         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
    02276         virtual void setShadowTextureCount(size_t count);
    02278         size_t getShadowTextureCount(void) const {return mShadowTextureConfigList.size(); }
    02287         virtual void setShadowTextureSettings(unsigned short size, unsigned short count,
    02288             PixelFormat fmt = PF_X8R8G8B8);
    02289
    02296         virtual const TexturePtr& getShadowTexture(size_t shadowIndex);
    02297
    02312         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
    02316         virtual Real getShadowDirLightTextureOffset(void)  const { return mShadowTextureOffset; }
    02324         virtual void setShadowTextureFadeStart(Real fadeStart)
    02325         { mShadowTextureFadeStart = fadeStart; }
    02333         virtual void setShadowTextureFadeEnd(Real fadeEnd)
    02334         { mShadowTextureFadeEnd = fadeEnd; }
    02335
    02348         virtual void setShadowTextureSelfShadow(bool selfShadow);
    02349
    02351         virtual bool getShadowTextureSelfShadow(void) const
    02352         { return mShadowTextureSelfShadow; }
    02373         virtual void setShadowTextureCasterMaterial(const String& name);
    02395         virtual void setShadowTextureReceiverMaterial(const String& name);
    02396
    02407         virtual void setShadowCasterRenderBackFaces(bool bf) { mShadowCasterRenderBackFaces = bf; }
    02408
    02412         virtual bool getShadowCasterRenderBackFaces() const { return mShadowCasterRenderBackFaces; }
    02413
    02418         virtual void setShadowCameraSetup(const ShadowCameraSetupPtr& shadowSetup);
    02419
    02424         virtual const ShadowCameraSetupPtr& getShadowCameraSetup() const;
    02425
    02462         virtual void setShadowUseInfiniteFarPlane(bool enable) {
    02463             mShadowUseInfiniteFarPlane = enable; }
    02464
    02466         virtual bool isShadowTechniqueStencilBased(void) const
    02467         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
    02469         virtual bool isShadowTechniqueTextureBased(void) const
    02470         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
    02472         virtual bool isShadowTechniqueModulative(void) const
    02473         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
    02475         virtual bool isShadowTechniqueAdditive(void) const
    02476         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
    02478         virtual bool isShadowTechniqueIntegrated(void) const
    02479         { return (mShadowTechnique & SHADOWDETAILTYPE_INTEGRATED) != 0; }
    02481         virtual bool isShadowTechniqueInUse(void) const
    02482         { return mShadowTechnique != SHADOWTYPE_NONE; }
    02483
    02487         virtual void addShadowListener(ShadowListener* s);
    02490         virtual void removeShadowListener(ShadowListener* s);
    02491
    02501         virtual StaticGeometry* createStaticGeometry(const String& name);
    02505         virtual StaticGeometry* getStaticGeometry(const String& name) const;
    02507         virtual bool hasStaticGeometry(const String& name) const;
    02509         virtual void destroyStaticGeometry(StaticGeometry* geom);
    02511         virtual void destroyStaticGeometry(const String& name);
    02513         virtual void destroyAllStaticGeometry(void);
    02514
    02524         virtual InstancedGeometry* createInstancedGeometry(const String& name);
    02526         virtual InstancedGeometry* getInstancedGeometry(const String& name) const;
    02528         virtual void destroyInstancedGeometry(InstancedGeometry* geom);
    02530         virtual void destroyInstancedGeometry(const String& name);
    02532         virtual void destroyAllInstancedGeometry(void);
    02533
    02534
    02545         virtual MovableObject* createMovableObject(const String& name,
    02546             const String& typeName, const NameValuePairList* params = 0);
    02552         virtual void destroyMovableObject(const String& name, const String& typeName);
    02558         virtual void destroyMovableObject(MovableObject* m);
    02560         virtual void destroyAllMovableObjectsByType(const String& typeName);
    02562         virtual void destroyAllMovableObjects(void);
    02566         virtual MovableObject* getMovableObject(const String& name, const String& typeName) const;
    02568         virtual bool hasMovableObject(const String& name, const String& typeName) const;
    02569         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
    02575         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
    02587         virtual void injectMovableObject(MovableObject* m);
    02594         virtual void extractMovableObject(const String& name, const String& typeName);
    02601         virtual void extractMovableObject(MovableObject* m);
    02608         virtual void extractAllMovableObjectsByType(const String& typeName);
    02609
    02616         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
    02617
    02621         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
    02622
    02626         uint32 _getCombinedVisibilityMask(void) const;
    02627
    02634         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
    02635
    02639         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
    02640
    02646         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true);
    02647
    02666         virtual void _suppressRenderStateChanges(bool suppress);
    02667
    02671         virtual bool _areRenderStateChangesSuppressed(void) const
    02672         { return mSuppressRenderStateChanges; }
    02673
    02686         virtual const Pass* _setPass(const Pass* pass,
    02687             bool evenIfSuppressed = false, bool shadowDerivation = true);
    02688
    02689
    02699         virtual void _suppressShadows(bool suppress);
    02700
    02704         virtual bool _areShadowsSuppressed(void) const
    02705         { return mSuppressShadows; }
    02706
    02710         virtual void _renderQueueGroupObjects(RenderQueueGroup* group,
    02711             QueuedRenderableCollection::OrganisationMode om);
    02712
    02728         void setQueuedRenderableVisitor(SceneMgrQueuedRenderableVisitor* visitor);
    02729
    02731         SceneMgrQueuedRenderableVisitor* getQueuedRenderableVisitor(void) const;
    02732
    02733
    02737         RenderSystem *getDestinationRenderSystem();
    02738
    02741         Viewport* getCurrentViewport(void) const { return mCurrentViewport; }
    02742
    02744         const VisibleObjectsBoundsInfo& getVisibleObjectsBoundsInfo(const Camera* cam) const;
    02745
    02747         const VisibleObjectsBoundsInfo& getShadowCasterBoundsInfo(const Light* light) const;
    02748     };
    02749
    02751     class _OgreExport DefaultIntersectionSceneQuery :
    02752         public IntersectionSceneQuery
    02753     {
    02754     public:
    02755         DefaultIntersectionSceneQuery(SceneManager* creator);
    02756         ~DefaultIntersectionSceneQuery();
    02757
    02759         void execute(IntersectionSceneQueryListener* listener);
    02760     };
    02761
    02763     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
    02764     {
    02765     public:
    02766         DefaultRaySceneQuery(SceneManager* creator);
    02767         ~DefaultRaySceneQuery();
    02768
    02770         void execute(RaySceneQueryListener* listener);
    02771     };
    02773     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
    02774     {
    02775     public:
    02776         DefaultSphereSceneQuery(SceneManager* creator);
    02777         ~DefaultSphereSceneQuery();
    02778
    02780         void execute(SceneQueryListener* listener);
    02781     };
    02783     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
    02784     {
    02785     public:
    02786         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
    02787         ~DefaultPlaneBoundedVolumeListSceneQuery();
    02788
    02790         void execute(SceneQueryListener* listener);
    02791     };
    02793     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
    02794     {
    02795     public:
    02796         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
    02797         ~DefaultAxisAlignedBoxSceneQuery();
    02798
    02800         void execute(SceneQueryListener* listener);
    02801     };
    02802
    02803
    02805     typedef uint16 SceneTypeMask;
    02806
    02810     enum SceneType
    02811     {
    02812         ST_GENERIC = 1,
    02813         ST_EXTERIOR_CLOSE = 2,
    02814         ST_EXTERIOR_FAR = 4,
    02815         ST_EXTERIOR_REAL_FAR = 8,
    02816         ST_INTERIOR = 16
    02817     };
    02818
    02820     struct SceneManagerMetaData
    02821     {
    02823         String typeName;
    02825         String description;
    02827         SceneTypeMask sceneTypeMask;
    02829         bool worldGeometrySupported;
    02830     };
    02831
    02832
    02833
    02835     class _OgreExport SceneManagerFactory
    02836     {
    02837     protected:
    02838         mutable SceneManagerMetaData mMetaData;
    02839         mutable bool mMetaDataInit;
    02841         virtual void initMetaData(void) const = 0;
    02842     public:
    02843         SceneManagerFactory() : mMetaDataInit(true) {}
    02844         virtual ~SceneManagerFactory() {}
    02846         virtual const SceneManagerMetaData& getMetaData(void) const
    02847         {
    02848             if (mMetaDataInit)
    02849             {
    02850                 initMetaData();
    02851                 mMetaDataInit = false;
    02852             }
    02853             return mMetaData;
    02854         }
    02859         virtual SceneManager* createInstance(const String& instanceName) = 0;
    02861         virtual void destroyInstance(SceneManager* instance) = 0;
    02862
    02863     };
    02864
    02865
    02866
    02867 } // Namespace
    02868
    02869
    02870
    02871 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:26 2008