diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
commit | c48b54f3fb7bbe9046915eb99eca02fa84dc55c9 (patch) | |
tree | 752831451d2bd3a658485df724a01ae39e80fae3 /stockton-levels/src/traits | |
parent | b437109ebf4da243fd643f0a31546d0d0155b0a4 (diff) |
feat(render): multithreaded texture loading
also a bunch of supporting changes
Diffstat (limited to 'stockton-levels/src/traits')
-rw-r--r-- | stockton-levels/src/traits/light_maps.rs | 4 | ||||
-rw-r--r-- | stockton-levels/src/traits/light_vols.rs | 6 | ||||
-rw-r--r-- | stockton-levels/src/traits/mod.rs | 2 | ||||
-rw-r--r-- | stockton-levels/src/traits/textures.rs | 2 | ||||
-rw-r--r-- | stockton-levels/src/traits/tree.rs | 16 | ||||
-rw-r--r-- | stockton-levels/src/traits/vertices.rs | 4 |
6 files changed, 17 insertions, 17 deletions
diff --git a/stockton-levels/src/traits/light_maps.rs b/stockton-levels/src/traits/light_maps.rs index 50ec84d..cc7fa70 100644 --- a/stockton-levels/src/traits/light_maps.rs +++ b/stockton-levels/src/traits/light_maps.rs @@ -17,12 +17,12 @@ use std::fmt; -use crate::types::RGB; +use crate::types::Rgb; /// Stores light map textures that help make surface lighting more realistic #[derive(Clone)] pub struct LightMap { - pub map: [[RGB; 128]; 128], + pub map: [[Rgb; 128]; 128], } impl PartialEq for LightMap { diff --git a/stockton-levels/src/traits/light_vols.rs b/stockton-levels/src/traits/light_vols.rs index 48972ef..016ddab 100644 --- a/stockton-levels/src/traits/light_vols.rs +++ b/stockton-levels/src/traits/light_vols.rs @@ -15,12 +15,12 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -use crate::types::RGB; +use crate::types::Rgb; #[derive(Debug, Clone, Copy)] pub struct LightVol { - pub ambient: RGB, - pub directional: RGB, + pub ambient: Rgb, + pub directional: Rgb, pub dir: [u8; 2], } diff --git a/stockton-levels/src/traits/mod.rs b/stockton-levels/src/traits/mod.rs index c65cde8..00d129f 100644 --- a/stockton-levels/src/traits/mod.rs +++ b/stockton-levels/src/traits/mod.rs @@ -39,6 +39,6 @@ pub use self::light_vols::HasLightVols; pub use self::models::HasModels; pub use self::planes::HasPlanes; pub use self::textures::HasTextures; -pub use self::tree::HasBSPTree; +pub use self::tree::HasBspTree; pub use self::vertices::{HasMeshVerts, HasVertices}; pub use self::visdata::HasVisData; diff --git a/stockton-levels/src/traits/textures.rs b/stockton-levels/src/traits/textures.rs index 4477fba..66c120c 100644 --- a/stockton-levels/src/traits/textures.rs +++ b/stockton-levels/src/traits/textures.rs @@ -160,5 +160,5 @@ pub trait HasTextures { type TexturesIter<'a>: Iterator<Item = &'a Texture>; fn textures_iter(&self) -> Self::TexturesIter<'_>; - fn get_texture(&self, idx: u32) -> &Texture; + fn get_texture(&self, idx: u32) -> Option<&Texture>; } diff --git a/stockton-levels/src/traits/tree.rs b/stockton-levels/src/traits/tree.rs index 253ae1b..5ca0d59 100644 --- a/stockton-levels/src/traits/tree.rs +++ b/stockton-levels/src/traits/tree.rs @@ -24,29 +24,29 @@ use na::Vector3; /// A node in a BSP tree. /// Either has two children *or* a leaf entry. #[derive(Debug, Clone)] -pub struct BSPNode { +pub struct BspNode { pub plane_idx: u32, pub min: Vector3<i32>, pub max: Vector3<i32>, - pub value: BSPNodeValue, + pub value: BspNodeValue, } #[derive(Debug, Clone)] -pub enum BSPNodeValue { - Leaf(BSPLeaf), - Children(Box<BSPNode>, Box<BSPNode>), +pub enum BspNodeValue { + Leaf(BspLeaf), + Children(Box<BspNode>, Box<BspNode>), } /// A leaf in a BSP tree. /// Will be under a `BSPNode`, min and max values are stored there. #[derive(Debug, Clone)] -pub struct BSPLeaf { +pub struct BspLeaf { pub cluster_id: u32, pub area: i32, pub faces_idx: Box<[u32]>, pub brushes_idx: Box<[u32]>, } -pub trait HasBSPTree<S: CoordSystem>: HasFaces<S> + HasBrushes<S> + HasVisData { - fn get_bsp_root(&self) -> &BSPNode; +pub trait HasBspTree<S: CoordSystem>: HasFaces<S> + HasBrushes<S> + HasVisData { + fn get_bsp_root(&self) -> &BspNode; } diff --git a/stockton-levels/src/traits/vertices.rs b/stockton-levels/src/traits/vertices.rs index ff23785..44c3000 100644 --- a/stockton-levels/src/traits/vertices.rs +++ b/stockton-levels/src/traits/vertices.rs @@ -17,7 +17,7 @@ use crate::coords::CoordSystem; use crate::helpers::slice_to_f32; -use crate::types::RGBA; +use crate::types::Rgba; use na::Vector3; /// A vertex, used to describe a face. @@ -26,7 +26,7 @@ pub struct Vertex { pub position: Vector3<f32>, pub tex: TexCoord, pub normal: Vector3<f32>, - pub color: RGBA, + pub color: Rgba, } /// Represents a TexCoord. 0 = surface, 1= lightmap. |