From b2673f17323fede93dbf5f3abf8915786d09b900 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 18 Jan 2024 15:33:22 -0800 Subject: [PATCH] Streamables --- src/bot.rs | 23 ++++++++++++++++++++--- src/demo.rs | 20 +++++++++++++++----- src/lib.rs | 6 +++--- src/map.rs | 26 ++++++++++++++++++++++++-- 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/bot.rs b/src/bot.rs index c90b823..cd23d82 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -1,5 +1,5 @@ pub enum Error{ - + InvalidSegment, } /* block types @@ -28,6 +28,23 @@ loop{ */ -pub struct Bot{ - // +struct SegmentId(u64); + +pub struct Segment{ + state:simulation::State, + instructions:Vec> +} + +pub struct StreamableBot{ + file:crate::file::File, + timeline:timeline::Timeline, +} +impl StreamableBot{ + pub fn load_segment(&mut self,segment_id:u64)->Result{ + //load region from disk + //parse the models and determine what resources need to be loaded + //load resources into self.resources + //return Region + Err(Error::InvalidSegment) + } } \ No newline at end of file diff --git a/src/demo.rs b/src/demo.rs index c2d30d4..ea66dc5 100644 --- a/src/demo.rs +++ b/src/demo.rs @@ -1,13 +1,23 @@ pub enum Error{ - + // } /* BLOCK_DEMO_HEADER: -//timeline of loading maps, bots +u128 map_resource_id +u64 map_header_block_id +u32 num_bots +for bot_id in 0..num_bots{ + u128 bot_resource_id + u64 bot_header_block_id +} + +//bot loading timeline +how to do worldstate for deathrun!? + */ -pub struct Demo{ - map:Box, - bots:Vec, +pub struct StreamableDemo{ + map:Box, + bots:Vec, } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 01caa08..e36ef03 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,9 +13,9 @@ pub enum Error{ } pub enum SNF{ - Map(map::Map), - Bot(bot::Bot), - Demo(demo::Demo), + Map(map::StreamableMap), + Bot(bot::StreamableBot), + Demo(demo::StreamableDemo), } pub fn read(input:R)->Result{ diff --git a/src/map.rs b/src/map.rs index df2d59b..e4fc21f 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1,5 +1,5 @@ pub enum Error{ - + InvalidNode, } /* block types @@ -46,6 +46,28 @@ for model_id in 0..num_models{ */ -pub struct Map{ +struct Uuid(u128); +struct BvhNodeId(u64); +struct BvhNode{ // +} +enum Resource{ + IndexedModel(model::IndexedModel), + Image(image::Image),//? +} + +pub struct StreamableMap{ + file:crate::file::File, + style:physics::StyleModifiers,//probably should move this out of physics + bvh:BvhNode, + resources:std::collections::HashMap, +} +impl StreamableMap{ + pub fn load_node(&mut self,node_id:BvhNodeId)->Result,Error>{ + //load region from disk + //parse the models and determine what resources need to be loaded + //load resources into self.resources + //return Region + Err(Error::InvalidNode) + } } \ No newline at end of file