examples/eVolve/frameData.h

00001 
00002 /* Copyright (c) 2006-2008, 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 EVOLVE_FRAMEDATA_H
00019 #define EVOLVE_FRAMEDATA_H
00020 
00021 #include "eVolve.h"
00022 
00023 #include <eq/eq.h>
00024 
00025 namespace eVolve
00026 {
00027     class FrameData : public eq::net::Object
00028     {
00029     public:
00030 
00031         FrameData()
00032             {
00033                 reset();
00034                 EQINFO << "New FrameData " << std::endl;
00035             }
00036 
00037         void reset()
00038             {
00039                 data.translation   = eq::Vector3f::ZERO;
00040                 data.translation.z() = -2.f;
00041                 data.rotation = eq::Matrix4f::IDENTITY;
00042                 data.rotation.rotate_x( static_cast<float>( -M_PI_2 ));
00043                 data.rotation.rotate_y( static_cast<float>( -M_PI_2 ));
00044             }
00045 
00046         struct Data
00047         {
00048             Data() : ortho( false ), statistics( false ) {}
00049 
00050             eq::Matrix4f rotation;
00051             eq::Vector3f translation;
00052             bool           ortho;
00053             bool           statistics;
00054         } data;
00055     
00056     protected:
00057         virtual ChangeType getChangeType() const { return INSTANCE; }
00058 
00059         virtual void getInstanceData( eq::net::DataOStream& os )
00060             { os.writeOnce( &data, sizeof( data )); }
00061 
00062         virtual void applyInstanceData( eq::net::DataIStream& is )
00063             {
00064                 memcpy( &data, is.getRemainingBuffer(), sizeof( data ));
00065                 is.advanceBuffer( sizeof( data ));
00066             }
00067     };
00068 }
00069 
00070 
00071 #endif // EVOLVE_FRAMEDATA_H
00072 
Generated on Mon Aug 10 18:58:33 2009 for Equalizer 0.9 by  doxygen 1.5.8