00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef EQ_COMPOSITOR_H
00019 #define EQ_COMPOSITOR_H
00020
00021 #include <eq/client/frame.h>
00022 #include <eq/client/pixel.h>
00023 #include <eq/client/types.h>
00024 #include <eq/base/base.h>
00025
00026 #include <vector>
00027
00028 namespace eq
00029 {
00030 class Channel;
00031 class Image;
00032
00034 class EQ_EXPORT Compositor
00035 {
00036 public:
00038 struct ImageOp
00039 {
00040 ImageOp() : channel( 0 ), buffers( 0 )
00041 , offset( Vector2i::ZERO ) {}
00042
00043 Channel* channel;
00044 uint32_t buffers;
00045 Vector2i offset;
00046 Pixel pixel;
00047 Zoom zoom;
00048 };
00049
00059 static void assembleFrames( const FrameVector& frames,
00060 Channel* channel );
00061
00073 static void assembleFramesSorted( const FrameVector& frames,
00074 Channel* channel,
00075 const bool blendAlpha = false );
00076
00084 static void assembleFramesUnsorted( const FrameVector& frames,
00085 Channel* channel );
00086
00103 static void assembleFramesCPU( const FrameVector& frames,
00104 Channel* channel,
00105 const bool blendAlpha = false );
00106
00108 static const Image* mergeFramesCPU( const FrameVector& frames,
00109 const bool blendAlpha = false );
00110
00126 static bool mergeFramesCPU( const FrameVector& frames,
00127 const bool blendAlpha,
00128 void* colorBuffer,
00129 const uint32_t colorBufferSize,
00130 void* depthBuffer,
00131 const uint32_t depthBufferSize,
00132 PixelViewport& outPVP );
00133
00135 static void assembleFrame( const Frame* frame, Channel* channel );
00137
00138
00147 static void assembleImage( const Image* image,
00148 const ImageOp& operation );
00149
00156 static void setupStencilBuffer( const Image* image,
00157 const ImageOp& operation );
00158
00160 static void assembleImage2D( const Image* image, const ImageOp& op );
00162 static void assembleImageDB( const Image* image, const ImageOp& op );
00163
00168 static void assembleImageDB_FF( const Image* image, const ImageOp& op );
00169
00174 static void assembleImageDB_GLSL( const Image* image,
00175 const ImageOp& op );
00177
00178 private:
00179 typedef std::pair< const Frame*, const Image* > FrameImage;
00180
00181 static bool _collectOutputData( const FrameVector& frames,
00182 PixelViewport& destPVP,
00183 uint32_t& colorFormat,
00184 uint32_t& colorType,
00185 uint32_t& depthFormat,
00186 uint32_t& depthType );
00187
00188 static void _mergeFrames( const FrameVector& frames,
00189 const bool blendAlpha,
00190 void* colorBuffer, void* depthBuffer,
00191 const PixelViewport& destPVP );
00192
00193 static void _mergeDBImage( void* destColor, void* destDepth,
00194 const PixelViewport& destPVP,
00195 const Image* image,
00196 const Vector2i& offset );
00197
00198 static void _merge2DImage( void* destColor, void* destDepth,
00199 const PixelViewport& destPVP,
00200 const Image* input,
00201 const Vector2i& offset );
00202
00203 static void _mergeBlendImage( void* dest,
00204 const PixelViewport& destPVP,
00205 const Image* input,
00206 const Vector2i& offset );
00207 static bool _mergeImage_PC( int operation, void* destColor,
00208 void* destDepth, const Image* source );
00212 static void _drawPixels( const Image* image, const ImageOp& op,
00213 const Frame::Buffer which );
00214
00215 };
00216 }
00217
00218 #endif // EQ_COMPOSITOR_H
00219