X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FShaders%2FShaders_TangentSpaceNormal_glsl.pxx;h=0878cd55f3c6a1d382dcdf1d340652dcf941796a;hb=786077023239ed807d12180613e223f95a545b70;hpb=6216ed573eba2e021c05ae79b13de3404ae2633d diff --git a/src/Shaders/Shaders_TangentSpaceNormal_glsl.pxx b/src/Shaders/Shaders_TangentSpaceNormal_glsl.pxx new file mode 100644 index 0000000000..0878cd55f3 --- /dev/null +++ b/src/Shaders/Shaders_TangentSpaceNormal_glsl.pxx @@ -0,0 +1,20 @@ +// This file has been automatically generated from resource file src/Shaders/TangentSpaceNormal.glsl + +static const char Shaders_TangentSpaceNormal_glsl[] = + "//! Calculates transformation from tangent space and apply it to value from normal map to get normal in object space\n" + "vec3 TangentSpaceNormal (in mat2 theDeltaUVMatrix,\n" + " in mat2x3 theDeltaVectorMatrix,\n" + " in vec3 theNormalMapValue,\n" + " in vec3 theNormal,\n" + " in bool theIsInverse)\n" + "{\n" + " theNormalMapValue = normalize(theNormalMapValue * 2.0 - vec3(1.0));\n" + " // Inverse matrix\n" + " theDeltaUVMatrix = mat2 (theDeltaUVMatrix[1][1], -theDeltaUVMatrix[0][1], -theDeltaUVMatrix[1][0], theDeltaUVMatrix[0][0]);\n" + " theDeltaVectorMatrix = theDeltaVectorMatrix * theDeltaUVMatrix;\n" + " // Gram-Schmidt orthogonalization\n" + " theDeltaVectorMatrix[1] = normalize(theDeltaVectorMatrix[1] - dot(theNormal, theDeltaVectorMatrix[1]) * theNormal);\n" + " theDeltaVectorMatrix[0] = cross(theDeltaVectorMatrix[1], theNormal);\n" + " float aDirection = theIsInverse ? -1.0 : 1.0;\n" + " return mat3 (aDirection * theDeltaVectorMatrix[0], aDirection * theDeltaVectorMatrix[1], theNormal) * theNormalMapValue;\n" + "}\n";