Skip to content

Instantly share code, notes, and snippets.

@eodabash
Created February 2, 2015 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eodabash/13623179d2e84d5c183e to your computer and use it in GitHub Desktop.
Save eodabash/13623179d2e84d5c183e to your computer and use it in GitHub Desktop.
#version 300 es
struct HColor {
mediump vec4 diffuse;
mediump vec4 specular;
};
struct distant_light_t {
mediump vec3 direction;
mediump vec4 diffuse;
mediump vec3 specular;
mediump vec3 halfway;
};
out mediump vec4 out_color0;
out mediump vec4 out_color1;
uniform distant_light_t DistantLights[2];
uniform mat4 Projection;
uniform mat4 ModelView;
uniform mat3 NormalizedModelView3x3;
uniform HColor MaterialColor;
uniform vec3 AmbientLightDir;
in vec3 _in_position;
in vec3 _in_normal;
void main ()
{
vec4 tmpvar_1;
vec3 eye_normal_2;
mediump vec4 tmpvar_3;
mediump vec4 tmpvar_4;
tmpvar_3 = MaterialColor.diffuse;
vec4 tmpvar_5;
tmpvar_5.w = 1.0;
tmpvar_5.xyz = _in_position;
vec3 tmpvar_6;
tmpvar_6 = (NormalizedModelView3x3 * _in_normal);
eye_normal_2 = tmpvar_6;
vec4 tmpvar_7;
tmpvar_7 = (Projection * (ModelView * tmpvar_5));
if ((tmpvar_6.z > 0.0)) {
eye_normal_2 = -(tmpvar_6);
};
vec3 tmpvar_8;
tmpvar_8 = -(eye_normal_2);
eye_normal_2 = tmpvar_8;
distant_light_t light_9;
light_9 = DistantLights[0];
mediump vec3 tmpvar_10;
tmpvar_10 = (light_9.specular * pow (clamp (
dot (tmpvar_8, light_9.halfway)
, 0.0, 1.0), MaterialColor.specular.w));
tmpvar_4.xyz = (DistantLights[0].diffuse.xyz * clamp (dot (tmpvar_8, DistantLights[0].direction), 0.0, 1.0));
tmpvar_3.w = (((tmpvar_10.x * 0.3125) + (tmpvar_10.y * 0.5)) + (tmpvar_10.z * 0.1875));
tmpvar_4.w = (0.5 + (0.5 * dot (tmpvar_8, AmbientLightDir)));
tmpvar_1.xyw = tmpvar_7.xyw;
tmpvar_1.z = ((tmpvar_7.z * 2.0) - tmpvar_7.w);
gl_Position = tmpvar_1;
out_color0 = tmpvar_3;
out_color1 = tmpvar_4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment