irrlicht/media/ogles2.vert
cutealien 2ae2a551a6 Merging r5975 through r6036 from trunk to ogl-es branch.
GLES drivers adapted, but only did make compile-tests.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6038 dfc29bdd-3216-0410-991c-e03cc46cb475
2020-01-03 19:05:16 +00:00

35 lines
837 B
GLSL

attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
uniform mat4 mWorldViewProj;
uniform mat4 mInvWorld;
uniform mat4 mTransWorld;
uniform vec3 mLightPos;
uniform vec4 mLightColor;
varying mediump vec4 v_color;
varying mediump vec2 v_texCoord;
void main(void)
{
gl_Position = mWorldViewProj * vec4(inVertexPosition,1.0);
vec4 normal = vec4(inVertexNormal, 0.0);
normal = mInvWorld * normal;
normal = normalize(normal);
vec4 worldpos = vec4(inVertexPosition,1.0) * mTransWorld;
vec4 lightVector = worldpos - vec4(mLightPos,1.0);
lightVector = normalize(lightVector);
float tmp2 = dot(-lightVector, normal);
vec4 tmp = mLightColor * tmp2;
v_color = vec4(tmp.x, tmp.y, tmp.z, 0.0);
v_texCoord = inTexCoord0;
}