aboutsummaryrefslogtreecommitdiff
path: root/stockton-levels/src/traits/vertices.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commit439219e74090c7158f8dbc33fed4107a5eb7c003 (patch)
tree7ba62254b2d888578ff6c1c8de4f0f35c01c75dd /stockton-levels/src/traits/vertices.rs
parent04f17923d38171f07f72603a54237f20ca3572dd (diff)
refactor(levels): no longer q3 specific
Diffstat (limited to 'stockton-levels/src/traits/vertices.rs')
-rw-r--r--stockton-levels/src/traits/vertices.rs52
1 files changed, 0 insertions, 52 deletions
diff --git a/stockton-levels/src/traits/vertices.rs b/stockton-levels/src/traits/vertices.rs
deleted file mode 100644
index 11cd681..0000000
--- a/stockton-levels/src/traits/vertices.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-use crate::coords::CoordSystem;
-use crate::helpers::slice_to_f32;
-use crate::types::Rgba;
-use na::Vector3;
-
-/// A vertex, used to describe a face.
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct Vertex {
- pub position: Vector3<f32>,
- pub tex: TexCoord,
- pub normal: Vector3<f32>,
- pub color: Rgba,
-}
-
-/// Represents a TexCoord. 0 = surface, 1= lightmap.
-/// This could also be written as [[f32; 2]; 2]
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct TexCoord {
- pub u: [f32; 2],
- pub v: [f32; 2],
-}
-
-impl TexCoord {
- /// Internal function. Converts a slice to a TexCoord.
- pub fn from_bytes(bytes: &[u8; 16]) -> TexCoord {
- TexCoord {
- u: [slice_to_f32(&bytes[0..4]), slice_to_f32(&bytes[8..12])],
- v: [slice_to_f32(&bytes[4..8]), slice_to_f32(&bytes[12..16])],
- }
- }
-}
-
-/// A vertex offset, used to describe generalised triangle meshes
-pub type MeshVert = u32;
-
-pub trait HasVertices<S: CoordSystem> {
- type VerticesIter<'a>: Iterator<Item = &'a Vertex>;
-
- fn vertices_iter(&self) -> Self::VerticesIter<'_>;
- fn get_vertex(&self, index: u32) -> &Vertex;
-}
-
-pub trait HasMeshVerts<S: CoordSystem>: HasVertices<S> {
- type MeshVertsIter<'a>: Iterator<Item = &'a MeshVert>;
-
- fn meshverts_iter(&self) -> Self::MeshVertsIter<'_>;
- fn get_meshvert(&self, index: u32) -> MeshVert;
-
- fn resolve_meshvert(&self, index: u32, base: u32) -> &Vertex {
- self.get_vertex(self.get_meshvert(index) + base)
- }
-}