remove BlockDescriptorSource trait

This commit is contained in:
griffi-gh 2023-02-15 22:11:15 +01:00
parent b63f2e4075
commit dd382c899f
3 changed files with 12 additions and 11 deletions

View file

@ -31,12 +31,9 @@ pub enum Block {
Cobblestone, Cobblestone,
} }
pub trait BlockDescriptorSource { impl Block {
fn descriptor(self) -> BlockDescriptor;
}
impl BlockDescriptorSource for Block {
#[inline] #[inline]
fn descriptor(self) -> BlockDescriptor { pub const fn descriptor(self) -> BlockDescriptor {
match self { match self {
Self::Air => BlockDescriptor { Self::Air => BlockDescriptor {
name: "air", name: "air",
@ -124,9 +121,13 @@ impl CubeTexture {
} }
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
struct CrossTexture { pub struct CrossTexture {
pub a: BlockTexture, pub a_front: BlockTexture,
pub b: 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 { pub enum RenderType {
None, None,
SolidBlock(CubeTexture), SolidBlock(CubeTexture),
CrossShape, CrossShape(CrossTexture),
} }

View file

@ -1,7 +1,7 @@
use strum::{EnumIter, IntoEnumIterator}; use strum::{EnumIter, IntoEnumIterator};
use glam::{Vec3A, vec3a, IVec3, ivec3}; use glam::{Vec3A, vec3a, IVec3, ivec3};
use std::mem::discriminant; use std::mem::discriminant;
use kubi_shared::block::{Block, RenderType, BlockDescriptorSource}; use kubi_shared::block::{Block, RenderType};
use super::{chunk::CHUNK_SIZE, }; use super::{chunk::CHUNK_SIZE, };
use crate::rendering::world::ChunkVertex; use crate::rendering::world::ChunkVertex;

View file

@ -1,6 +1,6 @@
use glam::{Vec3, IVec3}; use glam::{Vec3, IVec3};
use shipyard::{View, Component, ViewMut, IntoIter, UniqueView, track}; use shipyard::{View, Component, ViewMut, IntoIter, UniqueView, track};
use kubi_shared::block::{Block, BlockDescriptorSource}; use kubi_shared::block::Block;
use crate::transform::Transform; use crate::transform::Transform;
use super::ChunkStorage; use super::ChunkStorage;