Have 100 cubes flying around in a circle with refraction.

This commit is contained in:
Zed A. Shaw 2026-09-09 13:36:53 -04:00
parent 1107c86036
commit a199d41890
7 changed files with 29 additions and 15 deletions

View file

@ -1,11 +1,17 @@
#version 330 core
out vec4 FragColor;
in vec3 Normal;
in vec3 FragPos;
in vec2 TexCoords;
uniform sampler2D texture1;
uniform vec3 cameraPos;
uniform samplerCube skybox;
void main()
{
FragColor = texture(texture1, TexCoords);
float ratio = 1.0/1.52;
vec3 I = normalize(FragPos - cameraPos);
vec3 R = refract(I, normalize(Normal), ratio);
FragColor = vec4(texture(skybox, R).rgb, 1.0);
}

View file

@ -16,12 +16,7 @@ uniform vec3 offsets[10];
void main()
{
// THIS WORKS
// vec3 in_offset = offsets[gl_InstanceID];
// THIS DOES NOT, see Scene::setup_instancing and Mesh::draw
vec3 in_offset = aOffset;
// in_offset.x = gl_InstanceID;
vec4 offset = vec4(aPos + in_offset, 1.0);
gl_Position = projection * view * model * offset;