Skip to content

Commit cadf573

Browse files
committed
unify(shader): Merge W3DShaderManager code, move Smudge, W3DSmudge to Core (#1920)
1 parent 042fc81 commit cadf573

File tree

16 files changed

+904
-60
lines changed

16 files changed

+904
-60
lines changed

Core/GameEngine/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ set(GAMEENGINE_SRC
222222
# Include/GameClient/Shell.h
223223
# Include/GameClient/ShellHooks.h
224224
# Include/GameClient/ShellMenuScheme.h
225-
# Include/GameClient/Smudge.h
225+
Include/GameClient/Smudge.h
226226
# Include/GameClient/Snow.h
227227
# Include/GameClient/Statistics.h
228228
# Include/GameClient/TerrainRoads.h
@@ -827,7 +827,7 @@ set(GAMEENGINE_SRC
827827
# Source/GameClient/System/Image.cpp
828828
# Source/GameClient/System/ParticleSys.cpp
829829
# Source/GameClient/System/RayEffect.cpp
830-
# Source/GameClient/System/Smudge.cpp
830+
Source/GameClient/System/Smudge.cpp
831831
# Source/GameClient/Terrain/TerrainRoads.cpp
832832
# Source/GameClient/Terrain/TerrainVisual.cpp
833833
Source/GameClient/VideoPlayer.cpp

Core/GameEngineDevice/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ set(GAMEENGINEDEVICE_SRC
6363
# Include/W3DDevice/GameClient/W3DShaderManager.h
6464
# Include/W3DDevice/GameClient/W3DShadow.h
6565
# Include/W3DDevice/GameClient/W3DShroud.h
66-
# Include/W3DDevice/GameClient/W3DSmudge.h
66+
Include/W3DDevice/GameClient/W3DSmudge.h
6767
# Include/W3DDevice/GameClient/W3DSnow.h
6868
# Include/W3DDevice/GameClient/W3DStatusCircle.h
6969
# Include/W3DDevice/GameClient/W3DTerrainBackground.h
@@ -165,7 +165,7 @@ set(GAMEENGINEDEVICE_SRC
165165
# Source/W3DDevice/GameClient/W3DScene.cpp
166166
# Source/W3DDevice/GameClient/W3DShaderManager.cpp
167167
# Source/W3DDevice/GameClient/W3DShroud.cpp
168-
# Source/W3DDevice/GameClient/W3DSmudge.cpp
168+
Source/W3DDevice/GameClient/W3DSmudge.cpp
169169
# Source/W3DDevice/GameClient/W3DSnow.cpp
170170
# Source/W3DDevice/GameClient/W3DStatusCircle.cpp
171171
# Source/W3DDevice/GameClient/W3DTerrainBackground.cpp

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ enum FilterTypes CPP_11(: Int)
7676
FT_VIEW_BW_FILTER, //filter to apply a black & white filter to the screen.
7777
FT_VIEW_MOTION_BLUR_FILTER, //filter to apply motion blur filter to screen.
7878
FT_VIEW_CROSSFADE, ///<filter to apply a cross blend between previous/current views.
79+
FT_VIEW_DEFAULT, ///<default filter mode for default filter.
7980
FT_MAX
8081
};
8182

@@ -101,7 +102,7 @@ enum FilterModes CPP_11(: Int)
101102
FM_VIEW_MB_OUT_SATURATE, // Motion blur filter out saturated blur
102103
FM_VIEW_MB_END_PAN_ALPHA, // Moton blur on screen pan (for camera tracks object mode)
103104

104-
105+
FM_VIEW_DEFAULT, //Default filter that's enabled when all others are off.
105106

106107
// NOTE: This has to be the last entry in this enum.
107108
// Add new entries before this one. jba.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum CustomScenePassModes CPP_11(: Int);
4040
enum StaticGameLODLevel CPP_11(: Int);
4141
enum ChipsetType CPP_11(: Int);
4242
enum CpuType CPP_11(: Int);
43+
enum GraphicsVenderID CPP_11(: Int);
4344

4445
class TextureClass; ///forward reference
4546
/** System for managing complex rendering settings which are either not handled by
@@ -65,6 +66,11 @@ class W3DShaderManager
6566
ST_ROAD_BASE_NOISE2, //shader to apply base texture and cloud/noise 2.
6667
ST_ROAD_BASE_NOISE12,//shader to apply base texture and both cloud/noise
6768
ST_CLOUD_TEXTURE, //shader to project clouds.
69+
ST_FLAT_TERRAIN_BASE, //shader to apply base terrain texture only
70+
ST_FLAT_TERRAIN_BASE_NOISE1, //shader to apply base texture and cloud/noise 1.
71+
ST_FLAT_TERRAIN_BASE_NOISE2, //shader to apply base texture and cloud/noise 2.
72+
ST_FLAT_TERRAIN_BASE_NOISE12,//shader to apply base texture and both cloud/noise
73+
ST_FLAT_SHROUD_TEXTURE, //shader to apply shroud texture projection.
6874
ST_MAX
6975
};
7076

@@ -75,8 +81,11 @@ class W3DShaderManager
7581
static void updateCloud(); ///<update the cloud position once every render frame.
7682

7783
static ChipsetType getChipset(void); ///<return current device chipset.
84+
static GraphicsVenderID getCurrentVendor(void) {return m_currentVendor;} ///<return current card vendor.
85+
static __int64 getCurrentDriverVersion(void) {return m_driverVersion; } ///<return current driver version.
7886
static Int getShaderPasses(ShaderTypes shader); ///<rendering passes required for shader
7987
static Int setShader(ShaderTypes shader, Int pass); ///<enable specific shader pass.
88+
static Int setShroudTex(Int stage); ///<Set shroud in a texture stage.
8089
static void resetShader(ShaderTypes shader); ///<make sure W3D2 gets restored to normal
8190
///Specify all textures (up to 8) which can be accessed by the shaders.
8291
static void setTexture(Int stage,TextureClass* texture) {m_Textures[stage]=texture;}
@@ -101,12 +110,15 @@ class W3DShaderManager
101110
static void startRenderToTexture(void); ///< Sets render target to texture.
102111
static IDirect3DTexture8 * endRenderToTexture(void); ///< Ends render to texture, & returns texture.
103112
static IDirect3DTexture8 * getRenderTexture(void); ///< returns last used render target texture
113+
static Bool isRenderingToTexture(void) {return m_renderingToTexture; }
104114
static void drawViewport(Int color); ///<draws 2 triangles covering the current tactical viewport
105115

106116

107117
protected:
108118
static TextureClass *m_Textures[8]; ///textures assigned to each of the possible stages
109119
static ChipsetType m_currentChipset; ///<last video card chipset that was detected.
120+
static GraphicsVenderID m_currentVendor; ///<last video card vendor
121+
static __int64 m_driverVersion; ///<driver version of last chipset.
110122
static ShaderTypes m_currentShader; ///<last shader that was set.
111123
static Int m_currentShaderPass; ///<pass of last shader that was set.
112124

0 commit comments

Comments
 (0)