diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:20 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:20 +0100 |
commit | de0f306ffcdf540c16ff2f89d99790c7f2b541fc (patch) | |
tree | f84e4a898a74ac412b4b332eb7c8c842c1b6af04 /stockton-render/src | |
parent | f6c2f402e245c620f8f03dcf3aa6265fca6e8dcf (diff) |
refactor(render): remove old entity stuff from world type
Diffstat (limited to 'stockton-render/src')
-rw-r--r-- | stockton-render/src/lib.rs | 18 | ||||
-rw-r--r-- | stockton-render/src/walk_bsp.rs | 26 |
2 files changed, 37 insertions, 7 deletions
diff --git a/stockton-render/src/lib.rs b/stockton-render/src/lib.rs index 43c5d6a..2255c49 100644 --- a/stockton-render/src/lib.rs +++ b/stockton-render/src/lib.rs @@ -17,20 +17,23 @@ extern crate core; #[cfg(feature = "vulkan")] extern crate gfx_backend_vulkan as back; - -extern crate image; -extern crate log; extern crate gfx_hal as hal; -extern crate stockton_types; extern crate shaderc; extern crate winit; + extern crate nalgebra_glm as na; +extern crate image; +extern crate log; + +extern crate stockton_types; +extern crate stockton_bsp; extern crate arrayvec; pub mod draw; mod error; mod types; +mod walk_bsp; use std::sync::{Arc, RwLock}; @@ -41,7 +44,7 @@ use draw::RenderingContext; /// Renders a world to a window when you tell it to. pub struct Renderer<'a> { - _world: Arc<RwLock<World<'a>>>, + world: Arc<RwLock<World<'a>>>, pub context: RenderingContext<'a> } @@ -49,11 +52,12 @@ pub struct Renderer<'a> { impl<'a> Renderer<'a> { /// Create a new Renderer. /// This initialises all the vulkan context, etc needed. - pub fn new(world: Arc<RwLock<World<'a>>>, window: &winit::window::Window) -> Result<Self, CreationError> { + pub fn new(world: World<'a>, window: &winit::window::Window) -> Result<Self, CreationError> { + let world = Arc::new(RwLock::new(world)); let context = RenderingContext::new(window)?; Ok(Renderer { - _world: world, context + world: world, context }) } diff --git a/stockton-render/src/walk_bsp.rs b/stockton-render/src/walk_bsp.rs new file mode 100644 index 0000000..3701da0 --- /dev/null +++ b/stockton-render/src/walk_bsp.rs @@ -0,0 +1,26 @@ +// Copyright (C) 2019 Oscar Shrimpton + +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation, either version 3 of the License, or (at your option) +// any later version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. + +//! Walks a compiled BSP tree and renders it + +use crate::draw::RenderingContext; +use stockton_bsp::BSPFile; +use std::pin::Pin; +use std::boxed::Box; + +fn walk_tree<'a>(ctx: &RenderingContext<'a>, file: &Pin<Box<BSPFile>>) -> (){ + // TODO + +}
\ No newline at end of file |