v2
This commit is contained in:
parent
b04a6d870a
commit
a78859b231
32
src/body.rs
32
src/body.rs
@ -257,34 +257,23 @@ fn get_control_dir(controls: u32) -> glam::Vec3{
|
||||
return control_dir
|
||||
}
|
||||
|
||||
pub enum SetSpawnBehaviour{
|
||||
None,
|
||||
Trigger,
|
||||
Teleport,
|
||||
}
|
||||
|
||||
pub enum GameMechanicAttributes{
|
||||
Platform{
|
||||
spawn_id:u32,
|
||||
},
|
||||
SetSpawn{
|
||||
spawn_id:u32,//which spawn to send to
|
||||
force:bool,//allow setting to lower spawn id i.e. 7->3
|
||||
behaviour:SetSpawnBehaviour
|
||||
},
|
||||
//Spawn(u32) NO! spawns are indexed in the map header instead of marked with attibutes
|
||||
}
|
||||
|
||||
pub struct GameMechanicsState{
|
||||
pub spawn_id:u32,
|
||||
//jump_count:u32,
|
||||
//jump_counts:HashMap<u32,u32>,
|
||||
}
|
||||
|
||||
pub struct StageDescription{
|
||||
pub start:u32,//start=model_id
|
||||
pub spawns:Vec<u32>,//spawns[spawn_id]=model_id
|
||||
pub ordered_checkpoints:Vec<u32>,//ordered_checkpoints[checkpoint_id]=model_id
|
||||
pub unordered_checkpoints:Vec<u32>,//unordered_checkpoints[checkpoint_id]=model_id
|
||||
}
|
||||
|
||||
pub struct WorldState{
|
||||
//all models
|
||||
pub models:Vec<ModelPhysics>,
|
||||
//indexed list spawns[mode][spawn_id]=model_id
|
||||
pub spawns:Vec<Vec<u32>>,
|
||||
|
||||
pub stages:Vec<StageDescription>,
|
||||
//the spawn point is where you spawn when you load into the map.
|
||||
//This is not the same as Reset which teleports you to Spawn0
|
||||
pub spawn_point:glam::Vec3,
|
||||
@ -432,6 +421,7 @@ pub struct ModelPhysics {
|
||||
//A model is a thing that has a hitbox. can be represented by a list of TreyMesh-es
|
||||
//in this iteration, all it needs is extents.
|
||||
mesh: TreyMesh,
|
||||
attributes:crate::model::CollisionAttributes,
|
||||
}
|
||||
|
||||
impl ModelPhysics {
|
||||
|
73
src/model.rs
73
src/model.rs
@ -66,6 +66,79 @@ pub struct IndexedModelInstances{
|
||||
pub spawn_point:glam::Vec3,
|
||||
}
|
||||
|
||||
//you have this effect while in contact
|
||||
struct ContactingSurf{}
|
||||
struct ContactingLadder{
|
||||
sticky:bool
|
||||
}
|
||||
//you have this effect while intersecting
|
||||
struct IntersectingWater{
|
||||
viscosity:i64,
|
||||
density:i64,
|
||||
}
|
||||
struct IntersectingAccelerator{
|
||||
acceleration:glam::I64Vec3
|
||||
}
|
||||
//All models can be given these attributes
|
||||
struct GameMechanicJumpLimit{
|
||||
count:u32,
|
||||
}
|
||||
struct GameMechanicBooster{
|
||||
velocity:glam::I64Vec3,
|
||||
}
|
||||
enum ZoneBehaviour{
|
||||
//Start is indexed
|
||||
//Checkpoints are indexed
|
||||
Finish,
|
||||
Anitcheat,
|
||||
}
|
||||
struct GameMechanicZone{
|
||||
mode_id:u32,
|
||||
behaviour:ZoneBehaviour
|
||||
}
|
||||
enum StageElementBehaviour{
|
||||
SpawnAt,
|
||||
Trigger,
|
||||
Teleport,
|
||||
Platform,
|
||||
}
|
||||
struct GameMechanicStageElement{
|
||||
mode_id:u32,
|
||||
stage_id:u32,//which spawn to send to
|
||||
force:bool,//allow setting to lower spawn id i.e. 7->3
|
||||
behaviour:StageElementBehaviour
|
||||
}
|
||||
struct GameMechanicWormhole{//(position,angles)*=origin.transform.inverse()*destination.transform
|
||||
model_id:u32,
|
||||
}
|
||||
struct GameMechanicAttributes{
|
||||
jump_limit:Option<GameMechanicJumpLimit>,
|
||||
booster:Option<GameMechanicBooster>,
|
||||
zone:Option<GameMechanicZone>,
|
||||
stage_element:Option<GameMechanicStageElement>,
|
||||
wormhole:Option<GameMechanicWormhole>,
|
||||
}
|
||||
struct ContactingAttributes{
|
||||
surf:Option<ContactingSurf>,
|
||||
ladder:Option<ContactingLadder>,
|
||||
}
|
||||
struct IntersectingAttibutes{
|
||||
water:Option<IntersectingWater>,
|
||||
accelerator:Option<IntersectingAccelerator>,
|
||||
}
|
||||
//Spawn(u32) NO! spawns are indexed in the map header instead of marked with attibutes
|
||||
pub enum CollisionAttributes{
|
||||
Decoration,//visual only
|
||||
Contact{//track whether you are contacting the object
|
||||
contacting:ContactingAttributes,
|
||||
general:GameMechanicAttributes,
|
||||
},
|
||||
Intersect{//track whether you are intersecting the object
|
||||
intersecting:IntersectingAttibutes,
|
||||
general:GameMechanicAttributes,
|
||||
},
|
||||
}
|
||||
|
||||
pub fn generate_indexed_model_list_from_obj(data:obj::ObjData,color:[f32;4]) -> Vec<IndexedModel>{
|
||||
let mut unique_vertex_index = std::collections::HashMap::<obj::IndexTuple,u32>::new();
|
||||
return data.objects.iter().map(|object|{
|
||||
|
Loading…
Reference in New Issue
Block a user