server/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 EQSERVER_OBSERVER_H
00019 #define EQSERVER_OBSERVER_H
00020 
00021 #include "types.h"
00022 #include "observerVisitor.h"    // used in inline method
00023 
00024 #include <eq/client/eye.h>      // enum
00025 #include <eq/client/observer.h> // base class
00026 #include <string>
00027 
00028 namespace eq
00029 {
00030 namespace server
00031 {
00032     struct ObserverPath;
00033 
00037     class Observer : public eq::Observer
00038     {
00039     public:
00043         Observer();
00044 
00046         Observer( const Observer& from, Config* config );
00047 
00049         virtual ~Observer();
00050 
00056         ObserverPath getPath() const;
00057 
00059         const Vector3f& getEyePosition( const eq::Eye eye ) const
00060             { return _eyes[ eye ]; }
00061 
00063         const Matrix4f& getInverseHeadMatrix() const
00064             { return _inverseHeadMatrix; }
00065 
00067         Config* getConfig() { return _config; }
00069 
00075         void init();
00076 
00083         VisitorResult accept( ObserverVisitor& visitor )
00084             { return visitor.visit( this ); }
00085         VisitorResult accept( ConstObserverVisitor& visitor ) const
00086             { return visitor.visit( this ); }
00087 
00089         void unmap();
00091         
00092     protected:
00094         virtual void deserialize( net::DataIStream& is, 
00095                                   const uint64_t dirtyBits );
00096 
00097     private:
00098         virtual void getInstanceData( net::DataOStream& os );
00099 
00101         Config* _config;
00102         friend class Config;
00103 
00105         Matrix4f _inverseHeadMatrix;
00106 
00108         Vector3f _eyes[eq::EYE_ALL];
00109 
00110         union // placeholder for binary-compatible changes
00111         {
00112             char dummy[64];
00113         };
00114 
00115         void _updateEyes();
00116     };
00117 }
00118 }
00119 #endif // EQSERVER_OBSERVER_H
Generated on Mon Aug 10 18:58:40 2009 for Equalizer 0.9 by  doxygen 1.5.8