Compare commits
2 Commits
96d813a3a6
...
5efdd3654a
Author | SHA1 | Date | |
---|---|---|---|
5efdd3654a | |||
37fb390465 |
@ -132,9 +132,10 @@ impl IntersectingAttributes{
|
||||
self.water.is_some()
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Copy)]
|
||||
pub struct CollisionAttributesId(u32);
|
||||
impl CollisionAttributesId{
|
||||
pub fn new(id:u32)->Self{
|
||||
pub fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ pub enum StageElementBehaviour{
|
||||
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||
pub struct CheckpointId(usize);
|
||||
#[derive(Clone,Hash,Eq,PartialEq,Ord,PartialOrd)]
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,Ord,PartialOrd)]
|
||||
pub struct StageId(u32);
|
||||
impl StageId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
|
@ -1,4 +1,4 @@
|
||||
const VALVE_SCALE:i64=16;
|
||||
const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16
|
||||
|
||||
use crate::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
||||
|
||||
@ -138,13 +138,13 @@ impl StyleModifiers{
|
||||
air_accel_limit:Some(Planar64::raw(150<<28)*100),
|
||||
tick_rate:Ratio64::new(100,Time::ONE_SECOND.nanos() as u64).unwrap(),
|
||||
}),
|
||||
jump_impulse:JumpImpulse::FromHeight(Planar64::int(52)/VALVE_SCALE),
|
||||
jump_impulse:JumpImpulse::FromHeight(Planar64::int(52)*VALVE_SCALE),
|
||||
jump_calculation:JumpCalculation::Linear,
|
||||
gravity:Planar64Vec3::int(0,-800,0)/VALVE_SCALE,
|
||||
gravity:Planar64Vec3::int(0,-800,0)*VALVE_SCALE,
|
||||
static_friction:Planar64::int(2),//?
|
||||
kinetic_friction:Planar64::int(3),//?
|
||||
mass:Planar64::int(1),
|
||||
mv:Planar64::raw(30)/VALVE_SCALE,
|
||||
mv:Planar64::raw(30)*VALVE_SCALE,
|
||||
rocket_force:None,
|
||||
walk_speed:Planar64::int(18),//?
|
||||
walk_accel:Planar64::int(90),//?
|
||||
@ -154,7 +154,7 @@ impl StyleModifiers{
|
||||
swim_speed:Planar64::int(12),//?
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox:Hitbox::source(),
|
||||
camera_offset:(Planar64Vec3::int(0,64,0)-Planar64Vec3::int(0,73,0)/2)/VALVE_SCALE,
|
||||
camera_offset:(Planar64Vec3::int(0,64,0)-Planar64Vec3::int(0,73,0)/2)*VALVE_SCALE,
|
||||
}
|
||||
}
|
||||
fn source_surf()->Self{
|
||||
@ -163,16 +163,16 @@ impl StyleModifiers{
|
||||
controls_mask:!0,//&!(Self::CONTROL_MOVEUP|Self::CONTROL_MOVEDOWN),
|
||||
strafe:Some(StrafeSettings{
|
||||
enable:EnableStrafe::Always,
|
||||
air_accel_limit:Some(Planar64::int(150)*66/VALVE_SCALE),
|
||||
air_accel_limit:Some(Planar64::int(150)*66*VALVE_SCALE),
|
||||
tick_rate:Ratio64::new(66,Time::ONE_SECOND.nanos() as u64).unwrap(),
|
||||
}),
|
||||
jump_impulse:JumpImpulse::FromHeight(Planar64::int(52)/VALVE_SCALE),
|
||||
jump_impulse:JumpImpulse::FromHeight(Planar64::int(52)*VALVE_SCALE),
|
||||
jump_calculation:JumpCalculation::Linear,
|
||||
gravity:Planar64Vec3::int(0,-800,0)/VALVE_SCALE,
|
||||
gravity:Planar64Vec3::int(0,-800,0)*VALVE_SCALE,
|
||||
static_friction:Planar64::int(2),//?
|
||||
kinetic_friction:Planar64::int(3),//?
|
||||
mass:Planar64::int(1),
|
||||
mv:Planar64::int(30)/VALVE_SCALE,
|
||||
mv:Planar64::int(30)*VALVE_SCALE,
|
||||
rocket_force:None,
|
||||
walk_speed:Planar64::int(18),//?
|
||||
walk_accel:Planar64::int(90),//?
|
||||
@ -182,7 +182,7 @@ impl StyleModifiers{
|
||||
swim_speed:Planar64::int(12),//?
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox:Hitbox::source(),
|
||||
camera_offset:(Planar64Vec3::int(0,64,0)-Planar64Vec3::int(0,73,0)/2)/VALVE_SCALE,
|
||||
camera_offset:(Planar64Vec3::int(0,64,0)-Planar64Vec3::int(0,73,0)/2)*VALVE_SCALE,
|
||||
}
|
||||
}
|
||||
fn roblox_rocket()->Self{
|
||||
@ -275,7 +275,7 @@ impl Hitbox{
|
||||
}
|
||||
fn source()->Self{
|
||||
Self{
|
||||
halfsize:Planar64Vec3::raw(33,73,33)/2/VALVE_SCALE,
|
||||
halfsize:Planar64Vec3::raw(33,73,33)/2*VALVE_SCALE,
|
||||
mesh:HitboxMesh::Box,
|
||||
}
|
||||
}
|
||||
|
94
src/model.rs
94
src/model.rs
@ -5,31 +5,97 @@ use crate::updatable::Updatable;
|
||||
|
||||
pub type TextureCoordinate=glam::Vec2;
|
||||
pub type Color4=glam::Vec4;
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct PositionId(u32);
|
||||
impl PositionId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct TextureCoordinateId(u32);
|
||||
impl TextureCoordinateId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct NormalId(u32);
|
||||
impl NormalId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct ColorId(u32);
|
||||
impl ColorId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Hash,PartialEq,Eq)]
|
||||
pub struct IndexedVertex{
|
||||
pub pos:u32,
|
||||
pub tex:u32,
|
||||
pub normal:u32,
|
||||
pub color:u32,
|
||||
pub pos:PositionId,
|
||||
pub tex:TextureCoordinateId,
|
||||
pub normal:NormalId,
|
||||
pub color:ColorId,
|
||||
}
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct VertexId(u32);
|
||||
impl VertexId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
pub struct IndexedVertexList{
|
||||
pub vertices:Vec<VertexId>,
|
||||
}
|
||||
pub struct GroupId(u32);
|
||||
pub enum IndexedGroup{
|
||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
||||
pub struct PolygonGroupId(u32);
|
||||
impl PolygonGroupId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
pub enum PolygonGroup{
|
||||
PolygonList(Vec<IndexedVertexList>),
|
||||
//TriangleStrip(Vec<IndexedVertexList>),
|
||||
}
|
||||
pub struct RenderId(u32);
|
||||
/// Ah yes, a group of things to render at the same time
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||
pub struct RenderGroupId(u32);
|
||||
impl RenderGroupId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||
pub struct TextureId(u32);
|
||||
impl TextureId{
|
||||
pub const fn id(id:u32)->Self{
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct RenderConfig{
|
||||
texture:Option<TextureId>,
|
||||
}
|
||||
impl RenderConfig{
|
||||
pub const fn texture(texture:TextureId)->Self{
|
||||
Self{
|
||||
texture:Some(texture),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct IndexedGraphicsGroup{
|
||||
//Render pattern material/texture/shader/flat color
|
||||
pub render:RenderId,
|
||||
pub groups:Vec<GroupId>,
|
||||
pub render:RenderGroupId,
|
||||
pub groups:Vec<PolygonGroupId>,
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct IndexedPhysicsGroup{
|
||||
//the polygons in this group are guaranteed to make a closed convex shape
|
||||
pub groups:Vec<GroupId>,
|
||||
pub groups:Vec<PolygonGroupId>,
|
||||
}
|
||||
//This is a superset of PhysicsModel and GraphicsModel
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||
@ -45,12 +111,12 @@ pub struct IndexedModel{
|
||||
pub unique_tex:Vec<TextureCoordinate>,
|
||||
pub unique_color:Vec<Color4>,
|
||||
pub unique_vertices:Vec<IndexedVertex>,
|
||||
//groups are constant texture AND convexity slices
|
||||
pub groups:Vec<IndexedGroup>,
|
||||
//polygon groups are constant texture AND convexity slices
|
||||
pub polygon_groups:Vec<PolygonGroup>,
|
||||
//graphics indexed (by texture)
|
||||
pub graphics_sets:Vec<IndexedGraphicsGroup>,
|
||||
pub graphics_groups:Vec<IndexedGraphicsGroup>,
|
||||
//physics indexed (by convexity)
|
||||
pub physics_sets:Vec<IndexedPhysicsGroup>,
|
||||
pub physics_groups:Vec<IndexedPhysicsGroup>,
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user