summaryrefslogtreecommitdiff
path: root/engine/src/opengl/vertex_array.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-05-10 13:10:46 +0200
committerHampusM <hampus@hampusmat.com>2025-05-10 13:42:34 +0200
commit6b2feeab0b845d05cdf76328d44b7b70a5e50c18 (patch)
treec214ad5e89a0a289d32094fb934caa6325b6cb4e /engine/src/opengl/vertex_array.rs
parentc1db67dbeaeeb447b8b4361ae6bb750785ed04bd (diff)
refactor(engine): make GL renderer have it's own Vertex struct
Diffstat (limited to 'engine/src/opengl/vertex_array.rs')
-rw-r--r--engine/src/opengl/vertex_array.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/engine/src/opengl/vertex_array.rs b/engine/src/opengl/vertex_array.rs
index f0d04ae..1f8a870 100644
--- a/engine/src/opengl/vertex_array.rs
+++ b/engine/src/opengl/vertex_array.rs
@@ -1,10 +1,6 @@
use std::mem::size_of;
use crate::opengl::buffer::Buffer;
-use crate::vertex::Vertex;
-
-#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
-const VERTEX_STRIDE: i32 = size_of::<Vertex>() as i32;
#[derive(Debug)]
pub struct VertexArray
@@ -59,10 +55,10 @@ impl VertexArray
}
}
- pub fn bind_vertex_buffer(
+ pub fn bind_vertex_buffer<VertexT>(
&mut self,
binding_index: u32,
- vertex_buffer: &Buffer<Vertex>,
+ vertex_buffer: &Buffer<VertexT>,
offset: isize,
)
{
@@ -72,7 +68,7 @@ impl VertexArray
binding_index,
vertex_buffer.object(),
offset,
- VERTEX_STRIDE,
+ size_of::<VertexT>() as i32,
);
}
}