1 // This file has been automatically generated from resource file src/Shaders/PBREnvBaking.vs
3 static const char Shaders_PBREnvBaking_vs[] =
4 "THE_SHADER_OUT vec3 ViewDirection; //!< direction of fetching from environment cubemap\n"
6 "uniform int uCurrentSide; //!< current side of cubemap\n"
7 "uniform int uYCoeff; //!< coefficient of Y controlling horizontal flip of cubemap\n"
8 "uniform int uZCoeff; //!< coefficient of Z controlling vertical flip of cubemap\n"
10 "const mat2 cubemapDirectionMatrices[6] = mat2[]\n"
12 " mat2 ( 0, -1, -1, 0),\n"
13 " mat2 ( 0, 1, -1, 0),\n"
14 " mat2 ( 0, 1, 1, 0),\n"
15 " mat2 ( 0, 1, -1, 0),\n"
16 " mat2 ( 1, 0, 0, -1),\n"
17 " mat2 (-1, 0, 0, -1)\n"
20 "//! Generates environment map fetching direction considering current index of side.\n"
21 "vec3 cubemapBakingViewDirection (in int theSide,\n"
22 " in vec2 theScreenCoord)\n"
24 " int anAxis = theSide / 2;\n"
25 " vec3 aDirection = vec3(0.0);\n"
26 " aDirection[anAxis] = float(-(int(theSide) % 2) * 2 + 1);\n"
27 " theScreenCoord = cubemapDirectionMatrices[theSide] * theScreenCoord;\n"
28 " aDirection[(anAxis + 1) % 3] = theScreenCoord.x;\n"
29 " aDirection[(anAxis + 2) % 3] = theScreenCoord.y;\n"
30 " return aDirection;\n"
35 " ViewDirection = cubemapBakingViewDirection (uCurrentSide, occVertex.xy);\n"
36 " ViewDirection = cubemapVectorTransform (ViewDirection, uYCoeff, uZCoeff);\n"
37 " gl_Position = vec4 (occVertex.xy, 0.0, 1.0);\n"