00001 00002 /* Copyright (c) 2006-2009, 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 #include "frame.h" 00019 00020 #include "frameData.h" 00021 #include "packets.h" 00022 00023 #include <eq/net/dataIStream.h> 00024 #include <eq/net/dataOStream.h> 00025 #include <eq/net/session.h> 00026 00027 using namespace std; 00028 00029 namespace eq 00030 { 00031 00032 Frame::Frame() 00033 : _frameData( 0 ) 00034 { 00035 EQINFO << "New Frame @" << (void*)this << endl; 00036 } 00037 00038 Frame::~Frame() 00039 { 00040 if( _frameData ) 00041 EQINFO << "FrameData attached to frame during deletion" << endl; 00042 } 00043 00044 void Frame::getInstanceData( net::DataOStream& os ) 00045 { 00046 EQUNREACHABLE; 00047 os << _data; 00048 } 00049 00050 void Frame::applyInstanceData( net::DataIStream& is ) 00051 { 00052 is >> _data; 00053 } 00054 00055 const std::string& Frame::getName() const 00056 { 00057 return _name; 00058 } 00059 00060 uint32_t Frame::getBuffers() const 00061 { 00062 EQASSERT( _frameData ); 00063 return _frameData->getBuffers(); 00064 } 00065 00066 const Pixel& Frame::getPixel() const 00067 { 00068 EQASSERT( _frameData ); 00069 return _frameData->getPixel(); 00070 } 00071 00072 const Range& Frame::getRange() const 00073 { 00074 EQASSERT( _frameData ); 00075 return _frameData->getRange(); 00076 } 00077 00078 void Frame::setRange( const Range& range ) 00079 { 00080 EQASSERT( _frameData ); 00081 _frameData->setRange( range ); 00082 } 00083 00084 const ImageVector& Frame::getImages() const 00085 { 00086 EQASSERT( _frameData ); 00087 return _frameData->getImages(); 00088 } 00089 00090 void Frame::setPixelViewport( const PixelViewport& pvp ) 00091 { 00092 EQASSERT( _frameData ); 00093 _frameData->setPixelViewport( pvp ); 00094 } 00095 00096 void Frame::clear() 00097 { 00098 EQASSERT( _frameData ); 00099 _frameData->clear(); 00100 } 00101 00102 void Frame::flush() 00103 { 00104 if( _frameData ) 00105 _frameData->flush(); 00106 } 00107 00108 void Frame::setColorType( const GLuint colorType ) 00109 { 00110 if( _frameData ) 00111 _frameData->setColorType( colorType ); 00112 } 00113 00114 void Frame::setAlphaUsage( const bool useAlpha ) 00115 { 00116 if( _frameData ) 00117 _frameData->setAlphaUsage( useAlpha ); 00118 } 00119 00120 void Frame::startReadback( Window::ObjectManager* glObjects ) 00121 { 00122 EQASSERT( _frameData ); 00123 _frameData->startReadback( *this, glObjects ); 00124 } 00125 00126 void Frame::syncReadback() 00127 { 00128 EQASSERT( _frameData ); 00129 _frameData->syncReadback(); 00130 } 00131 00132 void Frame::transmit( net::NodePtr toNode, const uint32_t frameNumber ) 00133 { 00134 EQASSERT( _frameData ); 00135 _frameData->transmit( toNode, frameNumber ); 00136 } 00137 00138 void Frame::setReady() 00139 { 00140 EQASSERT( _frameData ); 00141 _frameData->setReady(); 00142 } 00143 00144 bool Frame::isReady() const 00145 { 00146 EQASSERT( _frameData ); 00147 return _frameData->isReady(); 00148 } 00149 00150 void Frame::waitReady() const 00151 { 00152 EQASSERT( _frameData ); 00153 _frameData->waitReady(); 00154 } 00155 00156 void Frame::disableBuffer( const Buffer buffer ) 00157 { 00158 EQASSERT( _frameData ); 00159 _frameData->disableBuffer( buffer ); 00160 } 00161 00162 void Frame::useSendToken( const bool use ) 00163 { 00164 EQASSERT( _frameData ); 00165 _frameData->useSendToken( use ); 00166 } 00167 00168 00169 void Frame::addListener( base::Monitor<uint32_t>& listener ) 00170 { 00171 EQASSERT( _frameData ); 00172 _frameData->addListener( listener ); 00173 } 00174 00175 void Frame::removeListener( base::Monitor<uint32_t>& listener ) 00176 { 00177 EQASSERT( _frameData ); 00178 _frameData->removeListener( listener ); 00179 } 00180 00181 EQ_EXPORT std::ostream& operator << ( std::ostream& os, 00182 const Frame::Type type ) 00183 { 00184 os << "type "; 00185 if ( type == eq::Frame::TYPE_TEXTURE ) 00186 os << " texture" << endl; 00187 else if ( type == eq::Frame::TYPE_MEMORY ) 00188 os << " memory" << endl; 00189 00190 return os; 00191 } 00192 00193 EQ_EXPORT std::ostream& operator << ( std::ostream& os, 00194 const Frame::Buffer buffer ) 00195 { 00196 if( buffer == Frame::BUFFER_NONE ) 00197 os << "none "; 00198 else if( buffer & Frame::BUFFER_UNDEFINED ) 00199 os << "undefined "; 00200 else 00201 { 00202 if( buffer & Frame::BUFFER_COLOR ) 00203 os << "color "; 00204 if( buffer & Frame::BUFFER_DEPTH ) 00205 os << "depth "; 00206 } 00207 00208 return os; 00209 } 00210 00211 }
0.9 by
1.5.8