openGL work and other parts
This commit is contained in:
@@ -4,19 +4,39 @@ precision mediump int;
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform mat4 m_matrix;
|
||||
uniform mat4 mv_matrix;
|
||||
uniform mat4 mvp_matrix;
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec3 a_position;
|
||||
attribute vec3 a_normal;
|
||||
attribute vec2 a_texcoord;
|
||||
attribute vec3 a_tangent;
|
||||
|
||||
varying vec3 v_WorldPos;
|
||||
varying vec3 v_CamPos;
|
||||
|
||||
varying vec3 v_normal;
|
||||
varying vec2 v_texcoord;
|
||||
varying mat3 normalMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Calculate vertex position in screen space
|
||||
gl_Position = mvp_matrix * a_position;
|
||||
void main() {
|
||||
|
||||
// Pass texture coordinate to fragment shader
|
||||
// Value will be automatically interpolated to fragments inside polygon faces
|
||||
|
||||
|
||||
// interpolation:
|
||||
v_WorldPos = vec3(m_matrix * vec4(a_position, 1.0));
|
||||
v_CamPos = vec3(mv_matrix * vec4(a_position, 1.0));
|
||||
v_normal = a_normal;//normalize(vec3(mv_matrix * vec4(a_normal, 0.0)));
|
||||
v_texcoord = a_texcoord;
|
||||
|
||||
|
||||
|
||||
// http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-13-normal-mapping/
|
||||
vec3 bitangent = cross(a_normal, a_tangent);
|
||||
normalMat = mat3(a_tangent, bitangent, a_normal);
|
||||
|
||||
// 2D position for the vertex
|
||||
gl_Position = mvp_matrix * vec4(a_position, 1.0);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user