Permalink
Browse files

Merge pull request #363 from LaurensVoerman/dxtcGetcolor

added dxtc support in Image::getColor, Image::isImageTranscent testdxt3 and dxt5
  • Loading branch information...
openscenegraph committed Oct 12, 2017
2 parents adb6ae8 + 63f1298 commit 4d67c803502cb5eca1b7e04c30a14f7162f78b52
Showing with 462 additions and 17 deletions.
  1. +7 −1 src/osg/Image.cpp
  2. +438 −9 src/osg/dxtctool.cpp
  3. +17 −7 src/osg/dxtctool.h
View
@@ -1719,7 +1719,7 @@ bool Image::isImageTranslucent() const
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
return dxtc_tool::CompressedImageTranslucent(_s, _t, _pixelFormat, _data);
return dxtc_tool::isCompressedImageTranslucent(_s, _t, _pixelFormat, _data);
default:
return false;
}
@@ -1919,6 +1919,12 @@ Vec4 _readColor(GLenum pixelFormat, T* data,float scale)
Vec4 Image::getColor(unsigned int s,unsigned t,unsigned r) const
{
if (dxtc_tool::isDXTC(_pixelFormat)) {
unsigned char color[4];
if (dxtc_tool::CompressedImageGetColor(color, s, t, r, _s, _t, _r, _pixelFormat, _data)) {
return Vec4(((float)color[0]) / 255.0f, ((float)color[1]) / 255.0f, ((float)color[2]) / 255.0f, ((float)color[3]) / 255.0f );
}
}
const unsigned char* ptr = data(s,t,r);
switch(_dataType)
Oops, something went wrong.

0 comments on commit 4d67c80

Please sign in to comment.