From 121dc57f0962f27ab9e5da2ec05d3a1b1d97cdb2 Mon Sep 17 00:00:00 2001 From: Micha White Date: Thu, 13 Oct 2022 10:09:24 -0400 Subject: Rotate instances in the clockwise direction --- shaders/sprite.wgsl | 3 ++- src/camera.rs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shaders/sprite.wgsl b/shaders/sprite.wgsl index 5a00e24..43f494e 100644 --- a/shaders/sprite.wgsl +++ b/shaders/sprite.wgsl @@ -27,7 +27,8 @@ fn vs_main(model: VertexInput, instance: InstanceInput) -> VertexOutput { var out: VertexOutput; // rotate the sprite - let a = vec2(cos(instance.rotation), sin(instance.rotation)); + let rotation = -instance.rotation; + let a = vec2(cos(rotation), sin(rotation)); let b = vec2(-a[1], a[0]); let rotation = mat2x2(a, b); let rotated = rotation * model.position; diff --git a/src/camera.rs b/src/camera.rs index fb46158..edc3405 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -151,7 +151,6 @@ impl Camera { #[allow(clippy::wrong_self_convention)] fn to_matrix(&self) -> CameraUniform { - // TODO why do the camera and instances rotate in different directions? let cos = self.rotation.cos(); let sin = self.rotation.sin(); -- cgit v1.2.3