// This file has been automatically generated from resource file src/Shaders/PBREnvBaking.vs static const char Shaders_PBREnvBaking_vs[] = "THE_SHADER_OUT vec3 ViewDirection; //!< direction of fetching from environment cubemap\n" "\n" "uniform int uCurrentSide; //!< current side of cubemap\n" "uniform int uYCoeff; //!< coefficient of Y controlling horizontal flip of cubemap\n" "uniform int uZCoeff; //!< coefficient of Z controlling vertical flip of cubemap\n" "\n" "const mat2 cubemapDirectionMatrices[6] = mat2[]\n" "(\n" " mat2 ( 0, -1, -1, 0),\n" " mat2 ( 0, 1, -1, 0),\n" " mat2 ( 0, 1, 1, 0),\n" " mat2 ( 0, 1, -1, 0),\n" " mat2 ( 1, 0, 0, -1),\n" " mat2 (-1, 0, 0, -1)\n" ");\n" "\n" "//! Generates environment map fetching direction considering current index of side.\n" "vec3 cubemapBakingViewDirection (in int theSide,\n" " in vec2 theScreenCoord)\n" "{\n" " int anAxis = theSide / 2;\n" " vec3 aDirection = vec3(0.0);\n" " aDirection[anAxis] = float(-(int(theSide) % 2) * 2 + 1);\n" " theScreenCoord = cubemapDirectionMatrices[theSide] * theScreenCoord;\n" " aDirection[(anAxis + 1) % 3] = theScreenCoord.x;\n" " aDirection[(anAxis + 2) % 3] = theScreenCoord.y;\n" " return aDirection;\n" "}\n" "\n" "void main()\n" "{\n" " ViewDirection = cubemapBakingViewDirection (uCurrentSide, occVertex.xy);\n" " ViewDirection = cubemapVectorTransform (ViewDirection, uYCoeff, uZCoeff);\n" " gl_Position = vec4 (occVertex.xy, 0.0, 1.0);\n" "}\n";