diff --git a/neo/renderer/Image.h b/neo/renderer/Image.h index 7b1b95f5..e58b2264 100644 --- a/neo/renderer/Image.h +++ b/neo/renderer/Image.h @@ -642,6 +642,7 @@ byte* R_MipMap( const byte* in, int width, int height ); void R_BlendOverTexture( byte* data, int pixelCount, const byte blend[4] ); void R_HorizontalFlip( byte* data, int width, int height ); void R_VerticalFlip( byte* data, int width, int height ); +void R_VerticalFlipRGB16F( byte* data, int width, int height ); void R_RotatePic( byte* data, int width ); void R_ApplyCubeMapTransforms( int i, byte* data, int size ); diff --git a/neo/renderer/Image_process.cpp b/neo/renderer/Image_process.cpp index c83a871e..b719d747 100644 --- a/neo/renderer/Image_process.cpp +++ b/neo/renderer/Image_process.cpp @@ -528,6 +528,31 @@ void R_VerticalFlip( byte* data, int width, int height ) } } +// RB: halfFloat_t helper +struct ColorRGB16F +{ + uint16 red; + uint16 green; + uint16 blue; +}; + +void R_VerticalFlipRGB16F( byte* data, int width, int height ) +{ + int i, j; + ColorRGB16F temp; + + for( i = 0; i < width; i++ ) + { + for( j = 0; j < height / 2; j++ ) + { + temp = *( ( ColorRGB16F* )data + j * width + i ); + + *( ( ColorRGB16F* )data + j * width + i ) = *( ( ColorRGB16F* )data + ( height - 1 - j ) * width + i ); + *( ( ColorRGB16F* )data + ( height - 1 - j ) * width + i ) = temp; + } + } +} + void R_RotatePic( byte* data, int width ) { int i, j; diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 69f80522..071c9207 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -838,23 +838,7 @@ void R_ReadTiledPixels( int width, int height, byte* buffer, renderView_t* ref = glPixelStorei( GL_PACK_ROW_LENGTH, RADIANCE_CUBEMAP_SIZE ); glReadPixels( 0, 0, w, h, GL_RGB, GL_HALF_FLOAT, buffer ); -#if 0 - // TODO vertical flip with half floats - { - int i, j; - uint64 temp; - - for( i = 0 ; i < width ; i++ ) - { - for( j = 0 ; j < height / 2 ; j++ ) - { - temp = *( ( uint64* )buffer + j * width + i ); - *( ( uint64* )buffer + j * width + i ) = *( ( uint64* )buffer + ( height - 1 - j ) * width + i ); - *( ( uint64* )buffer + ( height - 1 - j ) * width + i ) = temp; - } - } - } -#endif + R_VerticalFlipRGB16F( buffer, w, h ); Framebuffer::Unbind(); }