@@ -46,7 +46,7 @@ public: | |||
{ | |||
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(03_noise)); | |||
m_coord = m_shader->GetAttribLocation(VertexUsage::Position, 0); | |||
m_time_uni = m_shader->GetUniformLocation("u_Time"); | |||
m_time_uni = m_shader->GetUniformLocation("u_time"); | |||
m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position)); | |||
@@ -2,7 +2,7 @@ | |||
#version 120 | |||
uniform float u_Time; | |||
uniform float u_time; | |||
attribute vec2 in_Position; | |||
@@ -19,7 +19,7 @@ void main(void) | |||
{ | |||
mat3 r = mat3(0.36, 0.48, -0.8, -0.8, 0.60, 0.0, 0.48, 0.64, 0.60); | |||
vec3 p_pos = r * vec3(in_Position * vec2(16.0, 9.0), 0.0); | |||
vec3 p_time = r * vec3(0.0, 0.0, u_Time * 2.0); | |||
vec3 p_time = r * vec3(0.0, 0.0, u_time * 2.0); | |||
/* Noise sampling points for water */ | |||
water[0] = p_pos / 2.0 + p_time; | |||
@@ -28,7 +28,7 @@ void main(void) | |||
water[3] = p_pos / 16.0 + p_time; | |||
/* Noise sampling points for fire */ | |||
p_pos = 16.0 * p_pos - r * vec3(0.0, mod289(u_Time) * 128.0, 0.0); | |||
p_pos = 16.0 * p_pos - r * vec3(0.0, mod289(u_time) * 128.0, 0.0); | |||
fire[0] = p_pos / 2.0 + p_time * 2.0; | |||
fire[1] = p_pos / 4.0 + p_time * 1.5; | |||
fire[2] = p_pos / 8.0 + p_time; | |||
@@ -36,7 +36,7 @@ void main(void) | |||
/* Pass rotated screen coordinates */ | |||
pass_Position.xy = in_Position; | |||
mat2 rot = mat2(cos(u_Time), sin(u_Time), -sin(u_Time), cos(u_Time)); | |||
mat2 rot = mat2(cos(u_time), sin(u_time), -sin(u_time), cos(u_time)); | |||
pass_Position.zw = rot * in_Position; | |||
gl_Position = vec4(in_Position, 0.0, 1.0); | |||
@@ -50,7 +50,7 @@ void main(void) | |||
precision highp float; | |||
#endif | |||
uniform float u_Time; | |||
uniform float u_time; | |||
varying vec4 pass_Position; | |||
varying vec3 water[4]; | |||
@@ -92,7 +92,7 @@ float noise3d(vec3 p) | |||
void main(void) | |||
{ | |||
/* Dither the transition between water and fire */ | |||
float test = pass_Position.z * pass_Position.w + 1.5 * sin(u_Time); | |||
float test = pass_Position.z * pass_Position.w + 1.5 * sin(u_time); | |||
vec2 d = vec2(16.0, 9.0) * pass_Position.xy; | |||
test += 0.5 * (length(fract(d) - 0.5) - length(fract(d + 0.5) - 0.5)); | |||
@@ -153,7 +153,7 @@ float mod289(float x) | |||
} | |||
void main(float2 in_Position : POSITION, | |||
uniform float u_Time, | |||
uniform float u_time, | |||
out float4 out_Position : POSITION, | |||
out float4 pass_Position : TEXCOORD0, | |||
out float3 water[4] : TEXCOORD1, | |||
@@ -161,7 +161,7 @@ void main(float2 in_Position : POSITION, | |||
{ | |||
float3x3 r = float3x3(0.36, 0.48, -0.8, -0.8, 0.60, 0.0, 0.48, 0.64, 0.60); | |||
float3 p_pos = mul(r, float3(in_Position * float2(16.0, 9.0), 0.0)); | |||
float3 p_time = mul(r, float3(0.0, 0.0, u_Time * 2.0)); | |||
float3 p_time = mul(r, float3(0.0, 0.0, u_time * 2.0)); | |||
/* Noise sampling points for water */ | |||
water[0] = p_pos / 2.0 + p_time; | |||
@@ -170,7 +170,7 @@ void main(float2 in_Position : POSITION, | |||
water[3] = p_pos / 16.0 + p_time; | |||
/* Noise sampling points for fire */ | |||
p_pos = 16.0 * p_pos - mul(r, float3(0.0, mod289(u_Time) * 128.0, 0.0)); | |||
p_pos = 16.0 * p_pos - mul(r, float3(0.0, mod289(u_time) * 128.0, 0.0)); | |||
fire[0] = p_pos / 2.0 + p_time * 2.0; | |||
fire[1] = p_pos / 4.0 + p_time * 1.5; | |||
fire[2] = p_pos / 8.0 + p_time; | |||
@@ -178,7 +178,7 @@ void main(float2 in_Position : POSITION, | |||
/* Pass rotated screen coordinates */ | |||
pass_Position.xy = in_Position; | |||
float2x2 rot = float2x2(cos(u_Time), sin(u_Time), -sin(u_Time), cos(u_Time)); | |||
float2x2 rot = float2x2(cos(u_time), sin(u_time), -sin(u_time), cos(u_time)); | |||
pass_Position.zw = mul(rot, in_Position); | |||
out_Position = float4(in_Position, 0.0, 1.0); | |||
@@ -222,11 +222,11 @@ float noise3d(float3 p) | |||
void main(in float4 pass_Position : TEXCOORD0, | |||
in float3 water[4] : TEXCOORD1, | |||
in float3 fire[4] : TEXCOORD5, | |||
uniform float u_Time, | |||
uniform float u_time, | |||
out float4 out_FragColor : COLOR) | |||
{ | |||
/* Dither the transition between water and fire */ | |||
float test = pass_Position.z * pass_Position.w + 1.5 * sin(u_Time); | |||
float test = pass_Position.z * pass_Position.w + 1.5 * sin(u_time); | |||
float2 d = float2(16.0, 9.0) * pass_Position.xy; | |||
test += 0.5 * (length(frac(d) - 0.5) - length(frac(d + 0.5) - 0.5)); | |||
@@ -62,7 +62,7 @@ public: | |||
m_uni_flag = m_shader->GetUniformLocation("in_Flag"); | |||
m_uni_point = m_shader->GetUniformLocation("in_Point"); | |||
m_uni_color = m_shader->GetUniformLocation("in_Color"); | |||
m_uni_texture = m_shader->GetUniformLocation("in_Texture"); | |||
m_uni_texture = m_shader->GetUniformLocation("u_texture"); | |||
m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position)); | |||
@@ -20,7 +20,7 @@ void main() | |||
precision highp float; | |||
#endif | |||
uniform sampler2D in_Texture; | |||
uniform sampler2D u_texture; | |||
uniform float in_Flag; | |||
uniform vec3 in_Point; | |||
uniform vec3 in_Color; | |||
@@ -46,7 +46,7 @@ void main(void) | |||
else | |||
{ | |||
vec2 texcoords = pass_Position * 0.5 + vec2(0.5, 0.5); | |||
gl_FragColor = vec4(texture2D(in_Texture, texcoords).xyz, 1.0); | |||
gl_FragColor = vec4(texture2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -63,7 +63,7 @@ void main(float2 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform sampler2D u_texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -88,7 +88,7 @@ void main(in float2 pass_Position : TEXCOORD0, | |||
float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5); | |||
/* FIXME: this should be passed as a uniform or something */ | |||
texcoords += float2(0.5 / 800.0, 0.5 / 600.0); | |||
out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0); | |||
out_FragColor = float4(tex2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -20,7 +20,7 @@ void main() | |||
precision highp float; | |||
#endif | |||
uniform sampler2D in_Texture; | |||
uniform sampler2D u_texture; | |||
uniform float in_Flag; | |||
uniform vec3 in_Point; | |||
uniform vec3 in_Color; | |||
@@ -46,7 +46,7 @@ void main(void) | |||
else | |||
{ | |||
vec2 texcoords = pass_Position * 0.5 + vec2(0.5, 0.5); | |||
gl_FragColor = vec4(texture2D(in_Texture, texcoords).xyz, 1.0); | |||
gl_FragColor = vec4(texture2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -63,7 +63,7 @@ void main(float2 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform sampler2D u_texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -88,7 +88,7 @@ void main(in float2 pass_Position : TEXCOORD0, | |||
float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5); | |||
/* FIXME: this should be passed as a uniform or something */ | |||
texcoords += float2(0.5 / 800.0, 0.5 / 600.0); | |||
out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0); | |||
out_FragColor = float4(tex2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -61,7 +61,7 @@ float3 rand_color(float t) | |||
} | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform sampler2D u_texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -86,7 +86,7 @@ void main(in float2 pass_Position : TEXCOORD0, | |||
float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5); | |||
/* FIXME: this should be passed as a uniform or something */ | |||
texcoords += float2(0.5 / 800.0, 0.5 / 600.0); | |||
out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0); | |||
out_FragColor = float4(tex2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -82,7 +82,6 @@ void main(float2 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -20,7 +20,7 @@ void main() | |||
precision highp float; | |||
#endif | |||
uniform sampler2D in_Texture; | |||
uniform sampler2D u_texture; | |||
uniform float in_Flag; | |||
uniform vec3 in_Point; | |||
uniform vec3 in_Color; | |||
@@ -46,7 +46,7 @@ void main(void) | |||
else | |||
{ | |||
vec2 texcoords = pass_Position * 0.5 + vec2(0.5, 0.5); | |||
gl_FragColor = vec4(texture2D(in_Texture, texcoords).xyz, 1.0); | |||
gl_FragColor = vec4(texture2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -63,7 +63,7 @@ void main(float2 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform sampler2D u_texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -88,7 +88,7 @@ void main(in float2 pass_Position : TEXCOORD0, | |||
float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5); | |||
/* FIXME: this should be passed as a uniform or something */ | |||
texcoords += float2(0.5 / 800.0, 0.5 / 600.0); | |||
out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0); | |||
out_FragColor = float4(tex2D(u_texture, texcoords).xyz, 1.0); | |||
} | |||
} | |||
@@ -59,7 +59,6 @@ void main(float2 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(in float2 pass_Position : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform float in_Flag, | |||
uniform float3 in_Point, | |||
uniform float3 in_Color, | |||
@@ -122,12 +122,12 @@ DefaultShaderData::DefaultShaderData(uint16_t vert_decl_flags, Shader* shader, b | |||
static const String DefaultUniforms[7] = | |||
{ | |||
String("u_Lights"), | |||
String("in_ModelView"), | |||
String("in_View"), | |||
String("in_Inv_View"), | |||
String("in_Proj"), | |||
String("in_NormalMat"), | |||
String("u_lights"), | |||
String("u_modelview"), | |||
String("u_view"), | |||
String("u_inv_view"), | |||
String("u_proj"), | |||
String("u_normalmat"), | |||
String("in_Damage") | |||
}; | |||
//----------------------------------------------------------------------------- | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -17,14 +17,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -35,10 +35,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -77,11 +77,11 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r, p; | |||
p = (in_View * pos).xyz; | |||
p = (u_view * pos).xyz; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
@@ -104,7 +104,7 @@ void main(void) | |||
#if 0 | |||
//Light calculation for cube light | |||
vec3 specular_color = vec3(1.0, 1.0, 0.6); | |||
vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 Local_Vertex = (u_inv_view * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); | |||
vec3 new_LightDir = Local_Vertex - Proj_Vertex; | |||
@@ -115,7 +115,7 @@ void main(void) | |||
sdotn = 1.0; | |||
else | |||
{ | |||
new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
new_LightDir = normalize((u_view * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
sdotn = max(dot(new_LightDir, TNormal), 0.0); | |||
r = reflect(-new_LightDir, TNormal); | |||
if (sdotn > 0.0 && light_radius_mod > 0.0) | |||
@@ -137,17 +137,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -157,7 +156,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -8,10 +8,10 @@ attribute vec4 in_Color; | |||
attribute vec2 in_Index; | |||
attribute vec2 in_Weight; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
//10is not a fix idea, should be more. | |||
uniform mat4 in_BoneList[10]; | |||
@@ -21,14 +21,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -39,10 +39,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -79,14 +79,14 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
s = normalize((in_View * pos).xyz - pass_Vertex.xyz); | |||
s = normalize((u_view * pos).xyz - pass_Vertex.xyz); | |||
r = reflect(-s, pass_TNormal); | |||
} | |||
else | |||
@@ -107,7 +107,7 @@ void main(void) | |||
//Light calculation for cube light | |||
//const float cos_45 = 0.70710678118; | |||
//const float inv_cos_45 = 0.29289321881; | |||
vec3 local_vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 local_vertex = (u_inv_view * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 proj_vertex = clamp(local_vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); | |||
vec3 proj_local_dir = local_vertex - proj_vertex; | |||
vec3 inner_dir = proj_vertex / in_Light3_Size_Inner; | |||
@@ -138,7 +138,7 @@ void main(void) | |||
// //vec3 proj_local_light = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(proj_local_dir / in_Light3_Size_Outer)); | |||
//} | |||
/* | |||
proj_local_dir = normalize((in_View * vec4(proj_vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
proj_local_dir = normalize((u_view * vec4(proj_vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
sdotn = max(dot(proj_local_dir, pass_TNormal), 0.0); | |||
r = reflect(-proj_local_dir, pass_TNormal); | |||
if (sdotn > 0.0 && light_radius_mod > 0.0) | |||
@@ -162,17 +162,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -182,7 +181,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -7,10 +7,10 @@ attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
attribute vec2 in_TexCoord; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -19,15 +19,15 @@ varying vec2 pass_TexCoord; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
pass_TexCoord = in_TexCoord; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -38,10 +38,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -96,17 +96,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -116,7 +115,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -17,14 +17,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = vec4(1.0, 1.0, 1.0, in_Color.w);//; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -35,10 +35,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -61,14 +61,14 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
s = normalize((in_View * pos).xyz - pass_Vertex.xyz); | |||
s = normalize((u_view * pos).xyz - pass_Vertex.xyz); | |||
r = reflect(-s, pass_TNormal); | |||
} | |||
else | |||
@@ -96,17 +96,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -116,7 +115,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -17,14 +17,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -35,10 +35,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -58,17 +58,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -78,7 +77,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -17,14 +17,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -35,10 +35,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -54,17 +54,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -74,7 +73,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -17,14 +17,14 @@ varying vec4 pass_Color; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -35,10 +35,10 @@ precision highp float; | |||
#endif | |||
uniform float in_Damage; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -80,11 +80,11 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r, p; | |||
p = (in_View * pos).xyz; | |||
p = (u_view * pos).xyz; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
@@ -107,7 +107,7 @@ void main(void) | |||
#if 0 | |||
//Light calculation for cube light | |||
vec3 specular_color = vec3(1.0, 1.0, 0.6); | |||
vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 Local_Vertex = (u_inv_view * pass_Vertex).xyz - (in_Light3_Pos).xyz; | |||
vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); | |||
vec3 new_LightDir = Local_Vertex - Proj_Vertex; | |||
@@ -118,7 +118,7 @@ void main(void) | |||
sdotn = 1.0; | |||
else | |||
{ | |||
new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
new_LightDir = normalize((u_view * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); | |||
sdotn = max(dot(new_LightDir, TNormal), 0.0); | |||
r = reflect(-new_LightDir, TNormal); | |||
if (sdotn > 0.0 && light_radius_mod > 0.0) | |||
@@ -140,17 +140,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -160,7 +159,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -25,13 +25,13 @@ void main() | |||
precision mediump float; | |||
#endif | |||
uniform sampler2D in_Texture; | |||
uniform vec2 in_TexSize; | |||
uniform sampler2D u_texture; | |||
uniform vec2 u_texsize; | |||
varying vec2 pass_TexCoord; | |||
void main() | |||
{ | |||
vec4 col = texture2D(in_Texture, pass_TexCoord); | |||
vec4 col = texture2D(u_texture, pass_TexCoord); | |||
if (col.a == 0.0) | |||
discard; | |||
gl_FragColor = col; | |||
@@ -44,12 +44,12 @@ void main(float4 in_Position : POSITION, | |||
uniform float4x4 u_projection, | |||
uniform float4x4 u_view, | |||
uniform float4x4 u_model, | |||
uniform float2 in_TexSize, | |||
uniform float2 u_texsize, | |||
out float2 out_TexCoord : TEXCOORD0, | |||
out float4 out_Position : POSITION) | |||
{ | |||
#if _XBOX | |||
float2 delta = float2(-0.5, -0.5) / in_TexSize; | |||
float2 delta = float2(-0.5, -0.5) / u_texsize; | |||
#else | |||
float2 delta = float2(0.0, 0.0); | |||
#endif | |||
@@ -60,10 +60,10 @@ void main(float4 in_Position : POSITION, | |||
[frag.hlsl] | |||
void main(float2 in_TexCoord : TEXCOORD0, | |||
uniform sampler2D in_Texture, | |||
uniform sampler2D u_texture, | |||
out float4 out_FragColor : COLOR) | |||
{ | |||
float4 col = tex2D(in_Texture, in_TexCoord); | |||
float4 col = tex2D(u_texture, in_TexCoord); | |||
out_FragColor = col; | |||
} | |||
@@ -257,9 +257,9 @@ void Scene::RenderTiles() // XXX: rename to Blit() | |||
uni_mat = data->m_tile_shader->GetUniformLocation("u_model"); | |||
data->m_tile_shader->SetUniform(uni_mat, mat4(1.f)); | |||
uni_tex = data->m_tile_shader->GetUniformLocation("in_Texture"); | |||
uni_tex = data->m_tile_shader->GetUniformLocation("u_texture"); | |||
data->m_tile_shader->SetUniform(uni_tex, 0); | |||
uni_texsize = data->m_tile_shader->GetUniformLocation("in_TexSize"); | |||
uni_texsize = data->m_tile_shader->GetUniformLocation("u_texsize"); | |||
for (int buf = 0, i = 0, n; i < data->m_tiles.Count(); i = n, buf += 2) | |||
{ | |||
@@ -6,10 +6,10 @@ attribute vec3 in_Position; | |||
attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
uniform float in_Damage; | |||
varying vec4 pass_Vertex; /* View space */ | |||
@@ -22,14 +22,14 @@ void main(void) | |||
float dam_perc = in_Damage / (0.1 * 40); | |||
vec3 vGravity = vec3(0.0, -0.981, 0.0) * 2.0; | |||
float k = pow(dam_perc, 3); | |||
vertex = in_ModelView * vertex + in_View * vec4(vGravity * k, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vertex = u_modelview * vertex + u_view * vec4(vGravity * k, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -39,13 +39,13 @@ void main(void) | |||
precision highp float; | |||
#endif | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 in_Inv_ModelView; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform mat4 u_inv_modelview; | |||
uniform float in_Damage; | |||
//Light list | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -68,14 +68,14 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
s = normalize((in_View * pos).xyz - pass_Vertex.xyz); | |||
s = normalize((u_view * pos).xyz - pass_Vertex.xyz); | |||
r = reflect(-s, pass_TNormal); | |||
} | |||
else | |||
@@ -94,8 +94,8 @@ void main(void) | |||
vec3 light = ambient + diffuse + specular; | |||
vec4 world_vertex = in_Inv_ModelView * pass_Vertex; | |||
vec4 world_normal = in_Inv_ModelView * vec4(pass_TNormal, 1.0); | |||
vec4 world_vertex = u_inv_modelview * pass_Vertex; | |||
vec4 world_normal = u_inv_modelview * vec4(pass_TNormal, 1.0); | |||
float dam_perc = in_Damage / (0.1 * 40); | |||
float PI = 3.14159265358979323846264; | |||
@@ -120,17 +120,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -140,7 +139,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||
@@ -7,10 +7,10 @@ attribute vec3 in_Normal; | |||
attribute vec4 in_Color; | |||
attribute vec2 in_TexCoord; | |||
uniform mat4 in_ModelView; | |||
uniform mat4 in_View; | |||
uniform mat4 in_Proj; | |||
uniform mat3 in_NormalMat; | |||
uniform mat4 u_modelview; | |||
uniform mat4 u_view; | |||
uniform mat4 u_proj; | |||
uniform mat3 u_normalmat; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -19,15 +19,15 @@ varying vec2 pass_TexCoord; | |||
void main(void) | |||
{ | |||
vec4 vertex = in_ModelView * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(in_NormalMat * in_Normal); | |||
vec4 vertex = u_modelview * vec4(in_Position, 1.0); | |||
vec3 tnorm = normalize(u_normalmat * in_Normal); | |||
pass_Vertex = vertex; | |||
pass_TNormal = tnorm; | |||
pass_Color = in_Color; | |||
pass_TexCoord = in_TexCoord; | |||
gl_Position = in_Proj * vertex; | |||
gl_Position = u_proj * vertex; | |||
} | |||
[frag.glsl] | |||
@@ -37,13 +37,13 @@ void main(void) | |||
precision highp float; | |||
#endif | |||
uniform mat4 in_View; | |||
uniform mat4 in_Inv_View; | |||
uniform mat4 in_Inv_ModelView; | |||
uniform mat4 u_view; | |||
uniform mat4 u_inv_view; | |||
uniform mat4 u_inv_modelview; | |||
uniform sampler2D u_Texture; | |||
//Light list | |||
uniform vec4 u_Lights[8 * 2]; | |||
uniform vec4 u_lights[8 * 2]; | |||
varying vec4 pass_Vertex; /* View space */ | |||
varying vec3 pass_TNormal; | |||
@@ -67,14 +67,14 @@ void main(void) | |||
/* Apply lighting */ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
vec4 pos = u_Lights[i * 2]; | |||
vec4 color = u_Lights[i * 2 + 1]; | |||
vec4 pos = u_lights[i * 2]; | |||
vec4 color = u_lights[i * 2 + 1]; | |||
vec3 s, r; | |||
if (pos.w > 0.0) | |||
{ | |||
/* Point light -- no attenuation yet */ | |||
s = normalize((in_View * pos).xyz - pass_Vertex.xyz); | |||
s = normalize((u_view * pos).xyz - pass_Vertex.xyz); | |||
r = reflect(-s, pass_TNormal); | |||
} | |||
else | |||
@@ -101,17 +101,16 @@ void main(void) | |||
void main(float3 in_Vertex : POSITION, | |||
float3 in_Normal : NORMAL, | |||
float4 in_Color : COLOR, | |||
uniform float4x4 in_ModelView, | |||
uniform float4x4 in_Model, | |||
uniform float4x4 in_Proj, | |||
uniform float3x3 in_NormalMat, | |||
uniform float4x4 u_modelview, | |||
uniform float4x4 u_proj, | |||
uniform float3x3 u_normalmat, | |||
out float4 pass_Vertex : TEXCOORD0, | |||
out float3 pass_TNormal : TEXCOORD1, | |||
out float4 pass_Color : COLOR, | |||
out float4 out_Position : POSITION) | |||
{ | |||
float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(in_NormalMat, in_Normal)); | |||
float4 eye = mul(u_modelview, float4(in_Vertex, 1.0)); | |||
float3 tnorm = normalize(mul(u_normalmat, in_Normal)); | |||
pass_Vertex = eye; | |||
pass_TNormal = tnorm; | |||
@@ -121,7 +120,7 @@ void main(float3 in_Vertex : POSITION, | |||
pass_Color = in_Color; | |||
#endif | |||
out_Position = mul(in_Proj, eye); | |||
out_Position = mul(u_proj, eye); | |||
} | |||
[frag.hlsl] | |||