wip: engine enhancements and fixes

This commit is contained in:
reo 2025-08-24 18:49:41 +03:00
parent 9816f14f53
commit cc7921a5fe
27 changed files with 347 additions and 32 deletions

View file

@ -0,0 +1,22 @@
#version 330 core
in vec3 direction;
out vec4 frag_color;
uniform sampler2D equirect;
const vec2 inv_atan = vec2(0.15915494309, 0.31830988618);
vec2 sample_spherical_map(vec3 v) {
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
uv *= inv_atan;
uv += 0.5;
return uv;
}
void main() {
vec2 uv = sample_spherical_map(normalize(direction));
vec3 color = texture(equirect, uv).rgb;
frag_color = vec4(color, 1.0);
}