try the thing

This commit is contained in:
2026-02-16 08:55:53 -08:00
parent 0eee8dadbd
commit 6f805a6cd2
2 changed files with 17 additions and 4 deletions

View File

@@ -1,9 +1,22 @@
use strafesnet_graphics::graphics::GraphicsState;
#[derive(Debug)]
pub enum Error{
File(strafesnet_snf::Error),
Map(strafesnet_snf::map::Error),
}
/// The graphics state, essentially a handle to all the information on the GPU.
pub struct Graphics{
graphics:strafesnet_graphics::graphics::GraphicsState,
graphics:GraphicsState,
}
impl Graphics{
pub fn new(data:&[u8])->Result<Self,()>{
Err(())
pub fn new(mut graphics:GraphicsState,data:&[u8],device:&wgpu::Device,queue:&wgpu::Queue)->Result<Self,Error>{
let map=strafesnet_snf::read_map(std::io::Cursor::new(data))
.map_err(Error::File)?
.into_complete_map()
.map_err(Error::Map)?;
graphics.generate_models(device,queue,&map);
Ok(Self{graphics})
}
}

View File

@@ -204,7 +204,7 @@ impl WindowContext<'_>{
graphics.resize(&setup_context.device,&setup_context.config,glam::Vec2::ONE);
let bot=include_bytes!("../../web-demo/bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d.qbot");
let map=include_bytes!("../../web-demo/bhop_marble_5692093612.snfm");
let graphics=strafesnet_roblox_bot_player::graphics::Graphics::new(map).unwrap();
let graphics=strafesnet_roblox_bot_player::graphics::Graphics::new(graphics,map,&setup_context.device,&setup_context.queue).unwrap();
let bot=strafesnet_roblox_bot_player::bot::Bot::new(bot).unwrap();
let graphics_thread=crate::graphics::GraphicsWorker::new(graphics);//,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue);
WindowContext{