Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Generals/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ class GameLODManager
Bool setDynamicLODLevel(DynamicGameLODLevel level); ///< set the current dynamic LOD level.
DynamicGameLODLevel getDynamicLODLevel(void) { return m_currentDynamicLOD;}
void init(void); ///<initialize tables of preset LOD's.
void setCurrentTextureReduction(Int val) {m_currentTextureReduction = val;}
Int getCurrentTextureReduction(void) {return m_currentTextureReduction;}
Int getStaticGameLODIndex(AsciiString name);
Int getDynamicGameLODIndex(AsciiString name);
inline Bool isParticleSkipped(void);
Expand Down Expand Up @@ -229,7 +227,6 @@ class GameLODManager
Real m_floatBenchIndex;
Real m_memBenchIndex;
Real m_compositeBenchIndex;
Real m_currentTextureReduction;
Int m_reallyLowMHz;
};

Expand Down
3 changes: 2 additions & 1 deletion Generals/Code/GameEngine/Include/GameClient/GameClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class GameClient : public SubsystemInterface,

//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ) = 0; ///< @todo superhack for demo, remove!!!
virtual void adjustLOD( Int adj ) = 0; ///< @todo hack for evaluation, remove.

virtual void setTextureLOD( Int level ) = 0;

virtual void releaseShadows(void); ///< frees all shadow resources used by this module - used by Options screen.
virtual void allocateShadows(void); ///< create shadow resources if not already present. Used by Options screen.
Expand Down
12 changes: 4 additions & 8 deletions Generals/Code/GameEngine/Source/Common/GameLOD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ GameLODManager::GameLODManager(void)
m_memBenchIndex=0;
m_compositeBenchIndex=0;
m_numBenchProfiles=0;
m_currentTextureReduction=0;
m_reallyLowMHz = 400;

for (Int i=0; i<STATIC_GAME_LOD_CUSTOM; i++)
Expand Down Expand Up @@ -580,13 +579,7 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
TheWritableGlobalData->m_useShadowVolumes=lodInfo->m_useShadowVolumes;
TheWritableGlobalData->m_useShadowDecals=lodInfo->m_useShadowDecals;

//Check if texture resolution changed. No need to apply when current is unknown because display will do it
if (requestedTextureReduction != m_currentTextureReduction)
{
TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction;
if (TheGameClient)
TheGameClient->adjustLOD(0); //apply the new setting stored in globaldata
}
TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction;

//Check if shadow state changed
if (m_currentStaticLOD == STATIC_GAME_LOD_UNKNOWN ||
Expand Down Expand Up @@ -623,9 +616,12 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
TheWritableGlobalData->m_shellMapOn = false;
}
}

if (TheTerrainVisual)
TheTerrainVisual->setTerrainTracksDetail();

if (TheGameClient)
TheGameClient->setTextureLOD(requestedTextureReduction);
}

/**Parse a description of all the LOD settings for a given detail level*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
//used to access a messagebox that does "ok" and "cancel"
#include "GameClient/MessageBox.h"

#include "ww3d.h"

// This is for non-RC builds only!!!
#define VERBOSE_VERSION L"Release"

Expand Down Expand Up @@ -1112,18 +1114,14 @@ static void saveOptions( void )
//-------------------------------------------------------------------------------------------------
// Texture resolution slider
{
AsciiString prefString;

val = GadgetSliderGetPosition(sliderTextureResolution);
val = 2-val;
val = 2 - GadgetSliderGetPosition(sliderTextureResolution);

AsciiString prefString;
prefString.format("%d",val);
(*pref)["TextureReduction"] = prefString;

if (TheGlobalData->m_textureReductionFactor != val)
{
TheGameClient->adjustLOD(val-TheGlobalData->m_textureReductionFactor); //apply the new setting
}
TheWritableGlobalData->m_textureReductionFactor = val;
TheGameClient->setTextureLOD(val);
}

TheWritableGlobalData->m_useShadowVolumes = GadgetCheckBoxIsChecked( check3DShadows );
Expand Down Expand Up @@ -1855,10 +1853,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}

Int txtFact=TheGameLODManager->getCurrentTextureReduction();
GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel());

GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact);
GadgetSliderSetPosition( sliderTextureResolution, 2-WW3D::Get_Texture_Reduction());

GadgetCheckBoxSetChecked( check3DShadows, TheGlobalData->m_useShadowVolumes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#include "GameNetwork/GameSpyOverlay.h"
#include "GameNetwork/GameSpy/BuddyThread.h"

#include "ww3d.h"


#if defined(RTS_DEBUG)
Expand Down Expand Up @@ -3785,7 +3786,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_LOD_DECREASE:
{
TheGameClient->adjustLOD(-1);
const Int level = clamp(0, WW3D::Get_Texture_Reduction() - 1, 4);
TheGameClient->setTextureLOD(level);
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugDecreaseLOD", L"Decrease LOD") );
disp = DESTROY_MESSAGE;
break;
Expand All @@ -3795,7 +3797,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_LOD_INCREASE:
{
TheGameClient->adjustLOD(1);
const Int level = clamp(0, WW3D::Get_Texture_Reduction() + 1, 4);
TheGameClient->setTextureLOD(level);
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugIncreaseLOD", L"Increase LOD") );
disp = DESTROY_MESSAGE;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class W3DGameClient : public GameClient

//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!!
virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove.
virtual void setTextureLOD( Int level );

protected:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ int TerrainTextureClass::update(WorldHeightMap *htMap)
surface_level->UnlockRect();
surface_level->Release();
DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX));
if (TheWritableGlobalData->m_textureReductionFactor) {
Peek_D3D_Texture()->SetLOD(TheWritableGlobalData->m_textureReductionFactor);
if (WW3D::Get_Texture_Reduction()) {
Peek_D3D_Texture()->SetLOD(WW3D::Get_Texture_Reduction());
}
return(surface_desc.Height);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,14 +745,10 @@ void W3DDisplay::init( void )
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}
else
{ //Static LOD level was applied during GameLOD manager init except for texture reduction
{
//Static LOD level was applied during GameLOD manager init except for texture reduction
//which needs to be applied here.
Int txtReduction=TheWritableGlobalData->m_textureReductionFactor;
if (txtReduction > 0)
{ WW3D::Set_Texture_Reduction(txtReduction,6);
//Tell LOD manager that texture reduction was applied.
TheGameLODManager->setCurrentTextureReduction(txtReduction);
}
TheGameClient->setTextureLOD(TheWritableGlobalData->m_textureReductionFactor);
}

if (TheGlobalData->m_displayGamma != 1.0f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,29 +196,16 @@ void W3DGameClient::setTeamColor(Int red, Int green, Int blue)
}

//-------------------------------------------------------------------------------------------------
/** temporary entry point for adjusting LOD for development testing. */
//-------------------------------------------------------------------------------------------------
void W3DGameClient::adjustLOD( Int adj )
void W3DGameClient::setTextureLOD( Int level )
{
if (TheGlobalData == NULL)
return;

TheWritableGlobalData->m_textureReductionFactor += adj;

if (TheWritableGlobalData->m_textureReductionFactor > 4)
TheWritableGlobalData->m_textureReductionFactor = 4; //16x less resolution is probably enough.
if (TheWritableGlobalData->m_textureReductionFactor < 0)
TheWritableGlobalData->m_textureReductionFactor = 0;
if (WW3D::Get_Texture_Reduction() != level)
{
WW3D::Set_Texture_Reduction(level, 6);

if (WW3D::Get_Texture_Reduction() != TheWritableGlobalData->m_textureReductionFactor)
{ WW3D::Set_Texture_Reduction(TheWritableGlobalData->m_textureReductionFactor,6);
TheGameLODManager->setCurrentTextureReduction(TheWritableGlobalData->m_textureReductionFactor);
//I commented this out because we're no longer using terrain LOD. So I
//stole this function and keys to adjust the texture resolution instead. -MW
//if( TheTerrainRenderObject )
// TheTerrainRenderObject->setTextureLOD(level);
}

//I commented this out because we're no longer using terrain LOD. So I
//stole this function and keys to adjust the texture resolution instead. -MW

// if( TheTerrainRenderObject )
// TheTerrainRenderObject->adjustTerrainLOD( adj );

}
3 changes: 0 additions & 3 deletions GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ class GameLODManager
Bool setDynamicLODLevel(DynamicGameLODLevel level); ///< set the current dynamic LOD level.
DynamicGameLODLevel getDynamicLODLevel(void) { return m_currentDynamicLOD;}
void init(void); ///<initialize tables of preset LOD's.
void setCurrentTextureReduction(Int val) {m_currentTextureReduction = val;}
Int getCurrentTextureReduction(void) {return m_currentTextureReduction;}
Int getStaticGameLODIndex(AsciiString name);
Int getDynamicGameLODIndex(AsciiString name);
inline Bool isParticleSkipped(void);
Expand Down Expand Up @@ -230,7 +228,6 @@ class GameLODManager
Real m_floatBenchIndex;
Real m_memBenchIndex;
Real m_compositeBenchIndex;
Int m_currentTextureReduction;
Int m_reallyLowMHz;
};

Expand Down
3 changes: 2 additions & 1 deletion GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class GameClient : public SubsystemInterface,

//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ) = 0; ///< @todo superhack for demo, remove!!!
virtual void adjustLOD( Int adj ) = 0; ///< @todo hack for evaluation, remove.

virtual void setTextureLOD( Int level ) = 0;

virtual void releaseShadows(void); ///< frees all shadow resources used by this module - used by Options screen.
virtual void allocateShadows(void); ///< create shadow resources if not already present. Used by Options screen.
Expand Down
12 changes: 4 additions & 8 deletions GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ GameLODManager::GameLODManager(void)
m_memBenchIndex=0;
m_compositeBenchIndex=0;
m_numBenchProfiles=0;
m_currentTextureReduction=0;
m_reallyLowMHz = 400;

for (Int i=0; i<STATIC_GAME_LOD_CUSTOM; i++)
Expand Down Expand Up @@ -585,13 +584,7 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
TheWritableGlobalData->m_useShadowVolumes=lodInfo->m_useShadowVolumes;
TheWritableGlobalData->m_useShadowDecals=lodInfo->m_useShadowDecals;

//Check if texture resolution changed. No need to apply when current is unknown because display will do it
if (requestedTextureReduction != m_currentTextureReduction)
{
TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction;
if (TheGameClient)
TheGameClient->adjustLOD(0); //apply the new setting stored in globaldata
}
TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction;

//Check if shadow state changed
if (m_currentStaticLOD == STATIC_GAME_LOD_UNKNOWN ||
Expand Down Expand Up @@ -629,9 +622,12 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
TheWritableGlobalData->m_shellMapOn = false;
}
}

if (TheTerrainVisual)
TheTerrainVisual->setTerrainTracksDetail();

if (TheGameClient)
TheGameClient->setTextureLOD(requestedTextureReduction);
}

/**Parse a description of all the LOD settings for a given detail level*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
//used to access a messagebox that does "ok" and "cancel"
#include "GameClient/MessageBox.h"

#include "ww3d.h"

// This is for non-RC builds only!!!
#define VERBOSE_VERSION L"Release"

Expand Down Expand Up @@ -1163,18 +1165,14 @@ static void saveOptions( void )
//-------------------------------------------------------------------------------------------------
// Texture resolution slider
{
AsciiString prefString;

val = GadgetSliderGetPosition(sliderTextureResolution);
val = 2-val;
val = 2 - GadgetSliderGetPosition(sliderTextureResolution);

AsciiString prefString;
prefString.format("%d",val);
(*pref)["TextureReduction"] = prefString;

if (TheGlobalData->m_textureReductionFactor != val)
{
TheGameClient->adjustLOD(val-TheGlobalData->m_textureReductionFactor); //apply the new setting
}
TheWritableGlobalData->m_textureReductionFactor = val;
TheGameClient->setTextureLOD(val);
}

TheWritableGlobalData->m_useShadowVolumes = GadgetCheckBoxIsChecked( check3DShadows );
Expand Down Expand Up @@ -1922,10 +1920,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}

Int txtFact=TheGameLODManager->getCurrentTextureReduction();
GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel());

GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact);
GadgetSliderSetPosition( sliderTextureResolution, 2-WW3D::Get_Texture_Reduction());

GadgetCheckBoxSetChecked( check3DShadows, TheGlobalData->m_useShadowVolumes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#include "GameNetwork/GameSpyOverlay.h"
#include "GameNetwork/GameSpy/BuddyThread.h"


#include "ww3d.h"


#define dont_ALLOW_ALT_F4
Expand Down Expand Up @@ -4179,7 +4179,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_LOD_DECREASE:
{
TheGameClient->adjustLOD(-1);
const Int level = clamp(0, WW3D::Get_Texture_Reduction() - 1, 4);
TheGameClient->setTextureLOD(level);
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugDecreaseLOD", L"Decrease LOD") );
disp = DESTROY_MESSAGE;
break;
Expand All @@ -4189,7 +4190,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_LOD_INCREASE:
{
TheGameClient->adjustLOD(1);
const Int level = clamp(0, WW3D::Get_Texture_Reduction() + 1, 4);
TheGameClient->setTextureLOD(level);
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugIncreaseLOD", L"Increase LOD") );
disp = DESTROY_MESSAGE;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class W3DGameClient : public GameClient

//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!!
virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove.
virtual void setTextureLOD( Int level );
virtual void notifyTerrainObjectMoved(Object *obj);

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ int TerrainTextureClass::update(WorldHeightMap *htMap)
surface_level->UnlockRect();
surface_level->Release();
DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX));
if (TheWritableGlobalData->m_textureReductionFactor) {
Peek_D3D_Texture()->SetLOD(TheWritableGlobalData->m_textureReductionFactor);
if (WW3D::Get_Texture_Reduction()) {
Peek_D3D_Texture()->SetLOD(WW3D::Get_Texture_Reduction());
}
return(surface_desc.Height);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,10 @@ void W3DDisplay::init( void )
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}
else
{ //Static LOD level was applied during GameLOD manager init except for texture reduction
{
//Static LOD level was applied during GameLOD manager init except for texture reduction
//which needs to be applied here.
Int txtReduction=TheWritableGlobalData->m_textureReductionFactor;
if (txtReduction > 0)
{ WW3D::Set_Texture_Reduction(txtReduction,32);
//Tell LOD manager that texture reduction was applied.
TheGameLODManager->setCurrentTextureReduction(txtReduction);
}
TheGameClient->setTextureLOD(TheWritableGlobalData->m_textureReductionFactor);
}

if (TheGlobalData->m_displayGamma != 1.0f)
Expand Down
Loading
Loading