rotating stuff renders too now

This commit is contained in:
JozsefA 2021-01-11 01:04:18 -08:00
parent a56d08b78e
commit 379ff9302b
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,4 @@
#version 330 core #version 420 core
#define PI 3.1415926538 #define PI 3.1415926538
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;

View File

@ -40,8 +40,7 @@ mat4 kineticRotation() {
float degrees = rotationOffset + time * speed * -3./10.; float degrees = rotationOffset + time * speed * -3./10.;
float angle = fract(degrees / 360.) * PI * 2.; float angle = fract(degrees / 360.) * PI * 2.;
vec3 axis = normalize(rotationAxis); return rotate(normalize(rotationAxis), angle);
return rotate(axis, angle);
} }
mat4 contraptionRotation() { mat4 contraptionRotation() {
@ -64,7 +63,7 @@ void main() {
vec4 worldPos = contraptionRotation * localPos + vec4(cPos + 0.5, 0); vec4 worldPos = contraptionRotation * localPos + vec4(cPos + 0.5, 0);
BoxCoord = (worldPos.xyz - lightBoxMin) / lightBoxSize; BoxCoord = (worldPos.xyz - lightBoxMin) / lightBoxSize;
Diffuse = diffuse(normalize(contraptionRotation * localRotation * vec4(aNormal, 0.)).xyz); Diffuse = diffuse(normalize(contraptionRotation * kineticRotation * vec4(aNormal, 0.)).xyz);
Color = vec4(1.); Color = vec4(1.);
TexCoords = aTexCoords; TexCoords = aTexCoords;
gl_Position = projection * view * worldPos; gl_Position = projection * view * worldPos;