add multitexture debug toggle

This commit is contained in:
Chris Danford
2005-11-07 03:59:05 +00:00
parent 44e517339d
commit 72bfacbdfe
4 changed files with 92 additions and 71 deletions
+26 -24
View File
@@ -12,11 +12,12 @@
#include "ModelManager.h" #include "ModelManager.h"
#include "Foreach.h" #include "Foreach.h"
#include "LuaBinding.h" #include "LuaBinding.h"
#include "PrefsManager.h"
REGISTER_ACTOR_CLASS( Model ) REGISTER_ACTOR_CLASS( Model )
const float FRAMES_PER_SECOND = 30; static const float FRAMES_PER_SECOND = 30;
const CString DEFAULT_ANIMATION_NAME = "default"; static const CString DEFAULT_ANIMATION_NAME = "default";
Model::Model() Model::Model()
{ {
@@ -363,28 +364,8 @@ void Model::DrawPrimitives()
/* There's some common code that could be folded out here, but it seems /* There's some common code that could be folded out here, but it seems
* clearer to keep it separate. */ * clearer to keep it separate. */
if( DISPLAY->GetNumTextureUnits() < 2 ) bool bUseMultitexture = PREFSMAN->m_bAllowMultitexture && DISPLAY->GetNumTextureUnits() >= 2;
{ if( bUseMultitexture )
// render the diffuse texture
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
DrawMesh( i );
// render the additive texture
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
// UGLY: This overrides the Actor's BlendMode
DISPLAY->SetBlendMode( BLEND_ADD );
DISPLAY->SetTextureFiltering( true );
DrawMesh( i );
}
}
else
{ {
// render the diffuse texture with texture unit 1 // render the diffuse texture with texture unit 1
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ); DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
@@ -416,6 +397,27 @@ void Model::DrawPrimitives()
DISPLAY->SetTexture( TextureUnit_1, NULL ); DISPLAY->SetTexture( TextureUnit_1, NULL );
DISPLAY->SetSphereEnvironmentMapping( 0 ); DISPLAY->SetSphereEnvironmentMapping( 0 );
} }
else
{
// render the diffuse texture
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
DrawMesh( i );
// render the additive texture
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
// UGLY: This overrides the Actor's BlendMode
DISPLAY->SetBlendMode( BLEND_ADD );
DISPLAY->SetTextureFiltering( true );
DrawMesh( i );
}
}
if( vTexTranslate.x != 0 || vTexTranslate.y != 0 ) if( vTexTranslate.x != 0 || vTexTranslate.y != 0 )
DISPLAY->TexturePopMatrix(); DISPLAY->TexturePopMatrix();
+1
View File
@@ -220,6 +220,7 @@ PrefsManager::PrefsManager() :
m_iMaxTextureResolution ( "MaxTextureResolution", 2048 ), m_iMaxTextureResolution ( "MaxTextureResolution", 2048 ),
m_iRefreshRate ( "RefreshRate", REFRESH_DEFAULT ), m_iRefreshRate ( "RefreshRate", REFRESH_DEFAULT ),
m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.0f ), m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.0f ),
m_bAllowMultitexture ( "AllowMultitexture", true ),
m_bShowStats ( "ShowStats", TRUE_IF_DEBUG), m_bShowStats ( "ShowStats", TRUE_IF_DEBUG),
m_bShowBanners ( "ShowBanners", true ), m_bShowBanners ( "ShowBanners", true ),
+1
View File
@@ -30,6 +30,7 @@ public:
Preference<int> m_iMaxTextureResolution; Preference<int> m_iMaxTextureResolution;
Preference<int> m_iRefreshRate; Preference<int> m_iRefreshRate;
Preference<float> m_fDisplayAspectRatio; Preference<float> m_fDisplayAspectRatio;
Preference<bool> m_bAllowMultitexture;
Preference<bool> m_bShowStats; Preference<bool> m_bShowStats;
Preference<bool> m_bShowBanners; Preference<bool> m_bShowBanners;
+64 -47
View File
@@ -121,29 +121,31 @@ void ScreenDebugOverlay::Init()
g_Mappings.holdForDebug1 = DeviceInput(DEVICE_KEYBOARD, KEY_F3); g_Mappings.holdForDebug1 = DeviceInput(DEVICE_KEYBOARD, KEY_F3);
g_Mappings.holdForDebug2.MakeInvalid(); g_Mappings.holdForDebug2.MakeInvalid();
g_Mappings.gameplayButton[0] = DeviceInput(DEVICE_KEYBOARD, KEY_F8); int i=0;
g_Mappings.gameplayButton[1] = DeviceInput(DEVICE_KEYBOARD, KEY_F7); g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F8);
g_Mappings.gameplayButton[2] = DeviceInput(DEVICE_KEYBOARD, KEY_F6); g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F7);
g_Mappings.debugButton[3] = DeviceInput(DEVICE_KEYBOARD, KEY_C1); g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F6);
g_Mappings.debugButton[4] = DeviceInput(DEVICE_KEYBOARD, KEY_C2); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C1);
g_Mappings.debugButton[5] = DeviceInput(DEVICE_KEYBOARD, KEY_C3); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C2);
g_Mappings.debugButton[6] = DeviceInput(DEVICE_KEYBOARD, KEY_C4); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C3);
g_Mappings.debugButton[7] = DeviceInput(DEVICE_KEYBOARD, KEY_C5); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C4);
g_Mappings.debugButton[8] = DeviceInput(DEVICE_KEYBOARD, KEY_C6); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C5);
g_Mappings.debugButton[9] = DeviceInput(DEVICE_KEYBOARD, KEY_C7); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C6);
g_Mappings.debugButton[10] = DeviceInput(DEVICE_KEYBOARD, KEY_C8); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C7);
g_Mappings.debugButton[11] = DeviceInput(DEVICE_KEYBOARD, KEY_C9); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C8);
g_Mappings.debugButton[12] = DeviceInput(DEVICE_KEYBOARD, KEY_C0); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C9);
g_Mappings.debugButton[13] = DeviceInput(DEVICE_KEYBOARD, KEY_Cq); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C0);
g_Mappings.debugButton[14] = DeviceInput(DEVICE_KEYBOARD, KEY_Cw); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cq);
g_Mappings.debugButton[15] = DeviceInput(DEVICE_KEYBOARD, KEY_Ce); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cw);
g_Mappings.debugButton[16] = DeviceInput(DEVICE_KEYBOARD, KEY_Cr); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ce);
g_Mappings.debugButton[17] = DeviceInput(DEVICE_KEYBOARD, KEY_Ct); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cr);
g_Mappings.debugButton[18] = DeviceInput(DEVICE_KEYBOARD, KEY_Cy); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ct);
g_Mappings.debugButton[19] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cy);
g_Mappings.debugButton[20] = DeviceInput(DEVICE_KEYBOARD, KEY_Ci); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu);
g_Mappings.debugButton[21] = DeviceInput(DEVICE_KEYBOARD, KEY_UP); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ci);
g_Mappings.debugButton[22] = DeviceInput(DEVICE_KEYBOARD, KEY_DOWN); g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Co);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_UP);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_DOWN);
} }
@@ -341,6 +343,8 @@ void ChangeVolume( float fDelta )
// //
// DebugLines // DebugLines
// //
#define DECLARE_ONE( x ) static x g_##x
class DebugLineAutoplay : public IDebugLine class DebugLineAutoplay : public IDebugLine
{ {
virtual CString GetDescription() { return "AutoPlay"; } virtual CString GetDescription() { return "AutoPlay"; }
@@ -367,7 +371,7 @@ class DebugLineAutoplay : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineAutoplay g_DebugLineAutoplay; DECLARE_ONE( DebugLineAutoplay );
class DebugLineAssistTick : public IDebugLine class DebugLineAssistTick : public IDebugLine
{ {
@@ -383,7 +387,7 @@ class DebugLineAssistTick : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineAssistTick g_DebugLineAssistTick; DECLARE_ONE( DebugLineAssistTick );
class DebugLineAutosync : public IDebugLine class DebugLineAutosync : public IDebugLine
{ {
@@ -408,7 +412,7 @@ class DebugLineAutosync : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineAutosync g_DebugLineAutosync; DECLARE_ONE( DebugLineAutosync );
class DebugLineCoinMode : public IDebugLine class DebugLineCoinMode : public IDebugLine
{ {
@@ -424,7 +428,7 @@ class DebugLineCoinMode : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineCoinMode g_DebugLineCoinMode; DECLARE_ONE( DebugLineCoinMode );
class DebugLineSlow : public IDebugLine class DebugLineSlow : public IDebugLine
{ {
@@ -438,7 +442,7 @@ class DebugLineSlow : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineSlow g_DebugLineSlow; DECLARE_ONE( DebugLineSlow );
class DebugLineHalt : public IDebugLine class DebugLineHalt : public IDebugLine
{ {
@@ -453,7 +457,7 @@ class DebugLineHalt : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineHalt g_DebugLineHalt; DECLARE_ONE( DebugLineHalt );
class DebugLineLightsDebug : public IDebugLine class DebugLineLightsDebug : public IDebugLine
{ {
@@ -466,7 +470,7 @@ class DebugLineLightsDebug : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineLightsDebug g_DebugLineLightsDebug; DECLARE_ONE( DebugLineLightsDebug );
class DebugLineMonkeyInput : public IDebugLine class DebugLineMonkeyInput : public IDebugLine
{ {
@@ -479,7 +483,7 @@ class DebugLineMonkeyInput : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineMonkeyInput g_DebugLineMonkeyInput; DECLARE_ONE( DebugLineMonkeyInput );
class DebugLineStats : public IDebugLine class DebugLineStats : public IDebugLine
{ {
@@ -492,7 +496,7 @@ class DebugLineStats : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineStats g_DebugLineStats; DECLARE_ONE( DebugLineStats );
class DebugLineVsync : public IDebugLine class DebugLineVsync : public IDebugLine
{ {
@@ -506,7 +510,20 @@ class DebugLineVsync : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineVsync g_DebugLineVsync; DECLARE_ONE( DebugLineVsync );
class DebugLineAllowMultitexture : public IDebugLine
{
virtual CString GetDescription() { return "Multitexture"; }
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
virtual bool IsEnabled() { return PREFSMAN->m_bAllowMultitexture.Get(); }
virtual void Do( CString &sMessageOut )
{
PREFSMAN->m_bAllowMultitexture.Set( !PREFSMAN->m_bAllowMultitexture );
IDebugLine::Do( sMessageOut );
}
};
DECLARE_ONE( DebugLineAllowMultitexture );
class DebugLineScreenTestMode : public IDebugLine class DebugLineScreenTestMode : public IDebugLine
{ {
@@ -519,7 +536,7 @@ class DebugLineScreenTestMode : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineScreenTestMode g_DebugLineScreenTestMode; DECLARE_ONE( DebugLineScreenTestMode );
class DebugLineClearMachineStats : public IDebugLine class DebugLineClearMachineStats : public IDebugLine
{ {
@@ -534,7 +551,7 @@ class DebugLineClearMachineStats : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineClearMachineStats g_DebugClearMachineStats; DECLARE_ONE( DebugLineClearMachineStats );
class DebugLineFillMachineStats : public IDebugLine class DebugLineFillMachineStats : public IDebugLine
{ {
@@ -549,7 +566,7 @@ class DebugLineFillMachineStats : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineFillMachineStats g_DebugLineFillMachineStats; DECLARE_ONE( DebugLineFillMachineStats );
class DebugLineSendNotesEnded : public IDebugLine class DebugLineSendNotesEnded : public IDebugLine
{ {
@@ -562,7 +579,7 @@ class DebugLineSendNotesEnded : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineSendNotesEnded g_DebugLineSendNotesEnded; DECLARE_ONE( DebugLineSendNotesEnded );
class DebugLineReloadCurrentScreen : public IDebugLine class DebugLineReloadCurrentScreen : public IDebugLine
{ {
@@ -578,7 +595,7 @@ class DebugLineReloadCurrentScreen : public IDebugLine
sMessageOut = ""; sMessageOut = "";
} }
}; };
static DebugLineReloadCurrentScreen g_DebugLineReloadCurrentScreen; DECLARE_ONE( DebugLineReloadCurrentScreen );
class DebugLineReloadTheme : public IDebugLine class DebugLineReloadTheme : public IDebugLine
{ {
@@ -596,7 +613,7 @@ class DebugLineReloadTheme : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineReloadTheme g_DebugLineReloadTheme; DECLARE_ONE( DebugLineReloadTheme );
class DebugLineWriteProfiles : public IDebugLine class DebugLineWriteProfiles : public IDebugLine
{ {
@@ -624,7 +641,7 @@ class DebugLineWriteProfiles : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineWriteProfiles g_DebugLineWriteProfiles; DECLARE_ONE( DebugLineWriteProfiles );
class DebugLineWritePreferences : public IDebugLine class DebugLineWritePreferences : public IDebugLine
{ {
@@ -637,7 +654,7 @@ class DebugLineWritePreferences : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineStats g_DebugLineWritePreferences; DECLARE_ONE( DebugLineWritePreferences );
class DebugLineMenuTimer : public IDebugLine class DebugLineMenuTimer : public IDebugLine
{ {
@@ -650,7 +667,7 @@ class DebugLineMenuTimer : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineMenuTimer g_DebugLineMenuTimer; DECLARE_ONE( DebugLineMenuTimer );
class DebugLineFlushLog : public IDebugLine class DebugLineFlushLog : public IDebugLine
{ {
@@ -663,7 +680,7 @@ class DebugLineFlushLog : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineFlushLog g_DebugLineFlushLog; DECLARE_ONE( DebugLineFlushLog );
class DebugLinePullBackCamera : public IDebugLine class DebugLinePullBackCamera : public IDebugLine
{ {
@@ -679,7 +696,7 @@ class DebugLinePullBackCamera : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLinePullBackCamera g_DebugLinePullBackCamera; DECLARE_ONE( DebugLinePullBackCamera );
class DebugLineVolumeUp : public IDebugLine class DebugLineVolumeUp : public IDebugLine
{ {
@@ -692,7 +709,7 @@ class DebugLineVolumeUp : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineVolumeUp g_DebugLineVolumeUp; DECLARE_ONE( DebugLineVolumeUp );
class DebugLineVolumeDown : public IDebugLine class DebugLineVolumeDown : public IDebugLine
{ {
@@ -705,7 +722,7 @@ class DebugLineVolumeDown : public IDebugLine
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
static DebugLineVolumeDown g_DebugLineVolumeDown; DECLARE_ONE( DebugLineVolumeDown );
class DebugLineUptime : public IDebugLine class DebugLineUptime : public IDebugLine
{ {
@@ -714,7 +731,7 @@ class DebugLineUptime : public IDebugLine
virtual bool IsEnabled() { return false; } virtual bool IsEnabled() { return false; }
virtual void Do( CString &sMessageOut ) {} virtual void Do( CString &sMessageOut ) {}
}; };
static DebugLineUptime g_DebugLineUptime; DECLARE_ONE( DebugLineUptime );
/* /*