summaryrefslogtreecommitdiff
path: root/racer-tracer/src/vec3.rs
diff options
context:
space:
mode:
Diffstat (limited to 'racer-tracer/src/vec3.rs')
-rw-r--r--racer-tracer/src/vec3.rs19
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()