Skip to content

Commit

Permalink
update GWaterVolumetric to use new vertex format
Browse files Browse the repository at this point in the history
  • Loading branch information
meetric1 committed Jul 30, 2024
1 parent b34c8f4 commit 157250c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion binary/src/shaders/GWaterFinalpass.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ SHADER_DRAW {

// pShaderAPI->SetPixelShaderStateAmbientLightCube( PSREG_AMBIENT_CUBE, false ); // Force to black if not bAmbientLight

pShaderAPI->CommitPixelShaderLighting( PSREG_LIGHT_INFO_ARRAY );
pShaderAPI->CommitPixelShaderLighting(PSREG_LIGHT_INFO_ARRAY);

DECLARE_DYNAMIC_VERTEX_SHADER(GWaterFinalpass_vs30);
SET_DYNAMIC_VERTEX_SHADER_COMBO(NUM_LIGHTS, lightState.m_nNumLights);
Expand Down
5 changes: 4 additions & 1 deletion binary/src/shaders/GWaterVolumetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ BEGIN_VS_SHADER(GWaterVolumetric, "gwater2 helper")
// Shader parameters
BEGIN_SHADER_PARAMS
SHADER_PARAM(ALPHA, SHADER_PARAM_TYPE_FLOAT, "0.025", "Amount of transparency")
SHADER_PARAM(BASETEXTURE, SHADER_PARAM_TYPE_TEXTURE, "lights/white", "Base texture")
END_SHADER_PARAMS

SHADER_INIT_PARAMS() {

}

SHADER_INIT{

LoadTexture(BASETEXTURE);
}

SHADER_FALLBACK{
Expand Down Expand Up @@ -46,6 +47,7 @@ SHADER_DRAW {

// Transparent things (alpha = 0 or alpha = 1)
pShaderShadow->EnableAlphaTest(IS_FLAG_SET(MATERIAL_VAR_ALPHATEST));
pShaderShadow->EnableTexture(SHADER_SAMPLER0, true);

DECLARE_STATIC_VERTEX_SHADER(GWaterVolumetric_vs30);
SET_STATIC_VERTEX_SHADER(GWaterVolumetric_vs30);
Expand All @@ -59,6 +61,7 @@ SHADER_DRAW {
const float alpha = params[ALPHA]->GetFloatValue();

pShaderAPI->SetPixelShaderConstant(0, &alpha);
BindTexture(SHADER_SAMPLER0, BASETEXTURE);

DECLARE_DYNAMIC_VERTEX_SHADER(GWaterVolumetric_vs30);
SET_DYNAMIC_VERTEX_SHADER(GWaterVolumetric_vs30);
Expand Down
3 changes: 1 addition & 2 deletions materials/gwater2/bubble.vmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"UnlitGeneric" {
GWaterVolumetric {
$basetexture "gwater2/bubble"
$additive 1
$alpha 0.3
$basetexturetransform "center .5 .5 scale 0.15 0.15 rotate 0 translate 0 0"
}
3 changes: 1 addition & 2 deletions materials/gwater2/mist.vmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
UnlitGeneric {
GWaterVolumetric {
$basetexture "gwater2/splash"
$additive 1
$alpha 0.3
$basetexturetransform "center .5 .5 scale 1 1 rotate 0 translate 0 0"
}
Binary file added materials/gwater2/sphere.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions materials/gwater2/sphere.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"LightmappedGeneric"
{
"$basetexture" "gwater2/sphere"
}
Binary file added materials/gwater2/sphere.vtf
Binary file not shown.
1 change: 1 addition & 0 deletions materials/gwater2/volumetric.vmt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GWaterVolumetric {
$basetexture gwater2/sphere
$additive 1
$alpha 0.125
$translucent 1
Expand Down

0 comments on commit 157250c

Please sign in to comment.