-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
out gl_PerVertex { vec4 gl_Position; }; | ||
|
||
struct v_lmap | ||
{ | ||
float4 pos; // (float,float,float,1) | ||
float4 norm; // (nx,ny,nz,hemi occlusion) | ||
float2 tc0; // (base) | ||
float2 tc1; // (lmap/compressed) | ||
}; | ||
struct vf | ||
{ | ||
float4 hpos; | ||
float2 tc0; | ||
float2 tc1; | ||
float2 tch; | ||
float3 tc2; | ||
float3 c0; // c0=hemi+v-lights, c0.a = dt* | ||
float3 c1; // c1=sun, c1.a = dt+ | ||
float fog; | ||
}; | ||
|
||
layout(location = POSITION) in vec4 P; // (float,float,float,1) | ||
layout(location = NORMAL) in vec4 Nh; // (nx,ny,nz,hemi occlusion) | ||
layout(location = TANGENT) in vec4 T; // tangent | ||
layout(location = BINORMAL) in vec4 B; // binormal | ||
layout(location = TEXCOORD0) in vec2 tc; // (u,v) | ||
layout(location = TEXCOORD1) in vec2 lm; // (lmu,lmv) | ||
layout(location = COLOR0) in vec4 color; // (r,g,b,dir-occlusion) // Swizzle before use!!! | ||
|
||
layout(location = TEXCOORD0) out float2 tc0; | ||
layout(location = TEXCOORD1) out float2 tc1; | ||
layout(location = TEXCOORD2) out float2 tch; | ||
layout(location = TEXCOORD3) out float3 tc2; | ||
layout(location = COLOR0) out float3 c0; // c0=hemi+v-lights, c0.a = dt* | ||
layout(location = COLOR1) out float3 c1; // c1=sun, c1.a = dt+ | ||
layout(location = FOG) out float fog; | ||
|
||
vf _main( v_static v ); | ||
|
||
void main() | ||
{ | ||
v_static I; | ||
I.P = P; | ||
I.Nh = Nh; | ||
I.T = T; | ||
I.B = B; | ||
I.tc = tc; | ||
I.lmh = lm; | ||
I.color = color; | ||
|
||
vf O = _main(I); | ||
|
||
tc0 = O.tc0; | ||
tc1 = O.tc1; | ||
tch = O.tch; | ||
tc2 = O.tc2; | ||
c0 = O.c0; | ||
c1 = O.c1; | ||
fog = O.fog; | ||
gl_Position = O.hpos; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "common.h" | ||
#include "iostructs\v_lmape.h" | ||
|
||
vf _main (v_static v) | ||
{ | ||
vf o; | ||
|
||
float3 pos_w = v.P; | ||
float3 norm_w = normalize(unpack_normal(v.Nh)); | ||
|
||
o.hpos = mul (m_VP, v.P); // xform, input in world coords | ||
o.tc0 = unpack_tc_base (v.tc,v.T.w,v.B.w); // copy tc | ||
o.tc1 = unpack_tc_lmap (v.lmh); // copy tc | ||
o.tch = o.tc1; | ||
o.tc2 = calc_reflection (pos_w, norm_w); | ||
o.fog = saturate(calc_fogging (v.P)); // fog, input in world coords | ||
o.c0 = half4(v_hemi(norm_w),o.fog); // just hemisphere | ||
o.c1 = v_sun (norm_w); // sun | ||
|
||
return o; | ||
} |