return normal;
}
-virtual vec4 transform_position(vec4 pos)
+virtual mat4 get_vertex_transform()
{
- return eye_obj_matrix*pos;
+ return eye_obj_matrix;
}
-virtual vec3 transform_normal(vec3 nor)
+virtual mat3 get_normal_transform()
{
- return eye_obj_normal_matrix*nor;
+ return eye_obj_normal_matrix;
}
void standard_transform()
{
- out vec4 eye_vertex = transform_position(get_vertex_position());
+ mat4 vertex_tf = get_vertex_transform();
+ mat3 normal_tf = get_normal_transform();
+
+ out vec4 eye_vertex = vertex_tf*get_vertex_position();
gl_Position = projection_matrix*eye_vertex;
- out vec3 eye_normal = transform_normal(get_vertex_normal());
- vec3 eye_tangent = transform_normal(tangent);
- vec3 eye_binormal = transform_normal(binormal);
+ out vec3 eye_normal = normal_tf*get_vertex_normal();
+ vec3 eye_tangent = normal_tf*tangent;
+ vec3 eye_binormal = normal_tf*binormal;
out mat3 eye_tbn_matrix = mat3(eye_tangent, eye_binormal, eye_normal);
out vec3 eye_look_dir = normalize(eye_vertex.xyz);