add game&rawdata

This commit is contained in:
Vasily Petrov 2026-06-17 23:06:51 +03:00
parent 0133cd976c
commit 49b34b5546
45731 changed files with 709831 additions and 0 deletions

39
gamedata/shaders/r1/.lua Normal file
View file

@ -0,0 +1,39 @@
function printf(fmt, ...)
log(string.format(fmt, unpack(arg)))
end
t_point_att = "internal\\internal_light_attpoint"
t_rt = "$user$rendertarget"
t_distort = "$user$distort"
t_noise = "fx\\fx_noise2"
function r1_lspot(shader, t_base, vs, aref)
shader:begin(vs, "add_spot")
:fog(false)
:zb(true, false)
:blend(true, blend.one, blend.one)
:aref(true, aref or 0)
shader:sampler("s_base"):texture(t_base)
shader:sampler("s_lmap"):texture("internal\\internal_light_att")
:clamp()
:f_linear()
:project(true)
shader:sampler("s_att"):texture("internal\\internal_light_attclip")
:clamp()
:f_linear()
end
function r1_lpoint(shader, t_base, vs, aref)
shader:begin(vs, "add_point")
:fog(false)
:zb(true, false)
:blend(true, blend.one, blend.one)
:aref(true, aref or 0)
shader:sampler("s_base"):texture(t_base)
shader:sampler("s_lmap"):texture(t_point_att)
:clamp()
:f_linear()
shader:sampler("s_att"):texture(t_point_att)
:clamp()
:f_linear()
end

39
gamedata/shaders/r1/.s Normal file
View file

@ -0,0 +1,39 @@
function printf(fmt,...)
log(string.format(fmt,unpack(arg)))
end
t_point_att = "internal\\internal_light_attpoint"
t_rt = "$user$rendertarget"
t_distort = "$user$distort"
t_noise = "fx\\fx_noise2"
function r1_lspot (shader, t_base, vs, aref)
shader:begin (vs,"add_spot")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
: aref (true,aref or 0)
shader:sampler ("s_base") :texture (t_base)
shader:sampler ("s_lmap") :texture ("internal\\internal_light_att")
: clamp ()
: f_linear ()
: project (true)
shader:sampler ("s_att") :texture ("internal\\internal_light_attclip")
: clamp ()
: f_linear ()
end
function r1_lpoint (shader, t_base, vs, aref)
shader:begin (vs,"add_point")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
: aref (true,aref or 0)
shader:sampler ("s_base") :texture (t_base)
shader:sampler ("s_lmap") :texture (t_point_att)
: clamp ()
: f_linear ()
shader:sampler ("s_att") :texture (t_point_att)
: clamp ()
: f_linear ()
end

View file

@ -0,0 +1,19 @@
#include "common.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( vf_point I ) : COLOR
{
half4 t_base = tex2D (s_base, I.tc0);
half4 t_att1 = tex2D (s_lmap, I.tc1); // point-att
half4 t_att2 = tex2D (s_att, I.tc2); // point-att
half4 t_att = t_att1*t_att2;
half4 final_color = t_base*t_att*I.color;
final_color.rgb *= t_base.a;
half3 final_rgb = (final_color+final_color)*2;
half final_a = final_color.w;
// out
return final_color*2; //half4 (final_rgb,final_a);
}

View file

@ -0,0 +1,18 @@
#include "common.hlsli"
// Pixel
float4 main(vf_point I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_att1 = tex2D(s_lmap, I.tc1); // point-att
float4 t_att2 = tex2D(s_att, I.tc2); // point-att
float4 t_att = t_att1 * t_att2;
float4 final_color = t_base * t_att * I.color;
final_color.rgb *= t_base.a;
float3 final_rgb = (final_color + final_color) * 2.0f;
float final_a = final_color.w;
// out
return final_color * 2.0f; // float4 (final_rgb,final_a);
}

View file

@ -0,0 +1,21 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_0 = tex2D (s_base0,I.tc0);
half4 t_1 = tex2D (s_base1,I.tc1);
// out
return t_0*t_1*L_dynamic_color;
}

View file

@ -0,0 +1,20 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_0 = tex2D(s_base0, I.tc0);
float4 t_1 = tex2D(s_base1, I.tc1);
// out
return t_0 * t_1 * L_dynamic_color;
}

View file

@ -0,0 +1,18 @@
#include "common.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( vf_spot I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1); // spot-projector
half4 t_att = tex2D (s_att, I.tc2); // spot-att
half4 final_color = t_base*t_lmap*t_att*I.color;
final_color.rgb *= t_base.a;
half3 final_rgb = (final_color+final_color)*2;
half final_a = final_color.w;
// out
return final_color*2; //half4 (final_rgb,final_a);
}

View file

@ -0,0 +1,17 @@
#include "common.hlsli"
// Pixel
float4 main(vf_spot I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2Dproj(s_lmap, I.tc1); // spot-projector
float4 t_att = tex2D(s_att, I.tc2); // spot-att
float4 final_color = t_base * t_lmap * t_att * I.color;
final_color.rgb *= t_base.a;
float3 final_rgb = (final_color + final_color) * 2.0f;
float final_a = final_color.w;
// out
return final_color * 2; // float4 (final_rgb,final_a);
}

View file

@ -0,0 +1,21 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_0 = tex2D (s_base0,I.tc0);
half4 t_1 = tex2D (s_base1,I.tc1);
// out
return (t_0+t_1)*.5;
}

View file

@ -0,0 +1,20 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_0 = tex2D(s_base0, I.tc0);
float4 t_1 = tex2D(s_base1, I.tc1);
// out
return (t_0 + t_1) * .5;
}

View file

@ -0,0 +1,27 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // base
half2 tc2: TEXCOORD2; // base
half2 tc3: TEXCOORD3; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
uniform sampler2D s_base2;
uniform sampler2D s_base3;
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_0 = tex2D (s_base0,I.tc0);
half4 t_1 = tex2D (s_base1,I.tc1);
half4 t_2 = tex2D (s_base2,I.tc2);
half4 t_3 = tex2D (s_base3,I.tc3);
// out
return ((t_0+t_1)*.5 + (t_2+t_3)*.5)*.5;
}

View file

@ -0,0 +1,26 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // base
float2 tc2 : TEXCOORD2; // base
float2 tc3 : TEXCOORD3; // base
};
uniform sampler2D s_base0;
uniform sampler2D s_base1;
uniform sampler2D s_base2;
uniform sampler2D s_base3;
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_0 = tex2D(s_base0, I.tc0);
float4 t_1 = tex2D(s_base1, I.tc1);
float4 t_2 = tex2D(s_base2, I.tc2);
float4 t_3 = tex2D(s_base3, I.tc3);
// out
return ((t_0 + t_1) * .5 + (t_2 + t_3) * .5) * .5;
}

View file

@ -0,0 +1,20 @@
#include "common.hlsli"
struct v2p
{
float2 tc0: TEXCOORD0; // base
float2 tc1: TEXCOORD1; // lmap
float4 c0: COLOR0; // sun
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
float4 main ( v2p I ) : COLOR
{
float4 t_base = tex2D (s_base,I.tc0);
// out
return float4 (t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
}

View file

@ -0,0 +1,18 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // lmap
half4 c0: COLOR0; // sun
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
// out
return half4 (t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
}

View file

@ -0,0 +1,17 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float4 c0 : COLOR0; // sun
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
// out
return float4(t_base.r, t_base.g, t_base.b, t_base.a * I.c0.a);
}

View file

@ -0,0 +1,25 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float4 c0 : COLOR0; // color
};
vf main (v_vert v)
{
vf o;
o.hpos = mul (m_WVP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv,v.T.w,v.B.w); // copy tc
// o.tc0 = unpack_tc_base (v.tc); // copy tc
// calculate fade
float3 dir_v = normalize (mul(m_WV,v.P));
float3 norm_v = normalize (mul(m_WV,unpack_normal(v.N)));
float fade = abs (dot(dir_v,norm_v));
o.c0 = fade;
return o;
}

View file

@ -0,0 +1,25 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float4 c0 : COLOR0; // color
};
vf main(v_vert v)
{
vf o;
o.hpos = mul(m_WVP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv, v.T.w, v.B.w); // copy tc
// o.tc0 = unpack_tc_base (v.tc); // copy tc
// calculate fade
float3 dir_v = normalize(mul(m_WV, v.P));
float3 norm_v = normalize(mul(m_WV, unpack_normal(v.N)));
float fade = abs(dot(dir_v, norm_v));
o.c0 = fade;
return o;
}

View file

@ -0,0 +1,31 @@
#include "common.hlsli"
struct v2p
{
float2 tc0: TEXCOORD0; // base
float2 tc1: TEXCOORD1; // lmap
float4 c0: COLOR0; // sun
};
inline bool isCollimatorActive()
{
return (m_hud_params.w == 1.0f);
}
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base,I.tc0);
// out
if(isCollimatorActive())
{
return float4(t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
}
else
{
return float4(t_base.r,t_base.g,t_base.b,t_base.a * 0.0f);
}
}

View file

@ -0,0 +1,7 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "avg2")
:fog(false)
:zb(false, false)
shader:sampler("s_base0"):texture(t_base):clamp():f_linear()
shader:sampler("s_base1"):texture(t_base):clamp():f_linear()
end

View file

@ -0,0 +1,7 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","avg2")
: fog (false)
: zb (false,false)
shader:sampler ("s_base0") :texture(t_base): clamp() : f_linear ()
shader:sampler ("s_base1") :texture(t_base): clamp() : f_linear ()
end

View file

@ -0,0 +1,9 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "avg4")
:fog(false)
:zb(false, false)
shader:sampler("s_base0"):texture(t_base):clamp():f_linear()
shader:sampler("s_base1"):texture(t_base):clamp():f_linear()
shader:sampler("s_base2"):texture(t_base):clamp():f_linear()
shader:sampler("s_base3"):texture(t_base):clamp():f_linear()
end

View file

@ -0,0 +1,9 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","avg4")
: fog (false)
: zb (false,false)
shader:sampler ("s_base0") :texture(t_base): clamp() : f_linear ()
shader:sampler ("s_base1") :texture(t_base): clamp() : f_linear ()
shader:sampler ("s_base2") :texture(t_base): clamp() : f_linear ()
shader:sampler ("s_base3") :texture(t_base): clamp() : f_linear ()
end

View file

@ -0,0 +1,5 @@
@echo off
del test\*.ps
del test\*.vs
FOR %%a IN (*.ps) DO call p1 %%a
FOR %%b IN (*.vs) DO call h2 %%b

View file

@ -0,0 +1,10 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("clouds", "clouds")
:fog(false)
:zb(true, false)
:sorting(3, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
shader:sampler("s_clouds0"):texture("null"):wrap():f_anisotropic()
shader:sampler("s_clouds1"):texture("null"):wrap():f_anisotropic()
shader:sampler("s_tonemap"):texture("$user$tonemap")
end

View file

@ -0,0 +1,22 @@
#include "common.h"
struct v2p
{
half4 color : COLOR0; // rgb. intensity
half2 tc0 : TEXCOORD0;
half2 tc1 : TEXCOORD1;
};
uniform sampler2D s_clouds0 : register(s0);
uniform sampler2D s_clouds1 : register(s1);
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 s0 = tex2D (s_clouds0,I.tc0);
half4 s1 = tex2D (s_clouds1,I.tc1);
half4 mix = I.color * (s0 + s1) ;
return half4 (mix.rgb, mix.a) ;
}

View file

@ -0,0 +1,21 @@
#include "common.hlsli"
struct v2p
{
float4 color : COLOR0; // rgb. intensity
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
};
uniform sampler2D s_clouds0 : register(s0);
uniform sampler2D s_clouds1 : register(s1);
// Pixel
float4 main(v2p I) : COLOR
{
float4 s0 = tex2D(s_clouds0, I.tc0);
float4 s1 = tex2D(s_clouds1, I.tc1);
float4 mix = I.color * (s0 + s1);
return float4(mix.rgb, mix.a);
}

View file

@ -0,0 +1,10 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("clouds","clouds")
: fog (false)
: zb (true,false)
: sorting (3, true)
: blend (true, blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_clouds0") :texture ("null") : wrap() : f_anisotropic()
shader:sampler ("s_clouds1") :texture ("null") : wrap() : f_anisotropic()
shader:sampler ("s_tonemap") :texture ("$user$tonemap")
end

View file

@ -0,0 +1,37 @@
#include "common.h"
#include "shared\cloudconfig.h"
struct vi
{
float4 p : POSITION ;
float4 dir : COLOR0 ; // dir0,dir1(w<->z)
float4 color : COLOR1 ; // rgb. intensity
};
struct vf
{
float4 hpos : POSITION ;
float4 color : COLOR0 ; // rgb. intensity
float2 tc0 : TEXCOORD0 ;
float2 tc1 : TEXCOORD1 ;
};
vf main (vi v)
{
vf o;
o.hpos = mul (m_WVP, v.p); // xform, input in world coords
o.color = v.color; // copy color
o.color.w *= pow (v.p.y,25);
//if (length(float3(v.p.x,0,v.p.z))>CLOUD_FADE) o.color.w = 0 ;
// generate tcs
float2 d0 = v.dir.xy*2-1;
float2 d1 = v.dir.wz*2-1;
o.tc0 = v.p.xz * CLOUD_TILE0 + d0*timers.z*CLOUD_SPEED0;
o.tc1 = v.p.xz * CLOUD_TILE1 + d1*timers.z*CLOUD_SPEED1;
return o;
}

View file

@ -0,0 +1,37 @@
#include "common.hlsli"
#include "shared\cloudconfig.hlsli"
struct vi
{
float4 p : POSITION;
float4 dir : COLOR0; // dir0,dir1(w<->z)
float4 color : COLOR1; // rgb. intensity
};
struct vf
{
float4 hpos : POSITION;
float4 color : COLOR0; // rgb. intensity
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
};
vf main(vi v)
{
vf o;
o.hpos = mul(m_WVP, v.p); // xform, input in world coords
o.color = v.color; // copy color
o.color.w *= pow(v.p.y, 25);
// if (length(float3(v.p.x,0,v.p.z))>CLOUD_FADE) o.color.w = 0 ;
// generate tcs
float2 d0 = v.dir.xy * 2 - 1;
float2 d1 = v.dir.wz * 2 - 1;
o.tc0 = v.p.xz * CLOUD_TILE0 + d0 * timers.z * CLOUD_SPEED0;
o.tc1 = v.p.xz * CLOUD_TILE1 + d1 * timers.z * CLOUD_SPEED1;
return o;
}

View file

@ -0,0 +1,125 @@
#ifndef COMMON_H
#define COMMON_H
#include "shared\common.h"
uniform half4 L_dynamic_props; // per object, xyz=sun,w=hemi
uniform half4 L_dynamic_color; // dynamic light color (rgb1) - spot/point
uniform half4 L_dynamic_pos; // dynamic light pos+1/range(w) - spot/point
uniform float4x4 L_dynamic_xform;
uniform float4x4 m_plmap_xform;
uniform float4 m_plmap_clamp [2]; // 0.w = factor
half calc_fogging (half4 w_pos) { return dot(w_pos,fog_plane); }
half2 calc_detail (half3 w_pos) {
float dtl = distance(w_pos,eye_position)*dt_params.w;
dtl = min(dtl*dtl, 1);
half dt_mul = 1 - dtl; // dt* [1 .. 0 ]
half dt_add = .5 * dtl; // dt+ [0 .. 0.5]
return half2 (dt_mul,dt_add);
}
float3 calc_reflection (float3 pos_w, float3 norm_w)
{
return reflect(normalize(pos_w-eye_position), norm_w);
}
float4 calc_spot (out float4 tc_lmap, out float2 tc_att, float4 w_pos, float3 w_norm) {
float4 s_pos = mul (L_dynamic_xform, w_pos);
tc_lmap = s_pos.xyww; // projected in ps/ttf
tc_att = s_pos.z; // z=distance * (1/range)
float3 L_dir_n = normalize (w_pos - L_dynamic_pos.xyz);
float L_scale = dot(w_norm,-L_dir_n);
return L_dynamic_color*L_scale*saturate(calc_fogging(w_pos));
}
float4 calc_point (out float2 tc_att0, out float2 tc_att1, float4 w_pos, float3 w_norm) {
float3 L_dir_n = normalize (w_pos - L_dynamic_pos.xyz);
float L_scale = dot (w_norm,-L_dir_n);
float3 L_tc = (w_pos - L_dynamic_pos.xyz) * L_dynamic_pos.w + .5f; // tc coords
tc_att0 = L_tc.xz;
tc_att1 = L_tc.xy;
return L_dynamic_color*L_scale*saturate(calc_fogging(w_pos));
}
float3 calc_sun (float3 norm_w) { return L_sun_color*max(dot((norm_w),-L_sun_dir_w),0); }
float3 calc_model_hemi (float3 norm_w) { return (norm_w.y*0.5+0.5)*L_dynamic_props.w*L_hemi_color; }
float3 calc_model_lq_lighting (float3 norm_w) { return calc_model_hemi(norm_w) + L_ambient + L_dynamic_props.xyz*calc_sun(norm_w); }
float3 _calc_model_hemi (float3 norm_w) { return max(0,norm_w.y)*.2*L_hemi_color; }
float3 _calc_model_lq_lighting (float3 norm_w) { return calc_model_hemi(norm_w) + L_ambient + .5*calc_sun(norm_w); }
float4 calc_model_lmap (float3 pos_w) {
float3 pos_wc = clamp (pos_w,m_plmap_clamp[0],m_plmap_clamp[1]); // clamp to BBox
float4 pos_w4c = float4 (pos_wc,1);
float4 plmap = mul (m_plmap_xform,pos_w4c); // calc plmap tc
return plmap.xyww;
}
struct v_lmap
{
float4 P : POSITION; // (float,float,float,1)
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
float4 T : TANGENT;
float4 B : BINORMAL;
float2 uv0 : TEXCOORD0; // (base)
float2 uv1 : TEXCOORD1; // (lmap/compressed)
};
struct v_vert
{
float4 P : POSITION; // (float,float,float,1)
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
float4 T : TANGENT;
float4 B : BINORMAL;
float4 color : COLOR0; // (r,g,b,dir-occlusion)
float2 uv : TEXCOORD0; // (u0,v0)
};
struct v_model
{
float4 pos : POSITION; // (float,float,float,1)
float3 norm : NORMAL; // (nx,ny,nz)
float3 T : TANGENT; // (nx,ny,nz)
float3 B : BINORMAL; // (nx,ny,nz)
float2 tc : TEXCOORD0; // (u,v)
#ifdef SKIN_COLOR
float3 rgb_tint;
#endif
};
struct v_detail
{
float4 pos : POSITION; // (float,float,float,1)
int4 misc : TEXCOORD0; // (u(Q),v(Q),frac,matrix-id)
};
struct vf_spot
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float4 tc1 : TEXCOORD1; // lmap, projected
float2 tc2 : TEXCOORD2; // att + clipper
float4 color : COLOR0;
};
struct vf_point
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // att1 + clipper
float2 tc2 : TEXCOORD2; // att2 + clipper
float4 color : COLOR0;
};
//////////////////////////////////////////////////////////////////////////////////////////
uniform sampler2D s_base;
uniform samplerCUBE s_env;
uniform sampler2D s_lmap;
uniform sampler2D s_hemi;
uniform sampler2D s_att;
uniform sampler2D s_detail;
#define def_distort half(0.05f) // we get -0.5 .. 0.5 range, this is -512 .. 512 for 1024, so scale it
float3 v_hemi (float3 n) { return L_hemi_color/* *(.5f + .5f*n.y) */; }
float3 v_hemi_wrap (float3 n, float w) { return L_hemi_color/* *(w + (1-w)*n.y) */; }
float3 v_sun (float3 n) { return L_sun_color*max(0,dot(n,-L_sun_dir_w)); }
float3 v_sun_wrap (float3 n, float w) { return L_sun_color*(w+(1-w)*dot(n,-L_sun_dir_w)); }
half3 p_hemi (float2 tc) {
//half3 t_lmh = tex2D (s_hemi, tc);
//return dot (t_lmh,1.h/3.h);
half4 t_lmh = tex2D (s_hemi, tc);
return t_lmh.a;
}
#endif // COMMON_H

View file

@ -0,0 +1,160 @@
#ifndef COMMON_H
#define COMMON_H
#include "shared\common.hlsli"
uniform float4 L_dynamic_props; // per object, xyz=sun,w=hemi
uniform float4 L_dynamic_color; // dynamic light color (rgb1) - spot/point
uniform float4 L_dynamic_pos; // dynamic light pos+1/range(w) - spot/point
uniform float4x4 L_dynamic_xform;
uniform float4x4 m_plmap_xform;
uniform float4 m_plmap_clamp[2]; // 0.w = factor
float calc_fogging(float4 w_pos)
{
return saturate(dot(w_pos, fog_plane));
}
float2 calc_detail(float3 w_pos)
{
float dtl = distance(w_pos, eye_position) * dt_params.w;
dtl = min(dtl * dtl, 1.0f);
float dt_mul = 1.0f - dtl; // dt* [1 .. 0 ]
float dt_add = 0.5f * dtl; // dt+ [0 .. 0.5]
return float2(dt_mul, dt_add);
}
float3 calc_reflection(float3 pos_w, float3 norm_w)
{
return reflect(normalize(pos_w - eye_position), norm_w);
}
float4 calc_spot(out float4 tc_lmap, out float2 tc_att, float4 w_pos, float3 w_norm)
{
float4 s_pos = mul(L_dynamic_xform, w_pos);
tc_lmap = s_pos.xyww; // projected in ps/ttf
tc_att = s_pos.z; // z=distance * (1/range)
float3 L_dir_n = normalize(w_pos - L_dynamic_pos.xyz);
float L_scale = dot(w_norm, -L_dir_n);
return L_dynamic_color * L_scale * saturate(calc_fogging(w_pos));
}
float4 calc_point(out float2 tc_att0, out float2 tc_att1, float4 w_pos, float3 w_norm)
{
float3 L_dir_n = normalize(w_pos - L_dynamic_pos.xyz);
float L_scale = dot(w_norm, -L_dir_n);
float3 L_tc = (w_pos - L_dynamic_pos.xyz) * L_dynamic_pos.w + .5f; // tc coords
tc_att0 = L_tc.xz;
tc_att1 = L_tc.xy;
return L_dynamic_color * L_scale * saturate(calc_fogging(w_pos));
}
float3 calc_sun(float3 norm_w)
{
return L_sun_color * max(dot((norm_w), -L_sun_dir_w), 0);
}
float3 calc_model_hemi(float3 norm_w)
{
return (norm_w.y * 0.5 + 0.5) * L_dynamic_props.w * L_hemi_color;
}
float3 calc_model_lq_lighting(float3 norm_w)
{
return calc_model_hemi(norm_w) + L_ambient + L_dynamic_props.xyz * calc_sun(norm_w);
}
float3 _calc_model_hemi(float3 norm_w)
{
return max(0, norm_w.y) * .2 * L_hemi_color;
}
float3 _calc_model_lq_lighting(float3 norm_w)
{
return calc_model_hemi(norm_w) + L_ambient + .5 * calc_sun(norm_w);
}
float4 calc_model_lmap(float3 pos_w)
{
float3 pos_wc = clamp(pos_w, m_plmap_clamp[0], m_plmap_clamp[1]); // clamp to BBox
float4 pos_w4c = float4(pos_wc, 1);
float4 plmap = mul(m_plmap_xform, pos_w4c); // calc plmap tc
return plmap.xyww;
}
struct v_lmap
{
float4 P : POSITION; // (float,float,float,1)
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
float4 T : TANGENT;
float4 B : BINORMAL;
float2 uv0 : TEXCOORD0; // (base)
float2 uv1 : TEXCOORD1; // (lmap/compressed)
};
struct v_vert
{
float4 P : POSITION; // (float,float,float,1)
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
float4 T : TANGENT;
float4 B : BINORMAL;
float4 color : COLOR0; // (r,g,b,dir-occlusion)
float2 uv : TEXCOORD0; // (u0,v0)
};
struct v_model
{
float4 pos : POSITION; // (float,float,float,1)
float3 norm : NORMAL; // (nx,ny,nz)
float3 T : TANGENT; // (nx,ny,nz)
float3 B : BINORMAL; // (nx,ny,nz)
float2 tc : TEXCOORD0; // (u,v)
#ifdef SKIN_COLOR
float3 rgb_tint;
#endif
};
struct v_detail
{
float4 pos : POSITION; // (float,float,float,1)
int4 misc : TEXCOORD0; // (u(Q),v(Q),frac,matrix-id)
};
struct vf_spot
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float4 tc1 : TEXCOORD1; // lmap, projected
float2 tc2 : TEXCOORD2; // att + clipper
float4 color : COLOR0;
};
struct vf_point
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // att1 + clipper
float2 tc2 : TEXCOORD2; // att2 + clipper
float4 color : COLOR0;
};
uniform sampler2D s_base;
uniform samplerCUBE s_env;
uniform sampler2D s_lmap;
uniform sampler2D s_hemi;
uniform sampler2D s_att;
uniform sampler2D s_detail;
#define def_distort float(0.05f) // we get -0.5 .. 0.5 range, this is -512 .. 512 for 1024, so scale it
float3 v_hemi(float3 n)
{
return L_hemi_color /* *(.5f + .5f*n.y) */;
}
float3 v_hemi_wrap(float3 n, float w)
{
return L_hemi_color /* *(w + (1-w)*n.y) */;
}
float3 v_sun(float3 n)
{
return L_sun_color * max(0, dot(n, -L_sun_dir_w));
}
float3 v_sun_wrap(float3 n, float w)
{
return L_sun_color * (w + (1 - w) * dot(n, -L_sun_dir_w));
}
float3 p_hemi(float2 tc)
{
// float3 t_lmh = tex2D (s_hemi, tc);
// return dot (t_lmh,1.h/3.h);
float4 t_lmh = tex2D(s_hemi, tc);
return t_lmh.a;
}
#endif // COMMON_H

View file

@ -0,0 +1,19 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half3 c0: COLOR0;
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half3 final = t_base*I.c0*2;
// out
return half4 (final, t_base.a);
}

View file

@ -0,0 +1,19 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float3 c0 : COLOR0;
float fog : FOG;
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float3 final = t_base * I.c0 * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final, t_base.a);
}

View file

@ -0,0 +1,37 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float4 C : COLOR0;
float2 tc : TEXCOORD0;
};
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
uniform float4 array [200] : register(c10);
vf main (v_detail v)
{
vf o;
// index
int i = v.misc.w;
float4 m0 = array[i+0];
float4 m1 = array[i+1];
float4 m2 = array[i+2];
float4 c0 = array[i+3];
// Transform to world coords
float4 pos;
pos.x = dot (m0, v.pos);
pos.y = dot (m1, v.pos);
pos.z = dot (m2, v.pos);
pos.w = 1;
// Final out
o.hpos = mul (m_WVP,pos);
o.C = c0;
o.tc.xy = (v.misc * consts).xy;
return o;
}

View file

@ -0,0 +1,68 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float4 C : COLOR0;
float2 tc : TEXCOORD0;
float fog : FOG;
};
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
uniform float2x4 array[50] : register(c10);
float3x3 setMatrix (float3 hpb)
{
float _ch, _cp, _cb, _sh, _sp, _sb, _cc, _cs, _sc, _ss;
sincos(hpb.x, _sh, _ch);
sincos(hpb.y, _sp, _cp);
sincos(hpb.z, _sb, _cb);
_cc = _ch*_cb; _cs = _ch*_sb; _sc = _sh*_cb; _ss = _sh*_sb;
return float3x3(_cc-_sp*_ss, _sp*_sc+_cs, -_cp*_sh,
-_cp*_sb, _cp*_cb, _sp,
_sp*_cs+_sc, _ss-_sp*_cc, _cp*_ch);
};
vf main(v_detail v)
{
vf o;
// index
int i = v.misc.w;
float2x4 mm = array[i];
float3x3 mmhpb = setMatrix(mm[0].xyz);
float3 posi = float3(mm[1].xyz);
float scale = mm[0].w;
float hemi = abs(mm[1].w);
float sun = sign(mm[1].w)*0.25f+0.25f;
float4 m0 = float4(mmhpb[0]*scale, posi.x);
float4 m1 = float4(mmhpb[1]*scale, posi.y);
float4 m2 = float4(mmhpb[2]*scale, posi.z);
float4 c0 = float4(L_ambient.rgb+L_hemi_color.rgb*hemi+L_sun_color.rgb*sun, 1.0f);
// Transform to world coords
float4 pos;
pos.x = dot(m0, v.pos);
pos.y = dot(m1, v.pos);
pos.z = dot(m2, v.pos);
pos.w = 1;
// Calc fog
o.fog = calc_fogging(pos);
// Final out
o.hpos = mul(m_WVP, pos);
o.C = c0;
o.tc.xy = (v.misc * consts).xy;
return o;
}

View file

@ -0,0 +1,51 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float4 C : COLOR0;
float2 tc : TEXCOORD0;
};
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
uniform float4 wave; // cx,cy,cz,tm
uniform float4 dir2D;
uniform float4 array [200] : register(c10);
vf main (v_detail v)
{
vf o;
// index
int i = v.misc.w;
float4 m0 = array[i+0];
float4 m1 = array[i+1];
float4 m2 = array[i+2];
float4 c0 = array[i+3];
// Transform to world coords
float4 pos;
pos.x = dot (m0, v.pos);
pos.y = dot (m1, v.pos);
pos.z = dot (m2, v.pos);
pos.w = 1;
//
float base = m1.w;
float dp = calc_cyclic (dot(pos,wave));
float H = pos.y - base; // height of vertex (scaled)
float frac = v.misc.z*consts.x; // fractional
float inten = H * dp;
float2 result = calc_xz_wave (dir2D.xz*inten,frac);
pos = float4(pos.x+result.x, pos.y, pos.z+result.y, 1);
o.hpos = mul (m_WVP,pos);
// Fake lighting
float dpc = max (0.f, dp);
o.C = c0 * (consts.w+consts.z*dpc*frac);
// final xform, color, tc
o.tc.xy = (v.misc * consts).xy;
return o;
}

View file

@ -0,0 +1,82 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float4 C : COLOR0;
float2 tc : TEXCOORD0;
float fog : FOG;
};
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
uniform float4 wave; // cx,cy,cz,tm
uniform float4 dir2D;
uniform float2x4 array[50] : register(c10);
float3x3 setMatrix (float3 hpb)
{
float _ch, _cp, _cb, _sh, _sp, _sb, _cc, _cs, _sc, _ss;
sincos(hpb.x, _sh, _ch);
sincos(hpb.y, _sp, _cp);
sincos(hpb.z, _sb, _cb);
_cc = _ch*_cb; _cs = _ch*_sb; _sc = _sh*_cb; _ss = _sh*_sb;
return float3x3(_cc-_sp*_ss, _sp*_sc+_cs, -_cp*_sh,
-_cp*_sb, _cp*_cb, _sp,
_sp*_cs+_sc, _ss-_sp*_cc, _cp*_ch);
};
vf main(v_detail v)
{
vf o;
// index
int i = v.misc.w;
float2x4 mm = array[i];
float3x3 mmhpb = setMatrix(mm[0].xyz);
float3 posi = float3(mm[1].xyz);
float scale = mm[0].w;
float hemi = abs(mm[1].w);
float sun = sign(mm[1].w)*0.25f+0.25f;
float4 m0 = float4(mmhpb[0]*scale, posi.x);
float4 m1 = float4(mmhpb[1]*scale, posi.y);
float4 m2 = float4(mmhpb[2]*scale, posi.z);
float4 c0 = float4(L_ambient.rgb+L_hemi_color.rgb*hemi+L_sun_color.rgb*sun, 1.0f);
// Transform to world coords
float4 pos;
pos.x = dot(m0, v.pos);
pos.y = dot(m1, v.pos);
pos.z = dot(m2, v.pos);
pos.w = 1;
//
float base = m1.w;
float dp = calc_cyclic(dot(pos, wave));
float H = v.pos.y * length(m1.xyz);
float fractional = v.misc.z * consts.x; // fractional
float inten = H * dp;
float2 result = calc_xz_wave(dir2D.xz * inten, fractional);
pos = float4(pos.x + result.x, pos.y, pos.z + result.y, 1);
o.hpos = mul(m_WVP, pos);
// Calc fog
o.fog = calc_fogging(pos);
// Fake lighting
float dpc = max(0.f, dp);
o.C = c0 * (consts.w + consts.z * dpc * fractional);
// final xform, color, tc
o.tc.xy = (v.misc * consts).xy;
return o;
}

View file

@ -0,0 +1,23 @@
function l_special(shader, t_base, t_second, t_detail)
shader:begin("lod", "lod")
:blend(false, blend.one, blend.zero)
:aref(true, 200)
:zb(true, true)
:fog(true)
shader:sampler("s_base0"):texture(t_base)
shader:sampler("s_base1"):texture(t_base)
shader:sampler("s_hemi0"):texture(t_base .. "_nm")
shader:sampler("s_hemi1"):texture(t_base .. "_nm")
end
function normal(shader, t_base, t_second, t_detail)
shader:begin("lod", "lod")
:blend(true, blend.srcalpha, blend.invsrcalpha)
:aref(true, 8)
:zb(true, false)
:fog(true)
shader:sampler("s_base0"):texture(t_base)
shader:sampler("s_base1"):texture(t_base)
shader:sampler("s_hemi0"):texture(t_base .. "_nm")
shader:sampler("s_hemi1"):texture(t_base .. "_nm")
end

View file

@ -0,0 +1,23 @@
function l_special (shader, t_base, t_second, t_detail)
shader:begin ("lod","lod")
: blend (false, blend.one, blend.zero)
: aref (true, 200)
: zb (true, true)
: fog (true)
shader:sampler ("s_base0") :texture (t_base)
shader:sampler ("s_base1") :texture (t_base)
shader:sampler ("s_hemi0") :texture (t_base .. "_nm")
shader:sampler ("s_hemi1") :texture (t_base .. "_nm")
end
function normal (shader, t_base, t_second, t_detail)
shader:begin ("lod","lod")
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,8)
: zb (true,false)
: fog (true)
shader:sampler ("s_base0") :texture (t_base)
shader:sampler ("s_base1") :texture (t_base)
shader:sampler ("s_hemi0") :texture (t_base .. "_nm")
shader:sampler ("s_hemi1") :texture (t_base .. "_nm")
end

View file

@ -0,0 +1,18 @@
#include "common.h"
struct vf
{
float4 P: POSITION ;
float4 C: COLOR0 ;
};
uniform float4 tfactor;
vf main (vf i)
{
vf o;
o.P = mul (m_WVP, i.P); // xform, input in world coords
o.C = tfactor*i.C;
return o;
}

View file

@ -0,0 +1,19 @@
#include "common.hlsli"
struct vf
{
float4 P : POSITION;
float4 C : COLOR0;
};
uniform float4 tfactor;
vf main(vf i)
{
vf o;
o.P = mul(m_WVP, i.P); // xform, input in world coords
o.C = tfactor * i.C;
return o;
}

View file

@ -0,0 +1,9 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("base_lplanes", "base_lplanes")
:fog(false)
:zb(true, false)
:blend(true, blend.srcalpha, blend.one)
:aref(true, 0)
:sorting(2, false)
shader:sampler("s_base"):texture(t_base)
end

View file

@ -0,0 +1,9 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("base_lplanes","base_lplanes")
: fog (false)
: zb (true,false)
: blend (true,blend.srcalpha,blend.one)
: aref (true,0)
: sorting (2, false)
shader:sampler ("s_base") :texture (t_base)
end

View file

@ -0,0 +1,19 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("wmark", "wmark")
:sorting(2, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:aref(true, 0)
:zb(true, false)
:fog(true)
shader:sampler("s_base"):texture(t_base)
end
function l_spot(shader, t_base, t_second, t_detail)
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)
end

View file

@ -0,0 +1,19 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("wmark", "vert")
: sorting (2, false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: zb (true,false)
: fog (true)
shader:sampler ("s_base") :texture (t_base)
end
function l_spot (shader, t_base, t_second, t_detail)
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)
end

View file

@ -0,0 +1,18 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("wmark", "wmarkmult")
:sorting(2, false)
:blend(true, blend.destcolor, blend.srccolor)
:aref(false, 0)
:zb(true, true)
:fog(true)
:wmark(true)
shader:sampler("s_base"):texture(t_base)
end
function l_spot(shader, t_base, t_second, t_detail)
r1_lspot(shader, t_base, "wmark_spot")
end
function l_point(shader, t_base, t_second, t_detail)
r1_lpoint(shader, t_base, "wmark_point")
end

View file

@ -0,0 +1,19 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("wmark", "wmarkmult")
: sorting (2, false)
: blend (true,blend.destcolor,blend.srccolor)
: aref (false,0)
: zb (true,true)
: fog (true)
: wmark (true)
shader:sampler ("s_base") :texture (t_base)
end
function l_spot (shader, t_base, t_second, t_detail)
r1_lspot (shader, t_base, "wmark_spot")
end
function l_point (shader, t_base, t_second, t_detail)
r1_lpoint (shader, t_base, "wmark_point")
end

View file

@ -0,0 +1,16 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("wmark", "wmark")
:sorting(1, false)
:aref(false, 0)
:zb(true, true)
:fog(true)
shader:sampler("s_base"):texture(t_base)
end
function l_spot(shader, t_base, t_second, t_detail)
r1_lspot(shader, t_base, "wmark_spot")
end
function l_point(shader, t_base, t_second, t_detail)
r1_lpoint(shader, t_base, "wmark_point")
end

View file

@ -0,0 +1,16 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("wmark", "vert")
: sorting (1, false)
: aref (false,0)
: zb (true,true)
: fog (true)
shader:sampler ("s_base") :texture (t_base)
end
function l_spot (shader, t_base, t_second, t_detail)
r1_lspot (shader, t_base, "wmark_spot")
end
function l_point (shader, t_base, t_second, t_detail)
r1_lpoint (shader, t_base, "wmark_point")
end

View file

@ -0,0 +1,27 @@
local tex_base = "water\\water_water"
local tex_nmap = "water\\water_normal"
local tex_dist = "water\\water_dudv"
function normal(shader, t_base, t_second, t_detail)
shader:begin("water", "water")
:sorting(2, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:zb(true, false)
:distort(true)
:fog(false)
shader:sampler("s_base"):texture(tex_base)
shader:sampler("s_nmap"):texture(tex_nmap)
shader:sampler("s_env0"):texture("$user$sky0"):clamp()
shader:sampler("s_env1"):texture("$user$sky1"):clamp()
end
--function l_special(shader, t_base, t_second, t_detail)
-- shader:begin ("waterd","waterd")
-- : sorting (2, true)
-- : blend (true,blend.srcalpha,blend.invsrcalpha)
-- : zb (true,false)
-- : fog (false)
-- : distort (true)
-- shader:sampler ("s_base") :texture (tex_base)
-- shader:sampler ("s_distort") :texture (tex_dist)
--end

View file

@ -0,0 +1,29 @@
local tex_base = "water\\water_water_r1"
local tex_env = "sky\\sky_5_cube"
local tex_dist = "water\\water_dudv"
local tex_dist2 = "water\\water_dudv"
function normal (shader, t_base, t_second, t_detail)
shader:begin ("water","water")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: zb (true,false)
: distort (true)
: fog (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_env") :texture (tex_env) : clamp()
end
function l_special (shader, t_base, t_second, t_detail)
shader:begin ("waterd","waterd")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: zb (true,false)
: fog (false)
: distort (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_distort0") :texture (tex_dist)
shader:sampler ("s_distort1") :texture (tex_dist2)
end

View file

@ -0,0 +1,28 @@
local tex_base = "water\\water_ryaska1"
local tex_env = "sky\\sky_5_cube"
local tex_dist = "water\\water_dudv"
local tex_dist2 = "water\\water_dudv"
function normal(shader, t_base, t_second, t_detail)
shader:begin("water", "water")
:sorting(2, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:aref(true, 0)
:zb(true, false)
:distort(true)
:fog(true)
shader:sampler("s_base"):texture(tex_base)
shader:sampler("s_env"):texture(tex_env):clamp()
end
function l_special(shader, t_base, t_second, t_detail)
shader:begin("waterd", "waterd")
:sorting(2, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:zb(true, false)
:fog(false)
:distort(true)
shader:sampler("s_base"):texture(tex_base)
shader:sampler("s_distort0"):texture(tex_dist)
shader:sampler("s_distort1"):texture(tex_dist2)
end

View file

@ -0,0 +1,29 @@
local tex_base = "water\\water_ryaska1"
local tex_env = "sky\\sky_5_cube"
local tex_dist = "water\\water_dudv"
local tex_dist2 = "water\\water_dudv"
function normal (shader, t_base, t_second, t_detail)
shader:begin ("water","water")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: zb (true,false)
: distort (true)
: fog (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_env") :texture (tex_env) : clamp()
end
function l_special (shader, t_base, t_second, t_detail)
shader:begin ("waterd","waterd")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: zb (true,false)
: fog (false)
: distort (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_distort0") :texture (tex_dist)
shader:sampler ("s_distort1") :texture (tex_dist2)
end

View file

@ -0,0 +1,28 @@
local tex_base = "water\\water_studen"
local tex_env = "sky\\sky_5_cube"
local tex_dist = "water\\water_dudv"
local tex_dist2 = "water\\water_dudv"
function normal(shader, t_base, t_second, t_detail)
shader:begin("water", "water")
:sorting(2, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:aref(true, 0)
:zb(true, false)
:distort(true)
:fog(true)
shader:sampler("s_base"):texture(tex_base)
shader:sampler("s_env"):texture(tex_env):clamp()
end
function l_special(shader, t_base, t_second, t_detail)
shader:begin("waterd", "waterd")
:sorting(2, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
:zb(true, false)
:fog(false)
:distort(true)
shader:sampler("s_base"):texture(tex_base)
shader:sampler("s_distort0"):texture(tex_dist)
shader:sampler("s_distort1"):texture(tex_dist2)
end

View file

@ -0,0 +1,29 @@
local tex_base = "water\\water_studen"
local tex_env = "sky\\sky_5_cube"
local tex_dist = "water\\water_dudv"
local tex_dist2 = "water\\water_dudv"
function normal (shader, t_base, t_second, t_detail)
shader:begin ("water","water")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: aref (true,0)
: zb (true,false)
: distort (true)
: fog (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_env") :texture (tex_env) : clamp()
end
function l_special (shader, t_base, t_second, t_detail)
shader:begin ("waterd","waterd")
: sorting (2, true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
: zb (true,false)
: fog (false)
: distort (true)
shader:sampler ("s_base") :texture (tex_base)
shader:sampler ("s_distort0") :texture (tex_dist)
shader:sampler ("s_distort1") :texture (tex_dist2)
end

View file

@ -0,0 +1,20 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 r = tex2D (s_base,I.tc0);
// r.x = 1 - r.x;
// r.y = 1 - r.y;
// r.z = 1 - r.z;
r.w = 1 - r.w;
return r;
// return /*(half4(1,1,1,1) - */ tex2D (s_base,I.tc0);
}

View file

@ -0,0 +1,18 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 r = tex2D(s_base, I.tc0);
// r.x = 1 - r.x;
// r.y = 1 - r.y;
// r.z = 1 - r.z;
r.w = 1 - r.w;
return r;
// return /*(float4(1,1,1,1) - */ tex2D (s_base,I.tc0);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
#include "common.hlsli"
#define LUMINANCE_VECTOR float3(0.3f, 0.38f, 0.22f)
uniform sampler2D s_image;
struct v2p
{
float2 tc0 : TEXCOORD0;
float4 HPos : POSITION;
};
float4 main(v2p I) : COLOR
{
float3 image = tex2D(s_image, I.tc0);
return float4(image, dot(image, LUMINANCE_VECTOR));
}

View file

@ -0,0 +1,34 @@
#include "common.hlsli"
#include "fxaa.hlsli"
uniform float4 screen_res;
uniform sampler2D s_image;
struct v2p
{
float2 tc0 : TEXCOORD0;
float4 HPos : POSITION;
};
float4 main(v2p I) : COLOR
{
float2 rcpFrame = screen_res.zw;
return FxaaPixelShader(I.tc0,
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsolePosPos,
s_image, // FxaaTex tex,
s_image, // FxaaTex fxaaConsole360TexExpBiasNegOne,
s_image, // FxaaTex fxaaConsole360TexExpBiasNegTwo,
rcpFrame, // FxaaFloat2 fxaaQualityRcpFrame,
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsoleRcpFrameOpt,
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsoleRcpFrameOpt2,
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsole360RcpFrameOpt2,
0.35f, // FxaaFloat fxaaQualitySubpix,
0.125f, // FxaaFloat fxaaQualityEdgeThreshold,
0.0f, // 0.0625f, // FxaaFloat fxaaQualityEdgeThresholdMin,
0.0f, // FxaaFloat fxaaConsoleEdgeSharpness,
0.0f, // FxaaFloat fxaaConsoleEdgeThreshold,
0.0f, // FxaaFloat fxaaConsoleEdgeThresholdMin,
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f) // FxaaFloat fxaaConsole360ConstDir,
);
}

View file

@ -0,0 +1,25 @@
#include "common.hlsli"
uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
struct v
{
float3 P : POSITION;
float2 tc0 : TEXCOORD0;
};
struct v2p
{
float2 tc0 : TEXCOORD0;
float4 HPos : POSITION;
};
// Vertex
v2p main(v I)
{
v2p O;
O.HPos = float4(I.P.x * screen_res.z * 2 - 1, (I.P.y * screen_res.w * 2 - 1) * -1, 0, 1);
O.tc0 = I.tc0;
return O;
}

View file

@ -0,0 +1,13 @@
#include "common.h"
struct ui_vert_out
{
half2 tc0 : TEXCOORD0;
float4 P : POSITION;
};
half4 main ( ui_vert_out I ) : COLOR
{
half4 r = tex2D (s_base,I.tc0);
return r;
}

View file

@ -0,0 +1,13 @@
#include "common.hlsli"
struct ui_vert_out
{
float2 tc0 : TEXCOORD0;
float4 P : POSITION;
};
float4 main(ui_vert_out I) : COLOR
{
float4 r = tex2D(s_base, I.tc0);
return r;
}

View file

@ -0,0 +1,27 @@
#include "common.h"
struct ui_vert_in
{
float4 P : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
struct ui_vert_out
{
half2 tc0 : TEXCOORD0;
float4 P : POSITION;
};
ui_vert_out main (ui_vert_in v)
{
ui_vert_out O;
O.tc0 = v.uv;
O.P = v.P;
O.P.w = 1;
O.P = mul( m_WVP, O.P );
return O;
}

View file

@ -0,0 +1,25 @@
#include "common.hlsli"
struct ui_vert_in
{
float4 P : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
struct ui_vert_out
{
float2 tc0 : TEXCOORD0;
float4 P : POSITION;
};
ui_vert_out main(ui_vert_in v)
{
ui_vert_out O;
O.tc0 = v.uv;
O.P = v.P;
O.P.w = 1;
O.P = mul(m_WVP, O.P);
return O;
}

View file

@ -0,0 +1,6 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "simple_color")
:fog(false)
:zb(false, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
end

View file

@ -0,0 +1,6 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","simple_color")
: fog (false)
: zb (false,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
end

View file

@ -0,0 +1,7 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "hud_font")
:fog(false)
:zb(false, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
shader:sampler("s_base"):texture(t_base)
end

View file

@ -0,0 +1,16 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0;
half4 c0: COLOR0;
};
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 r = tex2D (s_base,I.tc0);
r.rgb = I.c0.rgb;
r.a *= I.c0.a;
return r;
}

View file

@ -0,0 +1,15 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0;
float4 c0 : COLOR0;
};
float4 main(v2p I) : COLOR
{
float4 r = tex2D(s_base, I.tc0);
r.rgb = I.c0.rgb;
r.a *= I.c0.a;
return r;
}

View file

@ -0,0 +1,7 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","hud_font")
: fog (false)
: zb (false,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_base") :texture (t_base)
end

View file

@ -0,0 +1,7 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "font2")
:fog(false)
:zb(false, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
shader:sampler("s_base"):texture(t_base)
end

View file

@ -0,0 +1,7 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","font2")
: fog (false)
: zb (false,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_base") :texture (t_base)
end

View file

@ -0,0 +1,7 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("null", "yuv2rgb")
:fog(false)
:zb(false, false)
:blend(true, blend.srcalpha, blend.invsrcalpha)
shader:sampler("s_base"):texture(t_base)
end

View file

@ -0,0 +1,7 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("null","yuv2rgb")
: fog (false)
: zb (false,false)
: blend (true,blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_base") :texture (t_base)
end

View file

@ -0,0 +1,7 @@
function normal(shader, t_base, t_second, t_detail)
shader:begin("hud3d", "hud3d")
:fog(false)
:zb(true, true)
:blend(true, blend.srcalpha, blend.invsrcalpha)
shader:sampler("s_base"):texture(t_base)
end

View file

@ -0,0 +1,7 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("hud3d","hud3d")
: fog (false)
: zb (true,true)
: blend (true,blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_base") :texture (t_base)
end

View file

@ -0,0 +1,30 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // lmap
half3 c0: COLOR0; // hemi
half3 c1: COLOR1; // sun
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1);
// lighting
half3 l_base = t_lmap.rgb; // base light-map
half3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
half3 l_sun = I.c1 * t_lmap.a; // sun color
half3 light = L_ambient + l_base + l_sun + l_hemi;
// final-color
half3 final = light*t_base*2;
// out
return half4 (final.rgb,1);
}

View file

@ -0,0 +1,29 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float3 c0 : COLOR0; // hemi
float3 c1 : COLOR1; // sun
float fog : FOG;
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
float3 l_sun = I.c1 * t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_sun + l_hemi;
// final-color
float3 final = light * t_base * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final.rgb, 1.0f);
}

View file

@ -0,0 +1,26 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float3 c0 : COLOR0; // c0=hemi, c0.a = dt*
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main (v_lmap v)
{
vf o;
float3 N = unpack_normal (v.N);
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.c0 = v_hemi (N); // hemi
o.c1 = v_sun (N); // sun
o.fog = calc_fogging (v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,26 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float3 c0 : COLOR0; // c0=hemi, c0.a = dt*
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main(v_lmap v)
{
vf o;
float3 N = unpack_normal(v.N);
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.c0 = v_hemi(N); // hemi
o.c1 = v_sun(N); // sun
o.fog = calc_fogging(v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,34 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // lmap
half2 tc2: TEXCOORD2; // detail
half4 c0: COLOR0; // hemi, c0.a *
half4 c1: COLOR1; // sun, c1.a +
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1);
// lighting
half3 l_base = t_lmap.rgb; // base light-map
half3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
half3 l_sun = I.c1 * t_lmap.a; // sun color
half3 light = L_ambient + l_base + l_sun + l_hemi;
// calc D-texture
half3 detail = tex2D (s_detail,I.tc2);
// final-color
half3 final = (light*t_base.rgb*2)*detail*2 ;
// out
return half4 (final.rgb,1);
// return half4 (light*detail*2,1);
}

View file

@ -0,0 +1,34 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float2 tc2 : TEXCOORD2; // detail
float4 c0 : COLOR0; // hemi, c0.a *
float4 c1 : COLOR1; // sun, c1.a +
float fog : FOG;
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
float3 l_sun = I.c1 * t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_sun + l_hemi;
// calc D-texture
float3 detail = tex2D(s_detail, I.tc2);
// final-color
float3 final = (light * t_base.rgb * 2.0f) * detail * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final.rgb, 1.0f);
// return float4 (light*detail*2,1);
}

View file

@ -0,0 +1,29 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float2 tc2 : TEXCOORD2;
float4 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
float4 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main (v_lmap v)
{
vf o;
float2 dt = calc_detail (v.P);
float3 N = unpack_normal (v.N);
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.tc2 = o.tc0*dt_params; // dt tc
o.c0 = float4 (v_hemi(N), dt.x); // c0=v-lights, c0.a = dt*
o.c1 = float4 (v_sun(N), dt.y); // c1=sun, c1.a = dt+
o.fog = calc_fogging (v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,29 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float2 tc2 : TEXCOORD2;
float4 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
float4 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main(v_lmap v)
{
vf o;
float2 dt = calc_detail(v.P);
float3 N = unpack_normal(v.N);
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.tc2 = o.tc0 * dt_params; // dt tc
o.c0 = float4(v_hemi(N), dt.x); // c0=v-lights, c0.a = dt*
o.c1 = float4(v_sun(N), dt.y); // c1=sun, c1.a = dt+
o.fog = calc_fogging(v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,48 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float2 tc2 : TEXCOORD2; // detail
float4 c0 : COLOR0; // hemi, c0.a *
float4 c1 : COLOR1; // sun, c1.a +
float fog : FOG;
};
uniform sampler2D s_dt_r;
uniform sampler2D s_dt_g;
uniform sampler2D s_dt_b;
uniform sampler2D s_dt_a;
uniform sampler2D s_mask;
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_mask = tex2D(s_mask, I.tc0);
t_mask = t_mask / dot(t_mask, 1.0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
float3 l_sun = I.c1 * t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_sun + l_hemi;
// calc D-texture
float3 t_dt_r = tex2D(s_dt_r, I.tc2) * t_mask.r;
float3 t_dt_g = tex2D(s_dt_g, I.tc2) * t_mask.g;
float3 t_dt_b = tex2D(s_dt_b, I.tc2) * t_mask.b;
float3 t_dt_a = tex2D(s_dt_a, I.tc2) * t_mask.a;
float3 detail = t_dt_a + t_dt_b + t_dt_g + t_dt_r;
// final-color
float3 final = (light * t_base.rgb * 2.0f) * detail * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final.rgb, 1.0f);
}

View file

@ -0,0 +1,23 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // lmap
half2 tc1: TEXCOORD1; // lmap
half3 c0: COLOR0; // hemi
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1);
// lighting
half3 l_base = t_lmap.rgb; // base light-map
half3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
half l_sun = t_lmap.a; // sun color
half3 light = L_ambient + l_base + l_hemi ;
return half4 (light,l_sun);
}

View file

@ -0,0 +1,22 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // lmap
float2 tc1 : TEXCOORD1; // lmap
float3 c0 : COLOR0; // hemi
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
float l_sun = t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_hemi;
return float4(light, l_sun);
}

View file

@ -0,0 +1,22 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float3 c0 : COLOR0;
};
vf main (v_lmap v)
{
vf o;
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.c0 = v_hemi(unpack_normal(v.N)); // just ambient
return o;
}

View file

@ -0,0 +1,21 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float3 c0 : COLOR0;
};
vf main(v_lmap v)
{
vf o;
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
o.tc1 = o.tc0; // copy tc
o.c0 = v_hemi(unpack_normal(v.N)); // just ambient
return o;
}

View file

@ -0,0 +1,13 @@
#include "common.h"
vf_point main (v_lmap v)
{
vf_point o;
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
o.color = calc_point (o.tc1,o.tc2,v.P,unpack_normal(v.N)); // just hemisphere
return o;
}

View file

@ -0,0 +1,13 @@
#include "common.hlsli"
vf_point main(v_lmap v)
{
vf_point o;
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
o.color = calc_point(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
return o;
}

View file

@ -0,0 +1,13 @@
#include "common.h"
vf_spot main (v_lmap v)
{
vf_spot o;
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
o.color = calc_spot (o.tc1,o.tc2,v.P,unpack_normal(v.N)); // just hemisphere
return o;
}

View file

@ -0,0 +1,13 @@
#include "common.hlsli"
vf_spot main(v_lmap v)
{
vf_spot o;
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
o.color = calc_spot(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
return o;
}

View file

@ -0,0 +1,31 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // lmap
half2 tc2: TEXCOORD2; // lmap-hemi
half3 c0: COLOR0; // hemi
half3 c1: COLOR1; // sun
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1);
// lighting
half3 l_base = t_lmap.rgb; // base light-map
half3 l_hemi = I.c0*p_hemi(I.tc2); // hemi
half3 l_sun = I.c1*t_lmap.a; // sun color
half3 light = L_ambient + l_base + l_sun + l_hemi ;
// final-color
half3 final = light*t_base*2;
// out
return half4 (final,t_base.a);
}

View file

@ -0,0 +1,31 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float2 tc2 : TEXCOORD2; // lmap-hemi
float3 c0 : COLOR0; // hemi
float3 c1 : COLOR1; // sun
float fog : FOG;
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * p_hemi(I.tc2); // hemi
float3 l_sun = I.c1 * t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_sun + l_hemi;
// final-color
float3 final = light * t_base * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final, t_base.a);
}

View file

@ -0,0 +1,29 @@
#include "common.h"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float2 tch : TEXCOORD2;
float3 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main (v_lmap v)
{
vf o;
float3 N = unpack_normal (v.N);
o.hpos = mul (m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc
// o.tc0 = unpack_tc_base (v.tc0); // copy tc
o.tc1 = unpack_tc_lmap (v.uv1); // copy tc
o.tch = o.tc1;
o.c0 = v_hemi(N); // just hemisphere
o.c1 = v_sun(N); // sun
o.fog = calc_fogging (v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,29 @@
#include "common.hlsli"
struct vf
{
float4 hpos : POSITION;
float2 tc0 : TEXCOORD0;
float2 tc1 : TEXCOORD1;
float2 tch : TEXCOORD2;
float3 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
float fog : FOG;
};
vf main(v_lmap v)
{
vf o;
float3 N = unpack_normal(v.N);
o.hpos = mul(m_VP, v.P); // xform, input in world coords
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
// o.tc0 = unpack_tc_base (v.tc0); // copy tc
o.tc1 = unpack_tc_lmap(v.uv1); // copy tc
o.tch = o.tc1;
o.c0 = v_hemi(N); // just hemisphere
o.c1 = v_sun(N); // sun
o.fog = calc_fogging(v.P); // fog, input in world coords
return o;
}

View file

@ -0,0 +1,35 @@
#include "common.h"
struct v2p
{
half2 tc0: TEXCOORD0; // base
half2 tc1: TEXCOORD1; // lmap
half2 tc2: TEXCOORD2; // hemi
half2 tc3: TEXCOORD3; // detail
half4 c0: COLOR0; // c0.a *
half4 c1: COLOR1; // c1.a +
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
half4 main_ps_1_1 ( v2p I ) : COLOR
{
half4 t_base = tex2D (s_base,I.tc0);
half4 t_lmap = tex2D (s_lmap,I.tc1);
// lighting
half3 l_base = t_lmap.rgb; // base light-map
half3 l_hemi = I.c0*p_hemi(I.tc2); // hemi
half3 l_sun = I.c1*t_lmap.a; // sun color
half3 light = L_ambient + l_base + l_sun + l_hemi;
// calc D-texture
half4 t_dt = tex2D (s_detail,I.tc3);
half3 detail = t_dt*I.c0.a + I.c1.a;
// final-color
half3 final = (light*t_base*2)*detail*2;
// out
return half4 (final.r,final.g,final.b,t_base.a);
}

View file

@ -0,0 +1,36 @@
#include "common.hlsli"
struct v2p
{
float2 tc0 : TEXCOORD0; // base
float2 tc1 : TEXCOORD1; // lmap
float2 tc2 : TEXCOORD2; // hemi
float2 tc3 : TEXCOORD3; // detail
float4 c0 : COLOR0; // c0.a *
float4 c1 : COLOR1; // c1.a +
float fog : FOG;
};
// Pixel
float4 main(v2p I) : COLOR
{
float4 t_base = tex2D(s_base, I.tc0);
float4 t_lmap = tex2D(s_lmap, I.tc1);
// lighting
float3 l_base = t_lmap.rgb; // base light-map
float3 l_hemi = I.c0 * p_hemi(I.tc2); // hemi
float3 l_sun = I.c1 * t_lmap.a; // sun color
float3 light = L_ambient + l_base + l_sun + l_hemi;
// calc D-texture
float4 t_dt = tex2D(s_detail, I.tc3);
float3 detail = t_dt * I.c0.a + I.c1.a;
// final-color
float3 final = (light * t_base * 2.0f) * detail * 2.0f;
final = lerp(fog_color.xyz, final, I.fog);
// out
return float4(final, t_base.a);
}

Some files were not shown because too many files have changed in this diff Show more