Streamables
This commit is contained in:
parent
ec60086109
commit
b2673f1732
23
src/bot.rs
23
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<instruction::TimedInstruction<simulation::Instruction>>
|
||||
}
|
||||
|
||||
pub struct StreamableBot{
|
||||
file:crate::file::File,
|
||||
timeline:timeline::Timeline<SegmentId>,
|
||||
}
|
||||
impl StreamableBot{
|
||||
pub fn load_segment(&mut self,segment_id:u64)->Result<Segment,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::InvalidSegment)
|
||||
}
|
||||
}
|
20
src/demo.rs
20
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<crate::map::Map>,
|
||||
bots:Vec<crate::bot::Bot>,
|
||||
pub struct StreamableDemo{
|
||||
map:Box<crate::map::StreamableMap>,
|
||||
bots:Vec<crate::bot::StreamableBot>,
|
||||
}
|
@ -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<R:Read>(input:R)->Result<SNF,Error>{
|
||||
|
26
src/map.rs
26
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<Uuid,Resource>,
|
||||
}
|
||||
impl StreamableMap{
|
||||
pub fn load_node(&mut self,node_id:BvhNodeId)->Result<Vec<model::ModelInstance>,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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user