Equalizer 1.0

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 eq::fabric::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 
00070         eq::uint128_t getModelID() const { return _modelID; }
00071         ColorMode getColorMode() const { return _colorMode; }
00072         float getQuality() const { return _quality; }
00073         bool useOrtho() const { return _ortho; }
00074         bool useStatistics() const { return _statistics; }
00075         bool showHelp() const { return _help; }
00076         bool useWireframe() const { return _wireframe; }
00077         bool usePilotMode() const { return _pilotMode; }
00078         bool isIdle() const { return _idle; }
00079         mesh::RenderMode getRenderMode() const { return _renderMode; }
00080         //*}
00081 
00083         //*{
00084         void setCameraPosition( const eq::Vector3f& position );
00085         void setRotation( const eq::Vector3f& rotation);
00086         void setModelRotation( const eq::Vector3f& rotation    );
00087         void spinCamera( const float x, const float y );
00088         void spinModel(  const float x, const float y );
00089         void spinModel(  const float x, const float y, const float z );
00090         void moveCamera( const float x, const float y, const float z );
00091 
00092         const eq::Matrix4f& getCameraRotation() const
00093             { return _rotation; }
00094         const eq::Matrix4f& getModelRotation() const
00095             { return _modelRotation; }
00096         const eq::Vector3f& getCameraPosition() const
00097             { return _position; }
00098         //*}
00099 
00101         //*{
00102         void setCurrentViewID( const eq::uint128_t& id );
00103         eq::uint128_t getCurrentViewID() const { return _currentViewID; }
00104         //*}
00105 
00107         //*{
00108         void setMessage( const std::string& message );
00109         const std::string& getMessage() const { return _message; }
00110         //*}
00111 
00112     protected:
00114         virtual void serialize( co::DataOStream& os,
00115                                 const uint64_t dirtyBits );
00117         virtual void deserialize( co::DataIStream& is,
00118                                   const uint64_t dirtyBits );
00119 
00120         virtual ChangeType getChangeType() const { return DELTA; }
00121 
00123         enum DirtyBits
00124         {
00125             DIRTY_CAMERA  = eq::fabric::Serializable::DIRTY_CUSTOM << 0,
00126             DIRTY_FLAGS   = eq::fabric::Serializable::DIRTY_CUSTOM << 1,
00127             DIRTY_VIEW    = eq::fabric::Serializable::DIRTY_CUSTOM << 2,
00128             DIRTY_MESSAGE = eq::fabric::Serializable::DIRTY_CUSTOM << 3,
00129         };
00130 
00131     private:
00132         eq::Matrix4f _rotation;
00133         eq::Matrix4f _modelRotation;
00134         eq::Vector3f _position;
00135         
00136         eq::uint128_t _modelID;
00137         mesh::RenderMode _renderMode;
00138         ColorMode        _colorMode;
00139         float            _quality;
00140         bool             _ortho;
00141         bool             _statistics;
00142         bool             _help;
00143         bool             _wireframe;
00144         bool             _pilotMode;
00145         bool             _idle;
00146 
00147         eq::uint128_t _currentViewID;
00148         std::string _message;
00149     };
00150 }
00151 
00152 
00153 #endif // EQ_PLY_FRAMEDATA_H
00154 
Generated on Sun May 8 2011 19:11:05 for Equalizer 1.0 by  doxygen 1.7.3