Crazy Eddie's GUI System  0.8.4
RenderingSurface.h
00001 /***********************************************************************
00002     created:    Mon Jan 12 2009
00003     author:     Paul D Turner
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
00007  *
00008  *   Permission is hereby granted, free of charge, to any person obtaining
00009  *   a copy of this software and associated documentation files (the
00010  *   "Software"), to deal in the Software without restriction, including
00011  *   without limitation the rights to use, copy, modify, merge, publish,
00012  *   distribute, sublicense, and/or sell copies of the Software, and to
00013  *   permit persons to whom the Software is furnished to do so, subject to
00014  *   the following conditions:
00015  *
00016  *   The above copyright notice and this permission notice shall be
00017  *   included in all copies or substantial portions of the Software.
00018  *
00019  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00023  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00024  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00025  *   OTHER DEALINGS IN THE SOFTWARE.
00026  ***************************************************************************/
00027 #ifndef _CEGUIRenderingSurface_h_
00028 #define _CEGUIRenderingSurface_h_
00029 
00030 #include "CEGUI/EventSet.h"
00031 #include "CEGUI/EventArgs.h"
00032 #include "CEGUI/RenderQueue.h"
00033 
00034 #if defined(_MSC_VER)
00035 #   pragma warning(push)
00036 #   pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00043 //----------------------------------------------------------------------------//
00045 enum RenderQueueID
00046 {
00047     RQ_USER_0,
00049     RQ_UNDERLAY,
00050     RQ_USER_1,
00052     RQ_BASE,
00053     RQ_USER_2,
00055     RQ_CONTENT_1,
00056     RQ_USER_3,
00058     RQ_CONTENT_2,
00059     RQ_USER_4,
00061     RQ_OVERLAY,
00062     RQ_USER_5
00063 };
00064 
00065 //----------------------------------------------------------------------------//
00066 
00073 class CEGUIEXPORT RenderQueueEventArgs : public EventArgs
00074 {
00075 public:
00084     RenderQueueEventArgs(const RenderQueueID id);
00085 
00087     RenderQueueID queueID;
00088 };
00089 
00090 //----------------------------------------------------------------------------//
00091 
00108 class CEGUIEXPORT RenderingSurface :
00109     public EventSet,
00110     public AllocatedObject<RenderingSurface>
00111 {
00112 public:
00114     static const String EventNamespace;
00122     static const String EventRenderQueueStarted;
00129     static const String EventRenderQueueEnded;
00130 
00148     RenderingSurface(RenderTarget& target);
00149 
00151     virtual ~RenderingSurface();
00152 
00173     void addGeometryBuffer(const RenderQueueID queue,
00174                            const GeometryBuffer& buffer);
00175 
00187     void removeGeometryBuffer(const RenderQueueID queue,
00188                               const GeometryBuffer& buffer);
00189 
00202     void clearGeometry(const RenderQueueID queue);
00203 
00212     void clearGeometry();
00213 
00224     virtual void draw();
00225 
00238     virtual void invalidate();
00239 
00255     bool isInvalidated() const;
00256 
00266     virtual bool isRenderingWindow() const;
00267 
00290     virtual RenderingWindow& createRenderingWindow(TextureTarget& target);
00291 
00305     virtual void destroyRenderingWindow(RenderingWindow& window);
00306 
00308 
00318     virtual void transferRenderingWindow(RenderingWindow& window);
00319 
00329     const RenderTarget& getRenderTarget() const;
00330     RenderTarget& getRenderTarget();
00331 
00332 protected:
00336     virtual void drawContent();
00337 
00339     void draw(const RenderQueue& queue, RenderQueueEventArgs& args);
00340 
00342     void detatchWindow(RenderingWindow& w);
00343 
00345     void attachWindow(RenderingWindow& w);
00346 
00348     typedef std::map<RenderQueueID, RenderQueue
00349         /*CEGUI_MAP_ALLOC(RenderQueueID, RenderQueue)*/> RenderQueueList;
00351     typedef std::vector<RenderingWindow*
00352         CEGUI_VECTOR_ALLOC(RenderingWindow*)> RenderingWindowList;
00354     RenderQueueList d_queues;
00356     RenderingWindowList d_windows;
00358     RenderTarget* d_target;
00360     bool d_invalidated;
00361 };
00362 
00363 } // End of  CEGUI namespace section
00364 
00365 #if defined(_MSC_VER)
00366 #   pragma warning(pop)
00367 #endif
00368 
00369 #endif  // end of guard _CEGUIRenderingSurface_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends