Skip to content

Commit

Permalink
xrRenderR1 shaders: fixed fogging wallmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyLoaderr authored and Xottab-DUTY committed Nov 17, 2019
1 parent 8e0b0f3 commit 40174b1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
10 changes: 5 additions & 5 deletions res/gamedata/shaders/r1/effects_wallmarkblend.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("wmark", "vert")
shader:begin ("wmark_blend", "vert")
: sorting (2, false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
Expand All @@ -9,11 +9,11 @@ function normal (shader, t_base, t_second, t_detail)
end

function l_spot (shader, t_base, t_second, t_detail)
r1_lspot (shader, t_base, "wmark_spot")
shader : sorting (2, false)
r1_lspot (shader, t_base, "wmark_spot")
shader:sorting(2, false)
end

function l_point (shader, t_base, t_second, t_detail)
r1_lpoint (shader, t_base, "wmark_point")
shader : sorting (2, false)
r1_lpoint (shader, t_base, "wmark_point")
shader:sorting(2, false)
end
34 changes: 34 additions & 0 deletions res/gamedata/shaders/r1/wmark_blend.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "common.h"
#include "shared\wmark.h"

// for multiplicative decal

// For alpha-blend decal
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float4 c0 : COLOR0; // c0=all lighting
float fog : FOG;
};

vf main (v_vert v)
{
vf o;

float3 N = unpack_normal (v.N);
float4 P = wmark_shift (v.P,N);
o.hpos = mul (m_VP, P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc

float3 L_rgb = v.color.xyz; // precalculated RGB lighting
float3 L_hemi = v_hemi(N)*v.N.w; // hemisphere
float3 L_sun = v_sun(N)*v.color.w; // sun
float3 L_final = L_rgb + L_hemi + L_sun + L_ambient;

o.c0.rgb = L_final;
o.c0.a = calc_fogging (P); // fog, input in world coords
o.fog = o.c0.a; // fog, input in world coords

return o;
}

0 comments on commit 40174b1

Please sign in to comment.