Skip to content

Commit 10ae347

Browse files
committed
R1 lighting improvements.
- Dynamic objects are now rendered with detail texture (if they have). - Detail textures are now affected by dynamic lights.
1 parent 8e0176b commit 10ae347

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+828
-972
lines changed
-181 Bytes
Binary file not shown.
68 Bytes
Binary file not shown.
-160 Bytes
Binary file not shown.
67 Bytes
Binary file not shown.

res/gamedata/shaders/r1/base_lplanes.vs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ vf main (v_vert v)
1212
vf o;
1313

1414
o.hpos = mul (m_WVP, v.P); // xform, input in world coords
15-
o.tc0 = unpack_tc_base (v.uv,v.T.w,v.B.w); // copy tc
16-
// o.tc0 = unpack_tc_base (v.tc); // copy tc
15+
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
1716

1817
// calculate fade
1918
float3 dir_v = normalize (mul(m_WV,v.P));

res/gamedata/shaders/r1/common.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct v_vert
6767
float4 T : TANGENT;
6868
float4 B : BINORMAL;
6969
float4 color : COLOR0; // (r,g,b,dir-occlusion)
70-
float2 uv : TEXCOORD0; // (u0,v0)
70+
float2 uv0 : TEXCOORD0; // (u0,v0)
7171
};
7272
struct v_model
7373
{
@@ -91,15 +91,21 @@ struct vf_spot
9191
float2 tc0 : TEXCOORD0; // base
9292
float4 tc1 : TEXCOORD1; // lmap, projected
9393
float2 tc2 : TEXCOORD2; // att + clipper
94-
float4 color : COLOR0;
94+
#ifdef DL_DETAILS
95+
float2 tcd : TEXCOORD3; // details
96+
#endif
97+
float4 color: COLOR0;
9598
};
9699
struct vf_point
97100
{
98101
float4 hpos : POSITION;
99102
float2 tc0 : TEXCOORD0; // base
100103
float2 tc1 : TEXCOORD1; // att1 + clipper
101104
float2 tc2 : TEXCOORD2; // att2 + clipper
102-
float4 color : COLOR0;
105+
#ifdef DL_DETAILS
106+
float2 tcd : TEXCOORD3; // details
107+
#endif
108+
float4 color: COLOR0;
103109
};
104110
//////////////////////////////////////////////////////////////////////////////////////////
105111
uniform sampler2D s_base;

res/gamedata/shaders/r1/effects_wallmarkmult.s

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,40 @@ function normal (shader, t_base, t_second, t_detail)
33
: sorting (2, false)
44
: blend (true,blend.destcolor,blend.srccolor)
55
: aref (false,0)
6-
: zb (true,true)
6+
: zb (true,false)
77
: fog (true)
88
: wmark (true)
99
shader:sampler ("s_base") :texture (t_base)
1010
end
1111

1212

1313
function l_spot (shader, t_base, t_second, t_detail)
14-
r1_lspot (shader, t_base, "wmark_spot")
14+
shader:begin ("wmark_spot","add_spot")
15+
: fog (false)
16+
: zb (true,false)
17+
: blend (true,blend.srcalpha,blend.one)
18+
: aref (true,aref or 0)
19+
shader:sampler ("s_base") :texture (t_base)
20+
shader:sampler ("s_lmap") :texture ("internal\\internal_light_att")
21+
: clamp ()
22+
: f_linear ()
23+
: project (true)
24+
shader:sampler ("s_att") :texture ("internal\\internal_light_attclip")
25+
: clamp ()
26+
: f_linear ()
1527
end
1628

1729
function l_point (shader, t_base, t_second, t_detail)
18-
r1_lpoint (shader, t_base, "wmark_point")
19-
end
30+
shader:begin ("wmark_point","add_point")
31+
: fog (false)
32+
: zb (true,false)
33+
: blend (true,blend.srcalpha,blend.one)
34+
: aref (true,aref or 0)
35+
shader:sampler ("s_base") :texture (t_base)
36+
shader:sampler ("s_lmap") :texture (t_point_att)
37+
: clamp ()
38+
: f_linear ()
39+
shader:sampler ("s_att") :texture (t_point_att)
40+
: clamp ()
41+
: f_linear ()
42+
end

res/gamedata/shaders/r1/impl.ps

190 Bytes
Binary file not shown.

res/gamedata/shaders/r1/impl.vs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,35 @@ struct vf
55
float4 hpos : POSITION;
66
float2 tc0 : TEXCOORD0;
77
float2 tc1 : TEXCOORD1;
8-
float3 c0 : COLOR0; // c0=hemi, c0.a = dt*
9-
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
8+
#ifdef T_DETAILS
9+
float2 tcd : TEXCOORD2;
10+
float4 c0 : COLOR0; // xyz=hemi, w=dt*
11+
float4 c1 : COLOR1; // xyz=sun, w=dt+
12+
#else
13+
float3 c0 : COLOR0; // hemi
14+
float3 c1 : COLOR1; // sun
15+
#endif
1016
float fog : FOG;
1117
};
1218

1319
vf main (v_lmap v)
1420
{
1521
vf o;
1622

17-
float3 N = unpack_normal (v.N);
18-
o.hpos = mul (m_VP, v.P); // xform, input in world coords
19-
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
20-
o.tc1 = o.tc0; // copy tc
21-
o.c0 = v_hemi (N); // hemi
22-
o.c1 = v_sun (N); // sun
23-
o.fog = calc_fogging (v.P); // fog, input in world coords
23+
float3 N = unpack_normal(v.N);
24+
o.hpos = mul(m_VP, v.P); // xform, input in world coords
25+
o.tc0 = unpack_tc_base(v.uv0,v.T.w,v.B.w);
26+
o.tc1 = o.tc0; // copy tc
27+
#ifdef T_DETAILS
28+
float2 dt = calc_detail(v.P);
29+
o.tcd = o.tc0*dt_params; // dt tc
30+
o.c0 = float4(v_hemi(N), dt.x); // xyz=hemi, w=dt*
31+
o.c1 = float4(v_sun(N), dt.y); // xyz=sun, w=dt+
32+
#else
33+
o.c0 = v_hemi(N); // hemi
34+
o.c1 = v_sun(N); // sun
35+
#endif
36+
o.fog = calc_fogging(v.P); // fog, input in world coords
2437

2538
return o;
2639
}

res/gamedata/shaders/r1/impl_dt.ps

-831 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)