move RageTextureID into its own file

This commit is contained in:
Glenn Maynard
2003-11-07 20:53:42 +00:00
parent cbdf39644f
commit 1601168c8d
6 changed files with 165 additions and 140 deletions
-72
View File
@@ -14,78 +14,6 @@
#include "RageTextureManager.h"
#include <string.h>
void RageTextureID::Init()
{
/* Maximum size of the texture, per dimension. */
iMaxSize = 2048;
/* Number of mipmaps. (unimplemented) */
iMipMaps = 4;
/* Maximum number of bits for alpha. In 16-bit modes, lowering
* this gives more bits for color values. (0, 1 or 4) */
iAlphaBits = 4;
/* If this is greater than -1, then the image will be loaded as a luma/alpha
* map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens
* when paletted textures are supported.
*
* If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit
* palettes, then the image will be loaded with 4bpp.
*
* This may be set to 0, resulting in an alpha map with all pixels white. */
iGrayscaleBits = -1;
/* If true and color precision is being lost, dither. (slow) */
bDither = false;
/* If true, resize the image to fill the internal texture. (slow) */
bStretch = false;
/* Preferred color depth of the image. (This is overridden for
* paletted images and transparencies.) */
iColorDepth = -1; /* default */
/* If true, enable HOT PINK color keying. (deprecated but needed for
* banners) */
bHotPinkColorKey = false;
/* These hints will be used in addition to any in the filename. */
AdditionalTextureHints = "";
}
bool RageTextureID::operator<(const RageTextureID &rhs) const
{
#define COMP(a) if(a<rhs.a) return true; if(a>rhs.a) return false;
COMP(filename);
COMP(iMaxSize);
COMP(iMipMaps);
COMP(iAlphaBits);
COMP(iGrayscaleBits);
COMP(iColorDepth);
COMP(bDither);
COMP(bStretch);
COMP(bHotPinkColorKey);
COMP(AdditionalTextureHints);
#undef COMP
return false;
}
bool RageTextureID::operator==(const RageTextureID &rhs) const
{
#define EQUAL(a) (a==rhs.a)
return
EQUAL(filename) &&
EQUAL(iMaxSize) &&
EQUAL(iMipMaps) &&
EQUAL(iAlphaBits) &&
EQUAL(iGrayscaleBits) &&
EQUAL(iColorDepth) &&
EQUAL(bDither) &&
EQUAL(bStretch) &&
EQUAL(bHotPinkColorKey) &&
EQUAL(AdditionalTextureHints);
}
RageTexture::RageTexture( RageTextureID name ):
m_ID(name)
+1 -26
View File
@@ -13,34 +13,9 @@
#include "RageTypes.h"
#include "RageTextureID.h"
/* A unique texture is identified by a RageTextureID. (Loading the
* same file with two different dither settings is considered two
* different textures, for example.) See RageTexture.cpp for explanations
* of these. */
struct RageTextureID
{
CString filename;
int iMaxSize;
int iMipMaps;
int iAlphaBits;
int iGrayscaleBits;
int iColorDepth;
bool bDither;
bool bStretch;
bool bHotPinkColorKey; /* #FF00FF */
CString AdditionalTextureHints;
bool operator< (const RageTextureID &rhs) const;
bool operator== (const RageTextureID &rhs) const;
void Init();
RageTextureID() { Init(); }
RageTextureID(const CString &fn) { Init(); filename=fn; }
};
//-----------------------------------------------------------------------------
// RageTexture Class Declarations
//-----------------------------------------------------------------------------
+75
View File
@@ -0,0 +1,75 @@
#include "global.h"
#include "RageTextureID.h"
void RageTextureID::Init()
{
/* Maximum size of the texture, per dimension. */
iMaxSize = 2048;
/* Number of mipmaps. (unimplemented) */
iMipMaps = 4;
/* Maximum number of bits for alpha. In 16-bit modes, lowering
* this gives more bits for color values. (0, 1 or 4) */
iAlphaBits = 4;
/* If this is greater than -1, then the image will be loaded as a luma/alpha
* map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens
* when paletted textures are supported.
*
* If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit
* palettes, then the image will be loaded with 4bpp.
*
* This may be set to 0, resulting in an alpha map with all pixels white. */
iGrayscaleBits = -1;
/* If true and color precision is being lost, dither. (slow) */
bDither = false;
/* If true, resize the image to fill the internal texture. (slow) */
bStretch = false;
/* Preferred color depth of the image. (This is overridden for
* paletted images and transparencies.) */
iColorDepth = -1; /* default */
/* If true, enable HOT PINK color keying. (deprecated but needed for
* banners) */
bHotPinkColorKey = false;
/* These hints will be used in addition to any in the filename. */
AdditionalTextureHints = "";
}
bool RageTextureID::operator<(const RageTextureID &rhs) const
{
#define COMP(a) if(a<rhs.a) return true; if(a>rhs.a) return false;
COMP(filename);
COMP(iMaxSize);
COMP(iMipMaps);
COMP(iAlphaBits);
COMP(iGrayscaleBits);
COMP(iColorDepth);
COMP(bDither);
COMP(bStretch);
COMP(bHotPinkColorKey);
COMP(AdditionalTextureHints);
#undef COMP
return false;
}
bool RageTextureID::operator==(const RageTextureID &rhs) const
{
#define EQUAL(a) (a==rhs.a)
return
EQUAL(filename) &&
EQUAL(iMaxSize) &&
EQUAL(iMipMaps) &&
EQUAL(iAlphaBits) &&
EQUAL(iGrayscaleBits) &&
EQUAL(iColorDepth) &&
EQUAL(bDither) &&
EQUAL(bStretch) &&
EQUAL(bHotPinkColorKey) &&
EQUAL(AdditionalTextureHints);
}
+30
View File
@@ -0,0 +1,30 @@
#ifndef RAGE_TEXTURE_ID_H
#define RAGE_TEXTURE_ID_H
/* A unique texture is identified by a RageTextureID. (Loading the
* same file with two different dither settings is considered two
* different textures, for example.) See RageTexture.cpp for explanations
* of these. */
struct RageTextureID
{
CString filename;
int iMaxSize;
int iMipMaps;
int iAlphaBits;
int iGrayscaleBits;
int iColorDepth;
bool bDither;
bool bStretch;
bool bHotPinkColorKey; /* #FF00FF */
CString AdditionalTextureHints;
bool operator< (const RageTextureID &rhs) const;
bool operator== (const RageTextureID &rhs) const;
void Init();
RageTextureID() { Init(); }
RageTextureID(const CString &fn) { Init(); filename=fn; }
};
#endif
+53 -42
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -62,10 +62,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\stepmania\stepmania
TargetDir=\temp\stepmania
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -82,28 +82,24 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c
# Begin Special Build Tool
IntDir=.\Debug
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -140,10 +136,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /pdb:none
# Begin Special Build Tool
IntDir=.\../Release6
TargetDir=\stepmania\stepmania
TargetDir=\temp\stepmania
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -161,31 +157,27 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "StepMania___Xbox_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF
# SUBTRACT LINK32 /pdb:none /map /debug
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
# Begin Special Build Tool
IntDir=.\StepMania___Xbox_Release
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -804,6 +796,25 @@ SOURCE=.\RageTexture.h
# End Source File
# Begin Source File
SOURCE=.\RageTextureID.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\RageTextureID.h
# End Source File
# Begin Source File
SOURCE=.\RageTextureManager.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
+6
View File
@@ -1612,6 +1612,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath=".\RageTexture.h">
</File>
<File
RelativePath="RageTextureID.cpp">
</File>
<File
RelativePath="RageTextureID.h">
</File>
<File
RelativePath=".\RageTextureManager.cpp">
</File>