22#include " dxtlib.h"
33#include < nvtt/nvtt.h>
44#include " ETextureParams.h"
5- #include " dds.h"
5+ // #include "dds.h"
66
7- BOOL APIENTRY DllMain (HANDLE hModule, u32 ul_reason_for_call, LPVOID lpReserved) { return TRUE ; }
7+ // BOOL APIENTRY DllMain(HANDLE hModule, u32 ul_reason_for_call, LPVOID lpReserved) { return TRUE; }
88static HFILE gFileOut ;
99static HFILE gFileIn ;
1010
11- const u32 fcc_DXT1 = MAKEFOURCC(' D' , ' X' , ' T' , ' 1' );
11+ /* const u32 fcc_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
1212const u32 fcc_DXT2 = MAKEFOURCC('D', 'X', 'T', '2');
1313const u32 fcc_DXT3 = MAKEFOURCC('D', 'X', 'T', '3');
1414const u32 fcc_DXT4 = MAKEFOURCC('D', 'X', 'T', '4');
15- const u32 fcc_DXT5 = MAKEFOURCC(' D' , ' X' , ' T' , ' 5' );
15+ const u32 fcc_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');*/
1616
17- void __cdecl WriteDTXnFile (DWORD count, void * buffer, void * userData)
17+ /* void __cdecl WriteDTXnFile(DWORD count, void* buffer, void* userData)
1818{
1919 if (count == sizeof(DDS_HEADER))
2020 {
@@ -32,7 +32,7 @@ void __cdecl WriteDTXnFile(DWORD count, void* buffer, void* userData)
3232 }
3333 }
3434 _write(gFileOut, buffer, count);
35- }
35+ }*/
3636
3737class DDSWriter : public nvtt ::OutputHandler
3838{
@@ -48,7 +48,7 @@ DDSWriter::DDSWriter(HFILE& file) : file(file) {}
4848void DDSWriter::beginImage (int size, int width, int height, int depth, int face, int miplevel) {}
4949bool DDSWriter::writeData (const void * data, int size)
5050{
51- if (size == sizeof (DDS_HEADER))
51+ /* if (size == sizeof(DDS_HEADER))
5252 {
5353 DDS_HEADER* hdr = (DDS_HEADER*)data;
5454 if (hdr->dwSize == size)
@@ -62,7 +62,7 @@ bool DDSWriter::writeData(const void* data, int size)
6262 case fcc_DXT5: hdr->ddspf.dwRGBBitCount = 0; break;
6363 }
6464 }
65- }
65+ }*/
6666 _write (file, data, size);
6767 return true ;
6868}
@@ -89,15 +89,15 @@ void DDSErrorHandler::error(nvtt::Error e)
8989 MessageBox (0 , msg, " DXT compress error" , MB_ICONERROR | MB_OK);
9090}
9191
92- void __cdecl ReadDTXnFile (DWORD count, void * buffer, void * userData) { _read (gFileIn , buffer, count); }
92+ /* void __cdecl ReadDTXnFile(DWORD count, void* buffer, void* userData) { _read(gFileIn, buffer, count); }
9393HRESULT WriteCompressedData(void* data, int miplevel, u32 size)
9494{
9595 _write(gFileOut, data, size);
9696 FillMemory(data, size, 0xff);
9797 return 0;
98- }
98+ }*/
9999
100- ENGINE_API u32 * Build32MipLevel (u32 & _w, u32 & _h, u32 & _p, u32 * pdwPixelSrc, STextureParams* fmt, float blend)
100+ /* ENGINE_API*/ u32 * Build32MipLevel (u32 & _w, u32 & _h, u32 & _p, u32 * pdwPixelSrc, STextureParams* fmt, float blend)
101101{
102102 R_ASSERT (pdwPixelSrc);
103103 R_ASSERT (_w % 2 == 0 );
@@ -260,7 +260,7 @@ int DXTCompressImage(LPCSTR out_name, u8* raw_data, u32 w, u32 h, u32 pitch, STe
260260 u8 * pixel = pImagePixels;
261261 for (u32 k = 0 ; k < w * 2 * h; k++, pixel += 4 )
262262 {
263- pixels[k].set (pixel[2 ], pixel[1 ], pixel[0 ], pixel[3 ]);
263+ pixels[k].set (pixel[0 ], pixel[1 ], pixel[2 ], pixel[3 ]);
264264 }
265265 inOpt.setMipmapData (pixels, w, h);
266266 result = nvtt::Compressor ().process (inOpt, compOpt, outOpt);
@@ -272,7 +272,7 @@ int DXTCompressImage(LPCSTR out_name, u8* raw_data, u32 w, u32 h, u32 pitch, STe
272272 rgba_t * pixels = pImage.pixels ();
273273 u8 * pixel = raw_data;
274274 for (u32 k = 0 ; k < w * h; k++, pixel += 4 )
275- pixels[k].set (pixel[2 ], pixel[1 ], pixel[0 ], pixel[3 ]);
275+ pixels[k].set (pixel[0 ], pixel[1 ], pixel[2 ], pixel[3 ]);
276276 inOpt.setMipmapData (pixels, w, h);
277277 result = nvtt::Compressor ().process (inOpt, compOpt, outOpt);
278278 }
0 commit comments