30 #include "frameData.h"
33 # define M_PI_2 1.57079632679489661923
39 FrameData::FrameData()
44 , _statistics( false )
49 LBINFO <<
"New FrameData " << std::endl;
52 void FrameData::reset()
54 _translation = eq::Vector3f::ZERO;
55 _translation.z() = -2.f;
56 _rotation = eq::Matrix4f::IDENTITY;
57 _rotation.rotate_x( static_cast<float>( -M_PI_2 ));
58 _rotation.rotate_y( static_cast<float>( -M_PI_2 ));
60 setDirty( DIRTY_CAMERA );
63 void FrameData::toggleBackground()
65 _bgMode =
static_cast< BackgroundMode >(( _bgMode + 1 ) % BG_ALL );
66 setDirty( DIRTY_FLAGS );
69 void FrameData::toggleNormalsQuality()
73 setDirty( DIRTY_FLAGS );
77 void FrameData::toggleColorMode()
79 _colorMode =
static_cast< ColorMode >(( _colorMode + 1 ) % COLOR_ALL );
80 setDirty( DIRTY_FLAGS );
83 void FrameData::toggleOrtho( )
86 setDirty( DIRTY_FLAGS );
89 void FrameData::setOrtho(
const bool ortho )
92 setDirty( DIRTY_FLAGS );
95 void FrameData::toggleStatistics()
97 _statistics = !_statistics;
98 setDirty( DIRTY_FLAGS );
101 void FrameData::toggleHelp()
104 setDirty( DIRTY_FLAGS );
107 void FrameData::spinCamera(
const float x,
const float y )
109 _rotation.pre_rotate_x( x );
110 _rotation.pre_rotate_y( y );
112 setDirty( DIRTY_CAMERA );
115 void FrameData::moveCamera(
const float x,
const float y,
const float z )
117 _translation.x() += x;
118 _translation.y() += y;
119 _translation.z() += z;
121 setDirty( DIRTY_CAMERA );
124 void FrameData::setTranslation(
const eq::Vector3f& translation )
126 _translation = translation;
127 setDirty( DIRTY_CAMERA );
130 void FrameData::setRotation(
const eq::Vector3f& rotation )
132 _rotation = eq::Matrix4f::IDENTITY;
133 _rotation.rotate_x( rotation.x() );
134 _rotation.rotate_y( rotation.y() );
135 _rotation.rotate_z( rotation.z() );
136 setDirty( DIRTY_CAMERA );
139 void FrameData::setCurrentViewID(
const eq::uint128_t&
id )
142 setDirty( DIRTY_VIEW );
145 void FrameData::adjustQuality(
const float delta )
148 _quality = LB_MAX( _quality, 0.1f );
149 _quality = LB_MIN( _quality, 1.0f );
150 setDirty( DIRTY_FLAGS );
151 LBINFO <<
"Set non-idle image quality to " << _quality << std::endl;
156 co::Serializable::serialize( os, dirtyBits );
157 if( dirtyBits & DIRTY_VIEW )
158 os << _currentViewID;
160 if( dirtyBits & DIRTY_CAMERA )
161 os << _rotation << _translation;
163 if( dirtyBits & DIRTY_FLAGS )
164 os << _ortho << _colorMode << _bgMode << _normalsQuality
165 << _statistics << _quality << _help;
167 if( dirtyBits & DIRTY_MESSAGE )
173 co::Serializable::deserialize( is, dirtyBits );
174 if( dirtyBits & DIRTY_VIEW )
175 is >> _currentViewID;
177 if( dirtyBits & DIRTY_CAMERA )
178 is >> _rotation >> _translation;
180 if( dirtyBits & DIRTY_FLAGS )
181 is >> _ortho >> _colorMode >> _bgMode >> _normalsQuality
182 >> _statistics >> _quality >> _help;
184 if( dirtyBits & DIRTY_MESSAGE )
188 void FrameData::setMessage(
const std::string& message )
190 if( _message == message )
194 setDirty( DIRTY_MESSAGE );
virtual void serialize(co::DataOStream &os, const uint64_t dirtyBits)
Render using the colors defined in the ply file.
virtual void deserialize(co::DataIStream &is, const uint64_t dirtyBits)