From bbe069880c6946e8be0d91bd557e4303ed33f863 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 25 Mar 2022 20:10:05 -0500 Subject: [PATCH] voxels --- src/chunk.rs | 1 + src/main.rs | 21 ++------------------- src/platform.rs | 3 +-- src/voxel.rs | 11 +++++++++++ 4 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 src/chunk.rs create mode 100644 src/voxel.rs diff --git a/src/chunk.rs b/src/chunk.rs new file mode 100644 index 0000000..cb32796 --- /dev/null +++ b/src/chunk.rs @@ -0,0 +1 @@ +pub struct Chunk {} diff --git a/src/main.rs b/src/main.rs index f297e43..fa2ab06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ +pub mod chunk; pub mod platform; +pub mod voxel; pub struct Position3D { pub x: f64, @@ -6,10 +8,6 @@ pub struct Position3D { pub z: f64, } -pub struct VoxelGrid { - pub name: String, - pub position: Position3D, -} use bgfx::*; use bgfx_rs::bgfx; use glfw::{Action, Key, Window}; @@ -38,7 +36,6 @@ fn main() { panic!("failed to init bgfx"); } - // bgfx::set_debug(DebugFlags::TEXT.bits()); bgfx::set_view_clear( 0, ClearFlags::COLOR.bits() | ClearFlags::DEPTH.bits(), @@ -68,20 +65,6 @@ fn main() { bgfx::set_view_rect(0, 0, 0, size.0 as _, size.1 as _); bgfx::touch(0); - /* - bgfx::dbg_text_clear(DbgTextClearArgs::default()); - - bgfx::dbg_text(0, 1, 0x0f, "Color can be changed with ANSI \x1b[9;me\x1b[10;ms\x1b[11;mc\x1b[12;ma\x1b[13;mp\x1b[14;me\x1b[0m code too."); - bgfx::dbg_text(80, 1, 0x0f, "\x1b[;0m \x1b[;1m \x1b[; 2m \x1b[; 3m \x1b[; 4m \x1b[; 5m \x1b[; 6m \x1b[; 7m \x1b[0m"); - bgfx::dbg_text(80, 2, 0x0f, "\x1b[;8m \x1b[;9m \x1b[;10m \x1b[;11m \x1b[;12m \x1b[;13m \x1b[;14m \x1b[;15m \x1b[0m"); - bgfx::dbg_text( - 0, - 4, - 0x3f, - "Description: Initialization and debug text with bgfx-rs Rust API.", - ); - */ - bgfx::frame(false); } shutdown_handler(); diff --git a/src/platform.rs b/src/platform.rs index 6d1249b..9bf38e4 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -1,5 +1,4 @@ -use bgfx_rs::static_lib::PlatformData; -use bgfx_rs::static_lib::RendererType; +use bgfx_rs::static_lib::{PlatformData, RendererType}; use glfw::Window; use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; diff --git a/src/voxel.rs b/src/voxel.rs new file mode 100644 index 0000000..cce7fea --- /dev/null +++ b/src/voxel.rs @@ -0,0 +1,11 @@ +use crate::{chunk::Chunk, Position3D}; + +pub struct VoxelData { + pub id: u32, +} + +pub struct VoxelGrid { + pub name: String, + pub position: Position3D, + pub chunks: Vec, +}