feat: render 2 rotating cubes side by side

- Push constant changed from float angle (4B) to mat4 model (64B)
- Two draw calls with different model matrices (x=-1.5 and x=+1.5)
- Both cubes rotate around Y axis at 0.2 rad/s
- 0 validation errors
This commit is contained in:
emil28092005
2026-06-18 13:20:22 +03:00
parent 567d88825d
commit edfcf33578
4 changed files with 12 additions and 13 deletions
@@ -10,18 +10,11 @@ layout(row_major, set = 0, binding = 0) uniform CameraUBO {
mat4 vp;
};
layout(push_constant) uniform PC {
float angle;
layout(row_major, push_constant) uniform PC {
mat4 model;
} pc;
void main() {
float c = cos(pc.angle);
float s = sin(pc.angle);
vec3 rotated = vec3(
inPosition.x * c - inPosition.z * s,
inPosition.y,
inPosition.x * s + inPosition.z * c
);
gl_Position = vp * vec4(rotated, 1.0);
gl_Position = vp * pc.model * vec4(inPosition, 1.0);
fragColor = inColor;
}