mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 13:18:21 -06:00
move block to shared
This commit is contained in:
parent
496de05f27
commit
bcffaa4562
|
@ -1,5 +1,35 @@
|
|||
use crate::prefabs::BlockTexture;
|
||||
pub use kubi_shared::blocks::Block;
|
||||
use bincode::{Encode, Decode};
|
||||
use strum::EnumIter;
|
||||
|
||||
#[derive(Clone, Copy, Debug, EnumIter)]
|
||||
#[repr(u8)]
|
||||
pub enum BlockTexture {
|
||||
Stone,
|
||||
Dirt,
|
||||
GrassTop,
|
||||
GrassSide,
|
||||
Sand,
|
||||
Bedrock,
|
||||
Wood,
|
||||
WoodTop,
|
||||
Leaf,
|
||||
Torch,
|
||||
TallGrass,
|
||||
Snow,
|
||||
GrassSideSnow,
|
||||
Cobblestone,
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Clone, Copy, Debug, PartialEq, Eq, EnumIter)]
|
||||
#[repr(u8)]
|
||||
pub enum Block {
|
||||
Air,
|
||||
Stone,
|
||||
Dirt,
|
||||
Grass,
|
||||
Sand,
|
||||
Cobblestone,
|
||||
}
|
||||
|
||||
pub trait BlockDescriptorSource {
|
||||
fn descriptor(self) -> BlockDescriptor;
|
||||
|
@ -92,6 +122,13 @@ impl CubeTexture {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct CrossTexture {
|
||||
pub a: BlockTexture,
|
||||
pub b: BlockTexture,
|
||||
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum CollisionType {
|
||||
None,
|
||||
|
@ -101,5 +138,6 @@ pub enum CollisionType {
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum RenderType {
|
||||
None,
|
||||
SolidBlock(CubeTexture)
|
||||
SolidBlock(CubeTexture),
|
||||
CrossShape,
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
use bincode::{Encode, Decode};
|
||||
use strum::EnumIter;
|
||||
|
||||
#[derive(Encode, Decode, Clone, Copy, Debug, PartialEq, Eq, EnumIter)]
|
||||
#[repr(u8)]
|
||||
pub enum Block {
|
||||
Air,
|
||||
Stone,
|
||||
Dirt,
|
||||
Grass,
|
||||
Sand,
|
||||
Cobblestone,
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
use crate::blocks::Block;
|
||||
use crate::block::Block;
|
||||
|
||||
pub const CHUNK_SIZE: usize = 32;
|
||||
pub type BlockData = Box<[[[Block; CHUNK_SIZE]; CHUNK_SIZE]; CHUNK_SIZE]>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub mod blocks;
|
||||
pub mod block;
|
||||
pub mod networking;
|
||||
pub mod worldgen;
|
||||
pub mod chunk;
|
||||
|
|
|
@ -2,7 +2,7 @@ use glam::{IVec3, ivec3};
|
|||
use bracket_noise::prelude::*;
|
||||
use crate::{
|
||||
chunk::{BlockData, CHUNK_SIZE},
|
||||
blocks::Block
|
||||
block::Block
|
||||
};
|
||||
|
||||
fn mountain_ramp(mut x: f32) -> f32 {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use shipyard::{UniqueViewMut, UniqueView, View, IntoIter, ViewMut, EntitiesViewMut};
|
||||
use kubi_shared::block::Block;
|
||||
use crate::{
|
||||
player::MainPlayer,
|
||||
world::{raycast::LookingAtBlock, block::Block, queue::{BlockUpdateQueue, BlockUpdateEvent}},
|
||||
world::{raycast::LookingAtBlock, queue::{BlockUpdateQueue, BlockUpdateEvent}},
|
||||
input::{Inputs, PrevInputs},
|
||||
events::{EventComponent, player_actions::PlayerActionEvent},
|
||||
};
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use shipyard::{Component, View, ViewMut, EntitiesViewMut, IntoIter, track};
|
||||
use glam::{IVec3, Quat, Vec3};
|
||||
|
||||
use kubi_shared::block::Block;
|
||||
use crate::{
|
||||
world::block::Block,
|
||||
player::MainPlayer,
|
||||
transform::Transform
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use shipyard::{NonSendSync, UniqueView, Unique, AllStoragesView};
|
||||
use glium::{texture::{SrgbTexture2dArray, MipmapsOption}, Program};
|
||||
use strum::EnumIter;
|
||||
use kubi_shared::block::{Block, BlockTexture};
|
||||
use crate::rendering::Renderer;
|
||||
|
||||
mod texture;
|
||||
|
@ -13,24 +13,6 @@ pub trait AssetPaths {
|
|||
fn file_name(self) -> &'static str;
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, EnumIter)]
|
||||
#[repr(u8)]
|
||||
pub enum BlockTexture {
|
||||
Stone,
|
||||
Dirt,
|
||||
GrassTop,
|
||||
GrassSide,
|
||||
Sand,
|
||||
Bedrock,
|
||||
Wood,
|
||||
WoodTop,
|
||||
Leaf,
|
||||
Torch,
|
||||
TallGrass,
|
||||
Snow,
|
||||
GrassSideSnow,
|
||||
Cobblestone,
|
||||
}
|
||||
impl AssetPaths for BlockTexture {
|
||||
fn file_name(self) -> &'static str {
|
||||
match self {
|
||||
|
|
|
@ -110,7 +110,6 @@ pub fn draw_world(
|
|||
}
|
||||
}
|
||||
|
||||
//this doesn't use culling!
|
||||
pub fn draw_current_chunk_border(
|
||||
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||
player: View<MainPlayer>,
|
||||
|
|
|
@ -4,10 +4,9 @@ use glam::IVec3;
|
|||
use hashbrown::HashMap;
|
||||
use anyhow::{Result, Context};
|
||||
|
||||
pub use kubi_shared::worldgen;
|
||||
pub use kubi_shared::{worldgen, block::Block};
|
||||
|
||||
pub mod chunk;
|
||||
pub mod block;
|
||||
pub mod tasks;
|
||||
pub mod loading;
|
||||
pub mod mesh;
|
||||
|
@ -15,7 +14,6 @@ pub mod neighbors;
|
|||
pub mod raycast;
|
||||
pub mod queue;
|
||||
|
||||
use block::Block;
|
||||
use chunk::{Chunk, ChunkMesh, CHUNK_SIZE};
|
||||
use tasks::ChunkTaskManager;
|
||||
use queue::BlockUpdateQueue;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use strum::{EnumIter, IntoEnumIterator};
|
||||
use glam::{Vec3A, vec3a, IVec3, ivec3};
|
||||
use std::mem::discriminant;
|
||||
use super::{chunk::CHUNK_SIZE, block::{Block, RenderType, BlockDescriptorSource}};
|
||||
use kubi_shared::block::{Block, RenderType, BlockDescriptorSource};
|
||||
use super::{chunk::CHUNK_SIZE, };
|
||||
use crate::rendering::world::ChunkVertex;
|
||||
|
||||
pub mod data;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use glam::{IVec3, ivec3};
|
||||
use kubi_shared::{blocks::Block, chunk::CHUNK_SIZE};
|
||||
use kubi_shared::{block::Block, chunk::CHUNK_SIZE};
|
||||
use shipyard::{UniqueViewMut, Unique};
|
||||
|
||||
use super::ChunkStorage;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use glam::{Vec3, IVec3};
|
||||
use shipyard::{View, Component, ViewMut, IntoIter, UniqueView, track};
|
||||
use crate::{transform::Transform, world::block::BlockDescriptorSource};
|
||||
use super::{ChunkStorage, block::Block};
|
||||
use kubi_shared::block::{Block, BlockDescriptorSource};
|
||||
use crate::transform::Transform;
|
||||
use super::ChunkStorage;
|
||||
|
||||
const RAYCAST_STEP: f32 = 0.25;
|
||||
|
||||
|
|
Loading…
Reference in a new issue