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-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         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 
00222     protected:
00224         String mName;
00225 
00227         RenderQueue* mRenderQueue;
00228 
00230         ColourValue mAmbientLight;
00231 
00233         RenderSystem *mDestRenderSystem;
00234 
00235         typedef std::map<String, Camera* > CameraList;
00236 
00239         CameraList mCameras;
00240 
00241         typedef std::map<String, StaticGeometry* > StaticGeometryList;
00242         StaticGeometryList mStaticGeometryList;
00243 
00244         typedef std::map<String, SceneNode*> SceneNodeList;
00245 
00252         SceneNodeList mSceneNodes;
00253 
00255         Camera* mCameraInProgress;
00257         Viewport* mCurrentViewport;
00258 
00260         SceneNode* mSceneRoot;
00261 
00263         typedef std::set<SceneNode*> AutoTrackingSceneNodes;
00264         AutoTrackingSceneNodes mAutoTrackingSceneNodes;
00265 
00266         // Sky params
00267         // Sky plane
00268         Entity* mSkyPlaneEntity;
00269         Entity* mSkyDomeEntity[5];
00270         Entity* mSkyBoxEntity[6];
00271 
00272         SceneNode* mSkyPlaneNode;
00273         SceneNode* mSkyDomeNode;
00274         SceneNode* mSkyBoxNode;
00275 
00276         // Sky plane
00277         bool mSkyPlaneEnabled;
00278         bool mSkyPlaneDrawFirst;
00279         Plane mSkyPlane;
00280         SkyPlaneGenParameters mSkyPlaneGenParameters;
00281         // Sky box
00282         bool mSkyBoxEnabled;
00283         bool mSkyBoxDrawFirst;
00284         Quaternion mSkyBoxOrientation;
00285         SkyBoxGenParameters mSkyBoxGenParameters;
00286         // Sky dome
00287         bool mSkyDomeEnabled;
00288         bool mSkyDomeDrawFirst;
00289         Quaternion mSkyDomeOrientation;
00290         SkyDomeGenParameters mSkyDomeGenParameters;
00291 
00292         // Fog
00293         FogMode mFogMode;
00294         ColourValue mFogColour;
00295         Real mFogStart;
00296         Real mFogEnd;
00297         Real mFogDensity;
00298 
00299         typedef std::set<uint8> SpecialCaseRenderQueueList;
00300         SpecialCaseRenderQueueList mSpecialCaseQueueList;
00301         SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
00302         uint8 mWorldGeometryRenderQueue;
00303         
00304         unsigned long mLastFrameNumber;
00305         Matrix4 mTempXform[256];
00306         bool mResetIdentityView;
00307         bool mResetIdentityProj;
00308 
00309         typedef std::map<String, MovableObject*> MovableObjectMap;
00310         typedef std::map<String, MovableObjectMap*> MovableObjectCollectionMap;
00311         MovableObjectCollectionMap mMovableObjectCollectionMap;
00312         MovableObjectMap* getMovableObjectMap(const String& typeName);
00313 
00318         virtual void initRenderQueue(void);
00320         Pass* mShadowCasterPlainBlackPass;
00322         Pass* mShadowReceiverPass;
00332         const Pass* deriveShadowCasterPass(const Pass* pass);
00341         const Pass* deriveShadowReceiverPass(const Pass* pass);
00342     
00349         bool validatePassForRendering(const Pass* pass);
00350 
00357         bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
00358 
00359         enum BoxPlane
00360         {
00361             BP_FRONT = 0,
00362             BP_BACK = 1,
00363             BP_LEFT = 2,
00364             BP_RIGHT = 3,
00365             BP_UP = 4,
00366             BP_DOWN = 5
00367         };
00368 
00369         /* Internal utility method for creating the planes of a skybox.
00370         */
00371         MeshPtr createSkyboxPlane(
00372             BoxPlane bp,
00373             Real distance,
00374             const Quaternion& orientation,
00375             const String& groupName);
00376 
00377         /* Internal utility method for creating the planes of a skydome.
00378         */
00379         MeshPtr createSkydomePlane(
00380             BoxPlane bp,
00381             Real curvature, Real tiling, Real distance,
00382             const Quaternion& orientation,
00383             int xsegments, int ysegments, int ySegmentsToKeep, 
00384             const String& groupName);
00385 
00386         // Flag indicating whether SceneNodes will be rendered as a set of 3 axes
00387         bool mDisplayNodes;
00388 
00390         typedef std::map<String, Animation*> AnimationList;
00391         AnimationList mAnimationsList;
00392         AnimationStateSet mAnimationStates;
00393 
00396         void useRenderableViewProjMode(const Renderable* pRend);
00397         
00400         void resetViewProjMode(void);
00401 
00402         typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
00403         RenderQueueListenerList mRenderQueueListeners;
00404 
00405         typedef std::vector<ShadowListener*> ShadowListenerList;
00406         ShadowListenerList mShadowListeners;
00408         bool fireRenderQueueStarted(uint8 id, const String& invocation);
00410         bool fireRenderQueueEnded(uint8 id, const String& invocation);
00411 
00413         void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
00415         void fireShadowTexturesPreCaster(Light* light, Camera* camera);
00417         void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
00419         virtual void setViewport(Viewport *vp);
00420 
00422         bool mShowBoundingBoxes;      
00423 
00425         virtual void renderVisibleObjectsDefaultSequence(void);
00427         virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
00429         virtual void prepareRenderQueue(void);
00430 
00431 
00444         virtual void renderSingleObject(const Renderable* rend, const Pass* pass, 
00445             bool doLightIteration, const LightList* manualLightList = 0);
00446 
00448         AutoParamDataSource mAutoParamDataSource;
00449 
00450         ShadowTechnique mShadowTechnique;
00451         bool mDebugShadows;
00452         ColourValue mShadowColour;
00453         Pass* mShadowDebugPass;
00454         Pass* mShadowStencilPass;
00455         Pass* mShadowModulativePass;
00456         bool mShadowMaterialInitDone;
00457         LightList mLightsAffectingFrustum;
00458         HardwareIndexBufferSharedPtr mShadowIndexBuffer;
00459         size_t mShadowIndexBufferSize;
00460         Rectangle2D* mFullScreenQuad;
00461         Real mShadowDirLightExtrudeDist;
00462         IlluminationRenderStage mIlluminationStage;
00463         unsigned short mShadowTextureSize;
00464         unsigned short mShadowTextureCount;
00465         PixelFormat mShadowTextureFormat;
00466         typedef std::vector<TexturePtr> ShadowTextureList;
00467         ShadowTextureList mShadowTextures;
00468         typedef std::vector<Camera*> ShadowTextureCameraList;
00469         ShadowTextureCameraList mShadowTextureCameras;
00470         Texture* mCurrentShadowTexture;
00471         bool mShadowUseInfiniteFarPlane;
00472 
00479         virtual void findLightsAffectingFrustum(const Camera* camera);
00481         virtual void initShadowVolumeMaterials(void);
00483         virtual void createShadowTextures(unsigned short size, unsigned short count, 
00484             PixelFormat fmt);
00486         virtual void destroyShadowTextures(void);
00488         virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
00489 
00495         virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam);
00501         virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
00503         void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
00504             Pass* pass, const LightList *manualLightList, unsigned long flags,
00505             bool secondpass, bool zfail, bool twosided);
00506         typedef std::vector<ShadowCaster*> ShadowCasterList;
00507         ShadowCasterList mShadowCasterList;
00508         SphereSceneQuery* mShadowCasterSphereQuery;
00509         AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
00510         Real mShadowFarDist;
00511         Real mShadowFarDistSquared;
00512         Real mShadowTextureOffset; // proportion of texture offset in view direction e.g. 0.4
00513         Real mShadowTextureFadeStart; // as a proportion e.g. 0.6
00514         Real mShadowTextureFadeEnd; // as a proportion e.g. 0.9
00515         bool mShadowTextureSelfShadow;
00516         Pass* mShadowTextureCustomCasterPass;
00517         Pass* mShadowTextureCustomReceiverPass;
00518         String mShadowTextureCustomCasterVertexProgram;
00519         String mShadowTextureCustomReceiverVertexProgram;
00520         String mShadowTextureCustomReceiverFragmentProgram;
00521         GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
00522         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
00523         GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
00524 
00526         uint32 mVisibilityMask;
00527         bool mFindVisibleObjects;
00528 
00530         bool mSuppressRenderStateChanges;
00532         bool mSuppressShadows;
00533 
00534 
00535         GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
00536         GpuProgramParametersSharedPtr mFiniteExtrusionParams;
00537 
00539         class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener
00540         {
00541         protected:
00542             SceneManager* mSceneMgr;
00543             ShadowCasterList* mCasterList;
00544             bool mIsLightInFrustum;
00545             const PlaneBoundedVolumeList* mLightClipVolumeList;
00546             const Camera* mCamera;
00547             const Light* mLight;
00548             Real mFarDistSquared;
00549         public:
00550             ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
00551                 mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0), 
00552                 mCamera(0) {}
00553             // Prepare the listener for use with a set of parameters  
00554             void prepare(bool lightInFrustum, 
00555                 const PlaneBoundedVolumeList* lightClipVolumes, 
00556                 const Light* light, const Camera* cam, ShadowCasterList* casterList, 
00557                 Real farDistSquared) 
00558             {
00559                 mCasterList = casterList;
00560                 mIsLightInFrustum = lightInFrustum;
00561                 mLightClipVolumeList = lightClipVolumes;
00562                 mCamera = cam;
00563                 mLight = light;
00564                 mFarDistSquared = farDistSquared;
00565             }
00566             bool queryResult(MovableObject* object);
00567             bool queryResult(SceneQuery::WorldFragment* fragment);
00568         };
00569 
00570         ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
00571 
00578         virtual const ShadowCasterList& findShadowCastersForLight(const Light* light, 
00579             const Camera* camera);
00581         virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 
00582             QueuedRenderableCollection::OrganisationMode om);
00584         virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00585             QueuedRenderableCollection::OrganisationMode om);
00587         virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
00588             QueuedRenderableCollection::OrganisationMode om);
00590         virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group, 
00591             QueuedRenderableCollection::OrganisationMode om);
00593         virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group, 
00594             QueuedRenderableCollection::OrganisationMode om);
00596         virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00597             QueuedRenderableCollection::OrganisationMode om);
00598 
00600         virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
00601             QueuedRenderableCollection::OrganisationMode om);
00603         virtual void renderObjects(const QueuedRenderableCollection& objs, 
00604             QueuedRenderableCollection::OrganisationMode om, 
00605             bool doLightIteration, const LightList* manualLightList = 0);
00611         virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs, 
00612             QueuedRenderableCollection::OrganisationMode om, 
00613             bool doLightIteration, const LightList* manualLightList = 0);
00614 
00617         virtual void updateRenderQueueSplitOptions(void);
00620         virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group, 
00621             bool suppressShadows, bool suppressRenderState);
00622 
00626         class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
00627         {
00628         protected:
00630             const Pass* mUsedPass;
00631         public:
00632             SceneMgrQueuedRenderableVisitor() 
00633                 :transparentShadowCastersMode(false) {}
00634             ~SceneMgrQueuedRenderableVisitor() {}
00635             void visit(const Renderable* r);
00636             bool visit(const Pass* p);
00637             void visit(const RenderablePass* rp);
00638 
00640             SceneManager* targetSceneMgr;
00642             bool transparentShadowCastersMode;
00644             bool autoLights;
00646             const LightList* manualLightList;
00647 
00648         };
00650         friend class SceneMgrQueuedRenderableVisitor;
00652         SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
00654         SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
00655 
00656     public:
00659         SceneManager(const String& instanceName);
00660 
00663         virtual ~SceneManager();
00664 
00666         const String& getName(void) const { return mName; }
00667 
00674         virtual const String& getTypeName(void) const = 0;
00675 
00683         virtual Camera* createCamera(const String& name);
00684 
00688         virtual Camera* getCamera(const String& name);
00689 
00692         virtual bool hasCamera(const String& name) const;
00693 
00702         virtual void destroyCamera(Camera *cam);
00703 
00709         virtual void destroyCamera(const String& name);
00710 
00719         virtual void destroyAllCameras(void);
00720 
00731         virtual Light* createLight(const String& name);
00732 
00736         virtual Light* getLight(const String& name);
00737 
00740         virtual bool hasLight(const String& name) const;
00741 
00746         virtual void destroyLight(const String& name);
00747 
00752         virtual void destroyLight(Light* light);
00755         virtual void destroyAllLights(void);
00756 
00776         virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
00777 
00778 
00795         virtual SceneNode* createSceneNode(void);
00796 
00811         virtual SceneNode* createSceneNode(const String& name);
00812 
00819         virtual void destroySceneNode(const String& name);
00820 
00836         virtual SceneNode* getRootSceneNode(void) const;
00837 
00845         virtual SceneNode* getSceneNode(const String& name) const;
00846 
00849         virtual bool hasSceneNode(const String& name) const;
00850 
00851 
00859         virtual Entity* createEntity(const String& entityName, const String& meshName);
00860 
00867         enum PrefabType {
00868             PT_PLANE
00869         };
00870 
00877         virtual Entity* createEntity(const String& entityName, PrefabType ptype);
00881         virtual Entity* getEntity(const String& name);
00884         virtual bool hasEntity(const String& name) const;
00885 
00894         virtual void destroyEntity(Entity* ent);
00895 
00904         virtual void destroyEntity(const String& name);
00905 
00915         virtual void destroyAllEntities(void);
00916 
00922         virtual ManualObject* createManualObject(const String& name);
00926         virtual ManualObject* getManualObject(const String& name);
00929         virtual bool hasManualObject(const String& name) const;
00930 
00933         virtual void destroyManualObject(ManualObject* obj);
00936         virtual void destroyManualObject(const String& name);
00939         virtual void destroyAllManualObjects(void);
00945         virtual BillboardChain* createBillboardChain(const String& name);
00949         virtual BillboardChain* getBillboardChain(const String& name);
00952         virtual bool hasBillboardChain(const String& name) const;
00953 
00956         virtual void destroyBillboardChain(BillboardChain* obj);
00959         virtual void destroyBillboardChain(const String& name);
00962         virtual void destroyAllBillboardChains(void);       
00968         virtual RibbonTrail* createRibbonTrail(const String& name);
00972         virtual RibbonTrail* getRibbonTrail(const String& name);
00975         virtual bool hasRibbonTrail(const String& name) const;
00976 
00979         virtual void destroyRibbonTrail(RibbonTrail* obj);
00982         virtual void destroyRibbonTrail(const String& name);
00985         virtual void destroyAllRibbonTrails(void);      
00986 
01007         virtual ParticleSystem* createParticleSystem(const String& name,
01008             const String& templateName);
01028         virtual ParticleSystem* createParticleSystem(const String& name,
01029             size_t quota = 500, 
01030             const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01034         virtual ParticleSystem* getParticleSystem(const String& name);
01037         virtual bool hasParticleSystem(const String& name) const;
01038 
01041         virtual void destroyParticleSystem(ParticleSystem* obj);
01044         virtual void destroyParticleSystem(const String& name);
01047         virtual void destroyAllParticleSystems(void);       
01048 
01054         virtual void clearScene(void);
01055 
01068         void setAmbientLight(const ColourValue& colour);
01069 
01072         const ColourValue& getAmbientLight(void) const;
01073 
01086         virtual void setWorldGeometry(const String& filename);
01087 
01103         virtual void setWorldGeometry(DataStreamPtr& stream, 
01104             const String& typeName = StringUtil::BLANK);
01105 
01118         virtual size_t estimateWorldGeometry(const String& filename) { return 0; }
01119 
01132         virtual size_t estimateWorldGeometry(DataStreamPtr& stream, 
01133             const String& typeName = StringUtil::BLANK) { return 0; }
01148         virtual ViewPoint getSuggestedViewpoint(bool random = false);
01149 
01163         virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
01164 
01178         virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
01179 
01189         virtual bool hasOption( const String& strKey ) const { return false; }
01204         virtual bool getOptionValues( const String& strKey, StringVector& refValueList ) { return false; }
01205 
01212         virtual bool getOptionKeys( StringVector& refKeys ) { return false; }
01213 
01222         virtual void _updateSceneGraph(Camera* cam);
01223 
01235         virtual void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
01236 
01241         virtual void _applySceneAnimations(void);
01242 
01245         virtual void _renderVisibleObjects(void);
01246 
01260         virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
01261 
01265         virtual void _queueSkiesForRendering(Camera* cam);
01266 
01267 
01268 
01277         virtual void _setDestinationRenderSystem(RenderSystem* sys);
01278 
01331         virtual void setSkyPlane(
01332             bool enable,
01333             const Plane& plane, const String& materialName, Real scale = 1000,
01334             Real tiling = 10, bool drawFirst = true, Real bow = 0, 
01335             int xsegments = 1, int ysegments = 1, 
01336             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01337 
01339         virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
01340 
01342         virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
01343 
01345         virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
01346 
01388         virtual void setSkyBox(
01389             bool enable, const String& materialName, Real distance = 5000,
01390             bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
01391             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01392 
01394         virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
01395 
01397         virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
01398 
01400         virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
01401 
01457         virtual void setSkyDome(
01458             bool enable, const String& materialName, Real curvature = 10,
01459             Real tiling = 8, Real distance = 4000, bool drawFirst = true,
01460             const Quaternion& orientation = Quaternion::IDENTITY,
01461             int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
01462             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
01463 
01465         virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
01466 
01468         virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
01469 
01471         virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
01472 
01497         void setFog(
01498             FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
01499             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
01500 
01503         virtual FogMode getFogMode(void) const;
01504 
01507         virtual const ColourValue& getFogColour(void) const;
01508 
01511         virtual Real getFogStart(void) const;
01512 
01515         virtual Real getFogEnd(void) const;
01516 
01519         virtual Real getFogDensity(void) const;
01520 
01521 
01539         virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
01540 
01544         virtual BillboardSet* getBillboardSet(const String& name);
01547         virtual bool hasBillboardSet(const String& name) const;
01548 
01555         virtual void destroyBillboardSet(BillboardSet* set);
01556 
01563         virtual void destroyBillboardSet(const String& name);
01564 
01574         virtual void destroyAllBillboardSets(void);
01575 
01583         virtual void setDisplaySceneNodes(bool display);
01585         virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
01586 
01607         virtual Animation* createAnimation(const String& name, Real length);
01608 
01612         virtual Animation* getAnimation(const String& name) const;
01615         virtual bool hasAnimation(const String& name) const;
01616 
01622         virtual void destroyAnimation(const String& name);
01623 
01625         virtual void destroyAllAnimations(void);
01626 
01654         virtual AnimationState* createAnimationState(const String& animName);
01655 
01659         virtual AnimationState* getAnimationState(const String& animName);
01662         virtual bool hasAnimationState(const String& name) const;
01663 
01669         virtual void destroyAnimationState(const String& name);
01670 
01672         virtual void destroyAllAnimationStates(void);
01673 
01697         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, 
01698             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, 
01699             bool doBeginEndFrame = false) ;
01700 
01711         virtual RenderQueue* getRenderQueue(void);
01712 
01716         virtual void addRenderQueueListener(RenderQueueListener* newListener);
01717 
01719         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
01720 
01734         virtual void addSpecialCaseRenderQueue(uint8 qid);
01740         virtual void removeSpecialCaseRenderQueue(uint8 qid);
01744         virtual void clearSpecialCaseRenderQueues(void);
01749         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
01751         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
01758         virtual bool isRenderQueueToBeProcessed(uint8 qid);
01759 
01775         virtual void setWorldGeometryRenderQueue(uint8 qid);
01786         virtual uint8 getWorldGeometryRenderQueue(void);
01787 
01789         virtual void showBoundingBoxes(bool bShow);
01790 
01792         virtual bool getShowBoundingBoxes() const;
01793 
01795         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
01796 
01797         
01810         virtual AxisAlignedBoxSceneQuery* 
01811             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
01824         virtual SphereSceneQuery* 
01825             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
01838         virtual PlaneBoundedVolumeListSceneQuery* 
01839             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
01840 
01841 
01854         virtual RaySceneQuery* 
01855             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
01856         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
01868         virtual IntersectionSceneQuery* 
01869             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
01870 
01872         virtual void destroyQuery(SceneQuery* query);
01873 
01874         typedef MapIterator<CameraList> CameraIterator;
01875         typedef MapIterator<AnimationList> AnimationIterator;
01876 
01878         CameraIterator getCameraIterator(void) {
01879             return CameraIterator(mCameras.begin(), mCameras.end());
01880         }
01882         AnimationIterator getAnimationIterator(void) {
01883             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
01884         }
01886         AnimationStateIterator getAnimationStateIterator(void) {
01887             return mAnimationStates.getAnimationStateIterator();
01888         }
01889 
01922         virtual void setShadowTechnique(ShadowTechnique technique);
01923         
01925         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
01926 
01928         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
01930         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
01931 
01938         virtual void setShadowColour(const ColourValue& colour);
01945         virtual const ColourValue& getShadowColour(void) const;
01957         virtual void setShadowDirectionalLightExtrusionDistance(Real dist); 
01960         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
01976         virtual void setShadowFarDistance(Real distance);
01980         virtual Real getShadowFarDistance(void) const
01981         { return mShadowFarDist; }
01982 
02008         virtual void setShadowIndexBufferSize(size_t size);
02010         virtual size_t getShadowIndexBufferSize(void) const
02011         { return mShadowIndexBufferSize; }
02018         virtual void setShadowTextureSize(unsigned short size);
02020         unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; }
02030         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
02032         PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; }
02040         virtual void setShadowTextureCount(unsigned short count);
02042         unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; }
02049         virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
02050             PixelFormat fmt = PF_X8R8G8B8);
02065         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
02073         virtual void setShadowTextureFadeStart(Real fadeStart) 
02074         { mShadowTextureFadeStart = fadeStart; }
02082         virtual void setShadowTextureFadeEnd(Real fadeEnd) 
02083         { mShadowTextureFadeEnd = fadeEnd; }
02084 
02097         virtual void setShadowTextureSelfShadow(bool selfShadow); 
02098 
02100         virtual bool getShadowTextureSelfShadow(void) const 
02101         { return mShadowTextureSelfShadow; }
02122         virtual void setShadowTextureCasterMaterial(const String& name);
02144         virtual void setShadowTextureReceiverMaterial(const String& name);
02145 
02182         virtual void setShadowUseInfiniteFarPlane(bool enable) {
02183             mShadowUseInfiniteFarPlane = enable; }
02184 
02186         virtual bool isShadowTechniqueStencilBased(void) const 
02187         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
02189         virtual bool isShadowTechniqueTextureBased(void) const 
02190         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
02192         virtual bool isShadowTechniqueModulative(void) const 
02193         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
02195         virtual bool isShadowTechniqueAdditive(void) const 
02196         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
02198         virtual bool isShadowTechniqueInUse(void) const 
02199         { return mShadowTechnique != SHADOWTYPE_NONE; }
02200 
02204         virtual void addShadowListener(ShadowListener* s);
02207         virtual void removeShadowListener(ShadowListener* s);
02208 
02218         virtual StaticGeometry* createStaticGeometry(const String& name);
02222         virtual StaticGeometry* getStaticGeometry(const String& name) const;
02224         virtual bool hasStaticGeometry(const String& name) const;
02226         virtual void destroyStaticGeometry(StaticGeometry* geom);
02228         virtual void destroyStaticGeometry(const String& name);
02230         virtual void destroyAllStaticGeometry(void);
02231 
02232 
02243         virtual MovableObject* createMovableObject(const String& name, 
02244             const String& typeName, const NameValuePairList* params = 0);
02250         virtual void destroyMovableObject(const String& name, const String& typeName);
02256         virtual void destroyMovableObject(MovableObject* m);
02258         virtual void destroyAllMovableObjectsByType(const String& typeName);
02260         virtual void destroyAllMovableObjects(void);
02264         virtual MovableObject* getMovableObject(const String& name, const String& typeName);
02266         virtual bool hasMovableObject(const String& name, const String& typeName) const;
02267         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
02269         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
02281         virtual void injectMovableObject(MovableObject* m);
02288         virtual void extractMovableObject(const String& name, const String& typeName);
02295         virtual void extractMovableObject(MovableObject* m);
02302         virtual void extractAllMovableObjectsByType(const String& typeName);
02303 
02307         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
02308 
02312         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
02313 
02320         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
02321 
02325         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
02326 
02332         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true);
02333 
02352         virtual void _suppressRenderStateChanges(bool suppress);
02353         
02357         virtual bool _areRenderStateChangesSuppressed(void) const
02358         { return mSuppressRenderStateChanges; }
02359 
02372         virtual const Pass* _setPass(const Pass* pass, 
02373             bool evenIfSuppressed = false, bool shadowDerivation = true);
02374 
02375 
02385         virtual void _suppressShadows(bool suppress); 
02386 
02390         virtual bool _areShadowsSuppressed(void) const
02391         { return mSuppressShadows; }
02392 
02396         virtual void _renderQueueGroupObjects(RenderQueueGroup* group, 
02397             QueuedRenderableCollection::OrganisationMode om);
02398 
02402         RenderSystem *getDestinationRenderSystem();
02403 
02406         Viewport* getCurrentViewport(void) { return mCurrentViewport; }
02407 
02408     };
02409 
02411     class _OgreExport DefaultIntersectionSceneQuery : 
02412         public IntersectionSceneQuery
02413     {
02414     public:
02415         DefaultIntersectionSceneQuery(SceneManager* creator);
02416         ~DefaultIntersectionSceneQuery();
02417 
02419         void execute(IntersectionSceneQueryListener* listener);
02420     };
02421 
02423     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
02424     {
02425     public:
02426         DefaultRaySceneQuery(SceneManager* creator);
02427         ~DefaultRaySceneQuery();
02428 
02430         void execute(RaySceneQueryListener* listener);
02431     };
02433     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
02434     {
02435     public:
02436         DefaultSphereSceneQuery(SceneManager* creator);
02437         ~DefaultSphereSceneQuery();
02438 
02440         void execute(SceneQueryListener* listener);
02441     };
02443     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
02444     {
02445     public:
02446         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
02447         ~DefaultPlaneBoundedVolumeListSceneQuery();
02448 
02450         void execute(SceneQueryListener* listener);
02451     };
02453     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
02454     {
02455     public:
02456         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
02457         ~DefaultAxisAlignedBoxSceneQuery();
02458 
02460         void execute(SceneQueryListener* listener);
02461     };
02462     
02463 
02465     typedef uint16 SceneTypeMask;
02466 
02470     enum SceneType
02471     {
02472         ST_GENERIC = 1,
02473         ST_EXTERIOR_CLOSE = 2,
02474         ST_EXTERIOR_FAR = 4,
02475         ST_EXTERIOR_REAL_FAR = 8,
02476         ST_INTERIOR = 16
02477     };
02478 
02480     struct SceneManagerMetaData
02481     {
02483         String typeName;
02485         String description;
02487         SceneTypeMask sceneTypeMask;
02489         bool worldGeometrySupported;
02490     };
02491 
02492 
02493 
02495     class _OgreExport SceneManagerFactory
02496     {
02497     protected:
02498         mutable SceneManagerMetaData mMetaData;
02499         mutable bool mMetaDataInit;
02501         virtual void initMetaData(void) const = 0;
02502     public:
02503         SceneManagerFactory() : mMetaDataInit(true) {}
02504         virtual ~SceneManagerFactory() {}
02506         virtual const SceneManagerMetaData& getMetaData(void) const 
02507         {
02508             if (mMetaDataInit)
02509             {
02510                 initMetaData();
02511                 mMetaDataInit = false;
02512             }
02513             return mMetaData; 
02514         }
02519         virtual SceneManager* createInstance(const String& instanceName) = 0;
02521         virtual void destroyInstance(SceneManager* instance) = 0;
02522 
02523     };
02524 
02525 
02526 
02527 } // Namespace
02528 
02529 
02530 
02531 #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 Jan 21 10:01:39 2007