• R/O
  • SSH
  • HTTPS

vima19: Commit


Commit MetaInfo

Revision748 (tree)
Time2022-08-11 03:49:53
Authorhgtterry

Log Message

Equity_SB 100822 Clean Up (WIP)

Change Summary

Incremental Difference

--- Anim19_OSDN/VM_Textures.h (revision 747)
+++ Anim19_OSDN/VM_Textures.h (nonexistent)
@@ -1,68 +0,0 @@
1-#pragma once
2-
3-// Error codes
4-#define TPACKERROR_OK 0
5-#define TPACKERROR_UNKNOWN (TPACKERROR_OK - 1)
6-#define TPACKERROR_WRITE (TPACKERROR_OK - 2)
7-#define TPACKERROR_MEMORYALLOCATION (TPACKERROR_OK - 3)
8-#define TPACKERROR_CREATEFILE (TPACKERROR_OK - 4)
9-
10-#pragma pack(1)
11-
12-typedef struct TGAHEADER
13-{
14- char IDLength;
15- char ColorMapType;
16- char ImageType;
17- Ogre::uint16 CMFirstEntry;
18- Ogre::uint16 CMLength;
19- char CMEntrySize;
20- Ogre::uint16 Xorigin;
21- Ogre::uint16 Yorigin;
22- Ogre::uint16 Width;
23- Ogre::uint16 Height;
24- char PixelDepth;
25- char ImageDescriptor;
26-} TGAHEADER;
27-
28-#pragma pack()
29-
30-class VM_Textures
31-{
32-public:
33- VM_Textures();
34- ~VM_Textures();
35-
36- int Genesis_WriteTGA(const char * pszFile, geBitmap *pBitmap);
37- int Genesis_WriteToBmp(geBitmap *bmp, char *filename);
38- bool Soil_Load_Texture(UINT textureArray[], LPSTR strFileName, int textureID);
39- bool TexureToWinPreviewFullPath(int Index, char* FullPath);
40- bool GetFormat(int cformat);
41- void Strip_JustFileName(char *pString, char *FileName);
42- bool CreateDummyTexture(void);
43- bool Soil_DecodeTextures(int TextureID);
44- void CreateTextureInfo(void);
45- bool HBITMAP_TO_BmpFile(HBITMAP Bitmap, char* Filename, char* SaveFolder);
46-
47- bool Jpg_To_Tga24(char* File);
48- bool Jpg_To_png24(char* File);
49- bool Bmp_To_Jpg(char* File);
50-
51- //HBITMAP GetHBITMAPFromImageFile(const WCHAR* pFilePath);
52-
53- bool Ogre_LoadImage(const Ogre::String& tex_ext, const Ogre::String& texture_path, int Index);
54-
55- bool RemoveFile(char* Filename, char* Folder);
56-
57- char JustFileName[255];
58- char GEFormatString[255];
59-
60- char TextureFileName[255];
61-
62- UINT g_Texture[300];
63-
64-protected:
65-
66-
67-};
68-
--- Anim19_OSDN/VM_TextLib.h (revision 747)
+++ Anim19_OSDN/VM_TextLib.h (nonexistent)
@@ -1,127 +0,0 @@
1-/*
2-Copyright (c) Vima19 Inflanite Software W.T.Flanigan H.C.Flanigan
3-
4-This software is provided 'as-is', without any express or implied
5-warranty. In no event will the authors be held liable for any damages
6-arising from the use of this software.
7-
8-Permission is granted to anyone to use this software for any purpose,
9-including commercial applications, and to alter it and redistribute it
10-freely, subject to the following restrictions:
11-
12-1. The origin of this software must not be misrepresented; you must not
13-claim that you wrote the original software. If you use this software
14-in a product, an acknowledgment in the product documentation would be
15-appreciated but is not required.
16-
17-2. Altered source versions must be plainly marked as such, and must not be
18-misrepresented as being the original software.
19-
20-3. This notice may not be removed or altered from any source
21-distribution.
22-*/
23-
24-#pragma once
25-
26-#define ENTRY_DELETED 0x00000001
27-
28-// Error codes
29-#define TPACKERROR_OK 0
30-#define TPACKERROR_UNKNOWN (TPACKERROR_OK - 1)
31-#define TPACKERROR_WRITE (TPACKERROR_OK - 2)
32-#define TPACKERROR_MEMORYALLOCATION (TPACKERROR_OK - 3)
33-#define TPACKERROR_CREATEFILE (TPACKERROR_OK - 4)
34-
35-typedef struct tagMY_BITMAPINFO
36-{
37- BITMAPINFOHEADER bmiHeader;
38- RGBQUAD bmiColors[256];
39-} MY_BITMAPINFO, *pMY_BITMAPINFO, **ppMY_BITMAPINFO;
40-
41-#define PAD32(i) (((i)+31)/32*4)
42-
43-typedef struct BitmapEntry
44-{
45- char * Name;
46- geBitmap * Bitmap;
47- HBITMAP WinBitmap;
48- HBITMAP WinABitmap;
49- unsigned Flags;
50- int Dirty;
51-} BitmapEntry;
52-
53-typedef struct TPack_WindowData
54-{
55- HINSTANCE Instance;
56- HWND hwnd;
57- int BitmapCount;
58- BitmapEntry * Bitmaps;
59- BitmapEntry * SelectedEntry;
60- BOOL FileNameIsValid;
61- char TXLFileName[1024];
62- BOOL Dirty;
63-} TPack_WindowData;
64-
65-
66-class VM_TextLib
67-{
68-public:
69- VM_TextLib();
70- ~VM_TextLib();
71-
72- void Start_TexturePack();
73-
74- int WriteTGA(const char * pszFile, geBitmap *pBitmap);
75-
76- bool Render2d_Blit(HDC hDC, HBITMAP Bmp, HBITMAP Alpha, const RECT *SourceRect, const RECT *DestRect);
77-
78- int WriteBMP8(const char * pszFile, geBitmap *pBitmap);
79-
80-
81- bool LoadFile(HWND ChDlg);
82- bool NonFatalError(const char *Msg, ...);
83- bool AddTexture(geVFile *BaseFile, const char *Path);
84- bool SelectBitmap();
85- int FindBitmap(TPack_WindowData *pData, const char *Name);
86- HBITMAP CreateHBitmapFromgeBitmap (geBitmap *Bitmap, HDC hdc);
87- bool UpDateGeList(int Location);
88-
89- bool TPack_ExtractSelected();
90- bool SaveSelectedFile(char* Extension,char* TszFile);
91-
92- bool CheckExtention(char *FileName);
93- bool TPack_ExtractAll();
94- bool Save(const char *Path);
95- bool CleanUp();
96- bool GetName();
97- bool ReName(const char *NewName);
98- bool UpDateList(const char *NewName);
99-
100-
101-
102- TPack_WindowData *p_Data;
103- BitmapEntry * NewBitmapList[200];
104- BitmapEntry * Entry;
105-
106- char LastPath [256];
107- char TextureName[256];
108- char NewTextureName[256];
109- int EditOrLoad;
110- char L_FileName[256];
111- char SaveFile[256];
112-
113- char Txt_FileName[255];
114- char Txt_Path_FileName[1024];
115-
116-protected:
117-
118- static LRESULT CALLBACK TextureLib_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
119- static bool CALLBACK TextureLibPreviewWnd(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
120- static LRESULT CALLBACK RenameProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
121-
122- bool Txt_OpenFile(char* Extension, char* Title, char* StartDirectory);
123-
124- OPENFILENAME ofn;
125-
126-};
127-
--- Anim19_OSDN/VM_Textures.cpp (revision 747)
+++ Anim19_OSDN/VM_Textures.cpp (nonexistent)
@@ -1,1036 +0,0 @@
1-#include "stdafx.h"
2-#include "GD19_App.h"
3-#include "resource.h"
4-#include "VM_Textures.h"
5-
6-#include "SOIL.h"
7-
8-#include "il.h"
9-#include "ilu.h"
10-#include "ilut.h"
11-
12-
13-#include "bitmap.h"
14-#include "bitmap._h"
15-#include "bitmap.__h"
16-
17-#pragma warning( disable : 4800)
18-
19-VM_Textures::VM_Textures()
20-{
21- ilInit();
22-}
23-
24-
25-VM_Textures::~VM_Textures()
26-{
27-}
28-
29-// *************************************************************************
30-// * Genesis_WriteTGA Terry Bernie *
31-// *************************************************************************
32-int VM_Textures::Genesis_WriteTGA(const char * pszFile, geBitmap *pBitmap)
33-{
34- geBitmap * pLock = NULL;
35- geBitmap * pLockA = NULL;
36- gePixelFormat Format;
37- gePixelFormat FormatA;
38- geBitmap_Info BitmapInfo;
39- int nErrorCode = TPACKERROR_UNKNOWN; // Return code
40- TGAHEADER tgah;
41- long footer = 0;
42- char signature[18] = "TRUEVISION-XFILE.";
43-
44- Ogre::uint8 * pPixelData;
45- Ogre::uint8 * pPixelDataA;
46-
47- int i, j;
48- HANDLE hFile = NULL;
49- DWORD nBytesWritten;
50-
51- // Create the .TGA file.
52- hFile = CreateFile(pszFile,
53- GENERIC_READ | GENERIC_WRITE,
54- (DWORD)0,
55- NULL,
56- CREATE_ALWAYS,
57- FILE_ATTRIBUTE_NORMAL,
58- (HANDLE)NULL);
59-
60- if (hFile == INVALID_HANDLE_VALUE)
61- return TPACKERROR_CREATEFILE;
62-
63- // get 24-bit bitmap
64- Format = GE_PIXELFORMAT_24BIT_BGR;
65- FormatA = GE_PIXELFORMAT_8BIT_GRAY;
66-
67- if (geBitmap_GetBits(pBitmap))
68- {
69- pLock = pBitmap;
70- }
71- else
72- {
73- if (!geBitmap_LockForRead(pBitmap, &pLock, 0, 0, Format, GE_FALSE, 0))
74- {
75- return FALSE;
76- }
77- }
78-
79- if (geBitmap_GetBits(geBitmap_GetAlpha(pBitmap)))
80- {
81- pLockA = geBitmap_GetAlpha(pBitmap);
82- }
83- else
84- {
85- if (!geBitmap_LockForRead(geBitmap_GetAlpha(pBitmap), &pLockA, 0, 0, FormatA, GE_FALSE, 0))
86- {
87- return FALSE;
88- }
89- }
90-
91- geBitmap_GetInfo(pLock, &BitmapInfo, NULL);
92- if (BitmapInfo.Format != Format)
93- {
94- nErrorCode = TPACKERROR_UNKNOWN;
95- goto ExitWriteBitmap;
96- }
97-
98- tgah.IDLength = 0;
99- tgah.ColorMapType = 0;
100- tgah.ImageType = 2; // we create an uncompressed, true color image
101- tgah.CMFirstEntry = 0;
102- tgah.CMLength = 0;
103- tgah.CMEntrySize = 0;
104- tgah.Xorigin = 0;
105- tgah.Yorigin = 0;
106-
107- tgah.Width = (Ogre::uint16)BitmapInfo.Width;
108- tgah.Height = (Ogre::uint16)BitmapInfo.Height;
109-
110- tgah.PixelDepth = 32;
111- tgah.ImageDescriptor = 8; //00001000 - not flipped, 8 alpha bits
112-
113- pPixelData = (Ogre::uint8*)geBitmap_GetBits(pLock);
114-
115- pPixelDataA = (Ogre::uint8*)geBitmap_GetBits(pLockA);
116-
117- // Write the tga header
118- if (!WriteFile(hFile, (LPVOID)&tgah, sizeof(TGAHEADER), (LPDWORD)&nBytesWritten, (NULL)))
119- {
120- nErrorCode = TPACKERROR_WRITE;
121- goto ExitWriteBitmap;
122- }
123-
124- // write pixels
125- pPixelData += 3 * tgah.Width*(tgah.Height - 1);
126- pPixelDataA += tgah.Width*(tgah.Height - 1);
127- for (i = 0; i<tgah.Height; i++)
128- {
129- for (j = 0; j<tgah.Width; j++)
130- {
131- if (!WriteFile(hFile, (LPVOID)pPixelData, 3, (LPDWORD)&nBytesWritten, (NULL)))
132- {
133- nErrorCode = TPACKERROR_WRITE;
134- goto ExitWriteBitmap;
135- }
136-
137- pPixelData += 3;
138-
139- if (!WriteFile(hFile, (LPVOID)pPixelDataA, 1, (LPDWORD)&nBytesWritten, (NULL)))
140- {
141- nErrorCode = TPACKERROR_WRITE;
142- goto ExitWriteBitmap;
143- }
144- pPixelDataA++;
145- }
146-
147- pPixelData -= 2 * 3 * tgah.Width;
148- pPixelDataA -= 2 * tgah.Width;
149- }
150-
151- // write the signature
152- if (!WriteFile(hFile, (LPVOID)&footer, 4, (LPDWORD)&nBytesWritten, (NULL)))
153- {
154- nErrorCode = TPACKERROR_WRITE;
155- goto ExitWriteBitmap;
156- }
157-
158- if (!WriteFile(hFile, (LPVOID)&footer, 4, (LPDWORD)&nBytesWritten, (NULL)))
159- {
160- nErrorCode = TPACKERROR_WRITE;
161- goto ExitWriteBitmap;
162- }
163-
164- if (!WriteFile(hFile, (LPVOID)signature, 18, (LPDWORD)&nBytesWritten, (NULL)))
165- {
166- nErrorCode = TPACKERROR_WRITE;
167- goto ExitWriteBitmap;
168- }
169-
170- CloseHandle(hFile);
171- hFile = NULL;
172-
173- // Success!
174- nErrorCode = TPACKERROR_OK;
175-
176-ExitWriteBitmap:
177-
178- // Clean-up
179- //------------------------------------
180- // Make sure the file gets closed
181- if (hFile)
182- CloseHandle(hFile);
183-
184- // Unlock the geBitmap
185- if (pLock != pBitmap)
186- {
187- geBitmap_UnLock(pLock);
188- }
189-
190- if (pLockA != geBitmap_GetAlpha(pBitmap))
191- {
192- geBitmap_UnLock(pLockA);
193- }
194-
195- return nErrorCode;
196-}
197-
198-// *************************************************************************
199-// * WriteToBmp Terry Bernie *
200-// *************************************************************************
201-int VM_Textures::Genesis_WriteToBmp(geBitmap *bmp, char *filename)
202-{
203- BITMAPFILEHEADER bmfh;
204- BITMAPINFOHEADER bmih;
205- int width, height, bpp;
206- int datasize;
207- geBitmap_Info Info;
208- geBitmap_Info Palette_Info;
209- void *data;
210- geBitmap_Palette * palette;
211- void *palette_data = nullptr;
212- int colors = 256;
213- int palette_size = 0;
214- int myRowWidth, bmpRowWidth, pelBytes;
215- data = (void *)&bmp->Data[0];
216- geBitmap_GetInfo(bmp, &Info, NULL);
217- width = Info.Width;
218- height = Info.Height;
219-
220- if (Info.Format == GE_PIXELFORMAT_8BIT_PAL)
221- {
222- palette_data = (void *)malloc(colors * 4);
223- palette = geBitmap_GetPalette(bmp);
224- geBitmap_Palette_GetInfo(palette, &Palette_Info);
225- geBitmap_Palette_GetData(palette, palette_data, GE_PIXELFORMAT_32BIT_XRGB, colors);
226- palette_size = colors * 4;
227- bpp = 1;
228- }
229-
230- else if (Info.Format == GE_PIXELFORMAT_16BIT_565_RGB || Info.Format == GE_PIXELFORMAT_16BIT_555_RGB)
231- {
232-
233- bpp = 2;
234- }
235- else if ((Info.Format == GE_PIXELFORMAT_24BIT_RGB) || (Info.Format == GE_PIXELFORMAT_24BIT_BGR))
236- {
237- bpp = 3;
238- }
239- else if (Info.Format == GE_PIXELFORMAT_32BIT_ARGB)
240- {
241- bpp = 4;
242- }
243-
244- else if (Info.Format == GE_PIXELFORMAT_32BIT_RGBA)
245- {
246- bpp = 4;
247- }
248- else if (Info.Format == GE_PIXELFORMAT_32BIT_XRGB)
249- {
250- bpp = 4;
251- }
252- else if (Info.Format == GE_PIXELFORMAT_32BIT_XBGR)
253- {
254- bpp = 4;
255- }
256- else
257- return 0;
258-
259- datasize = width * height * bpp; //write the file header bmfh
260- memset((void *)&bmfh, 0, sizeof(bmfh));
261- bmfh.bfType = 'B' + ('M' << 8);
262- bmfh.bfSize = sizeof(bmfh) + sizeof(bmih) + datasize;
263- bmfh.bfOffBits = sizeof(bmfh) + sizeof(bmih) + palette_size;
264- //write the info header bmih
265- memset((void *)&bmih, 0, sizeof(bmih));
266- bmih.biSize = sizeof(bmih);
267- bmih.biWidth = width;
268- bmih.biHeight = height;
269- bmih.biPlanes = 1;
270- bmih.biBitCount = bpp * 8;
271-
272- if (bpp == 1)
273- {
274- bmih.biClrUsed = 0;
275- bmih.biCompression = 0;
276- }
277- else
278- {
279- bmih.biCompression = BI_RGB;
280- }
281-
282- bmih.biXPelsPerMeter = 2834;
283- bmih.biYPelsPerMeter = 2834;
284- FILE *file = fopen(filename, "wb");
285- if (!file)
286- return -1;
287- fwrite((void *)&bmfh, sizeof(bmfh), 1, file);
288- fwrite((void *)&bmih, sizeof(bmih), 1, file);
289- if (bpp == 1)
290- fwrite((void *)palette_data, colors * 4, 1, file);
291- pelBytes = bpp;
292- myRowWidth = bmp->Info.Stride * pelBytes;
293- bmpRowWidth = (((bmih.biWidth * pelBytes) + 3)&(~3));
294- if (bmih.biHeight > 0)
295- {
296- int y;
297- char * row;
298- row = (char *)bmp->Data[0];
299- row += (bmp->Info.Height - 1) * myRowWidth;
300- for (y = bmp->Info.Height; y--; )
301- {
302- fwrite((void *)row, bmpRowWidth, 1, file);
303- row -= myRowWidth;
304- }
305- }
306- fclose(file);
307-
308- return 1;
309-}
310-
311-// *************************************************************************
312-// * DecodeTextures Terry Bernie *
313-// *************************************************************************
314-bool VM_Textures::Soil_DecodeTextures(int TextureID)
315-{
316- //int Index = 0;
317- //int Dont = 0;
318- //int jpg = 0;
319- //int DontAdd = 0;
320- //int AddDummy = 0;
321-
322- //char buf[1024];
323- //strcpy(buf, App->CL_Vm_Model->Texture_FolderPath);
324- //strcat(buf, "Etemp.bmp");
325-
326- //// ----------------------------------- Bitmap
327- //if (_stricmp(TextureFileName + strlen(TextureFileName) - 4, ".BMP") == 0)
328- //{
329- // ////S_TextureInfo[Count] = new GLTextureInfo_Type; // Need To Populate
330-
331- // int Test = Soil_Load_Texture(g_Texture, TextureFileName, TextureID);
332- // if (Test == 0)
333- // {
334- // CreateDummyTexture();
335- // Soil_Load_Texture(g_Texture, buf, TextureID);
336- // //remove(buf);
337- // }
338-
339- // return 1;
340- //}
341- //// ------------------------------------ JPEG
342- //if (_stricmp(TextureFileName + strlen(TextureFileName) - 4, ".JPG") == 0)
343- //{
344- // //S_TextureInfo[Count] = new GLTextureInfo_Type; // Need To Populate
345-
346- // int Test = Soil_Load_Texture(g_Texture, TextureFileName, TextureID);
347- // if (Test == 0)
348- // {
349- // CreateDummyTexture();
350- // Soil_Load_Texture(g_Texture, buf, TextureID);
351- // //remove(buf);
352- // }
353-
354- // return 1;
355- //}
356- //// ------------------------------------ TGA
357- //if (_stricmp(TextureFileName + strlen(TextureFileName) - 4, ".TGA") == 0)
358- //{
359- // //S_TextureInfo[Count] = new GLTextureInfo_Type; // Need To Populate
360-
361- // int Test = Soil_Load_Texture(g_Texture, TextureFileName, TextureID);
362- // if (Test == 0)
363- // {
364- // CreateDummyTexture();
365- // Soil_Load_Texture(g_Texture, buf, TextureID);
366- // //remove(buf);
367- // }
368-
369- // return 1;
370- //}
371- //// ------------------------------------ DDS
372- //if (_stricmp(TextureFileName + strlen(TextureFileName) - 4, ".DDS") == 0)
373- //{
374- // //S_TextureInfo[Count] = new GLTextureInfo_Type; // Need To Populate
375-
376- // int Test = Soil_Load_Texture(g_Texture, TextureFileName, TextureID);
377- // if (Test == 0)
378- // {
379- // CreateDummyTexture();
380- // Soil_Load_Texture(g_Texture, buf, TextureID);
381- // //remove(buf);
382- // }
383- // return 1;
384- //}
385- //// ------------------------------------ PNG
386- //if (_stricmp(TextureFileName + strlen(TextureFileName) - 4, ".PNG") == 0)
387- //{
388- // //S_TextureInfo[Count] = new GLTextureInfo_Type; // Need To Populate
389-
390- // int Test = Soil_Load_Texture(g_Texture, TextureFileName, TextureID);
391- // if (Test == 0)
392- // {
393- // CreateDummyTexture();
394- // Soil_Load_Texture(g_Texture, buf, TextureID);
395- // //remove(buf);
396- // }
397- // return 1;
398- //}
399-
400- //CreateDummyTexture();
401- //Soil_Load_Texture(g_Texture, buf, TextureID);
402- //remove(buf);
403-
404- return 1;
405-}
406-
407-// *************************************************************************
408-// * Soil_Load_Texture Terry Bernie *
409-// *************************************************************************
410-bool VM_Textures::Soil_Load_Texture(UINT textureArray[], LPSTR strFileName, int textureID)
411-{
412- //textureArray[textureID] = SOIL_load_OGL_texture
413- //(
414- // strFileName,
415- // SOIL_LOAD_AUTO,
416- // SOIL_CREATE_NEW_ID,
417- // SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS
418- //);
419-
420- //if (textureArray[textureID] == 0) // Fall back attemp to convert and load or Bail
421- //{
422- // //App->Say("Soil Fail 2");
423- //
424- // CreateDummyTexture();
425- // char buf[1024];
426- // strcpy(buf, App->CL_Vm_Model->Texture_FolderPath);
427- // strcat(buf, "Etemp.bmp");
428-
429- // textureArray[textureID] = SOIL_load_OGL_texture
430- // (
431-
432- // buf,
433- // SOIL_LOAD_AUTO,
434- // SOIL_CREATE_NEW_ID,
435- // SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS
436- //
437- // );
438-
439- // remove(buf);
440-
441- // if (textureArray[textureID] == 0)
442- // {
443- // const char* test = SOIL_last_result();
444- // char buff[255];
445- // strcpy(buff, test);
446- // strcat(buff, "- Soil Message");
447- // App->Say(buff);
448- // return 0;
449- // }
450- //}
451-
452- //glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
453-
454- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
455- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
456-
457- ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
458-
459- return 1;
460-}
461-
462-//// *************************************************************************
463-//// * Texture_To_Bmp *
464-//// *************************************************************************
465-//bool VM_Textures::Texture_To_Bmp(char* File)
466-//{
467-// int test = ilLoadImage(File);
468-// if (test == 0)
469-// {
470-// App->Say("Cant Load Image");
471-// }
472-//
473-// ilSaveImage("Etemp.bmp");
474-//
475-// return 1;
476-//}
477-
478-// *************************************************************************
479-// * Ogre_LoadImage *
480-// *************************************************************************
481-bool VM_Textures::Ogre_LoadImage(const Ogre::String& tex_ext, const Ogre::String& texture_path,int Index)
482-{
483- /*bool image_loaded = false;
484-
485- std::ifstream ifs(texture_path.c_str(), std::ios::binary | std::ios::in);
486- if (ifs.is_open())
487- {
488- {
489- Ogre::DataStreamPtr data_stream(new Ogre::FileStreamDataStream(texture_path, &ifs, false));
490- Ogre::Image img;
491- img.load(data_stream, tex_ext);
492-
493- img.save("Etemp.bmp");
494-
495- App->CL_Vm_Model->S_TextureInfo[Index]->HasGEBitmap = 1;
496- App->CL_Vm_Model->S_TextureInfo[Index]->GEWitdth = img.getWidth();
497- App->CL_Vm_Model->S_TextureInfo[Index]->GEHeight = img.getHeight();
498-
499- App->CL_Vm_Model->S_TextureInfo[Index]->GEFormat = img.getFormat();
500-
501- img.freeMemory();
502- data_stream->close();
503-
504- image_loaded = true;
505- }
506-
507- ifs.close();*/
508- //}
509-
510- return 0;
511-}
512-
513-// *************************************************************************
514-// * HBITMAP_TO_BmpFile *
515-// *************************************************************************
516-bool VM_Textures::HBITMAP_TO_BmpFile(HBITMAP Bitmap, char* Filename, char* SaveFolder)
517-{
518- HDC hDC;
519- int iBits;
520- WORD wBitCount;
521- DWORD dwPaletteSize = 0, dwBmBitsSize = 0, dwDIBSize = 0, dwWritten = 0;
522- BITMAP Bitmap0;
523- BITMAPFILEHEADER bmfHdr;
524- BITMAPINFOHEADER bi;
525- LPBITMAPINFOHEADER lpbi;
526- HANDLE fh, hDib, hPal, hOldPal2 = NULL;
527- hDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
528- iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
529- DeleteDC(hDC);
530- if (iBits <= 1)
531- wBitCount = 1;
532- else if (iBits <= 4)
533- wBitCount = 4;
534- else if (iBits <= 8)
535- wBitCount = 8;
536- else
537- wBitCount = 24;
538- GetObject(Bitmap, sizeof(Bitmap0), (LPSTR)&Bitmap0);
539- bi.biSize = sizeof(BITMAPINFOHEADER);
540- bi.biWidth = Bitmap0.bmWidth;
541- bi.biHeight = -Bitmap0.bmHeight;
542- bi.biPlanes = 1;
543- bi.biBitCount = wBitCount;
544- bi.biCompression = BI_RGB;
545- bi.biSizeImage = 0;
546- bi.biXPelsPerMeter = 0;
547- bi.biYPelsPerMeter = 0;
548- bi.biClrImportant = 0;
549- bi.biClrUsed = 256;
550- dwBmBitsSize = ((Bitmap0.bmWidth * wBitCount + 31) & ~31) / 8
551- * Bitmap0.bmHeight;
552- hDib = GlobalAlloc(GHND, dwBmBitsSize + dwPaletteSize + sizeof(BITMAPINFOHEADER));
553- lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDib);
554- *lpbi = bi;
555-
556- hPal = GetStockObject(DEFAULT_PALETTE);
557- if (hPal)
558- {
559- hDC = GetDC(NULL);
560- hOldPal2 = SelectPalette(hDC, (HPALETTE)hPal, FALSE);
561- RealizePalette(hDC);
562- }
563-
564-
565- GetDIBits(hDC, Bitmap, 0, (UINT)Bitmap0.bmHeight, (LPSTR)lpbi + sizeof(BITMAPINFOHEADER)
566- + dwPaletteSize, (BITMAPINFO *)lpbi, DIB_RGB_COLORS);
567-
568- if (hOldPal2)
569- {
570- SelectPalette(hDC, (HPALETTE)hOldPal2, TRUE);
571- RealizePalette(hDC);
572- ReleaseDC(NULL, hDC);
573- }
574-
575- fh = CreateFile(Filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
576- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
577-
578- if (fh == INVALID_HANDLE_VALUE)
579- return FALSE;
580-
581- bmfHdr.bfType = 0x4D42; // "BM"
582- dwDIBSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + dwPaletteSize + dwBmBitsSize;
583- bmfHdr.bfSize = dwDIBSize;
584- bmfHdr.bfReserved1 = 0;
585- bmfHdr.bfReserved2 = 0;
586- bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + (DWORD)sizeof(BITMAPINFOHEADER) + dwPaletteSize;
587-
588- WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
589-
590- WriteFile(fh, (LPSTR)lpbi, dwDIBSize, &dwWritten, NULL);
591- GlobalUnlock(hDib);
592- GlobalFree(hDib);
593- CloseHandle(fh);
594-
595- return 1;
596-}
597-
598-// *************************************************************************
599-// * TexureToWinPreviewFullPath *
600-// *************************************************************************
601-bool VM_Textures::TexureToWinPreviewFullPath(int Index, char* FullPath)
602-{
603- //ilutGetBmpInfo(BITMAPINFO *Info);
604-
605- //char mFileName[1024];
606- //strcpy(mFileName, FullPath);
607-
608- //HWND PreviewWnd = 0;// GetDlgItem(App->EBC_Groups->RightGroups_Hwnd, IDC_BASETEXTURE2);
609- //HDC hDC = GetDC(PreviewWnd);
610-
611- //// ----------------------------------- Bitmap
612- //if (_stricmp(mFileName + strlen(mFileName) - 4, ".BMP") == 0)
613- //{
614- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = NULL;
615-
616- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = ilutWinLoadImage(mFileName, hDC);
617- // ReleaseDC(PreviewWnd, hDC);
618-
619- // if (App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap == NULL)
620- // {
621- // CreateDummyTexture();
622- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = (HBITMAP)LoadImage(NULL, "Etemp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
623- // remove("Etemp.bmp");
624-
625- // App->CL_Vm_Model->S_MeshGroup[Index]->Bitmap_Loaded = 1;
626- // }
627- // else
628- // {
629- // App->CL_Vm_Model->S_MeshGroup[Index]->Bitmap_Loaded = 1;
630- // }
631- //
632- // return 1;
633- //}
634- //// ------------------------------------ TGA
635- //if (_stricmp(mFileName + strlen(mFileName) - 4, ".TGA") == 0)
636- //{
637- //
638- // int Test = Ogre_LoadImage("tga", mFileName, Index);
639- // if (Test == 0)
640- // {
641- // App->Say("Failed to load image tga");
642- // }
643-
644- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = (HBITMAP)LoadImage(NULL, "Etemp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
645-
646- // remove("Etemp.bmp");
647- // return 1;
648- //}
649- //// ------------------------------------ JPEG
650- //if (_stricmp(mFileName + strlen(mFileName) - 4, ".JPG") == 0)
651- //{
652- //
653- // int Test = Ogre_LoadImage("jpg", mFileName, Index);
654- // if (Test == 0)
655- // {
656- // App->Say("Failed to load image jpg");
657- // }
658-
659- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = (HBITMAP)LoadImage(NULL,"Etemp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
660- //
661- // remove("Etemp.bmp");
662- // return 1;
663- //}
664- //// ------------------------------------ DDS
665- //if (_stricmp(mFileName + strlen(mFileName) - 4, ".DDS") == 0)
666- //{
667- // int Test = Ogre_LoadImage("dds", mFileName, Index);
668- // if (Test == 0)
669- // {
670- // App->Say("Failed to load image dds");
671- // }
672-
673- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = (HBITMAP)LoadImage(NULL, "Etemp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
674-
675- // remove("Etemp.bmp");
676- // return 1;
677- //}
678- //// ------------------------------------ PNG
679- //if (_stricmp(mFileName + strlen(mFileName) - 4, ".PNG") == 0)
680- //{
681- // int Test = Ogre_LoadImage("png", mFileName, Index);
682- // if (Test == 0)
683- // {
684- // App->Say("Failed to load image png");
685- // }
686-
687- // App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = (HBITMAP)LoadImage(NULL, "Etemp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
688-
689- // remove("Etemp.bmp");
690- // return 1;
691- //}
692-
693- //
694- //// if all fails dummy texture here
695-
696- ////CreateDummyTexture();
697-
698- ////char buf[1024];
699- ////strcpy(buf,App->EquityDirecory_FullPath);
700- ////strcat(buf,"\\");
701- ////strcat(buf,"Etemp.bmp");
702-
703- //////App->CL_Vm_Model->S_MeshGroup[Index]->Base_Bitmap = ilLoadImage("Etemp.bmp");
704- //////Soil_Load_Texture(g_Texture,buf,TextureID);
705- ////remove(buf);
706-
707- return 1;
708-}
709-
710-//// *************************************************************************
711-//// * GetHBITMAPFromImageFile Terry Bernie *
712-//// *************************************************************************
713-//HBITMAP VM_Textures::GetHBITMAPFromImageFile(const WCHAR* pFilePath)
714-//{
715-// Gdiplus:: GdiplusStartupInput gpStartupInput;
716-// ULONG_PTR gpToken;
717-// GdiplusStartup(&gpToken, &gpStartupInput, NULL);
718-// HBITMAP result = NULL;
719-// Gdiplus::Bitmap* bitmap = Gdiplus::Bitmap::FromFile(pFilePath, false);
720-// if (bitmap)
721-// {
722-// bitmap->GetHBITMAP(RGB(255, 255, 255), &result);
723-// delete bitmap;
724-// }
725-// Gdiplus::GdiplusShutdown(gpToken);
726-// return result;
727-//}
728-
729-// *************************************************************************
730-// * RemoveFile Terry Bernie *
731-// *************************************************************************
732-bool VM_Textures::RemoveFile(char* Filename, char* Folder)
733-{
734- remove(Filename);
735- return 1;
736-}
737-
738-// *************************************************************************
739-// * CreateDummyTexture Terry Bernie *
740-// *************************************************************************
741-bool VM_Textures::CreateDummyTexture(void)
742-{
743- //HBITMAP hbmpTemp;
744- //hbmpTemp = LoadBitmap(App->hInst, MAKEINTRESOURCE(IDB_DUMMY));
745-
746- //HDC hdcTemp;
747- //BITMAP bmp;
748- //PBITMAPINFO pbmi;
749- //WORD cClrBits;
750- //HANDLE hf;
751- //BITMAPFILEHEADER hdr;
752- //PBITMAPINFOHEADER pbih;
753- //LPBYTE lpBits;
754- //DWORD dwTotal;
755- //DWORD cb;
756- //BYTE *hp;
757- //DWORD dwTmp;
758-
759- //hdcTemp = CreateCompatibleDC(GetDC(0));
760- //if (!hdcTemp)
761- //{
762- // App->Say("Compatible Faild");
763- // return 0;
764- //}
765-
766- //if (!GetObject(hbmpTemp, sizeof(BITMAP), (LPSTR)&bmp))
767-
768- //{
769- // App->Say("Failed 3");
770- // return 0;
771- //}
772-
773- //cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
774- //if (cClrBits == 1)
775- // cClrBits = 1;
776- //else if (cClrBits <= 4)
777- // cClrBits = 4;
778- //else if (cClrBits <= 8)
779- // cClrBits = 8;
780- //else if (cClrBits <= 16)
781- // cClrBits = 16;
782- //else if (cClrBits <= 24)
783- // cClrBits = 24;
784- //else cClrBits = 32;
785-
786-
787- //if (cClrBits != 24)
788- // pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
789- // sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << cClrBits));
790- //else
791- // pbmi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER));
792-
793- //// Initialize the fields in the BITMAPINFO structure.
794-
795- //pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
796- //pbmi->bmiHeader.biWidth = bmp.bmWidth;
797- //pbmi->bmiHeader.biHeight = bmp.bmHeight;
798- //pbmi->bmiHeader.biPlanes = bmp.bmPlanes;
799- //pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
800- //if (cClrBits < 24)
801- // pbmi->bmiHeader.biClrUsed = (1 << cClrBits);
802-
803-
804- //pbmi->bmiHeader.biCompression = BI_RGB;
805-
806- //pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) / 8 * pbmi->bmiHeader.biHeight * cClrBits;
807-
808- //pbmi->bmiHeader.biClrImportant = 0;
809-
810- //pbih = (PBITMAPINFOHEADER)pbmi;
811- //lpBits = (LPBYTE)GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
812-
813- //if (!lpBits)
814- //{
815- // App->Say("writeBMP::Could not allocate memory");
816- // return 0;
817- //}
818-
819- //if (!GetDIBits(hdcTemp, HBITMAP(hbmpTemp), 0, (WORD)pbih->biHeight, lpBits, pbmi,
820- // DIB_RGB_COLORS))
821- //{
822- // App->Say("writeBMP::GetDIB error");
823- // return 0;
824- //}
825-
826- //char buf[1024];
827- //strcpy(buf, App->CL_Vm_Model->Texture_FolderPath);
828- //strcat(buf, "Etemp.bmp");
829-
830- //hf = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, (DWORD)0,
831- // NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
832- // (HANDLE)NULL);
833-
834- ///*hf = CreateFile(App->ETemp_Folder, GENERIC_READ | GENERIC_WRITE, (DWORD)0,
835- // NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
836- // (HANDLE)NULL);*/
837-
838- //if (hf == INVALID_HANDLE_VALUE)
839- //{
840- // App->Say("Could not create file for writing");
841- // return 0;
842- //}
843- //hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
844-
845- //hdr.bfSize = (DWORD)(sizeof(BITMAPFILEHEADER) +
846- // pbih->biSize + pbih->biClrUsed
847- // * sizeof(RGBQUAD) + pbih->biSizeImage);
848- //hdr.bfReserved1 = 0;
849- //hdr.bfReserved2 = 0;
850-
851-
852- //hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
853- // pbih->biSize + pbih->biClrUsed
854- // * sizeof(RGBQUAD);
855-
856- //if (!WriteFile(hf, (LPVOID)&hdr, sizeof(BITMAPFILEHEADER),
857- // (LPDWORD)&dwTmp, NULL)) {
858- // App->Say("Could not write in to file");
859- // return 0;
860- //}
861-
862- //if (!WriteFile(hf, (LPVOID)pbih, sizeof(BITMAPINFOHEADER)
863- // + pbih->biClrUsed * sizeof(RGBQUAD),
864- // (LPDWORD)&dwTmp, (NULL))) {
865- // App->Say("Could not write in to file");
866- // return 0;
867- //}
868-
869- //dwTotal = cb = pbih->biSizeImage;
870- //hp = lpBits;
871- //if (!WriteFile(hf, (LPSTR)hp, (int)cb, (LPDWORD)&dwTmp, NULL)) {
872- // App->Say("Could not write in to file");
873- // return 0;
874- //}
875-
876- //if (!CloseHandle(hf)) {
877- // App->Say("Could not close file");
878- // return 0;
879- //}
880-
881- //GlobalFree((HGLOBAL)lpBits);
882- //DeleteObject(hbmpTemp);
883- //DeleteDC(hdcTemp);
884-
885- return 1;
886-}
887-
888-// *************************************************************************
889-// * CheckPath Terry Bernie *
890-// *************************************************************************
891-void VM_Textures::Strip_JustFileName(char *pString, char *FileName)
892-{
893- int Count = 0;
894- int Mark = 0;
895- bool Test = 0;
896-
897- while (*pString != 0)
898- {
899- if (*pString == '\\' || *pString == '/')
900- {
901- Test = 1;
902- Mark = Count;
903- }
904-
905- Count++;
906- pString++;
907- }
908-
909- if (Mark == 0 && Test == 0)
910- {
911- strcpy(JustFileName, FileName);
912- }
913- else
914- {
915- if (Mark == 0 && Test == 1)
916- {
917- Mark = 1;
918- strcpy(JustFileName, (FileName + Mark));
919- }
920- else
921- {
922- strcpy(JustFileName, (FileName + Mark) + 1);
923- }
924- }
925-}
926-
927-// *************************************************************************
928-// * CreateTextureInfo Terry Bernie *
929-// *************************************************************************
930-void VM_Textures::CreateTextureInfo(void)
931-{
932-
933-}
934-
935-// *************************************************************************
936-// * GetFormat *
937-// *************************************************************************
938-bool VM_Textures::GetFormat(int cformat)
939-{
940- GEFormatString[0] = 0;
941-
942- switch (cformat)
943- {
944- case 0:
945- strcpy(GEFormatString, "PIXELFORMAT_NO_DATA = 0");
946- return 1;
947-
948- case 1:
949- strcpy(GEFormatString, "PIXELFORMAT_8BIT");
950- return 1;
951-
952-
953-
954- case 10:
955- strcpy(GEFormatString, "PIXELFORMAT_24BIT_BGR");
956- return 1;
957-
958-
959- case 13:
960- strcpy(GEFormatString, "PIXELFORMAT_32BIT_XRGB");
961- return 1;
962-
963- case 17:
964- strcpy(GEFormatString, "PIXELFORMAT_32BIT_ARGB");
965- return 1;
966-
967- }
968-
969- strcpy(GEFormatString, "Cant Decode");
970- return 1;
971-}
972-
973-// *************************************************************************
974-// * Jpg_To_Tga *
975-// *************************************************************************
976-bool VM_Textures::Jpg_To_Tga24(char* File)
977-{
978- char OldFile[1024];
979- strcpy(OldFile, File);
980-
981- ilLoadImage(File);
982-
983- int Len = strlen(File);
984- File[Len - 4] = 0;
985- strcat(File, ".tga");
986-
987- ilSaveImage(File);
988-
989- remove(OldFile);
990- return 1;
991-}
992-
993-// *************************************************************************
994-// * Jpg_To_png24 *
995-// *************************************************************************
996-bool VM_Textures::Jpg_To_png24(char* File)
997-{
998- char OldFile[1024];
999- strcpy(OldFile, File);
1000-
1001- ilLoadImage(File);
1002-
1003- int Len = strlen(File);
1004- File[Len - 4] = 0;
1005- strcat(File, ".png");
1006-
1007- ilSaveImage(File);
1008-
1009- remove(OldFile);
1010- return 1;
1011-}
1012-
1013-// *************************************************************************
1014-// * Bmp_To_Jpg *
1015-// *************************************************************************
1016-bool VM_Textures::Bmp_To_Jpg(char* File)
1017-{
1018- char OldFile[1024];
1019- strcpy(OldFile, File);
1020-
1021- bool test = ilLoadImage(File);
1022- if (test == 0)
1023- {
1024- App->Say("Failed to load Texture Bmp_To_Jpg");
1025- }
1026-
1027- int Len = strlen(File);
1028- File[Len - 4] = 0;
1029- strcat(File, ".jpg");
1030-
1031- ilSaveImage(File);
1032-
1033- remove(OldFile);
1034- return 1;
1035-}
1036-
--- Anim19_OSDN/VM_TextLib.cpp (revision 747)
+++ Anim19_OSDN/VM_TextLib.cpp (nonexistent)
@@ -1,1377 +0,0 @@
1-/*
2-Copyright (c) Vima19 Inflanite Software W.T.Flanigan H.C.Flanigan
3-
4-This software is provided 'as-is', without any express or implied
5-warranty. In no event will the authors be held liable for any damages
6-arising from the use of this software.
7-
8-Permission is granted to anyone to use this software for any purpose,
9-including commercial applications, and to alter it and redistribute it
10-freely, subject to the following restrictions:
11-
12-1. The origin of this software must not be misrepresented; you must not
13-claim that you wrote the original software. If you use this software
14-in a product, an acknowledgment in the product documentation would be
15-appreciated but is not required.
16-
17-2. Altered source versions must be plainly marked as such, and must not be
18-misrepresented as being the original software.
19-
20-3. This notice may not be removed or altered from any source
21-distribution.
22-*/
23-
24-#include "stdafx.h"
25-#include "resource.h"
26-#include "GD19_App.h"
27-#include "VM_TextLib.h"
28-
29-#pragma warning( disable : 4800)
30-
31-VM_TextLib::VM_TextLib()
32-{
33- Entry = nullptr;
34- p_Data = nullptr;
35-}
36-
37-VM_TextLib::~VM_TextLib()
38-{
39-
40-}
41-
42-
43-// *************************************************************************
44-// * Start_TexturePack *
45-// *************************************************************************
46-void VM_TextLib::Start_TexturePack()
47-{
48- int test = Txt_OpenFile("Texture Libary *.txl\0*.txl\0", "Texure Editor", NULL);// S_Prefs[0]->TXLFolder);
49- if (test == 0)
50- {
51-
52- return;
53- }
54-
55- DialogBox(App->hInst, (LPCTSTR)IDD_TEXTUREPACKER, App->Fdlg, (DLGPROC)TextureLib_Proc);
56-}
57-
58-// *************************************************************************
59-// * TextureLib_Proc 06/06/08 *
60-// *************************************************************************
61-LRESULT CALLBACK VM_TextLib::TextureLib_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
62-{
63- switch (message)
64- {
65- case WM_INITDIALOG:
66- {
67- SendDlgItemMessage(hDlg, IDC_TEXTURELIST, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
68- SendDlgItemMessage(hDlg, IDC_EXPORTALL, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
69- SendDlgItemMessage(hDlg, IDC_RENAME, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
70- SendDlgItemMessage(hDlg, IDC_EXPORTSELECTED, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
71- SendDlgItemMessage(hDlg, IDC_ADD, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
72- SendDlgItemMessage(hDlg, IDC_SAVEAS, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
73- SendDlgItemMessage(hDlg, IDC_SAVE, WM_SETFONT, (WPARAM)App->Font_CB15, MAKELPARAM(TRUE, 0));
74-
75- App->CL_Vm_TextLib->Entry = new BitmapEntry;
76-
77- SetWindowLong(GetDlgItem(hDlg, IDC_PREVIEW), GWL_WNDPROC, (LONG)TextureLibPreviewWnd);
78- char buf1[200];
79- HFONT Font;
80- HFONT Font1;
81- HFONT Font2;
82- HFONT Font3;
83-
84-
85- bool test = App->CL_Vm_TextLib->LoadFile(hDlg);
86- if (test == 0)
87- {
88- App->CL_Vm_TextLib->CleanUp();
89- EndDialog(hDlg, LOWORD(wParam));
90- }
91-
92- strcpy(buf1, App->Version);
93- strcat(buf1, " ");
94- strcat(buf1, App->CL_Vm_TextLib->p_Data->TXLFileName);
95- SetWindowText(hDlg, buf1);
96-
97- Font = CreateFont(-24, 0, 0, 0, 0, 0, 0, 0, 0, OUT_TT_ONLY_PRECIS, 0, 0, 0, "Arial Black");
98- Font1 = CreateFont(-20, 0, 0, 0, 0, 0, 0, 0, 0, OUT_TT_ONLY_PRECIS, 0, 0, 0, "Arial Black");
99- Font2 = CreateFont(-12, 0, 0, 0, 0, 0, 0, 0, 0, OUT_TT_ONLY_PRECIS, 0, 0, 0, "Courier Black");
100- Font3 = CreateFont(-10, 0, 0, 0, 0, 0, 0, 0, 0, OUT_TT_ONLY_PRECIS, 0, 0, 0, "Courier");
101- SendDlgItemMessage(hDlg, IDC_TEXTURE, WM_SETFONT, (WPARAM)Font, MAKELPARAM(TRUE, 0));
102- SendDlgItemMessage(hDlg, IDC_ALPHA, WM_SETFONT, (WPARAM)Font, MAKELPARAM(TRUE, 0));
103- SendDlgItemMessage(hDlg, IDC_GEINFO, WM_SETFONT, (WPARAM)Font1, MAKELPARAM(TRUE, 0));
104-
105-
106- }
107-
108- case WM_CTLCOLORDLG:
109- {
110- return (LONG)App->AppBackground;
111- }
112-
113- case WM_NOTIFY:
114- {
115- LPNMHDR some_item = (LPNMHDR)lParam;
116-
117- if (some_item->idFrom == IDOK && some_item->code == NM_CUSTOMDRAW)
118- {
119- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
120- App->Custom_Button_Normal(item);
121- return CDRF_DODEFAULT;
122- }
123-
124- if (some_item->idFrom == IDCANCEL && some_item->code == NM_CUSTOMDRAW)
125- {
126- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
127- App->Custom_Button_Normal(item);
128- return CDRF_DODEFAULT;
129- }
130-
131- if (some_item->idFrom == IDC_EXPORTALL && some_item->code == NM_CUSTOMDRAW)
132- {
133- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
134- App->Custom_Button_Normal(item);
135- return CDRF_DODEFAULT;
136- }
137-
138- if (some_item->idFrom == IDC_RENAME && some_item->code == NM_CUSTOMDRAW)
139- {
140- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
141- App->Custom_Button_Normal(item);
142- return CDRF_DODEFAULT;
143- }
144-
145- if (some_item->idFrom == IDC_EXPORTSELECTED && some_item->code == NM_CUSTOMDRAW)
146- {
147- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
148- App->Custom_Button_Normal(item);
149- return CDRF_DODEFAULT;
150- }
151-
152- if (some_item->idFrom == IDC_ADD && some_item->code == NM_CUSTOMDRAW)
153- {
154- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
155- App->Custom_Button_Normal(item);
156- return CDRF_DODEFAULT;
157- }
158-
159- if (some_item->idFrom == IDC_SAVEAS && some_item->code == NM_CUSTOMDRAW)
160- {
161- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
162- App->Custom_Button_Normal(item);
163- return CDRF_DODEFAULT;
164- }
165-
166- if (some_item->idFrom == IDC_SAVE && some_item->code == NM_CUSTOMDRAW)
167- {
168- LPNMCUSTOMDRAW item = (LPNMCUSTOMDRAW)some_item;
169- App->Custom_Button_Normal(item);
170- return CDRF_DODEFAULT;
171- }
172-
173- return CDRF_DODEFAULT;
174- }
175-
176- case WM_COMMAND:
177- {
178- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
179- {
180-
181- if (App->CL_Vm_TextLib->p_Data->Dirty)
182- {
183- int Result;
184-
185- Result = MessageBox(NULL,
186- "Do you want to save changes before quitting?",
187- "Texture Packer",
188- MB_YESNOCANCEL);
189-
190- if (Result == IDCANCEL)
191- {
192- return 0;
193- }
194-
195- if (Result == IDYES)
196- {
197- if (App->CL_Vm_TextLib->p_Data->FileNameIsValid)
198- App->CL_Vm_TextLib->Save(App->CL_Vm_TextLib->p_Data->TXLFileName);
199- else
200- App->CL_Vm_TextLib->Save(NULL);
201- }
202- }
203-
204- App->CL_Vm_TextLib->CleanUp();
205- EndDialog(hDlg, LOWORD(wParam));
206- return TRUE;
207- }
208- //-------------------Click in Texture List Box ----------------
209- if (LOWORD(wParam) == IDC_TEXTURELIST)
210- {
211- App->CL_Vm_TextLib->SelectBitmap();
212-
213- return TRUE;
214- }
215- //--------------------------------- Add -----------------------
216- if (LOWORD(wParam) == IDC_ADD)
217- {
218- int test = App->CL_Vm_TextLib->Txt_OpenFile("Texture Files ( *.bmp *.tga )\0*.bmp;*.tga\0*.tga\0*.tga\0*.bmp\0*.bmp\0", "Add Texture", "Bitmap Files");
219- if (test == 0)
220- {
221- return 1;
222- }
223-
224- App->CL_Vm_TextLib->AddTexture(NULL, App->CL_Vm_TextLib->Txt_FileName);
225- App->CL_Vm_TextLib->p_Data->Dirty = 1; // it as changed reqest save
226-
227- App->Say("Texture Added");
228- return TRUE;
229- }
230- //--------------------------------- Save ----------------------
231- if (LOWORD(wParam) == IDC_SAVE)
232- {
233-
234- App->CL_Vm_TextLib->Save(App->CL_Vm_TextLib->p_Data->TXLFileName);
235- App->Say("Saved");
236- return TRUE;
237- }
238- //--------------------------------- Rename ----------------------
239- if (LOWORD(wParam) == IDC_RENAME)
240- {
241-
242- DialogBox(App->hInst, (LPCTSTR)IDD_RENAME,App->Fdlg, (DLGPROC)RenameProc);
243- App->CL_Vm_TextLib->p_Data->Dirty = 1; // it as changed reqest save
244- return TRUE;
245- }
246- //--------------------------------- Save AS --------------------
247- if (LOWORD(wParam) == IDC_SAVEAS)
248- {
249-
250- App->CL_Vm_TextLib->Save(NULL);
251- App->Say("Saved");
252- return TRUE;
253- }
254-
255- //--------------------------------- IDC_LOAD --------------------
256- /* if (LOWORD(wParam) == IDC_LOAD)
257- {
258-
259- C_TetureLib->TPack_ExtractSelected();
260-
261- strcpy(FileName,C_TetureLib->L_FileName);
262-
263- if (stricmp(C_TetureLib->L_FileName+strlen(C_TetureLib->L_FileName)-4,".bmp") == 0)
264- {
265-
266- int textureID=S_TextureInfo[PictureIndex]->ActorMaterialIndex;
267- S_TextureInfo[PictureIndex]->Tga=0;
268- NEWLoadTexture(g_Texture,C_TetureLib->L_FileName,textureID,PictureIndex);
269- Test();
270- At->SingleTextureInfo(PictureIndex);
271- C_Display->TextureNames();
272- }
273- if (stricmp(C_TetureLib->L_FileName+strlen(C_TetureLib->L_FileName)-4,".tga") == 0)
274- {
275-
276-
277- C_File->LoadTGA(C_TetureLib->L_FileName);
278- C_Textures->ReloadTextures(g_Texture);
279- At->SingleTextureInfo(PictureIndex);
280- C_Display->TextureNames();
281- }
282-
283- DeleteFile(C_TetureLib->L_FileName);
284-
285- return TRUE;
286- }*/
287-
288- //--------------------------------- Save AS --------------------
289- if (LOWORD(wParam) == IDC_EXPORTSELECTED)
290- {
291- App->CL_Vm_TextLib->TPack_ExtractSelected();
292- App->Say("Texture Exported");
293- return TRUE;
294- }
295-
296- //--------------------------------- Export All -----------------
297- if (LOWORD(wParam) == IDC_EXPORTALL)
298- {
299- char File[256];
300-
301- _getcwd(App->CL_Vm_TextLib->LastPath, 256);
302- _splitpath(App->CL_Vm_TextLib->p_Data->TXLFileName, NULL, NULL, File, NULL);
303- strcat(File, "_Textures");
304-
305- strcpy(App->Com_CDialogs->BrowserMessage, "Select Folder To Extract Textures");
306- int Test = App->Com_CDialogs->StartBrowser("", App->Fdlg);
307- if (Test == 0)
308- {
309- return 0;
310- }
311-
312- App->CL_Vm_TextLib->TPack_ExtractAll();
313-
314- App->Say("All Textures Exported");
315- return TRUE;
316- }
317-
318- }
319-
320- case WM_CTLCOLORSTATIC:
321- {
322-
323- /*if (GetDlgItem(hDlg, IDC_ALPHA) == (HWND)lParam)
324- {
325- SetBkColor((HDC)wParam, RGB(0, 255, 0));
326- SetTextColor((HDC)wParam, RGB(0, 0, 0));
327- SetBkMode((HDC)wParam, TRANSPARENT);
328- hBrushStatic = CreateSolidBrush(RGB(200, 200, 0));
329- return (UINT)hBrushStatic;
330- }
331- if (GetDlgItem(hDlg, IDC_TEXTURE) == (HWND)lParam)
332- {
333- SetBkColor((HDC)wParam, RGB(0, 255, 0));
334- SetTextColor((HDC)wParam, RGB(0, 0, 0));
335- SetBkMode((HDC)wParam, TRANSPARENT);
336- hBrushStatic = CreateSolidBrush(RGB(200, 200, 0));
337- return (UINT)hBrushStatic;
338- }*/
339-
340- break;
341- }
342- break;
343- }
344- return FALSE;
345-}
346-
347-// *************************************************************************
348-// * TextureLibPreviewWnd *
349-// *************************************************************************
350-
351-bool CALLBACK VM_TextLib::TextureLibPreviewWnd(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
352-{
353-
354- if (msg == WM_PAINT)
355- {
356-
357- PAINTSTRUCT ps;
358- HDC hDC;
359- RECT Rect;
360-
361- hDC = BeginPaint(hwnd, &ps);
362- GetClientRect(hwnd, &Rect);
363- Rect.left--;
364- Rect.bottom--;
365- FillRect(hDC, &Rect, (HBRUSH)(COLOR_WINDOW + 1));
366-
367- if (App->CL_Vm_TextLib->Entry->Bitmap != NULL)
368- {
369- RECT Source;
370- RECT Dest;
371- HDC hDC;
372-
373- Source.left = 0;
374- Source.top = 0;
375- Source.bottom = geBitmap_Height(App->CL_Vm_TextLib->Entry->Bitmap);
376- Source.right = geBitmap_Width(App->CL_Vm_TextLib->Entry->Bitmap);
377-
378- Dest = Rect;
379-
380- hDC = GetDC(hwnd);
381- SetStretchBltMode(hDC, HALFTONE);
382-
383- App->CL_Vm_TextLib->Render2d_Blit(hDC,
384- App->CL_Vm_TextLib->Entry->WinBitmap,
385- App->CL_Vm_TextLib->Entry->WinABitmap,
386- &Source,
387- &Dest);
388-
389- ReleaseDC(hwnd, hDC);
390- }
391- EndPaint(hwnd, &ps);
392- return 0;
393- }
394-
395- return DefWindowProc(hwnd, msg, wParam, lParam);
396-}
397-
398-// *************************************************************************
399-// * WriteTGA *
400-// *************************************************************************
401-int VM_TextLib::WriteTGA(const char * pszFile, geBitmap *pBitmap)
402-{
403- geBitmap * pLock = NULL;
404- geBitmap * pLockA = NULL;
405- gePixelFormat Format;
406- gePixelFormat FormatA;
407- geBitmap_Info BitmapInfo;
408- int nErrorCode = TPACKERROR_UNKNOWN; // Return code
409- TGAHEADER tgah;
410- long footer = 0;
411- char signature[18] = "TRUEVISION-XFILE.";
412-
413- uint8 * pPixelData;
414- uint8 * pPixelDataA;
415-
416- int i, j;
417- HANDLE hFile = NULL;
418- DWORD nBytesWritten;
419-
420- // Create the .TGA file.
421- hFile = CreateFile(pszFile,
422- GENERIC_READ | GENERIC_WRITE,
423- (DWORD)0,
424- NULL,
425- CREATE_ALWAYS,
426- FILE_ATTRIBUTE_NORMAL,
427- (HANDLE)NULL);
428-
429- if (hFile == INVALID_HANDLE_VALUE)
430- return TPACKERROR_CREATEFILE;
431-
432- // get 24-bit bitmap
433- Format = GE_PIXELFORMAT_24BIT_BGR;
434- FormatA = GE_PIXELFORMAT_8BIT_GRAY;
435-
436- if (geBitmap_GetBits(pBitmap))
437- {
438- pLock = pBitmap;
439- }
440- else
441- {
442- if (!geBitmap_LockForRead(pBitmap, &pLock, 0, 0, Format, GE_FALSE, 0))
443- {
444- return FALSE;
445- }
446- }
447-
448- if (geBitmap_GetBits(geBitmap_GetAlpha(pBitmap)))
449- {
450- pLockA = geBitmap_GetAlpha(pBitmap);
451- }
452- else
453- {
454- if (!geBitmap_LockForRead(geBitmap_GetAlpha(pBitmap), &pLockA, 0, 0, FormatA, GE_FALSE, 0))
455- {
456- return FALSE;
457- }
458- }
459-
460- geBitmap_GetInfo(pLock, &BitmapInfo, NULL);
461- if (BitmapInfo.Format != Format)
462- {
463- nErrorCode = TPACKERROR_UNKNOWN;
464- goto ExitWriteBitmap;
465- }
466-
467-
468- tgah.IDLength = 0;
469- tgah.ColorMapType = 0;
470- tgah.ImageType = 2; // we create an uncompressed, true color image
471- tgah.CMFirstEntry = 0;
472- tgah.CMLength = 0;
473- tgah.CMEntrySize = 0;
474- tgah.Xorigin = 0;
475- tgah.Yorigin = 0;
476-
477- tgah.Width = (uint16)BitmapInfo.Width;
478- tgah.Height = (uint16)BitmapInfo.Height;
479-
480- tgah.PixelDepth = 32;
481- tgah.ImageDescriptor = 8; //00001000 - not flipped, 8 alpha bits
482-
483-
484- pPixelData = (uint8*)geBitmap_GetBits(pLock);
485-
486- pPixelDataA = (uint8*)geBitmap_GetBits(pLockA);
487-
488- // Write the tga header
489- if (!WriteFile(hFile, (LPVOID)&tgah, sizeof(TGAHEADER), (LPDWORD)&nBytesWritten, (NULL)))
490- {
491- nErrorCode = TPACKERROR_WRITE;
492- goto ExitWriteBitmap;
493- }
494-
495- // write pixels
496- pPixelData += 3 * tgah.Width*(tgah.Height - 1);
497- pPixelDataA += tgah.Width*(tgah.Height - 1);
498- for (i = 0; i < tgah.Height; i++)
499- {
500- for (j = 0; j < tgah.Width; j++)
501- {
502- if (!WriteFile(hFile, (LPVOID)pPixelData, 3, (LPDWORD)&nBytesWritten, (NULL)))
503- {
504- nErrorCode = TPACKERROR_WRITE;
505- goto ExitWriteBitmap;
506- }
507-
508- pPixelData += 3;
509-
510-
511- if (!WriteFile(hFile, (LPVOID)pPixelDataA, 1, (LPDWORD)&nBytesWritten, (NULL)))
512- {
513- nErrorCode = TPACKERROR_WRITE;
514- goto ExitWriteBitmap;
515- }
516- pPixelDataA++;
517- }
518-
519- pPixelData -= 2 * 3 * tgah.Width;
520- pPixelDataA -= 2 * tgah.Width;
521- }
522-
523- // write the signature
524- if (!WriteFile(hFile, (LPVOID)&footer, 4, (LPDWORD)&nBytesWritten, (NULL)))
525- {
526- nErrorCode = TPACKERROR_WRITE;
527- goto ExitWriteBitmap;
528- }
529-
530- if (!WriteFile(hFile, (LPVOID)&footer, 4, (LPDWORD)&nBytesWritten, (NULL)))
531- {
532- nErrorCode = TPACKERROR_WRITE;
533- goto ExitWriteBitmap;
534- }
535-
536- if (!WriteFile(hFile, (LPVOID)signature, 18, (LPDWORD)&nBytesWritten, (NULL)))
537- {
538- nErrorCode = TPACKERROR_WRITE;
539- goto ExitWriteBitmap;
540- }
541-
542- CloseHandle(hFile);
543- hFile = NULL;
544-
545- // Success!
546- nErrorCode = TPACKERROR_OK;
547-
548-ExitWriteBitmap:
549-
550- // Clean-up
551- //------------------------------------
552- // Make sure the file gets closed
553- if (hFile)
554- CloseHandle(hFile);
555-
556- // Unlock the geBitmap
557- if (pLock != pBitmap)
558- {
559- geBitmap_UnLock(pLock);
560- }
561-
562- if (pLockA != geBitmap_GetAlpha(pBitmap))
563- {
564- geBitmap_UnLock(pLockA);
565- }
566-
567- return nErrorCode;
568-}
569-
570-
571-// *************************************************************************
572-// * FindBitmap *
573-// *************************************************************************
574-bool VM_TextLib::Render2d_Blit(HDC hDC, HBITMAP Bmp, HBITMAP Alpha, const RECT *SourceRect, const RECT *DestRect)
575-{
576- HDC MemDC;
577- int SourceWidth;
578- int SourceHeight;
579- int DestWidth;
580- int DestHeight;
581-
582- MemDC = CreateCompatibleDC(hDC);
583- if (MemDC == NULL)
584- return FALSE;
585-
586- SelectObject(MemDC, Bmp);
587- SourceWidth = SourceRect->right - SourceRect->left;
588- SourceHeight = SourceRect->bottom - SourceRect->top;
589- DestWidth = DestRect->right - DestRect->left;
590- DestHeight = DestRect->bottom - DestRect->top;
591- SetStretchBltMode(hDC, COLORONCOLOR);
592- StretchBlt(hDC,
593- DestRect->left,
594- DestRect->top,
595- DestHeight,
596- DestHeight,
597- MemDC,
598- SourceRect->left,
599- SourceRect->top,
600- SourceWidth,
601- SourceHeight,
602- SRCCOPY);
603-
604- if (Alpha)
605- {
606- SelectObject(MemDC, Alpha);
607- SetStretchBltMode(hDC, COLORONCOLOR);
608- StretchBlt(hDC,
609- DestRect->left + DestHeight + 2,
610- DestRect->top,
611- DestHeight,
612- DestHeight,
613- MemDC,
614- SourceRect->left,
615- SourceRect->top,
616- SourceWidth,
617- SourceHeight,
618- SRCCOPY);
619- }
620-
621- DeleteDC(MemDC);
622-
623- return TRUE;
624-}
625-
626-// *************************************************************************
627-// * TPack_ExtractAll *
628-// *************************************************************************
629-int VM_TextLib::WriteBMP8(const char * pszFile, geBitmap *pBitmap)
630-{
631-
632- return 0;
633-}
634-
635-//// TXL LIBRARY STUFF
636-// *************************************************************************
637-// * LoadFile 06/06/08 *
638-// *************************************************************************
639-bool VM_TextLib::LoadFile(HWND ChDlg)
640-{
641- geVFile * VFS = NULL;
642- geVFile_Finder * Finder = NULL;
643- geVFile_Finder * FinderCount = NULL;
644-
645- p_Data = new TPack_WindowData;
646- p_Data->hwnd = ChDlg;
647- p_Data->BitmapCount = 0;
648-
649- int TextureCount = 0;
650-
651-
652- //App->Say(Txt_FileName);
653- //App->Say(Txt_Path_FileName);
654- VFS = geVFile_OpenNewSystem(NULL, GE_VFILE_TYPE_VIRTUAL, Txt_Path_FileName, NULL, GE_VFILE_OPEN_READONLY | GE_VFILE_OPEN_DIRECTORY);
655- if (!VFS)
656- {
657- NonFatalError("Could not open file %s", Txt_Path_FileName);
658- return 0;
659- }
660-
661- FinderCount = geVFile_CreateFinder(VFS, "*.*");
662- if (!FinderCount)
663- {
664- NonFatalError("Could not load textures from 1 %s", Txt_Path_FileName);
665- geVFile_Close(VFS);
666- return 0;
667- }
668-
669- while (geVFile_FinderGetNextFile(FinderCount) != GE_FALSE)
670- {
671-
672- TextureCount++;
673-
674- }
675-
676- Finder = geVFile_CreateFinder(VFS, "*.*");
677- if (!Finder)
678- {
679- NonFatalError("Could not load textures from 2 %s", Txt_Path_FileName);
680- geVFile_Close(VFS);
681- return 0;
682- }
683-
684-
685- while (geVFile_FinderGetNextFile(Finder) != GE_FALSE)
686- {
687- geVFile_Properties Properties;
688-
689- geVFile_FinderGetProperties(Finder, &Properties);
690- if (!AddTexture(VFS, Properties.Name))
691- {
692- geVFile_Close(VFS);
693- return 0;
694- }
695-
696- }
697- strcpy(p_Data->TXLFileName, Txt_FileName);
698- p_Data->FileNameIsValid = TRUE;
699- p_Data->Dirty = FALSE;
700- geVFile_Close(VFS);
701-
702- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
703- App->CL_Vm_TextLib->SelectBitmap();
704- return 1;
705-}
706-
707-
708-// *************************************************************************
709-// * NonFatalError *
710-// *************************************************************************
711-bool VM_TextLib::NonFatalError(const char *Msg, ...)
712-{
713- char Buffer[1024];
714- va_list argptr;
715-
716- va_start(argptr, Msg);
717- vsprintf(Buffer, Msg, argptr);
718- va_end(argptr);
719-
720- MessageBox(NULL, Buffer, "Error", MB_ICONEXCLAMATION | MB_OK);
721- return 1;
722-}
723-
724-// *************************************************************************
725-// * AddTexture 06/06/08 *
726-// *************************************************************************
727-bool VM_TextLib::AddTexture(geVFile *BaseFile, const char *Path)
728-{
729- geBitmap_Info PInfo;
730- geBitmap_Info SInfo;
731- geBitmap * Bitmap;
732-
733- geVFile * File;
734- char FileName[_MAX_FNAME];
735- char * Name;
736-
737- Bitmap = NULL;
738- File = NULL;
739-
740- _splitpath(Path, NULL, NULL, FileName, NULL);
741- Name = _strdup(FileName);
742- if (!Name)
743- {
744- NonFatalError("Memory allocation error processing %s", Path);
745- return FALSE;
746- }
747-
748- if (BaseFile)
749- File = geVFile_Open(BaseFile, Path, GE_VFILE_OPEN_READONLY);
750- else
751- File = geVFile_OpenNewSystem(NULL, GE_VFILE_TYPE_DOS, Path, NULL, GE_VFILE_OPEN_READONLY);
752-
753- if (!File)
754- {
755- NonFatalError("Could not open %s", Path);
756- return TRUE;
757- }
758-
759- Bitmap = geBitmap_CreateFromFile(File);
760- geVFile_Close(File);
761- if (!Bitmap)
762- {
763- NonFatalError("%s is not a valid bitmap", Path);
764- return TRUE;
765- }
766- geBitmap_GetInfo(Bitmap, &PInfo, &SInfo);
767- // if (PInfo.Format != GE_PIXELFORMAT_8BIT)
768- // {
769- // NonFatalError("%s is not an 8bit bitmap", Path);
770- // goto fail;
771- // }
772- // NewBitmapList = geRam_Realloc(pData->Bitmaps, sizeof(*NewBitmapList) * (pData->BitmapCount + 1));
773- NewBitmapList[p_Data->BitmapCount] = new BitmapEntry;
774- if (!NewBitmapList)
775- {
776- NonFatalError("Memory allocation error processing %s", Path);
777- return TRUE;
778- }
779-
780- NewBitmapList[p_Data->BitmapCount]->Name = Name;
781- NewBitmapList[p_Data->BitmapCount]->Bitmap = Bitmap;
782- NewBitmapList[p_Data->BitmapCount]->WinBitmap = NULL;
783- NewBitmapList[p_Data->BitmapCount]->WinABitmap = NULL;
784- NewBitmapList[p_Data->BitmapCount]->Flags = 0;
785- p_Data->BitmapCount++;
786-
787- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)Name);
788-
789- return TRUE;
790-
791-}
792-
793-
794-// *************************************************************************
795-// * SelectBitmap 06/06/08 *
796-// *************************************************************************
797-bool VM_TextLib::SelectBitmap()
798-{
799-
800- int Index;
801-
802- int location = 0;
803-
804- Index = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
805- if (Index == LB_ERR)
806- {
807- // Entry = NULL;
808- }
809- else
810- {
811- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETTEXT, (WPARAM)Index, (LPARAM)&TextureName[0]);
812-
813- location = FindBitmap(p_Data, TextureName);
814-
815- // assert(Entry);
816- if (!NewBitmapList[location]->WinBitmap)
817- {
818- HWND PreviewWnd;
819- HBITMAP hbm;
820- HBITMAP ahbm;
821- HDC hDC;
822-
823- PreviewWnd = GetDlgItem(p_Data->hwnd, IDC_PREVIEW);
824- hDC = GetDC(PreviewWnd);
825- hbm = CreateHBitmapFromgeBitmap(NewBitmapList[location]->Bitmap, hDC);
826- NewBitmapList[location]->WinBitmap = hbm;
827-
828- if (geBitmap_HasAlpha(NewBitmapList[location]->Bitmap))
829- {
830- ahbm = CreateHBitmapFromgeBitmap(geBitmap_GetAlpha(NewBitmapList[location]->Bitmap), hDC);
831- NewBitmapList[location]->WinABitmap = ahbm;
832- }
833- ReleaseDC(PreviewWnd, hDC);
834- }
835-
836- if (!NewBitmapList[location]->WinBitmap)
837- {
838- NonFatalError("Memory allocation error creating bitmap");
839- return 0;
840- }
841- }
842-
843- InvalidateRect(GetDlgItem(p_Data->hwnd, IDC_PREVIEW), NULL, TRUE);
844-
845- Entry = NewBitmapList[location];
846- UpDateGeList(location);
847-
848- return 0;
849-}
850-
851-
852-// *************************************************************************
853-// * FindBitmap 06/06/08 *
854-// *************************************************************************
855-int VM_TextLib::FindBitmap(TPack_WindowData *p_Data, const char *Name)
856-{
857- int i;
858-
859- for (i = 0; i < p_Data->BitmapCount; i++)
860- {
861-
862- if (!strcmp(Name, NewBitmapList[i]->Name))
863- {
864- return i;
865- }
866- }
867-
868- return -1;
869-}
870-
871-
872-
873-// *************************************************************************
874-// * CreateHBitmapFromgeBitmap 06/06/08 *
875-// *************************************************************************
876-HBITMAP VM_TextLib::CreateHBitmapFromgeBitmap(geBitmap *Bitmap, HDC hdc)
877-{
878- HBITMAP hbm = NULL;
879-
880- return hbm;
881-}
882-
883-
884-// *************************************************************************
885-// * UpDateGeList 06/06/08 *
886-// *************************************************************************
887-bool VM_TextLib::UpDateGeList(int Location)
888-{
889- int B = 0;
890- geBitmap_Info MPInfo;
891- geBitmap_Info MSInfo;
892-
893- char buff[256];
894- strcpy(buff, "no info");
895- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_RESETCONTENT, (WPARAM)0, (LPARAM)0);
896-
897- sprintf(buff, "%s %s", "Texture Name :-", NewBitmapList[Location]->Name);
898- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_ADDSTRING, (WPARAM)0, (LPARAM)buff);
899-
900- sprintf(buff, "%s %i", "Index :-", Location);
901- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_ADDSTRING, (WPARAM)0, (LPARAM)buff);
902-
903- sprintf(buff, "%s %s", "Bitmap :-", "Valid");
904- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_ADDSTRING, (WPARAM)0, (LPARAM)buff);
905-
906- sprintf(buff, "%s %d", "Width :-", geBitmap_Width(NewBitmapList[Location]->Bitmap));
907- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_ADDSTRING, (WPARAM)0, (LPARAM)buff);
908-
909- sprintf(buff, "%s %d", "Height :-", geBitmap_Height(NewBitmapList[Location]->Bitmap));
910- SendDlgItemMessage(p_Data->hwnd, IDC_GEINFO, LB_ADDSTRING, (WPARAM)0, (LPARAM)buff);
911-
912-
913- geBitmap_GetInfo(NewBitmapList[Location]->Bitmap, &MPInfo, &MSInfo);
914-
915- return 1;
916-}
917-
918-// *************************************************************************
919-// * ExtractSelected 21/06/08 *
920-// *************************************************************************
921-bool VM_TextLib::TPack_ExtractSelected()
922-{
923- HWND hLB = 0;// GetDlgItem(pData->hwnd, IDC_TEXTURELIST);
924- int nSel;
925- // BitmapEntry * pEntry;
926- char szName[256];
927- char szFile[256];
928- char szPath[256];
929- int nErrorCode;
930-
931- //----------------------------------------------
932- // Get current selected list box entry.
933- // Get the geBitmap.
934- // Write 8-bit BMP file.
935- //----------------------------------------------
936-
937- // Ouput to the current directory
938-
939- GetCurrentDirectory(MAX_PATH, szPath);
940-
941- nSel = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
942- if (nSel == LB_ERR)
943- {
944- // Entry = NULL;
945- }
946- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETTEXT, (WPARAM)nSel, (LPARAM)&szName[0]);
947-
948-
949- // App->CL_Vm_TextLib->pEntry = FindBitmap(pData, szName);
950- // if (pEntry)
951- {
952- // Create an output file name
953- strcpy(szFile, szPath);
954- strcat(szFile, "\\");
955- strcat(szFile, NewBitmapList[nSel]->Name);
956-
957- if (geBitmap_HasAlpha(NewBitmapList[nSel]->Bitmap))
958- {
959- char Buf1[200];
960- strcpy(Buf1, NewBitmapList[nSel]->Name);
961- strcat(Buf1, ".tga");
962-
963- int Test = SaveSelectedFile("Tga File *.tga\0*.tga\0", Buf1);
964- if (Test == 0)
965- {
966- return 0;
967- }
968-
969- int Check = CheckExtention(SaveFile);
970- if (Check == 0)
971- {
972- strcat(SaveFile, ".tga");
973- }
974- strcpy(L_FileName, SaveFile);
975- }
976- else
977- {
978- char Buf1[200];
979- strcpy(Buf1, NewBitmapList[nSel]->Name);
980- strcat(Buf1, ".bmp");
981- int Test = SaveSelectedFile("Bitmap File *.bmp\0*.bmp\0", Buf1);
982- if (Test == 0)
983- {
984- return 0;
985- }
986-
987- int Check = CheckExtention(SaveFile);
988- if (Check == 0)
989- {
990- strcat(SaveFile, ".bmp");
991- }
992- strcpy(L_FileName, SaveFile);
993- }
994-
995- if (geBitmap_HasAlpha(NewBitmapList[nSel]->Bitmap))
996- nErrorCode = WriteTGA(SaveFile, NewBitmapList[nSel]->Bitmap);
997- else
998- nErrorCode = WriteBMP8(SaveFile, NewBitmapList[nSel]->Bitmap);
999- // end change
1000-
1001- if (nErrorCode != TPACKERROR_OK)
1002- {
1003- // Error writing this bitmap
1004- switch (nErrorCode)
1005- {
1006- case TPACKERROR_CREATEFILE:
1007- NonFatalError("Unable to create output file %s", SaveFile);
1008- break;
1009- case TPACKERROR_WRITE:
1010- NonFatalError("I/O error writing %s", szFile);
1011- break;
1012- case TPACKERROR_MEMORYALLOCATION:
1013- NonFatalError("Memory allocation error writing %s", SaveFile);
1014- break;
1015- case TPACKERROR_UNKNOWN:
1016- default:
1017- NonFatalError("UInknown error writing %s", SaveFile);
1018- }
1019- }
1020-
1021- }
1022- return 1;
1023-}
1024-
1025-
1026-// *************************************************************************
1027-// * SaveSelectedFile 09/04/04 *
1028-// *************************************************************************
1029-bool VM_TextLib::SaveSelectedFile(char* Extension, char* TszFile)
1030-{
1031- OPENFILENAME ofn;
1032- char LszFile[260];
1033- LszFile[0] = 0;
1034- strcpy(LszFile, TszFile);
1035-
1036-
1037- // strcpy(szFile,FileNameFullACP); // Copy OpenFile Name
1038- ZeroMemory(&ofn, sizeof(ofn));
1039- ofn.lStructSize = sizeof(ofn);
1040- ofn.hwndOwner = App->MainHwnd;
1041- ofn.hInstance = App->hInst;
1042- ofn.lpstrFile = LszFile;
1043- ofn.nMaxFile = sizeof(LszFile);
1044- ofn.lpstrFilter = Extension;
1045-
1046- ofn.nFilterIndex = 1;
1047- ofn.lpstrFileTitle = SaveFile;
1048- ofn.nMaxFileTitle = sizeof(SaveFile);;
1049- ofn.lpstrInitialDir = NULL;
1050- ofn.lpstrTitle = "Save Texture";
1051-
1052- ofn.Flags =
1053- OFN_PATHMUSTEXIST |
1054- OFN_FILEMUSTEXIST |
1055- OFN_EXPLORER |
1056- OFN_HIDEREADONLY |
1057- OFN_OVERWRITEPROMPT;
1058- if (GetSaveFileName(&ofn) == TRUE)
1059- {
1060- strcpy(SaveFile, LszFile);
1061- return 1;
1062- }
1063-
1064- return 0;
1065-}
1066-
1067-
1068-// *************************************************************************
1069-// * CheckExtention 09/04/04 *
1070-// *************************************************************************
1071-bool VM_TextLib::CheckExtention(char *FileName)
1072-{
1073- int ch = '.';
1074- char *IsIt;
1075- IsIt = strchr(FileName, ch);
1076- if (IsIt == NULL) // if no extension . extension return 0
1077- {
1078- return 0;
1079- }
1080- return 1; // file name has an extension return 1;
1081-}
1082-
1083-
1084-// *************************************************************************
1085-// * TPack_ExtractAll 06/06/08 *
1086-// *************************************************************************
1087-bool VM_TextLib::TPack_ExtractAll()
1088-{
1089- HWND hLB = GetDlgItem(p_Data->hwnd, IDC_TEXTURELIST);
1090- int nCount;
1091- int i;
1092- // BitmapEntry * pEntry;
1093- char szName[256];
1094- char szFile[256];
1095- int nErrorCode;
1096-
1097- nCount = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCOUNT, (WPARAM)0, (LPARAM)0);
1098-
1099- for (i = 0; i < nCount; i++)
1100- {
1101- if (SendMessage(p_Data->hwnd, LB_GETTEXT, i, (LPARAM)(LPCTSTR)szName) != LB_ERR) // Get text
1102- {
1103-
1104- if (NewBitmapList[i])
1105- {
1106- strcpy(szFile, App->Com_CDialogs->szSelectedDir);
1107- strcat(szFile, "\\");
1108- strcat(szFile, NewBitmapList[i]->Name);
1109-
1110- if (geBitmap_HasAlpha(NewBitmapList[i]->Bitmap))
1111- strcat(szFile, ".tga");
1112- else
1113- strcat(szFile, ".bmp");
1114-
1115-
1116- if (geBitmap_HasAlpha(NewBitmapList[i]->Bitmap))
1117- nErrorCode = WriteTGA(szFile, NewBitmapList[i]->Bitmap);
1118- else
1119- nErrorCode = WriteBMP8(szFile, NewBitmapList[i]->Bitmap);
1120-
1121-
1122- if (nErrorCode != TPACKERROR_OK)
1123- {
1124- // Error writing this bitmap
1125- switch (nErrorCode)
1126- {
1127- case TPACKERROR_CREATEFILE:
1128- NonFatalError("Unable to create output file %s", szFile);
1129- break;
1130- case TPACKERROR_WRITE:
1131- NonFatalError("I/O error writing %s", szFile);
1132- break;
1133- case TPACKERROR_MEMORYALLOCATION:
1134- NonFatalError("Memory allocation error writing %s", szFile);
1135- break;
1136- case TPACKERROR_UNKNOWN:
1137- default:
1138- NonFatalError("UInknown error writing %s", szFile);
1139- }
1140-
1141- break;
1142- }
1143- }
1144- }
1145- }
1146-
1147- return 1;
1148-}
1149-
1150-// *************************************************************************
1151-// * Save/SaveAs 13/06/08 *
1152-// *************************************************************************
1153-bool VM_TextLib::Save(const char *Path)
1154-{
1155- char FileName[_MAX_PATH];
1156- geVFile * VFS;
1157- int i;
1158-
1159- if (!Path)
1160- {
1161- OPENFILENAME ofn; // Windows open filename structure...
1162- char Filter[_MAX_PATH];
1163- char Dir[_MAX_PATH];
1164-
1165- FileName[0] = '\0';
1166-
1167- GetCurrentDirectory(sizeof(Dir), Dir);
1168-
1169- ofn.lStructSize = sizeof(OPENFILENAME);
1170- ofn.hwndOwner = p_Data->hwnd;
1171- ofn.hInstance = p_Data->Instance;
1172- {
1173- char *c;
1174-
1175- // build actor file filter string
1176- strcpy(Filter, "Texture Libraries (*.txl)");
1177- c = &Filter[strlen(Filter)] + 1;
1178- // c points one beyond end of string
1179- strcpy(c, "*.txl");
1180- c = &c[strlen(c)] + 1;
1181- *c = '\0'; // 2nd terminating nul character
1182- }
1183- ofn.lpstrFilter = Filter;
1184- ofn.lpstrCustomFilter = NULL;
1185- ofn.nMaxCustFilter = 0;
1186- ofn.nFilterIndex = 1;
1187- ofn.lpstrFile = FileName;
1188- ofn.nMaxFile = sizeof(FileName);
1189- ofn.lpstrFileTitle = FileName;
1190- ofn.nMaxFileTitle = sizeof(FileName);
1191- ofn.lpstrInitialDir = Dir;
1192- ofn.lpstrTitle = NULL;
1193- ofn.Flags = OFN_HIDEREADONLY;
1194- ofn.nFileOffset = 0;
1195- ofn.nFileExtension = 0;
1196- ofn.lpstrDefExt = "txl";
1197- ofn.lCustData = 0;
1198- ofn.lpfnHook = NULL;
1199- ofn.lpTemplateName = NULL;
1200-
1201- if (!GetSaveFileName(&ofn))
1202- return 0;
1203-
1204- Path = FileName;
1205- }
1206-
1207- _unlink(Path);
1208- VFS = geVFile_OpenNewSystem(NULL, GE_VFILE_TYPE_VIRTUAL, Path, NULL, GE_VFILE_OPEN_CREATE | GE_VFILE_OPEN_DIRECTORY);
1209- if (!VFS)
1210- {
1211- NonFatalError("Could not open file %s", Path);
1212- return 0;
1213- }
1214-
1215- for (i = 0; i < p_Data->BitmapCount; i++)
1216- {
1217- geVFile * File;
1218- geBoolean WriteResult;
1219-
1220-
1221-
1222- File = geVFile_Open(VFS, NewBitmapList[i]->Name, GE_VFILE_OPEN_CREATE);
1223- if (!File)
1224- {
1225- NonFatalError("Could not save bitmap %s", NewBitmapList[i]->Name);
1226- geVFile_Close(VFS);
1227- return 0;
1228- }
1229- WriteResult = geBitmap_WriteToFile(NewBitmapList[i]->Bitmap, File);
1230- geVFile_Close(File);
1231- if (WriteResult == GE_FALSE)
1232- {
1233- NonFatalError("Could not save bitmap %s", NewBitmapList[i]->Name);
1234- geVFile_Close(VFS);
1235- return 0;
1236- }
1237- }
1238-
1239- strcpy(p_Data->TXLFileName, Path);
1240- p_Data->FileNameIsValid = TRUE;
1241-
1242- if (geVFile_Close(VFS) == GE_FALSE)
1243- NonFatalError("I/O error writing %s", Path);
1244- else
1245- p_Data->Dirty = FALSE;
1246- return 1;
1247-}
1248-
1249-
1250-// *************************************************************************
1251-// * CleanUp 06/06/08 *
1252-// *************************************************************************
1253-bool VM_TextLib::CleanUp()
1254-{
1255-
1256- if (Entry) { delete Entry; Entry = NULL; }
1257-
1258- //if (pData ) { delete pData; pData = NULL; }
1259- return 1;
1260-}
1261-
1262-// *************************************************************************
1263-// * GetName 06/06/08 *
1264-// *************************************************************************
1265-bool VM_TextLib::GetName()
1266-{
1267-
1268- int Index = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
1269- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETTEXT, (WPARAM)Index, (LPARAM)&TextureName[0]);
1270- return 1;
1271-}
1272-// *************************************************************************
1273-// * ReName 06/06/08 *
1274-// *************************************************************************
1275-bool VM_TextLib::ReName(const char *NewName)
1276-{
1277-
1278- int Index = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
1279- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETTEXT, (WPARAM)Index, (LPARAM)&TextureName[0]);
1280- int location = FindBitmap(p_Data, TextureName);
1281-
1282- strcpy(NewBitmapList[location]->Name, NewName);
1283- return 1;
1284-}
1285-
1286-// *************************************************************************
1287-// * UpDateList 13/06/08 *
1288-// *************************************************************************
1289-bool VM_TextLib::UpDateList(const char *NewName)
1290-{
1291-
1292- int Index = SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
1293- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_RESETCONTENT, (WPARAM)0, (LPARAM)0);
1294-
1295- int i;
1296-
1297- for (i = 0; i < p_Data->BitmapCount; i++)
1298- {
1299-
1300- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NewBitmapList[i]->Name);
1301-
1302- }
1303-
1304- SendDlgItemMessage(p_Data->hwnd, IDC_TEXTURELIST, LB_SETCURSEL, (WPARAM)Index, (LPARAM)0);
1305-
1306- return 1;
1307-}
1308-
1309-// *************************************************************************
1310-// * Txt_OpenFile Terry Bernie *
1311-// *************************************************************************
1312-bool VM_TextLib::Txt_OpenFile(char* Extension, char* Title, char* StartDirectory)
1313-{
1314- strcpy(Txt_FileName, "");
1315- strcpy(Txt_Path_FileName, "");
1316-
1317- ZeroMemory(&ofn, sizeof(ofn));
1318- ofn.lStructSize = sizeof(ofn);
1319- ofn.hwndOwner = App->MainHwnd;
1320- ofn.hInstance = App->hInst;
1321- ofn.lpstrFile = Txt_Path_FileName; // full path and file name
1322- ofn.nMaxFile = sizeof(Txt_Path_FileName);
1323- ofn.lpstrFilter = Extension;
1324-
1325- ofn.nFilterIndex = 1;
1326- ofn.lpstrFileTitle = Txt_FileName; // Just File Name
1327- ofn.nMaxFileTitle = sizeof(Txt_FileName);;
1328- ofn.lpstrInitialDir = StartDirectory;
1329- ofn.lpstrTitle = Title;
1330- ofn.Flags = OFN_PATHMUSTEXIST |
1331- OFN_FILEMUSTEXIST |
1332- OFN_EXPLORER |
1333- OFN_HIDEREADONLY |
1334- OFN_FILEMUSTEXIST;
1335-
1336- if (GetOpenFileName(&ofn) == TRUE)
1337- {
1338- return 1;
1339- }
1340- return 0;
1341-}
1342-
1343-// *************************************************************************
1344-// * RenameProc 13/06/04 *
1345-// *************************************************************************
1346-LRESULT CALLBACK VM_TextLib::RenameProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
1347-{
1348- switch (message)
1349- {
1350- case WM_INITDIALOG:
1351-
1352- App->CL_Vm_TextLib->GetName();
1353- SetDlgItemText(hDlg, IDC_OLDNAME, App->CL_Vm_TextLib->TextureName);
1354- SetDlgItemText(hDlg, IDC_NEWNAME, App->CL_Vm_TextLib->TextureName);
1355- return TRUE;
1356-
1357- case WM_COMMAND:
1358- if (LOWORD(wParam) == IDOK)
1359- {
1360- char buf1[256];
1361- GetDlgItemText(hDlg, IDC_NEWNAME, buf1, 256);
1362-
1363- int test = strcmp(buf1, "");
1364- if (test == 0)
1365- {
1366- strcpy(buf1, App->CL_Vm_TextLib->TextureName);
1367- }
1368- App->CL_Vm_TextLib->ReName(buf1);
1369- App->CL_Vm_TextLib->UpDateList(buf1);
1370- EndDialog(hDlg, LOWORD(wParam));
1371- return TRUE;
1372- }
1373- break;
1374- }
1375-
1376- return FALSE;
1377-}
--- Anim19_OSDN/Common/Genesis/Gen/getypes.h (revision 747)
+++ Anim19_OSDN/Common/Genesis/Gen/getypes.h (revision 748)
@@ -57,13 +57,13 @@
5757 float r, g, b, a;
5858 } GE_RGBA;
5959
60-typedef struct
61-{
62- int32 Left;
63- int32 Right;
64- int32 Top;
65- int32 Bottom;
66-} GE_Rect;
60+//typedef struct
61+//{
62+// int32 Left;
63+// int32 Right;
64+// int32 Top;
65+// int32 Bottom;
66+//} GE_Rect;
6767
6868 typedef struct
6969 {
--- Anim19_OSDN/GD19_App.cpp (revision 747)
+++ Anim19_OSDN/GD19_App.cpp (revision 748)
@@ -56,10 +56,8 @@
5656 Cl_Keyboard = nullptr;
5757
5858 // Vima19 19/03/20
59- CL_Vm_Textures = nullptr;
6059 CL_Vm_FileIO = nullptr;
6160 CL_Vm_ImGui = nullptr;
62- CL_Vm_TextLib = nullptr;
6361 Cl_Vm_Dimensions = nullptr;
6462 Cl_Vm_Preferences = nullptr;
6563
@@ -211,10 +209,8 @@
211209 Cl_Keyboard = new GD_Keyboard();
212210
213211 // Vima19 19/03/20
214- CL_Vm_Textures = new VM_Textures();
215212 CL_Vm_FileIO = new VM_FileIO();
216213 CL_Vm_ImGui = new VM_ImGui();
217- CL_Vm_TextLib = new VM_TextLib();
218214 Cl_Vm_Dimensions = new VM_Dimensions();
219215 Cl_Vm_Preferences = new VM_Preferences();
220216
--- Anim19_OSDN/GD19_App.h (revision 747)
+++ Anim19_OSDN/GD19_App.h (revision 748)
@@ -48,10 +48,8 @@
4848 #include "GD_Keyboard.h"
4949
5050 // Vima19 19/03/20
51-#include "VM_Textures.h"
5251 #include "VM_FileIO.h"
5352 #include "VM_ImGui.h"
54-#include "VM_TextLib.h"
5553 #include "VM_Dimensions.h"
5654 #include "VM_Preferences.h"
5755
@@ -109,10 +107,8 @@
109107 GD_Keyboard* Cl_Keyboard;
110108
111109 // Vima19 19/03/20
112- VM_Textures* CL_Vm_Textures;
113110 VM_FileIO* CL_Vm_FileIO;
114111 VM_ImGui* CL_Vm_ImGui;
115- VM_TextLib* CL_Vm_TextLib;
116112 VM_Dimensions* Cl_Vm_Dimensions;
117113 VM_Preferences* Cl_Vm_Preferences;
118114
--- Anim19_OSDN/GD19_OSDN.cpp (revision 747)
+++ Anim19_OSDN/GD19_OSDN.cpp (revision 748)
@@ -348,7 +348,7 @@
348348
349349 case ID_TOOLS_TEXTURELIB:
350350 {
351- App->CL_Vm_TextLib->Start_TexturePack();
351+ //App->CL_Vm_TextLib->Start_TexturePack();
352352 return 1;
353353 }
354354
--- Anim19_OSDN/GD19_Utilities.cpp (revision 747)
+++ Anim19_OSDN/GD19_Utilities.cpp (revision 748)
@@ -135,7 +135,7 @@
135135 // *************************************************************************
136136 float GD19_Utilities::DegreesToRadians(float Degrees)
137137 {
138- float Radians = (Degrees * GE_PI)/180;
138+ float Radians = 0;// (Degrees * GE_PI) / 180;
139139 return Radians;
140140 }
141141
--- Anim19_OSDN/SB_Dialogs.cpp (revision 747)
+++ Anim19_OSDN/SB_Dialogs.cpp (revision 748)
@@ -227,8 +227,10 @@
227227
228228 char buf[255];
229229
230- sprintf(buf, "%s %s", "Project Location", App->SBC_Project->m_Project_Folder_Path);
230+ sprintf(buf, "%s", "Project Folder Location");
231231 SendDlgItemMessage(hDlg, IDC_LISTGROUP, LB_ADDSTRING, (WPARAM)0, (LPARAM)buf);
232+ sprintf(buf, "%s", App->SBC_Project->m_Project_Folder_Path);
233+ SendDlgItemMessage(hDlg, IDC_LISTGROUP, LB_ADDSTRING, (WPARAM)0, (LPARAM)buf);
232234
233235 //sprintf(buf, "%s %s", "Full Path", App->SBC_Project->m_Project_Full_Path);
234236 //SendDlgItemMessage(hDlg, IDC_LISTGROUP, LB_ADDSTRING, (WPARAM)0, (LPARAM)buf);
--- Anim19_OSDN/VM_ImGui.cpp (revision 747)
+++ Anim19_OSDN/VM_ImGui.cpp (revision 748)
@@ -867,30 +867,7 @@
867867 // *************************************************************************
868868 void VM_ImGui::ImGui_Image(void)
869869 {
870- //ImGui::SetNextWindowPos(ImVec2(10, 10), ImGuiCond_FirstUseEver);
871-
872- if (!ImGui::Begin("Image", &Show_Image, ImGuiWindowFlags_NoSavedSettings))
873- {
874- ImGui::End();
875- }
876- else
877- {
878- if (App->CL_Vm_Textures->g_Texture[0] == NULL)
879- {
880-
881- }
882- else
883- {
884-
885- /*int MatIndex = App->CL_Vm_Model->MatIndex_Data[0];
886- glBindTexture(GL_TEXTURE_2D, App->CL_Vm_Textures->g_Texture[MatIndex]);
887-
888- ImGui::Text("pointer = %p", App->CL_Vm_Textures->g_Texture[MatIndex]);
889- ImGui::Text("size = %d x %d", 256, 256);
890- ImGui::Image((void*)(intptr_t)App->CL_Vm_Textures->g_Texture[MatIndex], ImVec2(256.0f, 256.0f));
891- ImGui::End();*/
892- }
893- }
870+
894871 }
895872
896873 // *************************************************************************
--- Anim19_OSDN/stdafx.h (revision 747)
+++ Anim19_OSDN/stdafx.h (revision 748)
@@ -26,7 +26,6 @@
2626
2727 #define NOMINMAX
2828 #include <windows.h>
29-#include <Genesis.h>
3029 #include "btBulletDynamicsCommon.h"
3130 // C RunTime Header Files
3231 //#include <stdint.h>
@@ -56,8 +55,6 @@
5655 #include <gl/gl.h>
5756 #include <gl/glu.h>
5857
59-#include "Gen_Structures.h"
60-
6158 namespace Enums
6259 {
6360 enum Mesh_Viewer
Show on old repository browser