lib/client/view.h

00001 
00002 /* Copyright (c) 2008-2009, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQ_VIEW_H
00019 #define EQ_VIEW_H
00020 
00021 #include <eq/client/frustum.h>        // base class
00022 #include <eq/client/viewport.h>       // member
00023 #include <eq/client/visitorResult.h>  // enum
00024 #include <eq/client/types.h>          // member
00025 
00026 namespace eq
00027 {
00028 namespace server
00029 {
00030     class View;
00031 }
00032     class Config;
00033     class Layout;
00034     class Observer;
00035     class Pipe;
00036     class ViewVisitor;
00037     struct Event;
00038 
00045     class View : public Frustum
00046     {
00047     public:
00048         EQ_EXPORT View();
00049         EQ_EXPORT virtual ~View();
00050 
00054         EQ_EXPORT const Viewport& getViewport() const;
00055 
00057         EQ_EXPORT Config* getConfig();
00058 
00060         EQ_EXPORT const Config* getConfig() const;
00061 
00063         EQ_EXPORT Layout* getLayout() { return _layout; }
00064 
00066         EQ_EXPORT const Layout* getLayout() const { return _layout; }
00067 
00069         Observer* getObserver() { return _observer; }
00070         const Observer* getObserver() const { return _observer; }
00071 
00073         EQ_EXPORT void setOverdraw( const Vector2i& pixels );
00074         const Vector2i& getOverdraw() const { return _overdraw; }
00076 
00085         EQ_EXPORT VisitorResult accept( ViewVisitor& visitor );
00086 
00097         EQ_EXPORT virtual bool handleEvent( const Event& event );
00099 
00100     protected:
00102         EQ_EXPORT virtual void serialize( net::DataOStream& os,
00103                                           const uint64_t dirtyBits );
00104 
00106         EQ_EXPORT virtual void deserialize( net::DataIStream& is, 
00107                                             const uint64_t dirtyBits );
00108 
00109         enum DirtyBits
00110         {
00111             DIRTY_VIEWPORT   = Frustum::DIRTY_CUSTOM << 0,
00112             DIRTY_OBSERVER   = Frustum::DIRTY_CUSTOM << 1,
00113             DIRTY_OVERDRAW   = Frustum::DIRTY_CUSTOM << 2,
00114             DIRTY_FILL1      = Frustum::DIRTY_CUSTOM << 3,
00115             DIRTY_FILL2      = Frustum::DIRTY_CUSTOM << 4,
00116             DIRTY_CUSTOM     = Frustum::DIRTY_CUSTOM << 5,
00117         };
00118 
00120         const Frustum& getBaseFrustum() const { return _baseFrustum; }
00121 
00122         virtual ChangeType getChangeType() const { return DELTA; }
00123 
00124     private:
00126         Layout* _layout;
00127         friend class Layout;
00128 
00130         Pipe* _pipe;
00131         friend class Pipe;
00132 
00133         friend class server::View;
00134         Viewport    _viewport;
00135 
00137         Observer* _observer;
00138 
00140         Frustum _baseFrustum;
00141 
00143         Vector2i _overdraw;
00144 
00145         union // placeholder for binary-compatible changes
00146         {
00147             char dummy[64];
00148         };
00149     };
00150 
00151     EQ_EXPORT std::ostream& operator << ( std::ostream& os, const View& view );
00152 }
00153 
00154 #endif //EQ_VIEW_H
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8