Disabled DDS_LOADER by default.

a) It break 64-bit builds and I'm not deep enough in the format to fix this. Actually from the documentation I found so far the header-format used in the loader looked rather different to me from the format-descriptions I found and Microsoft warned that several dds-versions are out there and loaders
should care about that.
b) I suspect that this loader contains a S3TC implementation, although once again I'm not deep enough in it to validate that. This alorithm is unfortunately rather famous for it's patent as S3 is known to collect fees for it (that's the reason we didn't add that loader before). So users using it should be aware of this. (I think we could work around that at least for hardware-drivers as VideoCards-Vendors have licensed dds and it's possible to pass compressed data directly to the card, but that certainly wouldn't work for software-drivers).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3352 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2010-07-16 21:48:08 +00:00
parent a716532bb0
commit 011be981e7
2 changed files with 16 additions and 11 deletions

View File

@ -316,7 +316,12 @@ B3D, MS3D or X meshes */
//! Define _IRR_COMPILE_WITH_PSD_LOADER_ if you want to load .psd files
#define _IRR_COMPILE_WITH_PSD_LOADER_
//! Define _IRR_COMPILE_WITH_DDS_LOADER_ if you want to load .dds files
#define _IRR_COMPILE_WITH_DDS_LOADER_
// Outcommented because
// a) it doesn't compile on 64-bit currently
// b) anyone enabling it should be aware that S3TC compression algorithm which might be used in that loader
// is patented in the US by S3 and they do collect license fees when it's used in applications.
// So if you are unfortunate enough to develop applications for US market and their broken patent system be careful.
// #define _IRR_COMPILE_WITH_DDS_LOADER_
//! Define _IRR_COMPILE_WITH_TGA_LOADER_ if you want to load .tga files
#define _IRR_COMPILE_WITH_TGA_LOADER_
//! Define _IRR_COMPILE_WITH_WAL_LOADER_ if you want to load .wal files

View File

@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
/*
Based on Code from Copyright (c) 2003 Randy Reddig
Based on Code from Copyright (c) 2003 Randy Reddig
Based on code from Nvidia's DDS example:
http://www.nvidia.com/object/dxtc_decompression_code.html
@ -140,9 +140,9 @@ void DDSGetColorBlockColors( ddsColorBlock *block, ddsColor colors[ 4 ] )
/* use this for all but the super-freak math method */
if( block->colors[ 0 ] > block->colors[ 1 ] )
{
/* four-color block: derive the other two colors.
/* four-color block: derive the other two colors.
00 = color 0, 01 = color 1, 10 = color 2, 11 = color 3
these two bit codes correspond to the 2-bit fields
these two bit codes correspond to the 2-bit fields
stored in the 64-bit block. */
word = ((u16) colors[ 0 ].r * 2 + (u16) colors[ 1 ].r ) / 3;
@ -166,9 +166,9 @@ void DDSGetColorBlockColors( ddsColorBlock *block, ddsColor colors[ 4 ] )
else
{
/* three-color block: derive the other color.
00 = color 0, 01 = color 1, 10 = color 2,
00 = color 0, 01 = color 1, 10 = color 2,
11 = transparent.
These two bit codes correspond to the 2-bit fields
These two bit codes correspond to the 2-bit fields
stored in the 64-bit block */
word = ((u16) colors[ 0 ].r + (u16) colors[ 1 ].r) / 2;
@ -253,7 +253,7 @@ decodes a dds explicit alpha block
*/
static void DDSDecodeAlphaExplicit( u32 *pixel, ddsAlphaBlockExplicit *alphaBlock, s32 width, u32 alphaZero )
{
{
s32 row, pix;
u16 word;
ddsColor color;
@ -319,7 +319,7 @@ static void DDSDecodeAlpha3BitLinear( u32 *pixel, ddsAlphaBlock3BitLinear *alpha
/* 6-alpha block */
else
{
{
/* 000 = alpha_0, 001 = alpha_1, others are interpolated */
alphas[ 2 ] = (4 * alphas[ 0 ] + alphas[ 1 ]) / 5; /* bit code 010 */
alphas[ 3 ] = (3 * alphas[ 0 ] + 2 * alphas[ 1 ]) / 5; /* bit code 011 */
@ -390,7 +390,7 @@ static void DDSDecodeAlpha3BitLinear( u32 *pixel, ddsAlphaBlock3BitLinear *alpha
*pixel &= alphaZero;
/* or the bits into the prev. nulled alpha */
*pixel |= *((u32*) &(aColors[ row ][ pix ]));
*pixel |= *((u32*) &(aColors[ row ][ pix ]));
pixel++;
}
}
@ -647,7 +647,7 @@ s32 DDSDecompress( ddsBuffer *dds, u8 *pixels )
break;
case DDS_PF_DXT3:
r = DDSDecompressDXT3( dds, width, height, pixels );
r = DDSDecompressDXT3( dds, width, height, pixels );
break;
case DDS_PF_DXT4:
@ -655,7 +655,7 @@ s32 DDSDecompress( ddsBuffer *dds, u8 *pixels )
break;
case DDS_PF_DXT5:
r = DDSDecompressDXT5( dds, width, height, pixels );
r = DDSDecompressDXT5( dds, width, height, pixels );
break;
default: