Single light textureless phong shading complete.
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
// Model-view matrix.
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
// Normal matrix.
|
||||
uniform mat4 u_normalMat;
|
||||
|
||||
// Vertex position in world coordinates.
|
||||
attribute vec4 a_position;
|
||||
|
||||
// Vertex normal.
|
||||
attribute vec4 a_normal;
|
||||
|
||||
// Vertex color.
|
||||
attribute vec4 a_color;
|
||||
|
||||
// Vertex position to pass to the fragment shader.
|
||||
varying vec4 v_position;
|
||||
|
||||
// Vertex normal to pass to the fragment shader.
|
||||
varying vec3 v_normal;
|
||||
|
||||
// Vertex color to pass to the fragment shader.
|
||||
varying vec4 v_color;
|
||||
|
||||
void main(){
|
||||
v_position = u_projTrans * a_position;
|
||||
v_color = a_color;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
v_normal = vec3(u_normalMat * a_normal);
|
||||
|
||||
gl_Position = v_position;
|
||||
}
|
||||
|
Reference in New Issue
Block a user