Browse Source

Shaders: reduce redundant expression in MeshVisualizer.vert.

Doesn't seem to have any effect on the (slow AF) perf of the shader, so
I guess the most time is spent in the GS.
pull/547/head
Vladimír Vondruš 4 years ago
parent
commit
32ebab499f
  1. 9
      src/Magnum/Shaders/MeshVisualizer.vert

9
src/Magnum/Shaders/MeshVisualizer.vert

@ -343,22 +343,23 @@ void main() {
#ifdef TWO_DIMENSIONS #ifdef TWO_DIMENSIONS
gl_Position.xywz = vec4(transformationProjectionMatrix*vec3(position, 1.0), 0.0); gl_Position.xywz = vec4(transformationProjectionMatrix*vec3(position, 1.0), 0.0);
#elif defined(THREE_DIMENSIONS) #elif defined(THREE_DIMENSIONS)
gl_Position = projectionMatrix*transformationMatrix*position; highp const vec4 transformedPosition4 = transformationMatrix*position;
gl_Position = projectionMatrix*transformedPosition4;
#else #else
#error #error
#endif #endif
#ifdef TANGENT_DIRECTION #ifdef TANGENT_DIRECTION
tangentEndpoint = projectionMatrix*(transformationMatrix*position + vec4(normalize(normalMatrix*tangent.xyz)*lineLength, 0.0)); tangentEndpoint = projectionMatrix*(transformedPosition4 + vec4(normalize(normalMatrix*tangent.xyz)*lineLength, 0.0));
#endif #endif
#ifdef BITANGENT_FROM_TANGENT_DIRECTION #ifdef BITANGENT_FROM_TANGENT_DIRECTION
vec3 bitangent = cross(normal, tangent.xyz)*tangent.w; vec3 bitangent = cross(normal, tangent.xyz)*tangent.w;
#endif #endif
#if defined(BITANGENT_DIRECTION) || defined(BITANGENT_FROM_TANGENT_DIRECTION) #if defined(BITANGENT_DIRECTION) || defined(BITANGENT_FROM_TANGENT_DIRECTION)
bitangentEndpoint = projectionMatrix*(transformationMatrix*position + vec4(normalize(normalMatrix*bitangent)*lineLength, 0.0)); bitangentEndpoint = projectionMatrix*(transformedPosition4 + vec4(normalize(normalMatrix*bitangent)*lineLength, 0.0));
#endif #endif
#ifdef NORMAL_DIRECTION #ifdef NORMAL_DIRECTION
normalEndpoint = projectionMatrix*(transformationMatrix*position + vec4(normalize(normalMatrix*normal)*lineLength, 0.0)); normalEndpoint = projectionMatrix*(transformedPosition4 + vec4(normalize(normalMatrix*normal)*lineLength, 0.0));
#endif #endif
#if defined(WIREFRAME_RENDERING) && defined(NO_GEOMETRY_SHADER) #if defined(WIREFRAME_RENDERING) && defined(NO_GEOMETRY_SHADER)

Loading…
Cancel
Save