Equalizer  1.4.1
share/Equalizer/examples/eqPly/frameData.h
00001 
00002 /* Copyright (c) 2006-2010, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *
00007  * - Redistributions of source code must retain the above copyright notice, this
00008  *   list of conditions and the following disclaimer.
00009  * - Redistributions in binary form must reproduce the above copyright notice,
00010  *   this list of conditions and the following disclaimer in the documentation
00011  *   and/or other materials provided with the distribution.
00012  * - Neither the name of Eyescale Software GmbH nor the names of its
00013  *   contributors may be used to endorse or promote products derived from this
00014  *   software without specific prior written permission.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00020  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00021  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00022  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00023  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00025  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00026  * POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 #ifndef EQ_PLY_FRAMEDATA_H
00030 #define EQ_PLY_FRAMEDATA_H
00031 
00032 #include "eqPly.h"
00033 
00034 namespace eqPly
00035 {
00044     class FrameData : public co::Serializable
00045     {
00046     public:
00047         FrameData();
00048 
00049         virtual ~FrameData() {};
00050 
00051         void reset();
00052         
00054         //*{
00055         void setModelID( const eq::uint128_t& id );
00056 
00057         void setColorMode( const ColorMode color );
00058         void setRenderMode( const mesh::RenderMode mode );
00059         void setIdle( const bool idleMode );
00060 
00061         void toggleOrtho();
00062         void toggleStatistics();
00063         void toggleHelp();
00064         void toggleWireframe();
00065         void toggleColorMode();
00066         void adjustQuality( const float delta );
00067         void togglePilotMode();
00068         void toggleRenderMode();
00069         void toggleCompression();
00070 
00071         eq::uint128_t getModelID() const { return _modelID; }
00072         ColorMode getColorMode() const { return _colorMode; }
00073         float getQuality() const { return _quality; }
00074         bool useOrtho() const { return _ortho; }
00075         bool useStatistics() const { return _statistics; }
00076         bool showHelp() const { return _help; }
00077         bool useWireframe() const { return _wireframe; }
00078         bool usePilotMode() const { return _pilotMode; }
00079         bool isIdle() const { return _idle; }
00080         mesh::RenderMode getRenderMode() const { return _renderMode; }
00081         bool useCompression() const { return _compression; }
00082         //*}
00083 
00085         //*{
00086         void setCameraPosition( const eq::Vector3f& position );
00087         void setRotation( const eq::Vector3f& rotation);
00088         void setModelRotation( const eq::Vector3f& rotation    );
00089         void spinCamera( const float x, const float y );
00090         void spinModel(  const float x, const float y, const float z );
00091         void moveCamera( const float x, const float y, const float z );
00092 
00093         const eq::Matrix4f& getCameraRotation() const
00094             { return _rotation; }
00095         const eq::Matrix4f& getModelRotation() const
00096             { return _modelRotation; }
00097         const eq::Vector3f& getCameraPosition() const
00098             { return _position; }
00099         //*}
00100 
00102         //*{
00103         void setCurrentViewID( const eq::uint128_t& id );
00104         eq::uint128_t getCurrentViewID() const { return _currentViewID; }
00105         //*}
00106 
00108         //*{
00109         void setMessage( const std::string& message );
00110         const std::string& getMessage() const { return _message; }
00111         //*}
00112 
00113     protected:
00115         virtual void serialize( co::DataOStream& os,
00116                                 const uint64_t dirtyBits );
00118         virtual void deserialize( co::DataIStream& is,
00119                                   const uint64_t dirtyBits );
00120 
00121         virtual ChangeType getChangeType() const { return DELTA; }
00122 
00124         enum DirtyBits
00125         {
00126             DIRTY_CAMERA  = co::Serializable::DIRTY_CUSTOM << 0,
00127             DIRTY_FLAGS   = co::Serializable::DIRTY_CUSTOM << 1,
00128             DIRTY_VIEW    = co::Serializable::DIRTY_CUSTOM << 2,
00129             DIRTY_MESSAGE = co::Serializable::DIRTY_CUSTOM << 3,
00130         };
00131 
00132     private:
00133         eq::Matrix4f _rotation;
00134         eq::Matrix4f _modelRotation;
00135         eq::Vector3f _position;
00136         
00137         eq::uint128_t _modelID;
00138         mesh::RenderMode _renderMode;
00139         ColorMode        _colorMode;
00140         float            _quality;
00141         bool             _ortho;
00142         bool             _statistics;
00143         bool             _help;
00144         bool             _wireframe;
00145         bool             _pilotMode;
00146         bool             _idle;
00147         bool             _compression;
00148 
00149         eq::uint128_t _currentViewID;
00150         std::string _message;
00151     };
00152 }
00153 
00154 
00155 #endif // EQ_PLY_FRAMEDATA_H
00156 
Generated on Mon Nov 26 2012 14:41:48 for Equalizer 1.4.1 by  doxygen 1.7.6.1