diff options
| author | Sakarias Johansson <sakarias.johansson@goodbyekansas.com> | 2023-04-14 20:58:23 +0200 |
|---|---|---|
| committer | Sakarias Johansson <sakariasjohansson@hotmail.com> | 2023-04-14 21:17:20 +0200 |
| commit | 8201c8e2a7ff85383ff7606513778253aae7e666 (patch) | |
| tree | ad0175360dc19554c6f11b1a66af210d60418f99 /racer-tracer/src/vec3.rs | |
| parent | 0ae6ca062f5936ae6f595f45ca0a78ed049452bc (diff) | |
| download | racer-tracer-8201c8e2a7ff85383ff7606513778253aae7e666.tar.gz racer-tracer-8201c8e2a7ff85383ff7606513778253aae7e666.tar.xz racer-tracer-8201c8e2a7ff85383ff7606513778253aae7e666.zip | |
Before you could only move the position of the camera.
- Add support for turning camera by holding down left mouse.
- Add support for turning camera with arrow keys.
- Add Mouse move callback for key_inputs.
Diffstat (limited to 'racer-tracer/src/vec3.rs')
| -rw-r--r-- | racer-tracer/src/vec3.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/racer-tracer/src/vec3.rs b/racer-tracer/src/vec3.rs index 9d04cb4..6877eea 100644 --- a/racer-tracer/src/vec3.rs +++ b/racer-tracer/src/vec3.rs @@ -1,3 +1,6 @@ +//TODO: Replace this with glam. +use glam::f32::Vec3 as FVec3; + use std::{fmt, ops}; use serde::Deserialize; @@ -326,6 +329,22 @@ impl fmt::Display for Vec3 { } } +impl From<FVec3> for Vec3 { + fn from(v: FVec3) -> Self { + Vec3::new(v.x as f64, v.y as f64, v.z as f64) + } +} + +impl From<Vec3> for FVec3 { + fn from(v: Vec3) -> Self { + FVec3 { + x: v.data[0] as f32, + y: v.data[1] as f32, + z: v.data[2] as f32, + } + } +} + impl std::fmt::Debug for Vec3 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Vec3").field("data", &self.data).finish() |
