OgreRenderQueue.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2009 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __RenderQueue_H__
00029 #define __RenderQueue_H__
00030 
00031 #include "OgreHeaderPrefix.h"
00032 #include "OgrePrerequisites.h"
00033 #include "OgreIteratorWrappers.h"
00034 
00035 namespace Ogre {
00036 
00037     class Camera;
00038     class MovableObject;
00039     struct VisibleObjectsBoundsInfo;
00040 
00053     enum RenderQueueGroupID
00054     {
00056         RENDER_QUEUE_BACKGROUND = 0,
00058         RENDER_QUEUE_SKIES_EARLY = 5,
00059         RENDER_QUEUE_1 = 10,
00060         RENDER_QUEUE_2 = 20,
00061         RENDER_QUEUE_WORLD_GEOMETRY_1 = 25,
00062         RENDER_QUEUE_3 = 30,
00063         RENDER_QUEUE_4 = 40,
00065         RENDER_QUEUE_MAIN = 50,
00066         RENDER_QUEUE_6 = 60,
00067         RENDER_QUEUE_7 = 70,
00068         RENDER_QUEUE_WORLD_GEOMETRY_2 = 75,
00069         RENDER_QUEUE_8 = 80,
00070         RENDER_QUEUE_9 = 90,
00072         RENDER_QUEUE_SKIES_LATE = 95,
00074         RENDER_QUEUE_OVERLAY = 100, 
00076         RENDER_QUEUE_MAX = 105
00077     };
00078 
00079     #define OGRE_RENDERABLE_DEFAULT_PRIORITY  100
00080 
00092     class _OgreExport RenderQueue : public RenderQueueAlloc
00093     {
00094     public:
00095         typedef map< uint8, RenderQueueGroup* >::type RenderQueueGroupMap;
00097         typedef MapIterator<RenderQueueGroupMap> QueueGroupIterator;
00098         typedef ConstMapIterator<RenderQueueGroupMap> ConstQueueGroupIterator;
00104         class _OgreExport RenderableListener
00105         {
00106         public:
00107             RenderableListener() {}
00108             virtual ~RenderableListener() {}
00109 
00129             virtual bool renderableQueued(Renderable* rend, uint8 groupID, 
00130                 ushort priority, Technique** ppTech, RenderQueue* pQueue) = 0;
00131         };
00132     protected:
00133         RenderQueueGroupMap mGroups;
00135         uint8 mDefaultQueueGroup;
00137         ushort mDefaultRenderablePriority;
00138 
00139         bool mSplitPassesByLightingType;
00140         bool mSplitNoShadowPasses;
00141         bool mShadowCastersCannotBeReceivers;
00142 
00143         RenderableListener* mRenderableListener;
00144     public:
00145         RenderQueue();
00146         virtual ~RenderQueue();
00147 
00152         void clear(bool destroyPassMaps = false);
00153 
00159         RenderQueueGroup* getQueueGroup(uint8 qid);
00160 
00183         void addRenderable(Renderable* pRend, uint8 groupID, ushort priority);
00184 
00202         void addRenderable(Renderable* pRend, uint8 groupId);
00203 
00216         void addRenderable(Renderable* pRend);
00217         
00221         uint8 getDefaultQueueGroup(void) const;
00222 
00227         void setDefaultRenderablePriority(ushort priority);
00228 
00232         ushort getDefaultRenderablePriority(void) const;
00233 
00238         void setDefaultQueueGroup(uint8 grp);
00239         
00241         QueueGroupIterator _getQueueGroupIterator(void);
00242         ConstQueueGroupIterator _getQueueGroupIterator(void) const;
00243 
00247         void setSplitPassesByLightingType(bool split);
00248 
00252         bool getSplitPassesByLightingType(void) const;
00253 
00258         void setSplitNoShadowPasses(bool split);
00259 
00264         bool getSplitNoShadowPasses(void) const;
00265 
00269         void setShadowCastersCannotBeReceivers(bool ind);
00270 
00274         bool getShadowCastersCannotBeReceivers(void) const;
00275 
00281         void setRenderableListener(RenderableListener* listener)
00282         { mRenderableListener = listener; }
00283 
00284         RenderableListener* getRenderableListener(void) const
00285         { return mRenderableListener; }
00286 
00289         void merge( const RenderQueue* rhs );
00295         void processVisibleObject(MovableObject* mo, 
00296             Camera* cam, 
00297             bool onlyShadowCasters, 
00298             VisibleObjectsBoundsInfo* visibleBounds);
00299 
00300     };
00301 
00305 }
00306 
00307 #include "OgreHeaderSuffix.h"
00308 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:52