1 THE_SHADER_OUT vec3 ViewDirection; //!< direction of fetching from environment cubemap
3 uniform int uCurrentSide; //!< current side of cubemap
4 uniform int uYCoeff; //!< coefficient of Y controlling horizontal flip of cubemap
5 uniform int uZCoeff; //!< coefficient of Z controlling vertical flip of cubemap
7 const mat2 cubemapDirectionMatrices[6] = mat2[]
17 //! Generates environment map fetching direction considering current index of side.
18 vec3 cubemapBakingViewDirection (in int theSide,
19 in vec2 theScreenCoord)
21 int anAxis = theSide / 2;
22 vec3 aDirection = vec3(0.0);
23 aDirection[anAxis] = float(-(int(theSide) % 2) * 2 + 1);
24 theScreenCoord = cubemapDirectionMatrices[theSide] * theScreenCoord;
25 aDirection[(anAxis + 1) % 3] = theScreenCoord.x;
26 aDirection[(anAxis + 2) % 3] = theScreenCoord.y;
32 ViewDirection = cubemapBakingViewDirection (uCurrentSide, occVertex.xy);
33 ViewDirection = cubemapVectorTransform (ViewDirection, uYCoeff, uZCoeff);
34 gl_Position = vec4 (occVertex.xy, 0.0, 1.0);