style(1): Switch to industry standard

This commit is contained in:
Tibo De Peuter 2024-12-06 14:16:51 +01:00
parent 561541b10f
commit 385a06f531
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2

View file

@ -26,18 +26,13 @@ mat4 model(bool is_moon, float time)
// Based on:
// https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#cumulating-transformations
mat4 scale_matrix = uniform_scale(0.30);
float r = 2.0;
mat4 translation_matrix = translate(vec3(r, 0, 0));
// TODO Why is PI not defined?
float full_rotation = 2 * 3.14159;
float full_rotation = 2 * M_PI;
float theta = full_rotation * time / 4.0;
mat4 rotation_matrix = rotate_about_y(theta);
// Small hack to make the moon rotate around the origin
// Usually you would rotate first, then translate
return rotation_matrix * translation_matrix * scale_matrix;
float x = r * cos(theta);
float z = r * sin(theta);
return translate(vec3(x, 0, z)) * rotate_about_y(theta) * uniform_scale(0.30);
/////////////////////////////////////////////////////////////////////////////
}