summary refs log tree commit diff
path: root/src/linear_algebra.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-07-18 03:48:13 -0700
committerIrene Knapp <ireneista@irenes.space>2026-07-18 03:48:13 -0700
commit0371c8f086008d604dddfe92d021f8ecfe398436 (patch)
tree74c21e5fea53a71937b26b8bbfac7ee784355f6c /src/linear_algebra.rs
parent40bd889e67d6f9fb4ce837fcda4ddf5a34c54b47 (diff)
pull the shader data stuff into its own file
separate from the linear algebra stuff

Force-Push: yes
Change-Id: I26fc7ac596f304fa35ca7a4d0e1349d4fa0685ee
Diffstat (limited to 'src/linear_algebra.rs')
-rw-r--r--src/linear_algebra.rs80
1 files changed, 1 insertions, 79 deletions
diff --git a/src/linear_algebra.rs b/src/linear_algebra.rs
index 08e9306..acd949a 100644
--- a/src/linear_algebra.rs
+++ b/src/linear_algebra.rs
@@ -1,7 +1,6 @@
 #![forbid(unsafe_code)]
-use std::mem::{ size_of, MaybeUninit };
+use std::mem:: MaybeUninit;
 use std::ops::{ Add, Sub, Mul, Div, Neg };
-use vulkanalia::vk::{ self, HasBuilder };
 
 
 pub trait Real: Add<Output=Self> + Sub<Output=Self>
@@ -29,20 +28,6 @@ impl Real for f32 {
 }
 
 
-pub static VERTICES: [Vertex<f32>; 4] = [
-  Vertex::new(Vec2::new(-0.5, -0.5), Vec3::new(1.0, 0.0, 0.0),
-              Vec2::new(1.0, 0.0)),
-  Vertex::new(Vec2::new( 0.5, -0.5), Vec3::new(0.0, 1.0, 0.0),
-              Vec2::new(0.0, 0.0)),
-  Vertex::new(Vec2::new( 0.5,  0.5), Vec3::new(0.0, 0.0, 1.0),
-              Vec2::new(0.0, 1.0)),
-  Vertex::new(Vec2::new(-0.5,  0.5), Vec3::new(1.0, 1.0, 1.0),
-              Vec2::new(1.0, 1.0)),
-];
-
-pub const INDICES: &[u16] = &[0, 1, 2, 2, 3, 0];
-
-
 #[repr(C)]
 #[derive(Clone, Debug)]
 pub struct Vec2<T: Copy>([T; 2]);
@@ -618,66 +603,3 @@ impl<T: Copy> Transformation<T> {
   }
 }
 
-
-
-#[repr(C)]
-#[derive(Clone, Debug)]
-pub struct Vertex<T: Copy> {
-  pub position: Vec2<T>,
-  pub color: Vec3<T>,
-  pub texture_coordinates: Vec2<T>,
-}
-
-#[repr(C)]
-#[derive(Clone, Debug)]
-pub struct UniformBlock<T: Copy> {
-  pub scale: Vec3<T>,
-  pub model: Transformation<T>,
-  pub view: Transformation<T>,
-  pub projection: Mat4<T>,
-}
-
-impl<T: Copy> Vertex<T> {
-  const fn new(position: Vec2<T>, color: Vec3<T>,
-               texture_coordinates: Vec2<T>)
-      -> Self
-  {
-    Self { position, color, texture_coordinates }
-  }
-
-  pub fn binding_description() -> vk::VertexInputBindingDescription {
-    vk::VertexInputBindingDescription::builder()
-        .binding(0)
-        .stride(size_of::<Vertex<f32>>() as u32)
-        .input_rate(vk::VertexInputRate::VERTEX)
-        .build()
-  }
-
-  pub fn attribute_descriptions()
-      -> [vk::VertexInputAttributeDescription; 3]
-  {
-    let position = vk::VertexInputAttributeDescription::builder()
-            .binding(0)
-            .location(0)
-            .format(vk::Format::R32G32_SFLOAT)
-            .offset(0)
-            .build();
-
-    let color = vk::VertexInputAttributeDescription::builder()
-            .binding(0)
-            .location(1)
-            .format(vk::Format::R32G32B32_SFLOAT)
-            .offset(size_of::<Vec2<f32>>() as u32)
-            .build();
-
-    let texture_coordinates = vk::VertexInputAttributeDescription::builder()
-            .binding(0)
-            .location(2)
-            .format(vk::Format::R32G32_SFLOAT)
-            .offset((size_of::<Vec2<f32>>() + size_of::<Vec3<f32>>()) as u32)
-            .build();
-
-    [position, color, texture_coordinates]
-  }
-}
-