` //uniforms // uniform mat4 uNormalMatrix; // uniform mat4 uModelViewMatrix; // uniform mat4 uProjectionMatrix; //attribute attribute vec4 aVertexPosition; attribute vec3 aVertexNormal; attribute vec2 aTextureCoord; //varying varying highp vec2 vTextureCoord; varying highp vec3 vLighting; //////////// djafer //////// mat4 ajustwMatrix (float theta) { return mat4( vec4(cos(theta), sin(theta), 0.0, 0.0), vec4(-sin(theta), cos(theta), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0) ); } mat4 rotate_x(float theta) { return mat4( vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, cos(theta), sin(theta), 0.0), vec4(0.0, -sin(theta), cos(theta), 0.0), vec4(0.0, 0.0 , 0.0 , 1.0) ); } mat4 rotate_y(float theta) { return mat4( vec4(cos(theta), 0.0, sin(theta), 0.0), vec4(0.0, 1.0, 0.0 , 0.0), vec4(-sin(theta), 0.0, cos(theta), 0.0), vec4(0.0, 0.0, 0.0, 1.0) ); } mat4 rotate_z(float theta) { return mat4( vec4(cos(theta), sin(theta), 0.0, 0.0), vec4(-sin(theta), cos(theta), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0) ); } ////////// end ///////////// void main(void) { // gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition; // gl_Position = aVertexPosition * ajustwMatrix (15.0 ); //vec4(1.0, 1.0, 0.45 , 1.0 ); gl_Position = aVertexPosition ; vTextureCoord = aTextureCoord; // Apply lighting effect highp vec3 ambientLight = vec3(0.3, 0.3, 0.3); highp vec3 directionalLightColor = vec3(1, 1, 1); highp vec3 directionalVector = normalize(vec3(0.85, 0.8, 0.75)); // highp vec4 transformedNormal = uNormalMatrix * vec4(aVertexNormal, 1.0); // highp float directional = max(dot(transformedNormal.xyz, directionalVector), 0.0); // vLighting = ambientLight + (directionalLightColor * directional); vLighting = ambientLight ; //+ (directionalLightColor ); } `