use existing resource directory
This commit is contained in:
parent
4ce5b08c99
commit
79ee8f4373
10 changed files with 69 additions and 198 deletions
|
@ -8,31 +8,31 @@
|
|||
|
||||
#version 330
|
||||
|
||||
# Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPos
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPosition;
|
||||
|
||||
# Input uniform values
|
||||
uniform sampler2D equirectangularMap
|
||||
// Input uniform values
|
||||
uniform sampler2D equirectangularMap;
|
||||
|
||||
# Output fragment color
|
||||
out vec4 finalColor
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
vec2 SampleSphericalMap(vec3 v)
|
||||
[
|
||||
vec2 uv = vec2(atan(v.z, v.x), asin(v.y))
|
||||
uv *= vec2(0.1591, 0.3183)
|
||||
uv += 0.5
|
||||
return uv
|
||||
]
|
||||
{
|
||||
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
|
||||
uv *= vec2(0.1591, 0.3183);
|
||||
uv += 0.5;
|
||||
return uv;
|
||||
}
|
||||
|
||||
void main()
|
||||
[
|
||||
# Normalize local position
|
||||
vec2 uv = SampleSphericalMap(normalize(fragPos))
|
||||
{
|
||||
// Normalize local position
|
||||
vec2 uv = SampleSphericalMap(normalize(fragPosition));
|
||||
|
||||
# Fetch color from texture map
|
||||
vec3 color = texture(equirectangularMap, uv).rgb
|
||||
// Fetch color from texture map
|
||||
vec3 color = texture(equirectangularMap, uv).rgb;
|
||||
|
||||
# Calculate final fragment color
|
||||
finalColor = vec4(color, 1.0)
|
||||
]
|
||||
// Calculate final fragment color
|
||||
finalColor = vec4(color, 1.0);
|
||||
}
|
||||
|
|
Reference in a new issue