Equalizer 1.0
|
00001 00002 /* 00003 * Copyright (c) 00004 * 2008-2009, Thomas McGuire <thomas.mcguire@student.uni-siegen.de> 00005 * 2010, Stefan Eilemann <eile@eyescale.ch> 00006 * 2010, Sarah Amsellem <sarah.amsellem@gmail.com> 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, this 00012 * list of conditions and the following disclaimer. 00013 * - Redistributions in binary form must reproduce the above copyright notice, 00014 * this list of conditions and the following disclaimer in the documentation 00015 * and/or other materials provided with the distribution. 00016 * - Neither the name of Eyescale Software GmbH nor the names of its 00017 * contributors may be used to endorse or promote products derived from this 00018 * software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 #include "frameData.h" 00034 00035 namespace osgScaleViewer 00036 { 00037 00038 FrameData::FrameData() 00039 : _cameraPosition( eq::Vector3f( 0.f, 0.f, 10.f )) 00040 , _cameraLookAtPoint( eq::Vector3f::ZERO ) 00041 , _cameraUpVector( eq::Vector3f::ZERO ) 00042 , _statistics( false ) 00043 {} 00044 00045 void FrameData::serialize( co::DataOStream& os, const uint64_t dirtyBits ) 00046 { 00047 eq::fabric::Serializable::serialize( os, dirtyBits ); 00048 if( dirtyBits & DIRTY_CAMERA ) 00049 os << _cameraPosition << _cameraLookAtPoint << _cameraUpVector; 00050 if( dirtyBits & DIRTY_FLAGS ) 00051 os << _statistics; 00052 } 00053 00054 void FrameData::deserialize( co::DataIStream& is, 00055 const uint64_t dirtyBits ) 00056 { 00057 eq::fabric::Serializable::deserialize( is, dirtyBits ); 00058 if( dirtyBits & DIRTY_CAMERA ) 00059 is >> _cameraPosition >> _cameraLookAtPoint >> _cameraUpVector; 00060 if( dirtyBits & DIRTY_FLAGS ) 00061 is >> _statistics; 00062 } 00063 00064 void FrameData::setCameraPosition( eq::Vector3f cameraPosition ) 00065 { 00066 _cameraPosition = cameraPosition; 00067 setDirty( DIRTY_CAMERA ); 00068 } 00069 00070 void FrameData::setCameraLookAtPoint( eq::Vector3f cameraLookAtPoint ) 00071 { 00072 _cameraLookAtPoint = cameraLookAtPoint; 00073 setDirty( DIRTY_CAMERA ); 00074 } 00075 00076 void FrameData::setCameraUpVector( eq::Vector3f cameraUpVector ) 00077 { 00078 _cameraUpVector = cameraUpVector; 00079 setDirty( DIRTY_CAMERA ); 00080 } 00081 00082 void FrameData::toggleStatistics() 00083 { 00084 _statistics = !_statistics; 00085 setDirty( DIRTY_FLAGS ); 00086 } 00087 00088 co::Object::ChangeType FrameData::getChangeType() const 00089 { 00090 return DELTA; 00091 } 00092 }