Permalink
Browse files

added dxtc support in Image::getColor, enhanced Image::isImageTranslu…

…cent to test opacity of dxt3 and dxt5 images
  • Loading branch information...
LaurensVoerman committed Oct 12, 2017
1 parent adb6ae8 commit 63f12986b476562a06fa675732b2b015c01dd0a0
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 63f1298

Please sign in to comment.