Skip to content

Commit 933e1de

Browse files
authored
[GEN] Backport WaterTransparencySetting additions from Zero Hour (#777)
1 parent 9da89ce commit 933e1de

File tree

6 files changed

+147
-59
lines changed

6 files changed

+147
-59
lines changed

Generals/Code/GameEngine/Include/GameClient/Water.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ class WaterTransparencySetting : public Overridable
8181
public:
8282
Real m_transparentWaterDepth;
8383
Real m_minWaterOpacity;
84+
RGBColor m_standingWaterColor;
85+
RGBColor m_radarColor;
86+
Bool m_additiveBlend;
87+
AsciiString m_standingWaterTexture;
8488

8589
AsciiString m_skyboxTextureN;
8690
AsciiString m_skyboxTextureE;
@@ -93,6 +97,15 @@ class WaterTransparencySetting : public Overridable
9397
{
9498
m_transparentWaterDepth = 3.0f;
9599
m_minWaterOpacity = 1.0f;
100+
m_standingWaterColor.red = 1.0f;
101+
m_standingWaterColor.green = 1.0f;
102+
m_standingWaterColor.blue = 1.0f;
103+
m_radarColor.red = 140;
104+
m_radarColor.green = 140;
105+
m_radarColor.blue = 255;
106+
m_standingWaterTexture = "TWWater01.tga";
107+
m_additiveBlend = FALSE;
108+
96109
m_skyboxTextureN = "TSMorningN.tga";
97110
m_skyboxTextureE = "TSMorningE.tga";
98111
m_skyboxTextureS = "TSMorningS.tga";

Generals/Code/GameEngine/Source/GameClient/Water.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ const FieldParse WaterTransparencySetting::m_waterTransparencySettingFieldParseT
6464

6565
{ "TransparentWaterDepth", INI::parseReal, NULL, offsetof( WaterTransparencySetting, m_transparentWaterDepth ) },
6666
{ "TransparentWaterMinOpacity", INI::parseReal, NULL, offsetof( WaterTransparencySetting, m_minWaterOpacity ) },
67-
67+
{ "StandingWaterColor", INI::parseRGBColor, NULL, offsetof( WaterTransparencySetting, m_standingWaterColor ) },
68+
{ "StandingWaterTexture",INI::parseAsciiString, NULL, offsetof( WaterTransparencySetting, m_standingWaterTexture ) },
69+
{ "AdditiveBlending", INI::parseBool, NULL, offsetof( WaterTransparencySetting, m_additiveBlend) },
70+
{ "RadarWaterColor", INI::parseRGBColor, NULL, offsetof( WaterTransparencySetting, m_radarColor) },
6871
{ "SkyboxTextureN", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureN ) },
6972
{ "SkyboxTextureE", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureE ) },
7073
{ "SkyboxTextureS", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureS ) },

Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ class W3DRadar : public Radar
7676
void initializeTextureFormats( void ); ///< find format to use for the radar texture
7777
void deleteResources( void ); ///< delete resources used
7878
void drawEvents( Int pixelX, Int pixelY, Int width, Int height); ///< draw all of the radar events
79-
void drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, const Coord3D *pos ); //< draw a hero icon
79+
void drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, const Coord3D *pos ); //< draw a hero icon
8080
void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box
8181
void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar
8282
void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons
8383
void renderObjectList( const RadarObject *listHead, TextureClass *texture, Bool calcHero = FALSE ); ///< render an object list to the texture
84-
void interpolateColorForHeight( RGBColor *color,
84+
void interpolateColorForHeight( RGBColor *color,
8585
Real height,
8686
Real hiZ,
8787
Real midZ,
@@ -118,7 +118,7 @@ class W3DRadar : public Radar
118118
Real m_viewZoom; ///< camera zoom used for the view box we have
119119
ICoord2D m_viewBox[ 4 ]; ///< radar cell points for the 4 corners of view box
120120

121-
std::list<const Coord3D *> m_cachedHeroPosList; //< cache of hero positions for drawing icons in radar overlay
121+
std::list<const Coord3D *> m_cachedHeroPosList; //< cache of hero positions for drawing icons in radar overlay
122122
};
123123

124124

Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class WaterRenderObjClass : public Snapshot,
105105
void load(void); ///< load/setup any map dependent features
106106
void update( void ); ///< update phase of the water
107107
void enableWaterGrid(Bool state); ///< used to active custom water for special maps. (i.e DAM).
108+
void updateMapOverrides(void); ///< used to update any map specific map overrides for water appearance.
108109
void setTimeOfDay(TimeOfDay tod); ///<change sky/water for time of day
109110
void toggleCloudLayer(Bool state) { m_useCloudLayer=state;} ///<enables/disables the cloud layer
110111
void updateRenderTargetTextures(CameraClass *cam); ///< renders into any required textures.

Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "GameClient/Image.h"
4949
#include "GameClient/Line2D.h"
5050
#include "GameClient/TerrainVisual.h"
51+
#include "GameClient/Water.h"
5152
#include "W3DDevice/Common/W3DRadar.h"
5253
#include "W3DDevice/GameClient/HeightMap.h"
5354
#include "W3DDevice/GameClient/W3DShroud.h"
@@ -60,6 +61,7 @@
6061
//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
6162
#endif
6263

64+
6365
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
6466
enum { OVERLAY_REFRESH_RATE = 6 }; ///< over updates once this many frames
6567

@@ -277,8 +279,6 @@ void W3DRadar::drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, cons
277279
}
278280
}
279281

280-
281-
282282
//-------------------------------------------------------------------------------------------------
283283
/** Draw a "box" into the texture passed in that represents the viewable area for
284284
* the tactical display into the game world */
@@ -616,7 +616,6 @@ void W3DRadar::drawIcons( Int pixelX, Int pixelY, Int width, Int height )
616616
}
617617
}
618618

619-
620619
//-------------------------------------------------------------------------------------------------
621620
/** Render an object list into the texture passed in */
622621
//-------------------------------------------------------------------------------------------------
@@ -1034,9 +1033,9 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain )
10341033
m_reconstructViewBox = TRUE;
10351034

10361035
// setup our water color
1037-
waterColor.red = 0.55f;
1038-
waterColor.green = 0.55f;
1039-
waterColor.blue = 1.0f;
1036+
waterColor.red = TheWaterTransparency->m_radarColor.red;
1037+
waterColor.green = TheWaterTransparency->m_radarColor.green;
1038+
waterColor.blue = TheWaterTransparency->m_radarColor.blue;
10401039

10411040
// get the terrain surface to draw in
10421041
surface = m_terrainTexture->Get_Surface_Level();

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp

Lines changed: 121 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ static Bool wireframeForDebug = 0;
196196

197197
void WaterRenderObjClass::setupJbaWaterShader(void)
198198
{
199+
if (!TheWaterTransparency->m_additiveBlend)
200+
DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader);
201+
else
202+
DX8Wrapper::Set_Shader(ShaderClass::_PresetAdditiveShader);
199203

200-
DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader);
201204
VertexMaterialClass *vmat=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE);
202205
DX8Wrapper::Set_Material(vmat);
203206
REF_PTR_RELEASE(vmat);
@@ -304,7 +307,8 @@ WaterRenderObjClass::~WaterRenderObjClass(void)
304307
{ WaterSettings[i].m_skyTextureFile.clear();
305308
WaterSettings[i].m_waterTextureFile.clear();
306309
}
307-
310+
((WaterTransparencySetting*)TheWaterTransparency.getNonOverloadedPointer())->deleteInstance();
311+
TheWaterTransparency = NULL;
308312
ReleaseResources();
309313

310314
if (m_waterTrackSystem)
@@ -365,9 +369,6 @@ WaterRenderObjClass::WaterRenderObjClass(void)
365369
m_waterSparklesTexture=0;
366370
m_riverXOffset=0;
367371
m_riverYOffset=0;
368-
369-
370-
371372
}
372373

373374
//-------------------------------------------------------------------------------------------------
@@ -1088,8 +1089,8 @@ Int WaterRenderObjClass::init(Real waterLevel, Real dx, Real dy, SceneClass *par
10881089
REF_PTR_RELEASE(material);
10891090
}
10901091

1091-
m_riverTexture=WW3DAssetManager::Get_Instance()->Get_Texture("TWWater01.tga");
1092-
1092+
m_riverTexture=WW3DAssetManager::Get_Instance()->Get_Texture(TheWaterTransparency->m_standingWaterTexture.str());
1093+
10931094
//For some reason setting a NULL texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture.
10941095
m_whiteTexture=MSGNEW("TextureClass") TextureClass(1,1,WW3D_FORMAT_A4R4G4B4,MIP_LEVELS_1);
10951096
SurfaceClass *surface=m_whiteTexture->Get_Surface_Level();
@@ -1107,6 +1108,15 @@ Int WaterRenderObjClass::init(Real waterLevel, Real dx, Real dy, SceneClass *par
11071108
return 0;
11081109
}
11091110

1111+
void WaterRenderObjClass::updateMapOverrides(void)
1112+
{
1113+
if (m_riverTexture && TheWaterTransparency->m_standingWaterTexture.compareNoCase(m_riverTexture->Get_Texture_Name()) != 0)
1114+
{
1115+
REF_PTR_RELEASE(m_riverTexture);
1116+
m_riverTexture = WW3DAssetManager::Get_Instance()->Get_Texture(TheWaterTransparency->m_standingWaterTexture.str());
1117+
}
1118+
}
1119+
11101120
// ------------------------------------------------------------------------------------------------
11111121
// ------------------------------------------------------------------------------------------------
11121122
void WaterRenderObjClass::reset( void )
@@ -2713,29 +2723,49 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
27132723
}
27142724

27152725

2716-
Real shadeR, shadeG, shadeB;
2717-
shadeR = TheGlobalData->m_terrainAmbient[0].red;
2718-
shadeG = TheGlobalData->m_terrainAmbient[0].green;
2719-
shadeB = TheGlobalData->m_terrainAmbient[0].blue;
2726+
Real shadeR=TheWaterTransparency->m_standingWaterColor.red;
2727+
Real shadeG=TheWaterTransparency->m_standingWaterColor.green;
2728+
Real shadeB=TheWaterTransparency->m_standingWaterColor.blue;
27202729

2721-
//Add in diffuse lighting from each terrain light
2722-
for (Int lightIndex=0; lightIndex < TheGlobalData->m_numGlobalLights; lightIndex++)
2730+
//If the water color is not overridden, use legacy lighting code.
2731+
if ( shadeR==1.0f && shadeG==1.0f && shadeB==1.0f)
27232732
{
2724-
if (-TheGlobalData->m_terrainLightPos[lightIndex].z > 0)
2725-
{ shadeR += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].red;
2726-
shadeG += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].green;
2727-
shadeB += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].blue;
2733+
shadeR = TheGlobalData->m_terrainAmbient[0].red;
2734+
shadeG = TheGlobalData->m_terrainAmbient[0].green;
2735+
shadeB = TheGlobalData->m_terrainAmbient[0].blue;
2736+
2737+
//Add in diffuse lighting from each terrain light
2738+
for (Int lightIndex=0; lightIndex < TheGlobalData->m_numGlobalLights; lightIndex++)
2739+
{
2740+
if (-TheGlobalData->m_terrainLightPos[lightIndex].z > 0)
2741+
{ shadeR += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].red;
2742+
shadeG += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].green;
2743+
shadeB += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].blue;
2744+
}
27282745
}
2729-
}
27302746

2731-
//Get water material colors
2732-
Real waterShadeR = (m_settings[m_tod].waterDiffuse & 0xff) / 255.0f;
2733-
Real waterShadeG = ((m_settings[m_tod].waterDiffuse >> 8) & 0xff) / 255.0f;
2734-
Real waterShadeB = ((m_settings[m_tod].waterDiffuse >> 16) & 0xff) / 255.0f;
2747+
//Get water material colors
2748+
Real waterShadeR = (m_settings[m_tod].waterDiffuse & 0xff) / 255.0f;
2749+
Real waterShadeG = ((m_settings[m_tod].waterDiffuse >> 8) & 0xff) / 255.0f;
2750+
Real waterShadeB = ((m_settings[m_tod].waterDiffuse >> 16) & 0xff) / 255.0f;
27352751

2736-
shadeR=shadeR*waterShadeR*255.0f;
2737-
shadeG=shadeG*waterShadeG*255.0f;
2738-
shadeB=shadeB*waterShadeB*255.0f;
2752+
shadeR=shadeR*waterShadeR*255.0f;
2753+
shadeG=shadeG*waterShadeG*255.0f;
2754+
shadeB=shadeB*waterShadeB*255.0f;
2755+
}
2756+
else
2757+
{
2758+
shadeR=shadeR*255.0f;
2759+
shadeG=shadeG*255.0f;
2760+
shadeB=shadeB*255.0f;
2761+
2762+
if (shadeR == 0 && shadeG == 0 && shadeB == 0)
2763+
{ //special case where we disable lighting
2764+
shadeR=255;
2765+
shadeG=255;
2766+
shadeB=255;
2767+
}
2768+
}
27392769

27402770
Int diffuse=REAL_TO_INT(shadeB) | (REAL_TO_INT(shadeG) << 8) | (REAL_TO_INT(shadeR) << 16);
27412771

@@ -2840,9 +2870,15 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
28402870
DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); //position the water surface
28412871
DX8Wrapper::Set_Index_Buffer(ib_access,0);
28422872
DX8Wrapper::Set_Vertex_Buffer(vb_access);
2843-
DX8Wrapper::Set_Texture(0,m_riverTexture); //set to white
2873+
DX8Wrapper::Set_Texture(0,m_riverTexture); //set to blue
28442874

28452875
setupJbaWaterShader();
2876+
2877+
//In additive blending we need to use the alpha at the edges of river to darken
2878+
//rgb instead.
2879+
if (TheWaterTransparency->m_additiveBlend)
2880+
DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
2881+
28462882
if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(m_riverWaterPixelShader);
28472883
DWORD cull;
28482884
DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_CULLMODE, &cull);
@@ -2860,6 +2896,9 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
28602896

28612897
if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(NULL);
28622898

2899+
//restore blend mode to what W3D expects.
2900+
if (TheWaterTransparency->m_additiveBlend)
2901+
DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_ONE );
28632902

28642903
//do second pass to apply the shroud on water plane
28652904
if (TheTerrainRenderObject->getShroud())
@@ -2904,7 +2943,11 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
29042943
}
29052944

29062945
DX8Wrapper::Set_Texture(0,m_riverTexture);
2907-
DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader);
2946+
if (!TheWaterTransparency->m_additiveBlend)
2947+
DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader);
2948+
else
2949+
DX8Wrapper::Set_Shader(ShaderClass::_PresetAdditiveShader);
2950+
29082951
VertexMaterialClass *vmat=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE);
29092952
DX8Wrapper::Set_Material(vmat);
29102953
REF_PTR_RELEASE(vmat);
@@ -2995,7 +3038,7 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
29953038
DynamicIBAccessClass::WriteLockClass lockib(&ib_access);
29963039
UnsignedShort *curIb = lockib.Get_Index_Array();
29973040
for (j=0; j<vCount-1; j++)
2998-
for (i=0; i<uCount-1; i++)
3041+
{ for (i=0; i<uCount-1; i++)
29993042
{
30003043
//triangle 1
30013044
curIb[0] = (j)*uCount + i;
@@ -3009,32 +3052,53 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
30093052

30103053
curIb += 6; //skip the 6 indices we just added.
30113054
}
3055+
}
30123056
}
30133057

30143058
Real waterFactor=150;
3015-
Real shadeR, shadeG, shadeB;
3016-
shadeR = TheGlobalData->m_terrainAmbient[0].red;
3017-
shadeG = TheGlobalData->m_terrainAmbient[0].green;
3018-
shadeB = TheGlobalData->m_terrainAmbient[0].blue;
3059+
Real shadeR=TheWaterTransparency->m_standingWaterColor.red;
3060+
Real shadeG=TheWaterTransparency->m_standingWaterColor.green;
3061+
Real shadeB=TheWaterTransparency->m_standingWaterColor.blue;
30193062

3020-
//Add in diffuse lighting from each terrain light
3021-
for (Int lightIndex=0; lightIndex < TheGlobalData->m_numGlobalLights; lightIndex++)
3063+
//If the water color is not overridden, use legacy lighting code.
3064+
if ( shadeR==1.0f && shadeG==1.0f && shadeB==1.0f)
30223065
{
3023-
if (-TheGlobalData->m_terrainLightPos[lightIndex].z > 0)
3024-
{ shadeR += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].red;
3025-
shadeG += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].green;
3026-
shadeB += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].blue;
3066+
shadeR = TheGlobalData->m_terrainAmbient[0].red;
3067+
shadeG = TheGlobalData->m_terrainAmbient[0].green;
3068+
shadeB = TheGlobalData->m_terrainAmbient[0].blue;
3069+
3070+
//Add in diffuse lighting from each terrain light
3071+
for (Int lightIndex=0; lightIndex < TheGlobalData->m_numGlobalLights; lightIndex++)
3072+
{
3073+
if (-TheGlobalData->m_terrainLightPos[lightIndex].z > 0)
3074+
{ shadeR += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].red;
3075+
shadeG += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].green;
3076+
shadeB += -TheGlobalData->m_terrainLightPos[lightIndex].z * TheGlobalData->m_terrainDiffuse[lightIndex].blue;
3077+
}
30273078
}
3028-
}
30293079

3030-
//Get water material colors
3031-
Real waterShadeR = (m_settings[m_tod].waterDiffuse & 0xff) / 255.0f;
3032-
Real waterShadeG = ((m_settings[m_tod].waterDiffuse >> 8) & 0xff) / 255.0f;
3033-
Real waterShadeB = ((m_settings[m_tod].waterDiffuse >> 16) & 0xff) / 255.0f;
3080+
//Get water material colors
3081+
Real waterShadeR = (m_settings[m_tod].waterDiffuse & 0xff) / 255.0f;
3082+
Real waterShadeG = ((m_settings[m_tod].waterDiffuse >> 8) & 0xff) / 255.0f;
3083+
Real waterShadeB = ((m_settings[m_tod].waterDiffuse >> 16) & 0xff) / 255.0f;
30343084

3035-
shadeR=shadeR*waterShadeR*255.0f;
3036-
shadeG=shadeG*waterShadeG*255.0f;
3037-
shadeB=shadeB*waterShadeB*255.0f;
3085+
shadeR=shadeR*waterShadeR*255.0f;
3086+
shadeG=shadeG*waterShadeG*255.0f;
3087+
shadeB=shadeB*waterShadeB*255.0f;
3088+
}
3089+
else
3090+
{
3091+
shadeR=shadeR*255.0f;
3092+
shadeG=shadeG*255.0f;
3093+
shadeB=shadeB*255.0f;
3094+
3095+
if (shadeR == 0 && shadeG == 0 && shadeB == 0)
3096+
{ //special case where we disable lighting
3097+
shadeR=255;
3098+
shadeG=255;
3099+
shadeB=255;
3100+
}
3101+
}
30383102

30393103
Int diffuse=REAL_TO_INT(shadeB) | (REAL_TO_INT(shadeG) << 8) | (REAL_TO_INT(shadeR) << 16);
30403104

@@ -3173,7 +3237,8 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
31733237
//If video card supports it and it's enabled, feather the water edge using destination alpha
31743238
if (DX8Wrapper::getBackBufferFormat() == WW3D_FORMAT_A8R8G8B8 && TheGlobalData->m_showSoftWaterEdge && TheWaterTransparency->m_transparentWaterDepth !=0)
31753239
{ DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_DESTALPHA );
3176-
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_INVDESTALPHA );
3240+
if (!TheWaterTransparency->m_additiveBlend)
3241+
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_INVDESTALPHA );
31773242
}
31783243

31793244

@@ -3217,8 +3282,15 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
32173282

32183283
if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(NULL);
32193284
//Restore alpha blend to default values since we may have changed them to feather edges.
3220-
DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
3221-
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
3285+
if (!TheWaterTransparency->m_additiveBlend)
3286+
{ DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
3287+
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
3288+
}
3289+
else
3290+
{
3291+
DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_ONE );
3292+
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_ONE );
3293+
}
32223294

32233295
if (TheTerrainRenderObject->getShroud())
32243296
{

0 commit comments

Comments
 (0)