#![allow(dead_code, unused_imports)]
pub(crate) mod face;
pub(crate) mod mesh_metadata;
pub(crate) mod meshem;
pub(crate) mod pbs;
pub(crate) mod update;
pub(crate) mod util;
pub(crate) mod voxel_mesh;
use bevy::log::warn;
use bevy::render::mesh::{Mesh, MeshVertexAttribute};
pub mod prelude {
pub use crate::face::Face::*;
pub use crate::face::*;
pub use crate::mesh_metadata::*;
pub use crate::meshem::*;
pub use crate::pbs::*;
pub use crate::update::*;
pub use crate::util::compressed_voxel_grid::*;
pub use crate::util::vav::*;
pub use crate::util::*;
pub use crate::voxel_mesh::*;
pub use crate::VoxelRegistry;
pub use crate::*;
}
pub trait VoxelRegistry {
type Voxel: std::fmt::Debug + Eq + PartialEq;
fn get_mesh(&self, voxel: &Self::Voxel) -> VoxelMesh<&Mesh>;
fn is_covering(&self, voxel: &Self::Voxel, side: prelude::Face) -> bool;
fn get_center(&self) -> [f32; 3];
fn get_voxel_dimensions(&self) -> [f32; 3];
fn all_attributes(&self) -> Vec<MeshVertexAttribute>;
}
pub type Dimensions = (usize, usize, usize);
pub enum VoxelMesh<T> {
NormalCube(T),
CustomMesh(T),
Null,
}
impl<T> VoxelMesh<T> {
pub fn unwrap(self) -> T {
match self {
Self::NormalCube(t) => t,
Self::CustomMesh(t) => {
warn!("Custom Meshes are still not properly implemented!");
t
}
Self::Null => panic!(),
}
}
pub fn expect(self, msg: &str) -> T {
match self {
Self::NormalCube(t) => t,
Self::CustomMesh(t) => {
warn!("Custom Meshes are still not properly implemented!");
t
}
Self::Null => panic!("{}", msg),
}
}
}
pub(crate) type Neighbors = [bool; 6];