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 
01650         virtual AnimationState* createAnimationState(const String& animName);
01651 
01655         virtual AnimationState* getAnimationState(const String& animName);
01658         virtual bool hasAnimationState(const String& name) const;
01659 
01665         virtual void destroyAnimationState(const String& name);
01666 
01668         virtual void destroyAllAnimationStates(void);
01669 
01693         virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, 
01694             const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, 
01695             bool doBeginEndFrame = false) ;
01696 
01707         virtual RenderQueue* getRenderQueue(void);
01708 
01712         virtual void addRenderQueueListener(RenderQueueListener* newListener);
01713 
01715         virtual void removeRenderQueueListener(RenderQueueListener* delListener);
01716 
01730         virtual void addSpecialCaseRenderQueue(uint8 qid);
01736         virtual void removeSpecialCaseRenderQueue(uint8 qid);
01740         virtual void clearSpecialCaseRenderQueues(void);
01745         virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
01747         virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
01754         virtual bool isRenderQueueToBeProcessed(uint8 qid);
01755 
01771         virtual void setWorldGeometryRenderQueue(uint8 qid);
01782         virtual uint8 getWorldGeometryRenderQueue(void);
01783 
01785         virtual void showBoundingBoxes(bool bShow);
01786 
01788         virtual bool getShowBoundingBoxes() const;
01789 
01791         virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
01792 
01793         
01806         virtual AxisAlignedBoxSceneQuery* 
01807             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
01820         virtual SphereSceneQuery* 
01821             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
01834         virtual PlaneBoundedVolumeListSceneQuery* 
01835             createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask = 0xFFFFFFFF);
01836 
01837 
01850         virtual RaySceneQuery* 
01851             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
01852         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
01864         virtual IntersectionSceneQuery* 
01865             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
01866 
01868         virtual void destroyQuery(SceneQuery* query);
01869 
01870         typedef MapIterator<CameraList> CameraIterator;
01871         typedef MapIterator<AnimationList> AnimationIterator;
01872 
01874         CameraIterator getCameraIterator(void) {
01875             return CameraIterator(mCameras.begin(), mCameras.end());
01876         }
01878         AnimationIterator getAnimationIterator(void) {
01879             return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
01880         }
01882         AnimationStateIterator getAnimationStateIterator(void) {
01883             return mAnimationStates.getAnimationStateIterator();
01884         }
01885 
01918         virtual void setShadowTechnique(ShadowTechnique technique);
01919         
01921         virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
01922 
01924         virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
01926         virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
01927 
01934         virtual void setShadowColour(const ColourValue& colour);
01941         virtual const ColourValue& getShadowColour(void) const;
01953         virtual void setShadowDirectionalLightExtrusionDistance(Real dist); 
01956         virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
01972         virtual void setShadowFarDistance(Real distance);
01976         virtual Real getShadowFarDistance(void) const
01977         { return mShadowFarDist; }
01978 
02004         virtual void setShadowIndexBufferSize(size_t size);
02006         virtual size_t getShadowIndexBufferSize(void) const
02007         { return mShadowIndexBufferSize; }
02014         virtual void setShadowTextureSize(unsigned short size);
02016         unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; }
02026         virtual void setShadowTexturePixelFormat(PixelFormat fmt);
02028         PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; }
02036         virtual void setShadowTextureCount(unsigned short count);
02038         unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; }
02045         virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
02046             PixelFormat fmt = PF_X8R8G8B8);
02061         virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
02069         virtual void setShadowTextureFadeStart(Real fadeStart) 
02070         { mShadowTextureFadeStart = fadeStart; }
02078         virtual void setShadowTextureFadeEnd(Real fadeEnd) 
02079         { mShadowTextureFadeEnd = fadeEnd; }
02080 
02093         virtual void setShadowTextureSelfShadow(bool selfShadow); 
02094 
02096         virtual bool getShadowTextureSelfShadow(void) const 
02097         { return mShadowTextureSelfShadow; }
02118         virtual void setShadowTextureCasterMaterial(const String& name);
02140         virtual void setShadowTextureReceiverMaterial(const String& name);
02141 
02178         virtual void setShadowUseInfiniteFarPlane(bool enable) {
02179             mShadowUseInfiniteFarPlane = enable; }
02180 
02182         virtual bool isShadowTechniqueStencilBased(void) const 
02183         { return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
02185         virtual bool isShadowTechniqueTextureBased(void) const 
02186         { return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
02188         virtual bool isShadowTechniqueModulative(void) const 
02189         { return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
02191         virtual bool isShadowTechniqueAdditive(void) const 
02192         { return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
02194         virtual bool isShadowTechniqueInUse(void) const 
02195         { return mShadowTechnique != SHADOWTYPE_NONE; }
02196 
02200         virtual void addShadowListener(ShadowListener* s);
02203         virtual void removeShadowListener(ShadowListener* s);
02204 
02214         virtual StaticGeometry* createStaticGeometry(const String& name);
02218         virtual StaticGeometry* getStaticGeometry(const String& name) const;
02220         virtual bool hasStaticGeometry(const String& name) const;
02222         virtual void destroyStaticGeometry(StaticGeometry* geom);
02224         virtual void destroyStaticGeometry(const String& name);
02226         virtual void destroyAllStaticGeometry(void);
02227 
02228 
02239         virtual MovableObject* createMovableObject(const String& name, 
02240             const String& typeName, const NameValuePairList* params = 0);
02246         virtual void destroyMovableObject(const String& name, const String& typeName);
02252         virtual void destroyMovableObject(MovableObject* m);
02254         virtual void destroyAllMovableObjectsByType(const String& typeName);
02256         virtual void destroyAllMovableObjects(void);
02260         virtual MovableObject* getMovableObject(const String& name, const String& typeName);
02262         virtual bool hasMovableObject(const String& name, const String& typeName) const;
02263         typedef MapIterator<MovableObjectMap> MovableObjectIterator;
02265         virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
02277         virtual void injectMovableObject(MovableObject* m);
02284         virtual void extractMovableObject(const String& name, const String& typeName);
02291         virtual void extractMovableObject(MovableObject* m);
02298         virtual void extractAllMovableObjectsByType(const String& typeName);
02299 
02303         virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
02304 
02308         virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
02309 
02316         virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
02317 
02321         virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
02322 
02328         virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true);
02329 
02348         virtual void _suppressRenderStateChanges(bool suppress);
02349         
02353         virtual bool _areRenderStateChangesSuppressed(void) const
02354         { return mSuppressRenderStateChanges; }
02355 
02368         virtual const Pass* _setPass(const Pass* pass, 
02369             bool evenIfSuppressed = false, bool shadowDerivation = true);
02370 
02371 
02381         virtual void _suppressShadows(bool suppress); 
02382 
02386         virtual bool _areShadowsSuppressed(void) const
02387         { return mSuppressShadows; }
02388 
02392         virtual void _renderQueueGroupObjects(RenderQueueGroup* group, 
02393             QueuedRenderableCollection::OrganisationMode om);
02394 
02398         RenderSystem *getDestinationRenderSystem();
02399 
02402         Viewport* getCurrentViewport(void) { return mCurrentViewport; }
02403 
02404     };
02405 
02407     class _OgreExport DefaultIntersectionSceneQuery : 
02408         public IntersectionSceneQuery
02409     {
02410     public:
02411         DefaultIntersectionSceneQuery(SceneManager* creator);
02412         ~DefaultIntersectionSceneQuery();
02413 
02415         void execute(IntersectionSceneQueryListener* listener);
02416     };
02417 
02419     class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
02420     {
02421     public:
02422         DefaultRaySceneQuery(SceneManager* creator);
02423         ~DefaultRaySceneQuery();
02424 
02426         void execute(RaySceneQueryListener* listener);
02427     };
02429     class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
02430     {
02431     public:
02432         DefaultSphereSceneQuery(SceneManager* creator);
02433         ~DefaultSphereSceneQuery();
02434 
02436         void execute(SceneQueryListener* listener);
02437     };
02439     class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
02440     {
02441     public:
02442         DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
02443         ~DefaultPlaneBoundedVolumeListSceneQuery();
02444 
02446         void execute(SceneQueryListener* listener);
02447     };
02449     class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
02450     {
02451     public:
02452         DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
02453         ~DefaultAxisAlignedBoxSceneQuery();
02454 
02456         void execute(SceneQueryListener* listener);
02457     };
02458     
02459 
02461     typedef uint16 SceneTypeMask;
02462 
02466     enum SceneType
02467     {
02468         ST_GENERIC = 1,
02469         ST_EXTERIOR_CLOSE = 2,
02470         ST_EXTERIOR_FAR = 4,
02471         ST_EXTERIOR_REAL_FAR = 8,
02472         ST_INTERIOR = 16
02473     };
02474 
02476     struct SceneManagerMetaData
02477     {
02479         String typeName;
02481         String description;
02483         SceneTypeMask sceneTypeMask;
02485         bool worldGeometrySupported;
02486     };
02487 
02488 
02489 
02491     class _OgreExport SceneManagerFactory
02492     {
02493     protected:
02494         mutable SceneManagerMetaData mMetaData;
02495         mutable bool mMetaDataInit;
02497         virtual void initMetaData(void) const = 0;
02498     public:
02499         SceneManagerFactory() : mMetaDataInit(true) {}
02500         virtual ~SceneManagerFactory() {}
02502         virtual const SceneManagerMetaData& getMetaData(void) const 
02503         {
02504             if (mMetaDataInit)
02505             {
02506                 initMetaData();
02507                 mMetaDataInit = false;
02508             }
02509             return mMetaData; 
02510         }
02515         virtual SceneManager* createInstance(const String& instanceName) = 0;
02517         virtual void destroyInstance(SceneManager* instance) = 0;
02518 
02519     };
02520 
02521 
02522 
02523 } // Namespace
02524 
02525 
02526 
02527 #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 Jun 11 10:46:41 2006