Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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-2005 The OGRE Team
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 #ifndef __SceneManager_H__
00026 #define __SceneManager_H__
00027 
00028 // Precompiler options
00029 #include "OgrePrerequisites.h"
00030 
00031 #include "OgreString.h"
00032 #include "OgreSceneNode.h"
00033 #include "OgrePlane.h"
00034 #include "OgreQuaternion.h"
00035 #include "OgreColourValue.h"
00036 #include "OgreCommon.h"
00037 #include "OgreSceneQuery.h"
00038 #include "OgreAutoParamDataSource.h"
00039 #include "OgreAnimationState.h"
00040 #include "OgreRenderQueue.h"
00041 #include "OgreRenderQueueSortingGrouping.h"
00042 #include "OgreRectangle2D.h"
00043 #include "OgrePixelFormat.h"
00044 #include "OgreResourceGroupManager.h"
00045 #include "OgreTexture.h"
00046 
00047 namespace Ogre {
00048 
00050     struct ViewPoint
00051     {
00052         Vector3 position;
00053         Quaternion orientation;
00054     };
00055 
00056     // Forward declarations
00057     class DefaultIntersectionSceneQuery;
00058     class DefaultRaySceneQuery;
00059     class DefaultSphereSceneQuery;
00060     class DefaultAxisAlignedBoxSceneQuery;
00061 
00065     class _OgreExport ShadowListener
00066     {
00067     public:
00068         ShadowListener() {}
00069         virtual ~ShadowListener() {}
00070 
00085         virtual void shadowTexturesUpdated(size_t numberOfShadowTextures) = 0;
00086 
00099         virtual void shadowTextureCasterPreViewProj(Light* light, 
00100             Camera* camera) = 0;
00114         virtual void shadowTextureReceiverPreViewProj(Light* light, 
00115             Frustum* frustum) = 0;
00116         
00117     };
00118 
00148     class _OgreExport SceneManager
00149     {
00150     public:
00152         static uint32 WORLD_GEOMETRY_TYPE_MASK;
00154         static uint32 ENTITY_TYPE_MASK;
00156         static uint32 FX_TYPE_MASK;
00158         static uint32 STATICGEOMETRY_TYPE_MASK;
00160         static uint32 LIGHT_TYPE_MASK;
00162         static uint32 USER_TYPE_MASK_LIMIT;
00165         struct materialLess
00166         {
00167             _OgreExport bool operator()(const Material* x, const Material* y) const;
00168         };
00170         struct lightLess
00171         {
00172             _OgreExport bool operator()(const Light* a, const Light* b) const;
00173         };
00174 
00176         enum IlluminationRenderStage
00177         {
00179             IRS_NONE,
00181             IRS_RENDER_TO_TEXTURE,
00183             IRS_RENDER_RECEIVER_PASS
00184         };
00185 
00190         enum SpecialCaseRenderQueueMode
00191         {
00193             SCRQM_INCLUDE,
00195             SCRQM_EXCLUDE
00196         };
00197 
00198         typedef struct SkyDomeGenParameters
00199         {
00200             Real skyDomeCurvature;
00201             Real skyDomeTiling;
00202             Real skyDomeDistance;
00203             int skyDomeXSegments; 
00204             int skyDomeYSegments;
00205             int skyDomeYSegments_keep;
00206         };
00207         
00208         struct SkyPlaneGenParameters
00209         {
00210             Real skyPlaneScale;
00211             Real skyPlaneTiling; 
00212             Real skyPlaneBow; 
00213             int skyPlaneXSegments; 
00214             int skyPlaneYSegments; 
00215         };
00216         
00217         struct SkyBoxGenParameters
00218         {
00219             Real skyBoxDistance;
00220         };
00221     protected:
00223         String mName;
00224 
00226         RenderQueue* mRenderQueue;
00227 
00229         ColourValue mAmbientLight;
00230 
00232         RenderSystem *mDestRenderSystem;
00233 
00234         typedef std::map<String, Camera* > CameraList;
00235 
00238         CameraList mCameras;
00239 
00240         typedef std::map<String, StaticGeometry* > StaticGeometryList;
00241         StaticGeometryList mStaticGeometryList;
00242 
00243         typedef std::map<String, SceneNode*> SceneNodeList;
00244 
00251         SceneNodeList mSceneNodes;
00252 
00254         Camera* mCameraInProgress;
00256         Viewport* mCurrentViewport;
00257 
00259         SceneNode* mSceneRoot;
00260 
00262         typedef std::set<SceneNode*> AutoTrackingSceneNodes;
00263         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
00264 
00265         // Sky params
00266         // Sky plane
00267         Entity* mSkyPlaneEntity;
00268         Entity* mSkyDomeEntity[5];
00269         Entity* mSkyBoxEntity[6];
00270 
00271         SceneNode* mSkyPlaneNode;
00272         SceneNode* mSkyDomeNode;
00273         SceneNode* mSkyBoxNode;
00274 
00275         bool mSkyPlaneEnabled;
00276         bool mSkyPlaneDrawFirst;
00277         Plane mSkyPlane;
00278     SceneManager::SkyPlaneGenParameters mSkyPlaneGenParameters;
00279        // Sky box
00280         bool mSkyBoxEnabled;
00281         bool mSkyBoxDrawFirst;
00282         Quaternion mSkyBoxOrientation;
00283         SceneManager::SkyBoxGenParameters   mSkyBoxGenParameters;
00284         // Sky dome
00285         bool mSkyDomeEnabled;
00286         bool mSkyDomeDrawFirst;
00287         Quaternion mSkyDomeOrientation;
00288         SceneManager::SkyDomeGenParameters mSkyDomeGenParameters;
00289     
00290         // Fog
00291         FogMode mFogMode;
00292         ColourValue mFogColour;
00293         Real mFogStart;
00294         Real mFogEnd;
00295         Real mFogDensity;
00296 
00297         typedef std::set<uint8> SpecialCaseRenderQueueList;
00298         SpecialCaseRenderQueueList mSpecialCaseQueueList;
00299         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
00300         uint8 mWorldGeometryRenderQueue;
00301         
00302         unsigned long mLastFrameNumber;
00303         Matrix4 mTempXform[256];
00304         bool mResetIdentityView;
00305         bool mResetIdentityProj;
00306 
00307         typedef std::map<String, MovableObject*> MovableObjectMap;
00308         typedef std::map<String, MovableObjectMap*> MovableObjectCollectionMap;
00309         MovableObjectCollectionMap mMovableObjectCollectionMap;
00310         MovableObjectMap* getMovableObjectMap(const String& typeName);
00311 
00316         virtual void initRenderQueue(void);
00318         Pass* mShadowCasterPlainBlackPass;
00320         Pass* mShadowReceiverPass;
00330         const Pass* deriveShadowCasterPass(const Pass* pass);
00339         const Pass* deriveShadowReceiverPass(const Pass* pass);
00340     
00347         bool validatePassForRendering(const Pass* pass);
00348 
00355         bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
00356 
00357         enum BoxPlane
00358         {
00359             BP_FRONT = 0,
00360             BP_BACK = 1,
00361             BP_LEFT = 2,
00362             BP_RIGHT = 3,
00363             BP_UP = 4,
00364             BP_DOWN = 5
00365         };
00366 
00367         /* Internal utility method for creating the planes of a skybox.
00368         */
00369         MeshPtr createSkyboxPlane(
00370             BoxPlane bp,
00371             Real distance,
00372             const Quaternion& orientation,
00373             const String& groupName);
00374 
00375         /* Internal utility method for creating the planes of a skydome.
00376         */
00377         MeshPtr createSkydomePlane(
00378             BoxPlane bp,
00379             Real curvature, Real tiling, Real distance,
00380             const Quaternion& orientation,
00381             int xsegments, int ysegments, int ySegmentsToKeep, 
00382             const String& groupName);
00383 
00384         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
00385         bool mDisplayNodes;
00386 
00388         typedef std::map<String, Animation*> AnimationList;
00389         AnimationList mAnimationsList;
00390         AnimationStateSet mAnimationStates;
00391 
00394         void useRenderableViewProjMode(const Renderable* pRend);
00395         
00398         void resetViewProjMode(void);
00399 
00400         typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
00401         RenderQueueListenerList mRenderQueueListeners;
00402 
00403         typedef std::vector<ShadowListener*> ShadowListenerList;
00404         ShadowListenerList mShadowListeners;
00406         bool fireRenderQueueStarted(uint8 id, const String& invocation);
00408         bool fireRenderQueueEnded(uint8 id, const String& invocation);
00409 
00411         void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
00413         void fireShadowTexturesPreCaster(Light* light, Camera* camera);
00415         void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
00417         virtual void setViewport(Viewport *vp);
00418 
00420         bool mShowBoundingBoxes;      
00421 
00423         virtual void renderVisibleObjectsDefaultSequence(void);
00425         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
00427         virtual void prepareRenderQueue(void);
00428 
00429 
00442         virtual void renderSingleObject(const Renderable* rend, const Pass* pass, 
00443             bool doLightIteration, const LightList* manualLightList = 0);
00444 
00446         AutoParamDataSource mAutoParamDataSource;
00447 
00448         ShadowTechnique mShadowTechnique;
00449         bool mDebugShadows;
00450         ColourValue mShadowColour;
00451         Pass* mShadowDebugPass;
00452         Pass* mShadowStencilPass;
00453         Pass* mShadowModulativePass;
00454         bool mShadowMaterialInitDone;
00455         LightList mLightsAffectingFrustum;
00456         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
00457         size_t mShadowIndexBufferSize;
00458         Rectangle2D* mFullScreenQuad;
00459         Real mShadowDirLightExtrudeDist;
00460         IlluminationRenderStage mIlluminationStage;
00461         unsigned short mShadowTextureSize;
00462         unsigned short mShadowTextureCount;
00463         PixelFormat mShadowTextureFormat;
00464         typedef std::vector<TexturePtr> ShadowTextureList;
00465         ShadowTextureList mShadowTextures;
00466         typedef std::vector<Camera*> ShadowTextureCameraList;
00467         ShadowTextureCameraList mShadowTextureCameras;
00468         Texture* mCurrentShadowTexture;
00469         bool mShadowUseInfiniteFarPlane;
00470 
00477         virtual void findLightsAffectingFrustum(const Camera* camera);
00479         virtual void initShadowVolumeMaterials(void);
00481         virtual void createShadowTextures(unsigned short size, unsigned short count, 
00482             PixelFormat fmt);
00484         virtual void destroyShadowTextures(void);
00486         virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
00487 
00493         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam);
00499         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
00501         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
00502             Pass* pass, const LightList *manualLightList, unsigned long flags,
00503             bool secondpass, bool zfail, bool twosided);
00504         typedef std::vector<ShadowCaster*> ShadowCasterList;
00505         ShadowCasterList mShadowCasterList;
00506         SphereSceneQuery* mShadowCasterSphereQuery;
00507         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
00508         Real mShadowFarDist;
00509         Real mShadowFarDistSquared;
00510         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
00511         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
00512         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
00513         bool mShadowTextureSelfShadow;
00514         Pass* mShadowTextureCustomCasterPass;
00515         Pass* mShadowTextureCustomReceiverPass;
00516         String mShadowTextureCustomCasterVertexProgram;
00517         String mShadowTextureCustomReceiverVertexProgram;
00518         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
00519         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
00520         bool mShadowTextureCasterVPDirty;
00521         bool mShadowTextureReceiverVPDirty;
00522 
00524         uint32 mVisibilityMask;
00525         bool mFindVisibleObjects;
00526 
00528         bool mSuppressRenderStateChanges;
00530         bool mSuppressShadows;
00531 
00532 
00533         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
00534         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
00535 
00537         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener
00538         {
00539         protected:
00540             SceneManager* mSceneMgr;
00541             ShadowCasterList* mCasterList;
00542             bool mIsLightInFrustum;
00543             const PlaneBoundedVolumeList* mLightClipVolumeList;
00544             const Camera* mCamera;
00545             const Light* mLight;
00546             Real mFarDistSquared;
00547         public:
00548             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
00549                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0), 
00550                 mCamera(0) {}
00551             // Prepare the listener for use with a set of parameters  
00552             void prepare(bool lightInFrustum, 
00553                 const PlaneBoundedVolumeList* lightClipVolumes, 
00554                 const Light* light, const Camera* cam, ShadowCasterList* casterList, 
00555                 Real farDistSquared) 
00556             {
00557                 mCasterList = casterList;
00558                 mIsLightInFrustum = lightInFrustum;
00559                 mLightClipVolumeList = lightClipVolumes;
00560                 mCamera = cam;
00561                 mLight = light;
00562                 mFarDistSquared = farDistSquared;
00563             }
00564             bool queryResult(MovableObject* object);
00565             bool queryResult(SceneQuery::WorldFragment* fragment);
00566         };
00567 
00568         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
00569 
00576         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light, 
00577             const Camera* camera);
00579         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 
00580             QueuedRenderableCollection::OrganisationMode om);
00582         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00583             QueuedRenderableCollection::OrganisationMode om);
00585         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00586             QueuedRenderableCollection::OrganisationMode om);
00588         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group, 
00589             QueuedRenderableCollection::OrganisationMode om);
00591         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group, 
00592             QueuedRenderableCollection::OrganisationMode om);
00594         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00595             QueuedRenderableCollection::OrganisationMode om);
00596 
00598         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00599             QueuedRenderableCollection::OrganisationMode om);
00601         virtual void renderObjects(const QueuedRenderableCollection& objs, 
00602             QueuedRenderableCollection::OrganisationMode om, 
00603             bool doLightIteration, const LightList* manualLightList = 0);
00609         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs, 
00610             QueuedRenderableCollection::OrganisationMode om, 
00611             bool doLightIteration, const LightList* manualLightList = 0);
00612 
00615         virtual void updateRenderQueueSplitOptions(void);
00618         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group, 
00619             bool suppressShadows, bool suppressRenderState);
00620 
00624         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
00625         {
00626         protected:
00628             const Pass* mUsedPass;
00629         public:
00630             SceneMgrQueuedRenderableVisitor() 
00631                 :transparentShadowCastersMode(false) {}
00632             ~SceneMgrQueuedRenderableVisitor() {}
00633             void visit(const Renderable* r);
00634             bool visit(const Pass* p);
00635             void visit(const RenderablePass* rp);
00636 
00638             SceneManager* targetSceneMgr;
00640             bool transparentShadowCastersMode;
00642             bool autoLights;
00644             const LightList* manualLightList;
00645 
00646         };
00648         friend class SceneMgrQueuedRenderableVisitor;
00650         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
00652         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
00653 
00654     public:
00657         SceneManager(const String& instanceName);
00658 
00661         virtual ~SceneManager();
00662 
00664         const String& getName(void) const { return mName; }
00665 
00672         virtual const String& getTypeName(void) const = 0;
00673 
00681         virtual Camera* createCamera(const String& name);
00682 
00685         virtual Camera* getCamera(const String& name);
00686 
00695         virtual void destroyCamera(Camera *cam);
00696 
00702         virtual void destroyCamera(const String& name);
00703 
00712         virtual void destroyAllCameras(void);
00713 
00724         virtual Light* createLight(const String& name);
00725 
00728         virtual Light* getLight(const String& name);
00729 
00734         virtual void destroyLight(const String& name);
00735 
00740         virtual void destroyLight(Light* light);
00743         virtual void destroyAllLights(void);
00744 
00764         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
00765 
00766 
00783         virtual SceneNode* createSceneNode(void);
00784 
00799         virtual SceneNode* createSceneNode(const String& name);
00800 
00807         virtual void destroySceneNode(const String& name);
00808 
00824         virtual SceneNode* getRootSceneNode(void) const;
00825 
00832         virtual SceneNode* getSceneNode(const String& name) const;
00833 
00841         virtual Entity* createEntity(const String& entityName, const String& meshName);
00842 
00849         enum PrefabType {
00850             PT_PLANE
00851         };
00852 
00859         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
00861         virtual Entity* getEntity(const String& name);
00862 
00871         virtual void destroyEntity(Entity* ent);
00872 
00881         virtual void destroyEntity(const String& name);
00882 
00892         virtual void destroyAllEntities(void);
00893 
00899         virtual ManualObject* createManualObject(const String& name);
00901         virtual ManualObject* getManualObject(const String& name);
00902 
00905         virtual void destroyManualObject(ManualObject* obj);
00908         virtual void destroyManualObject(const String& name);
00911         virtual void destroyAllManualObjects(void);
00917         virtual BillboardChain* createBillboardChain(const String& name);
00919         virtual BillboardChain* getBillboardChain(const String& name);
00920 
00923         virtual void destroyBillboardChain(BillboardChain* obj);
00926         virtual void destroyBillboardChain(const String& name);
00929         virtual void destroyAllBillboardChains(void);       
00935         virtual RibbonTrail* createRibbonTrail(const String& name);
00937         virtual RibbonTrail* getRibbonTrail(const String& name);
00938 
00941         virtual void destroyRibbonTrail(RibbonTrail* obj);
00944         virtual void destroyRibbonTrail(const String& name);
00947         virtual void destroyAllRibbonTrails(void);      
00948 
00969         virtual ParticleSystem* createParticleSystem(const String& name,
00970             const String& templateName);
00990         virtual ParticleSystem* createParticleSystem(const String& name,
00991             size_t quota = 500, 
00992             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
00994         virtual ParticleSystem* getParticleSystem(const String& name);
00995 
00998         virtual void destroyParticleSystem(ParticleSystem* obj);
01001         virtual void destroyParticleSystem(const String& name);
01004         virtual void destroyAllParticleSystems(void);       
01005 
01011         virtual void clearScene(void);
01012 
01025         void setAmbientLight(const ColourValue& colour);
01026 
01029         const ColourValue& getAmbientLight(void) const;
01030 
01043         virtual void setWorldGeometry(const String& filename);
01044 
01060         virtual void setWorldGeometry(DataStreamPtr& stream, 
01061             const String& typeName = StringUtil::BLANK);
01062 
01075         virtual size_t estimateWorldGeometry(const String& filename) { return 0; }
01076 
01089         virtual size_t estimateWorldGeometry(DataStreamPtr& stream, 
01090             const String& typeName = StringUtil::BLANK) { return 0; }
01105         virtual ViewPoint getSuggestedViewpoint(bool random = false);
01106 
01120         virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
01121 
01135         virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
01136 
01146         virtual bool hasOption( const String& strKey ) const { return false; }
01161         virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; }
01162 
01169         virtual bool getOptionKeys( StringVector& refKeys ) { return false; }
01170 
01179         virtual void _updateSceneGraph(Camera* cam);
01180 
01192         virtual void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
01193 
01198         virtual void _applySceneAnimations(void);
01199 
01202         virtual void _renderVisibleObjects(void);
01203 
01217         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
01218 
01222         virtual void _queueSkiesForRendering(Camera* cam);
01223 
01224 
01225 
01234         virtual void _setDestinationRenderSystem(RenderSystem* sys);
01235 
01288         virtual void setSkyPlane(
01289             bool enable,
01290             const Plane& plane, const String& materialName, Real scale = 1000,
01291             Real tiling = 10, bool drawFirst = true, Real bow = 0, 
01292             int xsegments = 1, int ysegments = 1, 
01293             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01294 
01296         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
01297 
01299         virtual SceneNode* getSkyPlaneNode(void) { return mSkyPlaneNode; }      
01301         virtual SceneManager::SkyPlaneGenParameters getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
01302 
01344         virtual void setSkyBox(
01345             bool enable, const String& materialName, Real distance = 5000,
01346             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
01347             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01348 
01350         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
01351 
01353         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
01354         
01356         virtual SceneManager::SkyBoxGenParameters   getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
01357         
01413         virtual void setSkyDome(
01414             bool enable, const String& materialName, Real curvature = 10,
01415             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
01416             const Quaternion& orientation = Quaternion::IDENTITY,
01417             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
01418             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01419 
01421         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
01422 
01424         virtual SceneNode* getSkyDomeNode(void) { return mSkyDomeNode; }    
01425         
01427         virtual SceneManager::SkyDomeGenParameters  getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
01452         void setFog(
01453             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
01454             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
01455 
01458         virtual FogMode getFogMode(void) const;
01459 
01462         virtual const ColourValue& getFogColour(void) const;
01463 
01466         virtual Real getFogStart(void) const;
01467 
01470         virtual Real getFogEnd(void) const;
01471 
01474         virtual Real getFogDensity(void) const;
01475 
01476 
01494         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
01495 
01498         virtual BillboardSet* getBillboardSet(const String& name);
01499 
01506         virtual void destroyBillboardSet(BillboardSet* set);
01507 
01514         virtual void destroyBillboardSet(const String& name);
01515 
01525         virtual void destroyAllBillboardSets(void);
01526 
01534         virtual void setDisplaySceneNodes(bool display);
01536         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
01537 
01558         virtual Animation* createAnimation(const String& name, Real length);
01559 
01561         virtual Animation* getAnimation(const String& name) const;
01562 
01568         virtual void destroyAnimation(const String& name);
01569 
01571         virtual void destroyAllAnimations(void);
01572 
01596         virtual AnimationState* createAnimationState(const String& animName);
01597 
01599         virtual AnimationState* getAnimationState(const String& animName);
01600 
01606         virtual void destroyAnimationState(const String& name);
01607 
01609         virtual void destroyAllAnimationStates(void);
01610 
01634         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, 
01635             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, 
01636             bool doBeginEndFrame = false) ;
01637 
01648         virtual RenderQueue* getRenderQueue(void);
01649 
01653         virtual void addRenderQueueListener(RenderQueueListener* newListener);
01654 
01656         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
01657 
01671         virtual void addSpecialCaseRenderQueue(uint8 qid);
01677         virtual void removeSpecialCaseRenderQueue(uint8 qid);
01681         virtual void clearSpecialCaseRenderQueues(void);
01686         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
01688         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
01695         virtual bool isRenderQueueToBeProcessed(uint8 qid);
01696 
01712         virtual void setWorldGeometryRenderQueue(uint8 qid);
01723         virtual uint8 getWorldGeometryRenderQueue(void);
01724 
01726         virtual void showBoundingBoxes(bool bShow);
01727 
01729         virtual bool getShowBoundingBoxes() const;
01730 
01732         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
01733 
01734         
01747         virtual AxisAlignedBoxSceneQuery* 
01748             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
01761         virtual SphereSceneQuery* 
01762             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
01775         virtual PlaneBoundedVolumeListSceneQuery* 
01776             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
01777 
01778 
01791         virtual RaySceneQuery* 
01792             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
01793         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
01805         virtual IntersectionSceneQuery* 
01806             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
01807 
01809         virtual void destroyQuery(SceneQuery* query);
01810 
01811         typedef MapIterator<CameraList> CameraIterator;
01812         typedef MapIterator<AnimationList> AnimationIterator;
01813 
01815         CameraIterator getCameraIterator(void) {
01816             return CameraIterator(mCameras.begin(), mCameras.end());
01817         }
01819         AnimationIterator getAnimationIterator(void) {
01820             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
01821         }
01823         AnimationStateIterator getAnimationStateIterator(void) {
01824             return mAnimationStates.getAnimationStateIterator();
01825         }
01826 
01859         virtual void setShadowTechnique(ShadowTechnique technique);
01860         
01862         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
01863 
01865         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
01867         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
01868 
01875         virtual void setShadowColour(const ColourValue& colour);
01882         virtual const ColourValue& getShadowColour(void) const;
01894         virtual void setShadowDirectionalLightExtrusionDistance(Real dist); 
01897         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
01913         virtual void setShadowFarDistance(Real distance);
01917         virtual Real getShadowFarDistance(void) const
01918         { return mShadowFarDist; }
01919 
01945         virtual void setShadowIndexBufferSize(size_t size);
01947         virtual size_t getShadowIndexBufferSize(void) const
01948         { return mShadowIndexBufferSize; }
01955         virtual void setShadowTextureSize(unsigned short size);
01957         unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; }
01967         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
01969         PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; }
01977         virtual void setShadowTextureCount(unsigned short count);
01979         unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; }
01986         virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
01987             PixelFormat fmt = PF_X8R8G8B8);
02002         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
02010         virtual void setShadowTextureFadeStart(Real fadeStart) 
02011         { mShadowTextureFadeStart = fadeStart; }
02019         virtual void setShadowTextureFadeEnd(Real fadeEnd) 
02020         { mShadowTextureFadeEnd = fadeEnd; }
02021 
02034         virtual void setShadowTextureSelfShadow(bool selfShadow); 
02035 
02037         virtual bool getShadowTextureSelfShadow(void) const 
02038         { return mShadowTextureSelfShadow; }
02059         virtual void setShadowTextureCasterMaterial(const String& name);
02081         virtual void setShadowTextureReceiverMaterial(const String& name);
02082 
02119         virtual void setShadowUseInfiniteFarPlane(bool enable) {
02120             mShadowUseInfiniteFarPlane = enable; }
02121 
02123         virtual bool isShadowTechniqueStencilBased(void) const 
02124         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
02126         virtual bool isShadowTechniqueTextureBased(void) const 
02127         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
02129         virtual bool isShadowTechniqueModulative(void) const 
02130         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
02132         virtual bool isShadowTechniqueAdditive(void) const 
02133         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
02135         virtual bool isShadowTechniqueInUse(void) const 
02136         { return mShadowTechnique != SHADOWTYPE_NONE; }
02137 
02141         virtual void addShadowListener(ShadowListener* s);
02144         virtual void removeShadowListener(ShadowListener* s);
02145 
02155         virtual StaticGeometry* createStaticGeometry(const String& name);
02157         virtual StaticGeometry* getStaticGeometry(const String& name) const;
02159         virtual void destroyStaticGeometry(StaticGeometry* geom);
02161         virtual void destroyStaticGeometry(const String& name);
02163         virtual void destroyAllStaticGeometry(void);
02164 
02165 
02176         virtual MovableObject* createMovableObject(const String& name, 
02177             const String& typeName, const NameValuePairList* params = 0);
02183         virtual void destroyMovableObject(const String& name, const String& typeName);
02189         virtual void destroyMovableObject(MovableObject* m);
02191         virtual void destroyAllMovableObjectsByType(const String& typeName);
02193         virtual void destroyAllMovableObjects(void);
02195         virtual MovableObject* getMovableObject(const String& name, const String& typeName);
02196         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
02198         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
02210         virtual void injectMovableObject(MovableObject* m);
02217         virtual void extractMovableObject(const String& name, const String& typeName);
02224         virtual void extractMovableObject(MovableObject* m);
02231         virtual void extractAllMovableObjectsByType(const String& typeName);
02232 
02236         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
02237 
02241         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
02242 
02249         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
02250 
02254         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
02255 
02260         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend);
02261 
02280         virtual void _suppressRenderStateChanges(bool suppress);
02281         
02285         virtual bool _areRenderStateChangesSuppressed(void) const
02286         { return mSuppressRenderStateChanges; }
02287 
02298         virtual const Pass* _setPass(const Pass* pass, bool evenIfSuppressed = false);
02299 
02300 
02310         virtual void _suppressShadows(bool suppress); 
02311 
02315         virtual bool _areShadowsSuppressed(void) const
02316         { return mSuppressShadows; }
02317 
02321         virtual void _renderQueueGroupObjects(RenderQueueGroup* group, 
02322             QueuedRenderableCollection::OrganisationMode om);
02323 
02327         RenderSystem *getDestinationRenderSystem();
02328     };
02329 
02331     class _OgreExport DefaultIntersectionSceneQuery : 
02332         public IntersectionSceneQuery
02333     {
02334     public:
02335         DefaultIntersectionSceneQuery(SceneManager* creator);
02336         ~DefaultIntersectionSceneQuery();
02337 
02339         void execute(IntersectionSceneQueryListener* listener);
02340     };
02341 
02343     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
02344     {
02345     public:
02346         DefaultRaySceneQuery(SceneManager* creator);
02347         ~DefaultRaySceneQuery();
02348 
02350         void execute(RaySceneQueryListener* listener);
02351     };
02353     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
02354     {
02355     public:
02356         DefaultSphereSceneQuery(SceneManager* creator);
02357         ~DefaultSphereSceneQuery();
02358 
02360         void execute(SceneQueryListener* listener);
02361     };
02363     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
02364     {
02365     public:
02366         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
02367         ~DefaultPlaneBoundedVolumeListSceneQuery();
02368 
02370         void execute(SceneQueryListener* listener);
02371     };
02373     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
02374     {
02375     public:
02376         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
02377         ~DefaultAxisAlignedBoxSceneQuery();
02378 
02380         void execute(SceneQueryListener* listener);
02381     };
02382     
02383 
02385     typedef uint16 SceneTypeMask;
02386 
02390     enum SceneType
02391     {
02392         ST_GENERIC = 1,
02393         ST_EXTERIOR_CLOSE = 2,
02394         ST_EXTERIOR_FAR = 4,
02395         ST_EXTERIOR_REAL_FAR = 8,
02396         ST_INTERIOR = 16
02397     };
02398 
02400     struct SceneManagerMetaData
02401     {
02403         String typeName;
02405         String description;
02407         SceneTypeMask sceneTypeMask;
02409         bool worldGeometrySupported;
02410     };
02411 
02412 
02413 
02415     class _OgreExport SceneManagerFactory
02416     {
02417     protected:
02418         mutable SceneManagerMetaData mMetaData;
02419         mutable bool mMetaDataInit;
02421         virtual void initMetaData(void) const = 0;
02422     public:
02423         SceneManagerFactory() : mMetaDataInit(true) {}
02424         virtual ~SceneManagerFactory() {}
02426         virtual const SceneManagerMetaData& getMetaData(void) const 
02427         {
02428             if (mMetaDataInit)
02429             {
02430                 initMetaData();
02431                 mMetaDataInit = false;
02432             }
02433             return mMetaData; 
02434         }
02439         virtual SceneManager* createInstance(const String& instanceName) = 0;
02441         virtual void destroyInstance(SceneManager* instance) = 0;
02442 
02443     };
02444 
02445 
02446 
02447 } // Namespace
02448 
02449 
02450 
02451 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:49 2006