-0 Removals
+32 Additions
#version 100#version 100
precision highp float;precision highp float;
precision highp int;precision highp int;
void FFP_Assign(in vec2 vIn, out vec2 vOut)void FFP_Assign(in vec2 vIn, out vec2 vOut)
{{
vOut = vIn;vOut = vIn;
}}
void FFP_Assign(in vec4 vIn, out vec4 vOut)void FFP_Assign(in vec4 vIn, out vec4 vOut)
{{
vOut = vIn;vOut = vIn;
}}
void FFP_Construct(in float r, in float g, in float b, in float a, out vec4 vOut)void FFP_Construct(in float r, in float g, in float b, in float a, out vec4 vOut)
{{
vOut = vec4(r,g,b,a);vOut = vec4(r,g,b,a);
}}
void FFP_Light_Spot_Diffuse(in mat4 mWorldView, in vec4 vPos, in mat4 mWorldViewIT, in vec3 vNormal, in vec3 vLightPosView, in vec3 vNegLightDirView, in vec4 vAttParams, in vec3 vSpotParams, in vec3 vDiffuseColour, in vec3 vBaseColour, out vec3 vOut)
{
vOut = vBaseColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
vOut = clamp(vOut, 0.0, 1.0);
}
void FFP_Transform(in mat4 m, in vec4 v, out vec4 vOut)void FFP_Transform(in mat4 m, in vec4 v, out vec4 vOut)
{{
vOut = m * v;vOut = m * v;
}}
uniform mat4 worldviewproj_matrix;uniform mat4 worldviewproj_matrix;
uniform mat4 inverse_transpose_worldview_matrix;uniform mat4 inverse_transpose_worldview_matrix;
uniform vec4 derived_ambient_light_colour;uniform vec4 derived_ambient_light_colour;
uniform vec4 surface_diffuse_colour;uniform vec4 surface_diffuse_colour;
uniform vec4 surface_specular_colour;uniform vec4 surface_specular_colour;
uniform vec4 surface_emissive_colour;uniform vec4 surface_emissive_colour;
uniform vec4 derived_scene_colour;uniform vec4 derived_scene_colour;
uniform float surface_shininess;uniform float surface_shininess;
uniform mat4 worldview_matrix;
uniform vec4 light_position_view_space0;
uniform vec4 light_direction_view_space1;
uniform vec4 light_attenuation2;
uniform vec3 spotlight_params0;
uniform vec4 derived_light_diffuse3;
attribute vec4 vertex;attribute vec4 vertex;
attribute vec3 normal;attribute vec3 normal;
attribute vec4 uv0;attribute vec4 uv0;
varying vec4 oColor_0;varying vec4 oColor_0;
varying vec2 oTexcoord2_0;varying vec2 oTexcoord2_0;
void main() {void main() {
vec4 outputPosition; vec4 outputPosition;
vec4 lLocalParam_0; vec4 lLocalParam_0;
vec4 lLocalParam_1; vec4 lLocalParam_1;
FFP_Transform(worldviewproj_matrix, vertex, outputPosition); FFP_Transform(worldviewproj_matrix, vertex, outputPosition);
FFP_Construct(1.0, 1.0, 1.0, 1.0, lLocalParam_0); FFP_Construct(1.0, 1.0, 1.0, 1.0, lLocalParam_0);
FFP_Assign(lLocalParam_0, oColor_0); FFP_Assign(lLocalParam_0, oColor_0);
FFP_Construct(0.0, 0.0, 0.0, 0.0, lLocalParam_1); FFP_Construct(0.0, 0.0, 0.0, 0.0, lLocalParam_1);
FFP_Assign(derived_scene_colour, oColor_0); FFP_Assign(derived_scene_colour, oColor_0);
FFP_Light_Spot_Diffuse(worldview_matrix, vertex, inverse_transpose_worldview_matrix, normal, light_position_view_space0.xyz, light_direction_view_space1.xyz, light_attenuation2, spotlight_params0, derived_light_diffuse3.xyz, oColor_0.xyz, oColor_0.xyz);
FFP_Assign(uv0.xy, oTexcoord2_0); FFP_Assign(uv0.xy, oTexcoord2_0);
gl_Position = outputPosition; gl_Position = outputPosition;
}}
Editor
Original Text
Changed Text