diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | 47a0c0317cc774c19b78582bec9b5b09d56f569a (patch) | |
tree | d03471ea4e084ace9b95a2c5b7febb780b45bb63 /stockton-levels | |
parent | fb996488aa651cb2e7f46abc083c4318b47e77cd (diff) |
feat(render): draw passes
Diffstat (limited to 'stockton-levels')
-rw-r--r-- | stockton-levels/Cargo.toml | 3 | ||||
-rw-r--r-- | stockton-levels/src/features.rs | 7 | ||||
-rw-r--r-- | stockton-levels/src/parts/faces.rs | 2 | ||||
-rw-r--r-- | stockton-levels/src/parts/vertices.rs | 2 | ||||
-rw-r--r-- | stockton-levels/src/parts/visdata.rs | 6 |
5 files changed, 12 insertions, 8 deletions
diff --git a/stockton-levels/Cargo.toml b/stockton-levels/Cargo.toml index 526b21c..b70268b 100644 --- a/stockton-levels/Cargo.toml +++ b/stockton-levels/Cargo.toml @@ -9,4 +9,5 @@ edition = "2018" [dependencies] nalgebra = "^0.20" -serde = { version = "1.0", features = ["derive"] }
\ No newline at end of file +serde = { version = "1.0", features = ["derive"] } +stockton-types = { path = "../stockton-types" } diff --git a/stockton-levels/src/features.rs b/stockton-levels/src/features.rs index f748bd0..b4ddb99 100644 --- a/stockton-levels/src/features.rs +++ b/stockton-levels/src/features.rs @@ -14,5 +14,8 @@ use crate::parts::*; -pub trait MinRenderFeatures: HasFaces + HasTextures + Send + Sync {} -impl<T> MinRenderFeatures for T where T: HasFaces + HasTextures + Send + Sync {} +pub trait MinRenderFeatures<'a>: HasFaces + HasTextures + HasVisData<'a> + Send + Sync {} +impl<'a, T> MinRenderFeatures<'a> for T where + T: HasFaces + HasTextures + HasVisData<'a> + Send + Sync +{ +} diff --git a/stockton-levels/src/parts/faces.rs b/stockton-levels/src/parts/faces.rs index 0168cd8..1023af7 100644 --- a/stockton-levels/src/parts/faces.rs +++ b/stockton-levels/src/parts/faces.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; pub type FaceRef = u32; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum Geometry { Vertices(Vertex, Vertex, Vertex), } diff --git a/stockton-levels/src/parts/vertices.rs b/stockton-levels/src/parts/vertices.rs index 0b7dfd6..f2f5a2d 100644 --- a/stockton-levels/src/parts/vertices.rs +++ b/stockton-levels/src/parts/vertices.rs @@ -42,7 +42,7 @@ impl<'de> Deserialize<'de> for Vertex { TexV, Color, } - const FIELDS: &'static [&'static str] = + const FIELDS: &[&str] = &["pos_x", "pos_y", "pos_z", "tex_x", "tex_y", "color"]; struct VertexVisitor; diff --git a/stockton-levels/src/parts/visdata.rs b/stockton-levels/src/parts/visdata.rs index f311bf7..aa2ec3d 100644 --- a/stockton-levels/src/parts/visdata.rs +++ b/stockton-levels/src/parts/visdata.rs @@ -1,8 +1,8 @@ use super::faces::FaceRef; -use na::Vector3; use std::iter::Iterator; +use stockton_types::components::{CameraSettings, Transform}; -pub trait HasVisData { +pub trait HasVisData<'a> { type Faces: Iterator<Item = FaceRef>; - fn get_visible(pos: Vector3<f32>, rot: Vector3<f32>) -> Self::Faces; + fn get_visible(&'a self, transform: &Transform, settings: &CameraSettings) -> Self::Faces; } |