From dd382c899f9a21c014843f164f52e9caaa915005 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 15 Feb 2023 22:11:15 +0100 Subject: [PATCH] remove `BlockDescriptorSource` trait --- kubi-shared/src/block.rs | 19 ++++++++++--------- kubi/src/world/mesh.rs | 2 +- kubi/src/world/raycast.rs | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/kubi-shared/src/block.rs b/kubi-shared/src/block.rs index 6851554..11bad0b 100644 --- a/kubi-shared/src/block.rs +++ b/kubi-shared/src/block.rs @@ -31,12 +31,9 @@ pub enum Block { Cobblestone, } -pub trait BlockDescriptorSource { - fn descriptor(self) -> BlockDescriptor; -} -impl BlockDescriptorSource for Block { +impl Block { #[inline] - fn descriptor(self) -> BlockDescriptor { + pub const fn descriptor(self) -> BlockDescriptor { match self { Self::Air => BlockDescriptor { name: "air", @@ -124,9 +121,13 @@ impl CubeTexture { } #[derive(Clone, Copy, Debug)] -struct CrossTexture { - pub a: BlockTexture, - pub b: BlockTexture, +pub struct CrossTexture { + pub a_front: BlockTexture, + pub b_front: BlockTexture, + pub a_back: BlockTexture, + pub b_back: BlockTexture, +} +impl CrossTexture { } @@ -140,5 +141,5 @@ pub enum CollisionType { pub enum RenderType { None, SolidBlock(CubeTexture), - CrossShape, + CrossShape(CrossTexture), } diff --git a/kubi/src/world/mesh.rs b/kubi/src/world/mesh.rs index b8f738e..8b53a58 100644 --- a/kubi/src/world/mesh.rs +++ b/kubi/src/world/mesh.rs @@ -1,7 +1,7 @@ use strum::{EnumIter, IntoEnumIterator}; use glam::{Vec3A, vec3a, IVec3, ivec3}; use std::mem::discriminant; -use kubi_shared::block::{Block, RenderType, BlockDescriptorSource}; +use kubi_shared::block::{Block, RenderType}; use super::{chunk::CHUNK_SIZE, }; use crate::rendering::world::ChunkVertex; diff --git a/kubi/src/world/raycast.rs b/kubi/src/world/raycast.rs index a71802c..c545595 100644 --- a/kubi/src/world/raycast.rs +++ b/kubi/src/world/raycast.rs @@ -1,6 +1,6 @@ use glam::{Vec3, IVec3}; use shipyard::{View, Component, ViewMut, IntoIter, UniqueView, track}; -use kubi_shared::block::{Block, BlockDescriptorSource}; +use kubi_shared::block::Block; use crate::transform::Transform; use super::ChunkStorage;