A colorisable texture. More...
#include <hls_color_texture.h>
Classes | |
| struct | CMask |
| struct | CVectorInt |
Public Member Functions | |
| CHLSColorTexture () | |
| void | reset () |
| reset the build | |
| void | setBitmap (const NLMISC::CBitmap &bmp) |
| setup the un-colored bitmap for the texture. | |
| void | addMask (const NLMISC::CBitmap &bmp, uint threshold=15) |
| add a mask to the texture. | |
| uint | getNumMasks () const |
| get num of masks | |
| void | buildColorVersion (const CHLSColorDelta *colDeltaList, NLMISC::CBitmap &out) |
| build a texture with a HLS Color Delta | |
| void | serial (NLMISC::IStream &f) |
Static Public Member Functions | |
| static void | compressBlockRGB (CRGBA *srcRGBA, uint8 *dstDXTC) |
| compress DXTC5 RGB only block, from a RGBA raw array. dstDXTC Alpha part is not modified. srcRGBA->A are setup to 0!! | |
Static Private Member Functions | |
| static void | uncompressBlockRGB (const uint8 *srcDXTC, CRGBA *dstRGBA) |
| uncompress DXTC5 RGB only block, into a RGBA raw array. Alpha is setup with undefined values | |
| static void | computeMinMax (sint *diffBlock, CVectorInt &v, sint mean[3], sint rgb0[3], sint rgb1[3]) |
| used by compressBlockRGB() | |
| static void | colorizeDXTCBlockRGB (const uint8 *srcPtr, uint8 *dstPtr, uint8 dHue, uint dLum, uint dSat) |
| apply colDelta to the block. Alpha part is not modified. MMX with no EMMS called here !!! | |
Private Attributes | |
| uint32 | _Width |
| uint32 | _Height |
| uint32 | _NumMipMap |
| uint32 | _BlockToCompressIndex |
| std::vector< uint8 > | _Texture |
| std::vector< CMask > | _Masks |
A colorisable texture.
Definition at line 68 of file hls_color_texture.h.
| NL3D::CHLSColorTexture::CHLSColorTexture | ( | ) |
Definition at line 74 of file hls_color_texture.cpp.
References reset().
| void NL3D::CHLSColorTexture::addMask | ( | const NLMISC::CBitmap & | bmp, | |
| uint | threshold = 15 | |||
| ) |
add a mask to the texture.
R is taken as the mask value. must be same size as in setBitmap()
| threshold | used to know if a pixel mask value is or not an intermediate (ie not 0 or 255) |
Definition at line 150 of file hls_color_texture.cpp.
References _BlockToCompressIndex, _Height, _Masks, _NumMipMap, _Texture, _Width, BLOCK_ALPHA_SIZE, NL3D::CMaskInfo::Blocks, NLMISC::CBitmap::buildMipMaps(), NLMISC::CBitmap::convertToType(), NL3D::CHLSColorTexture::CMask::Data, NL3D::CHLSColorTexture::CMask::FullBlockIndex, NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getMipMapCount(), NLMISC::CBitmap::getPixels(), NLMISC::CBitmap::getWidth(), NL3D::CMaskInfo::HBlock, MASK_BLOCK_EMPTY, MASK_BLOCK_FULL, MASK_BLOCK_MIXT, min, NL3D::CHLSColorTexture::CMask::MixtBlockIndex, nlassert, NL3D::CMaskInfo::NumBlock, NLMISC::CRGBA::R, NLMISC::CBitmap::RGBA, NL3D::CHLSColorTexture::CMask::setBit(), and NL3D::CMaskInfo::WBlock.
| void NL3D::CHLSColorTexture::buildColorVersion | ( | const CHLSColorDelta * | colDeltaList, | |
| NLMISC::CBitmap & | out | |||
| ) |
build a texture with a HLS Color Delta
| colDelta | array of delta to apply to the bitmap (must be of numMasks entries) | |
| out | a colorised bitmap with DXTC5/mipMaps generated |
Definition at line 335 of file hls_color_texture.cpp.
References _BlockToCompressIndex, _Height, _Masks, _NumMipMap, _Texture, _Width, NLMISC::CRGBA::blendFromuiRGBOnly(), BLOCK_DXTC_SIZE, BLOCK_NUM_PIXEL, colorizeDXTCBlockRGB(), compressBlockRGB(), NL3D::CHLSColorTexture::CMask::Data, NL3D::CHLSColorDelta::DHue, NL3D::CHLSColorDelta::DLum, NL3D::CHLSColorDelta::DSat, NLMISC::CBitmap::DXTC5, NL3D::CHLSColorTexture::CMask::FullBlockIndex, NL3D::getBitPack(), NLMISC::CBitmap::getPixels(), NLMISC::CSystemInfo::hasMMX(), min, NL3D::CHLSColorTexture::CMask::MixtBlockIndex, NLMISC::n, nlassert, NLMISC::CBitmap::reset(), NLMISC::CBitmap::resize(), NLMISC::CBitmap::resizeMipMap(), NLMISC::CBitmap::setMipMapCount(), NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), and uncompressBlockRGB().
Referenced by NL3D::CHLSTextureBank::CTextureInstance::buildColorVersion().
| void NL3D::CHLSColorTexture::colorizeDXTCBlockRGB | ( | const uint8 * | srcPtr, | |
| uint8 * | dstPtr, | |||
| uint8 | dHue, | |||
| uint | dLum, | |||
| uint | dSat | |||
| ) | [static, private] |
apply colDelta to the block. Alpha part is not modified. MMX with no EMMS called here !!!
Definition at line 543 of file hls_color_texture.cpp.
References NL3D::CFastHLSModifier::applyHLSMod(), and NL3D::CFastHLSModifier::getInstance().
Referenced by buildColorVersion().
compress DXTC5 RGB only block, from a RGBA raw array. dstDXTC Alpha part is not modified. srcRGBA->A are setup to 0!!
Definition at line 626 of file hls_color_texture.cpp.
References NLMISC::CRGBA::A, NL3D::add(), NLMISC::CRGBA::B, NLMISC::CRGBA::blendFromui(), computeMinMax(), G, NLMISC::CRGBA::G, NLMISC::CSystemInfo::hasMMX(), NLMISC::n, NLMISC::CVector::normalize(), NLMISC::OptFastFloor(), NLMISC::CRGBA::R, NLMISC::CRGBA::set565(), NLMISC::sqr(), NL3D::CHLSColorTexture::CVectorInt::x, NLMISC::CVector::x, NL3D::CHLSColorTexture::CVectorInt::y, NLMISC::CVector::y, NL3D::CHLSColorTexture::CVectorInt::z, and NLMISC::CVector::z.
Referenced by buildColorVersion().
| void NL3D::CHLSColorTexture::computeMinMax | ( | sint * | diffBlock, | |
| CVectorInt & | v, | |||
| sint | mean[3], | |||
| sint | rgb0[3], | |||
| sint | rgb1[3] | |||
| ) | [static, private] |
used by compressBlockRGB()
Definition at line 584 of file hls_color_texture.cpp.
References NLMISC::fastClamp8(), G, NLMISC::n, NL3D::CHLSColorTexture::CVectorInt::x, NL3D::CHLSColorTexture::CVectorInt::y, and NL3D::CHLSColorTexture::CVectorInt::z.
Referenced by compressBlockRGB().
| uint NL3D::CHLSColorTexture::getNumMasks | ( | ) | const [inline] |
| void NL3D::CHLSColorTexture::reset | ( | ) |
reset the build
Definition at line 80 of file hls_color_texture.cpp.
References _Height, _Masks, _NumMipMap, _Texture, _Width, and NLMISC::contReset().
Referenced by CHLSColorTexture(), and setBitmap().
| void NL3D::CHLSColorTexture::serial | ( | NLMISC::IStream & | f | ) |
Definition at line 311 of file hls_color_texture.cpp.
References _BlockToCompressIndex, _Height, _Masks, _NumMipMap, _Texture, _Width, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), and NLMISC::IStream::serialVersion().
| void NL3D::CHLSColorTexture::setBitmap | ( | const NLMISC::CBitmap & | bmp | ) |
setup the un-colored bitmap for the texture.
| bmp | a bitmap which must be a DXTC5 with all mipmaps. |
Definition at line 90 of file hls_color_texture.cpp.
References _BlockToCompressIndex, _Height, _NumMipMap, _Texture, _Width, NLMISC::CBitmap::DXTC5, NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getMipMapCount(), NLMISC::CBitmap::getPixelFormat(), NLMISC::CBitmap::getPixels(), NLMISC::CBitmap::getWidth(), nlassert, reset(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
| void NL3D::CHLSColorTexture::uncompressBlockRGB | ( | const uint8 * | srcDXTC, | |
| CRGBA * | dstRGBA | |||
| ) | [static, private] |
uncompress DXTC5 RGB only block, into a RGBA raw array. Alpha is setup with undefined values
Definition at line 555 of file hls_color_texture.cpp.
References NLMISC::CRGBA::blendFromui(), NLMISC::n, and NLMISC::CRGBA::set565().
Referenced by buildColorVersion().
Definition at line 124 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), serial(), and setBitmap().
uint32 NL3D::CHLSColorTexture::_Height [private] |
Definition at line 123 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), reset(), serial(), and setBitmap().
std::vector<CMask> NL3D::CHLSColorTexture::_Masks [private] |
Definition at line 128 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), getNumMasks(), reset(), and serial().
uint32 NL3D::CHLSColorTexture::_NumMipMap [private] |
Definition at line 123 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), reset(), serial(), and setBitmap().
std::vector<uint8> NL3D::CHLSColorTexture::_Texture [private] |
Definition at line 126 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), reset(), serial(), and setBitmap().
uint32 NL3D::CHLSColorTexture::_Width [private] |
Definition at line 123 of file hls_color_texture.h.
Referenced by addMask(), buildColorVersion(), reset(), serial(), and setBitmap().
1.6.1