lib/client/observer.h

00001 
00002 /* Copyright (c) 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_OBSERVER_H
00019 #define EQ_OBSERVER_H
00020 
00021 #include <eq/client/object.h>         // base class
00022 #include <eq/client/types.h>
00023 #include <eq/client/visitorResult.h>  // enum
00024 
00025 #include <string>
00026 
00027 namespace eq
00028 {
00029     class Config;
00030     class ObserverVisitor;
00031 
00038     class Observer : public Object
00039     {
00040     public:
00044         EQ_EXPORT Observer();
00045 
00047         EQ_EXPORT virtual ~Observer();
00048 
00054         EQ_EXPORT void setEyeBase( const float eyeBase );
00055 
00057         float getEyeBase() const { return _eyeBase; }
00058 
00070         EQ_EXPORT void setHeadMatrix( const Matrix4f& matrix );
00071 
00073         const Matrix4f& getHeadMatrix() const { return _headMatrix; }
00075 
00086         EQ_EXPORT VisitorResult accept( ObserverVisitor& visitor );
00087 
00089         EQ_EXPORT virtual void deregister();
00091         
00092     protected:
00094         EQ_EXPORT virtual void serialize( net::DataOStream& os,
00095                                           const uint64_t dirtyBits );
00097         EQ_EXPORT virtual void deserialize( net::DataIStream& is, 
00098                                             const uint64_t dirtyBits );
00099 
00100         enum DirtyBits
00101         {
00102             DIRTY_EYE_BASE   = Object::DIRTY_CUSTOM << 0,
00103             DIRTY_HEAD       = Object::DIRTY_CUSTOM << 1,
00104             DIRTY_FILL1      = Object::DIRTY_CUSTOM << 2,
00105             DIRTY_FILL2      = Object::DIRTY_CUSTOM << 3,
00106             DIRTY_CUSTOM     = Object::DIRTY_CUSTOM << 4
00107         };
00108 
00109     private:
00111         Config* _config;
00112         friend class Config;
00113 
00115         float _eyeBase;
00116 
00118         Matrix4f _headMatrix;
00119 
00120         union // placeholder for binary-compatible changes
00121         {
00122             char dummy[64];
00123         };
00124     };
00125 
00126     EQ_EXPORT std::ostream& operator << ( std::ostream&, const Observer* );
00127 }
00128 #endif // EQ_OBSERVER_H
Generated on Mon Aug 10 18:58:40 2009 for Equalizer 0.9 by  doxygen 1.5.8