diff options
author | Denton Woods <denton.woods@gmail.com> | 2016-12-28 23:00:20 -0600 |
---|---|---|
committer | Denton Woods <denton.woods@gmail.com> | 2016-12-28 23:00:20 -0600 |
commit | db29d73dfde0b58d7283741efd7ae7bc63ade70e (patch) | |
tree | 8b2c056337fe6b05474b6a79ab88509ef6ebaf4e | |
parent | db15efa9ed8c45878a7ad58f21aeca70b06dde21 (diff) | |
download | devil-db29d73dfde0b58d7283741efd7ae7bc63ade70e.tar.gz |
- Fixed CMake for VC++ to have includes and resources in IL project
- Switched ILUT to C++ source files
-rw-r--r-- | DevIL/src-IL/CMakeLists.txt | 10 | ||||
-rw-r--r-- | DevIL/src-IL/src/il_dds.cpp | 165 | ||||
-rw-r--r-- | DevIL/src-ILU/CMakeLists.txt | 4 | ||||
-rw-r--r-- | DevIL/src-ILUT/CMakeLists.txt | 4 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_allegro.cpp (renamed from DevIL/src-ILUT/src/ilut_allegro.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_directx.cpp (renamed from DevIL/src-ILUT/src/ilut_directx.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_directx10.cpp (renamed from DevIL/src-ILUT/src/ilut_directx10.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_directx9.cpp (renamed from DevIL/src-ILUT/src/ilut_directx9.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_directxm.cpp (renamed from DevIL/src-ILUT/src/ilut_directxm.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_internal.cpp (renamed from DevIL/src-ILUT/src/ilut_internal.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_main.cpp (renamed from DevIL/src-ILUT/src/ilut_main.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_opengl.cpp (renamed from DevIL/src-ILUT/src/ilut_opengl.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_sdlsurface.cpp (renamed from DevIL/src-ILUT/src/ilut_sdlsurface.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_states.cpp (renamed from DevIL/src-ILUT/src/ilut_states.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_win32.cpp (renamed from DevIL/src-ILUT/src/ilut_win32.c) | 0 | ||||
-rw-r--r-- | DevIL/src-ILUT/src/ilut_x11.cpp (renamed from DevIL/src-ILUT/src/ilut_x11.c) | 0 |
16 files changed, 93 insertions, 90 deletions
diff --git a/DevIL/src-IL/CMakeLists.txt b/DevIL/src-IL/CMakeLists.txt index 2a197dc1..425cacc9 100644 --- a/DevIL/src-IL/CMakeLists.txt +++ b/DevIL/src-IL/CMakeLists.txt @@ -8,7 +8,7 @@ include (TestBigEndian) option(BUILD_SHARED_LIBS "Build with shared (.DLL .SO) libraries." ON) -file(GLOB DevIL_SRCS src/*.c src/*.cpp) +file(GLOB DevIL_SRCS src/*.cpp) file(GLOB DevIL_INC include/*.h ../include/config.h ../include/IL/devil_internal_exports.h ../include/IL/il.h) file(GLOB DevIL_RSRC) file(GLOB DevIL_TXT) @@ -32,15 +32,15 @@ if(WIN32) endif(BUILD_SHARED_LIBS) endif(WIN32) -source_group("Source Files" FILES src/*.c src/*.cpp) +source_group("Source Files" FILES src/*.cpp) source_group("Header Files" FILES ${DevIL_INC} ) source_group("Resource Files" FILES ${DevIL_RSRC} ) source_group("Text Files" FILES ${DevIL_TXT} ) if(BUILD_SHARED_LIBS) - add_library(IL SHARED ${DevIL_SRCS} ) + add_library(IL SHARED ${DevIL_SRCS} ${DevIL_INC} ${DevIL_RSRC} ${DevIL_TXT}) else(BUILD_SHARED_LIBS) - add_library(IL ${DevIL_SRCS} ) + add_library(IL ${DevIL_SRCS} ${DevIL_INC} ${DevIL_RSRC} ${DevIL_TXT}) endif(BUILD_SHARED_LIBS) @@ -64,7 +64,7 @@ find_package(LCMS) # TODO: utx doesn't currently compile (as C, anyway) -set(IL_NO_UTX 1) +#set(IL_NO_UTX 1) # TODO: WDP requires Microsoft HD Photo Device Porting Kit 1.0 set(IL_NO_WDP 1) diff --git a/DevIL/src-IL/src/il_dds.cpp b/DevIL/src-IL/src/il_dds.cpp index 1eb53893..5a53670e 100644 --- a/DevIL/src-IL/src/il_dds.cpp +++ b/DevIL/src-IL/src/il_dds.cpp @@ -1015,87 +1015,9 @@ void DxtcReadColor(ILushort Data, Color8888* Out) Out->b = b << 3 | r >> 2; } -ILboolean DecompressDXT1(ILimage *lImage, ILubyte *lCompData) -{ - ILuint x, y, z, i, j, k, Select; - ILubyte *Temp; - Color8888 colours[4], *col; - ILushort color_0, color_1; - ILuint bitmask, Offset; - - if (!lCompData) - return IL_FALSE; - - Temp = lCompData; - colours[0].a = 0xFF; - colours[1].a = 0xFF; - colours[2].a = 0xFF; - //colours[3].a = 0xFF; - for (z = 0; z < lImage->Depth; z++) { - for (y = 0; y < lImage->Height; y += 4) { - for (x = 0; x < lImage->Width; x += 4) { - color_0 = *((ILushort*)Temp); - UShort(&color_0); - color_1 = *((ILushort*)(Temp + 2)); - UShort(&color_1); - DxtcReadColor(color_0, colours); - DxtcReadColor(color_1, colours + 1); - bitmask = ((ILuint*)Temp)[1]; - UInt(&bitmask); - Temp += 8; - - if (color_0 > color_1) { - // Four-color block: derive the other two colors. - // 00 = color_0, 01 = color_1, 10 = color_2, 11 = color_3 - // These 2-bit codes correspond to the 2-bit fields - // stored in the 64-bit block. - colours[2].b = (2 * colours[0].b + colours[1].b + 1) / 3; - colours[2].g = (2 * colours[0].g + colours[1].g + 1) / 3; - colours[2].r = (2 * colours[0].r + colours[1].r + 1) / 3; - //colours[2].a = 0xFF; - - colours[3].b = (colours[0].b + 2 * colours[1].b + 1) / 3; - colours[3].g = (colours[0].g + 2 * colours[1].g + 1) / 3; - colours[3].r = (colours[0].r + 2 * colours[1].r + 1) / 3; - colours[3].a = 0xFF; - } - else { - // Three-color block: derive the other color. - // 00 = color_0, 01 = color_1, 10 = color_2, - // 11 = transparent. - // These 2-bit codes correspond to the 2-bit fields - // stored in the 64-bit block. - colours[2].b = (colours[0].b + colours[1].b) / 2; - colours[2].g = (colours[0].g + colours[1].g) / 2; - colours[2].r = (colours[0].r + colours[1].r) / 2; - //colours[2].a = 0xFF; - - colours[3].b = (colours[0].b + 2 * colours[1].b + 1) / 3; - colours[3].g = (colours[0].g + 2 * colours[1].g + 1) / 3; - colours[3].r = (colours[0].r + 2 * colours[1].r + 1) / 3; - colours[3].a = 0x00; - } - - for (j = 0, k = 0; j < 4; j++) { - for (i = 0; i < 4; i++, k++) { - Select = (bitmask & (0x03 << k*2)) >> k*2; - col = &colours[Select]; - - if (((x + i) < lImage->Width) && ((y + j) < lImage->Height)) { - Offset = z * lImage->SizeOfPlane + (y + j) * lImage->Bps + (x + i) * lImage->Bpp; - lImage->Data[Offset + 0] = col->r; - lImage->Data[Offset + 1] = col->g; - lImage->Data[Offset + 2] = col->b; - lImage->Data[Offset + 3] = col->a; - } - } - } - } - } - } - return IL_TRUE; -} +// Defined at the bottom of the file +//ILboolean DecompressDXT1(ILimage *lImage, ILubyte *lCompData) ILboolean DecompressDXT2(ILimage *lImage, ILubyte *lCompData) @@ -2517,7 +2439,88 @@ ILAPI ILboolean ILAPIENTRY ilInvertSurfaceDxtcDataAlpha() return IL_TRUE; } +#endif//IL_NO_DDS + +// Needed for UTX and potentially others outside of DDS +ILboolean DecompressDXT1(ILimage *lImage, ILubyte *lCompData) +{ + ILuint x, y, z, i, j, k, Select; + ILubyte *Temp; + Color8888 colours[4], *col; + ILushort color_0, color_1; + ILuint bitmask, Offset; + + if (!lCompData) + return IL_FALSE; + Temp = lCompData; + colours[0].a = 0xFF; + colours[1].a = 0xFF; + colours[2].a = 0xFF; + //colours[3].a = 0xFF; + for (z = 0; z < lImage->Depth; z++) { + for (y = 0; y < lImage->Height; y += 4) { + for (x = 0; x < lImage->Width; x += 4) { + color_0 = *((ILushort*)Temp); + UShort(&color_0); + color_1 = *((ILushort*)(Temp + 2)); + UShort(&color_1); + DxtcReadColor(color_0, colours); + DxtcReadColor(color_1, colours + 1); + bitmask = ((ILuint*)Temp)[1]; + UInt(&bitmask); + Temp += 8; + if (color_0 > color_1) { + // Four-color block: derive the other two colors. + // 00 = color_0, 01 = color_1, 10 = color_2, 11 = color_3 + // These 2-bit codes correspond to the 2-bit fields + // stored in the 64-bit block. + colours[2].b = (2 * colours[0].b + colours[1].b + 1) / 3; + colours[2].g = (2 * colours[0].g + colours[1].g + 1) / 3; + colours[2].r = (2 * colours[0].r + colours[1].r + 1) / 3; + //colours[2].a = 0xFF; + + colours[3].b = (colours[0].b + 2 * colours[1].b + 1) / 3; + colours[3].g = (colours[0].g + 2 * colours[1].g + 1) / 3; + colours[3].r = (colours[0].r + 2 * colours[1].r + 1) / 3; + colours[3].a = 0xFF; + } + else { + // Three-color block: derive the other color. + // 00 = color_0, 01 = color_1, 10 = color_2, + // 11 = transparent. + // These 2-bit codes correspond to the 2-bit fields + // stored in the 64-bit block. + colours[2].b = (colours[0].b + colours[1].b) / 2; + colours[2].g = (colours[0].g + colours[1].g) / 2; + colours[2].r = (colours[0].r + colours[1].r) / 2; + //colours[2].a = 0xFF; + + colours[3].b = (colours[0].b + 2 * colours[1].b + 1) / 3; + colours[3].g = (colours[0].g + 2 * colours[1].g + 1) / 3; + colours[3].r = (colours[0].r + 2 * colours[1].r + 1) / 3; + colours[3].a = 0x00; + } + + for (j = 0, k = 0; j < 4; j++) { + for (i = 0; i < 4; i++, k++) { + Select = (bitmask & (0x03 << k * 2)) >> k * 2; + col = &colours[Select]; + + if (((x + i) < lImage->Width) && ((y + j) < lImage->Height)) { + Offset = z * lImage->SizeOfPlane + (y + j) * lImage->Bps + (x + i) * lImage->Bpp; + lImage->Data[Offset + 0] = col->r; + lImage->Data[Offset + 1] = col->g; + lImage->Data[Offset + 2] = col->b; + lImage->Data[Offset + 3] = col->a; + } + } + } + } + } + } + + return IL_TRUE; +} -#endif//IL_NO_DDS diff --git a/DevIL/src-ILU/CMakeLists.txt b/DevIL/src-ILU/CMakeLists.txt index 40500fe5..4e95ff42 100644 --- a/DevIL/src-ILU/CMakeLists.txt +++ b/DevIL/src-ILU/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(ILU) -file(GLOB ILU_SRCS src/*.c src/*.cpp) +file(GLOB ILU_SRCS src/*.cpp) file(GLOB ILU_INC include/*.h ../include/IL/devil_internal_exports.h ../include/IL/ilu.h) file(GLOB ILU_RSRC) @@ -22,7 +22,7 @@ if(WIN32) endif(WIN32) -source_group("Source Files" FILES src/*.c src/*.cpp) +source_group("Source Files" FILES src/*.cpp) source_group("Header Files" FILES ${ILU_INC} ) source_group("Resource Files" FILES ${ILU_RSRC} ) diff --git a/DevIL/src-ILUT/CMakeLists.txt b/DevIL/src-ILUT/CMakeLists.txt index 1c57b654..f480f8e8 100644 --- a/DevIL/src-ILUT/CMakeLists.txt +++ b/DevIL/src-ILUT/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(ILUT) -file(GLOB ILUT_SRCS src/*.c src/*.cpp msvc9/il.def) +file(GLOB ILUT_SRCS src/*.cpp) file(GLOB ILUT_INC include/*.h ../include/IL/devil_internal_exports.h ../include/IL/ilut.h) file(GLOB ILUT_RSRC) @@ -22,7 +22,7 @@ if(WIN32) endif(BUILD_SHARED_LIBS) endif(WIN32) -source_group("Source Files" FILES src/*.c src/*.cpp) +source_group("Source Files" FILES src/*.cpp) source_group("Header Files" FILES ${ILUT_INC} ) source_group("Resource Files" FILES ${ILUT_RSRC} ) diff --git a/DevIL/src-ILUT/src/ilut_allegro.c b/DevIL/src-ILUT/src/ilut_allegro.cpp index 97e1dd1c..97e1dd1c 100644 --- a/DevIL/src-ILUT/src/ilut_allegro.c +++ b/DevIL/src-ILUT/src/ilut_allegro.cpp diff --git a/DevIL/src-ILUT/src/ilut_directx.c b/DevIL/src-ILUT/src/ilut_directx.cpp index e16560ff..e16560ff 100644 --- a/DevIL/src-ILUT/src/ilut_directx.c +++ b/DevIL/src-ILUT/src/ilut_directx.cpp diff --git a/DevIL/src-ILUT/src/ilut_directx10.c b/DevIL/src-ILUT/src/ilut_directx10.cpp index afb00b27..afb00b27 100644 --- a/DevIL/src-ILUT/src/ilut_directx10.c +++ b/DevIL/src-ILUT/src/ilut_directx10.cpp diff --git a/DevIL/src-ILUT/src/ilut_directx9.c b/DevIL/src-ILUT/src/ilut_directx9.cpp index 11f33bd5..11f33bd5 100644 --- a/DevIL/src-ILUT/src/ilut_directx9.c +++ b/DevIL/src-ILUT/src/ilut_directx9.cpp diff --git a/DevIL/src-ILUT/src/ilut_directxm.c b/DevIL/src-ILUT/src/ilut_directxm.cpp index 50b519f5..50b519f5 100644 --- a/DevIL/src-ILUT/src/ilut_directxm.c +++ b/DevIL/src-ILUT/src/ilut_directxm.cpp diff --git a/DevIL/src-ILUT/src/ilut_internal.c b/DevIL/src-ILUT/src/ilut_internal.cpp index 6c1c20da..6c1c20da 100644 --- a/DevIL/src-ILUT/src/ilut_internal.c +++ b/DevIL/src-ILUT/src/ilut_internal.cpp diff --git a/DevIL/src-ILUT/src/ilut_main.c b/DevIL/src-ILUT/src/ilut_main.cpp index 1f21cea2..1f21cea2 100644 --- a/DevIL/src-ILUT/src/ilut_main.c +++ b/DevIL/src-ILUT/src/ilut_main.cpp diff --git a/DevIL/src-ILUT/src/ilut_opengl.c b/DevIL/src-ILUT/src/ilut_opengl.cpp index a0530047..a0530047 100644 --- a/DevIL/src-ILUT/src/ilut_opengl.c +++ b/DevIL/src-ILUT/src/ilut_opengl.cpp diff --git a/DevIL/src-ILUT/src/ilut_sdlsurface.c b/DevIL/src-ILUT/src/ilut_sdlsurface.cpp index 938e6b50..938e6b50 100644 --- a/DevIL/src-ILUT/src/ilut_sdlsurface.c +++ b/DevIL/src-ILUT/src/ilut_sdlsurface.cpp diff --git a/DevIL/src-ILUT/src/ilut_states.c b/DevIL/src-ILUT/src/ilut_states.cpp index 0062f7da..0062f7da 100644 --- a/DevIL/src-ILUT/src/ilut_states.c +++ b/DevIL/src-ILUT/src/ilut_states.cpp diff --git a/DevIL/src-ILUT/src/ilut_win32.c b/DevIL/src-ILUT/src/ilut_win32.cpp index 3e43deb3..3e43deb3 100644 --- a/DevIL/src-ILUT/src/ilut_win32.c +++ b/DevIL/src-ILUT/src/ilut_win32.cpp diff --git a/DevIL/src-ILUT/src/ilut_x11.c b/DevIL/src-ILUT/src/ilut_x11.cpp index bb5ad249..bb5ad249 100644 --- a/DevIL/src-ILUT/src/ilut_x11.c +++ b/DevIL/src-ILUT/src/ilut_x11.cpp |