use id proc macro
This commit is contained in:
parent
7512c8676e
commit
fc1e6581ec
@ -132,13 +132,8 @@ impl IntersectingAttributes{
|
|||||||
self.water.is_some()
|
self.water.is_some()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Clone,Copy)]
|
#[derive(Clone,Copy,id::Id)]
|
||||||
pub struct CollisionAttributesId(u32);
|
pub struct CollisionAttributesId(u32);
|
||||||
impl CollisionAttributesId{
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Hash,Eq,PartialEq)]
|
#[derive(Clone,Hash,Eq,PartialEq)]
|
||||||
pub enum CollisionAttributes{
|
pub enum CollisionAttributes{
|
||||||
Decoration,//visual only
|
Decoration,//visual only
|
||||||
|
@ -31,30 +31,12 @@ pub enum StageElementBehaviour{
|
|||||||
Checkpoint,//this is a combined behaviour for Ordered & Unordered in case a model is used multiple times or for both.
|
Checkpoint,//this is a combined behaviour for Ordered & Unordered in case a model is used multiple times or for both.
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct CheckpointId(u32);
|
pub struct CheckpointId(u32);
|
||||||
impl CheckpointId{
|
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq,Ord,PartialOrd)]
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,Ord,PartialOrd)]
|
|
||||||
pub struct StageId(u32);
|
pub struct StageId(u32);
|
||||||
impl StageId{
|
impl StageId{
|
||||||
pub const FIRST:Self=Self(0);
|
pub const FIRST:Self=Self(0);
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pub struct Stage{
|
pub struct Stage{
|
||||||
spawn:ModelId,
|
spawn:ModelId,
|
||||||
@ -97,19 +79,11 @@ pub enum Zone{
|
|||||||
Finish,
|
Finish,
|
||||||
Anticheat,
|
Anticheat,
|
||||||
}
|
}
|
||||||
#[derive(Clone,Hash,Eq,PartialEq,Ord,PartialOrd)]
|
#[derive(Clone,Hash,id::Id,Eq,PartialEq,Ord,PartialOrd)]
|
||||||
pub struct ModeId(u32);
|
pub struct ModeId(u32);
|
||||||
impl ModeId{
|
impl ModeId{
|
||||||
pub const MAIN:Self=Self(0);
|
pub const MAIN:Self=Self(0);
|
||||||
pub const BONUS:Self=Self(1);
|
pub const BONUS:Self=Self(1);
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(&self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pub struct Mode{
|
pub struct Mode{
|
||||||
style:gameplay_style::StyleModifiers,
|
style:gameplay_style::StyleModifiers,
|
||||||
|
98
src/model.rs
98
src/model.rs
@ -5,54 +5,14 @@ use crate::updatable::Updatable;
|
|||||||
|
|
||||||
pub type TextureCoordinate=glam::Vec2;
|
pub type TextureCoordinate=glam::Vec2;
|
||||||
pub type Color4=glam::Vec4;
|
pub type Color4=glam::Vec4;
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
pub struct PositionId(u32);
|
pub struct PositionId(u32);
|
||||||
impl PositionId{
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
|
||||||
pub struct TextureCoordinateId(u32);
|
pub struct TextureCoordinateId(u32);
|
||||||
impl TextureCoordinateId{
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
|
||||||
pub struct NormalId(u32);
|
pub struct NormalId(u32);
|
||||||
impl NormalId{
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
|
||||||
pub struct ColorId(u32);
|
pub struct ColorId(u32);
|
||||||
impl ColorId{
|
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Hash,PartialEq,Eq)]
|
#[derive(Clone,Hash,PartialEq,Eq)]
|
||||||
pub struct IndexedVertex{
|
pub struct IndexedVertex{
|
||||||
pub pos:PositionId,
|
pub pos:PositionId,
|
||||||
@ -60,28 +20,13 @@ pub struct IndexedVertex{
|
|||||||
pub normal:NormalId,
|
pub normal:NormalId,
|
||||||
pub color:ColorId,
|
pub color:ColorId,
|
||||||
}
|
}
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
pub struct VertexId(u32);
|
pub struct VertexId(u32);
|
||||||
impl VertexId{
|
|
||||||
#[inline]
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub const fn get(self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct IndexedVertexList{
|
pub struct IndexedVertexList{
|
||||||
vertices:Vec<VertexId>,
|
vertices:Vec<VertexId>,
|
||||||
}
|
}
|
||||||
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
|
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
|
||||||
pub struct PolygonGroupId(u32);
|
pub struct PolygonGroupId(u32);
|
||||||
impl PolygonGroupId{
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub enum PolygonGroup{
|
pub enum PolygonGroup{
|
||||||
PolygonList(Vec<IndexedVertexList>),
|
PolygonList(Vec<IndexedVertexList>),
|
||||||
//TriangleStrip(Vec<VertexId>),
|
//TriangleStrip(Vec<VertexId>),
|
||||||
@ -100,20 +45,10 @@ impl PolygonGroup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Ah yes, a group of things to render at the same time
|
/// Ah yes, a group of things to render at the same time
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct RenderGroupId(u32);
|
pub struct RenderGroupId(u32);
|
||||||
impl RenderGroupId{
|
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
|
||||||
pub struct TextureId(u32);
|
pub struct TextureId(u32);
|
||||||
impl TextureId{
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct RenderConfig{
|
pub struct RenderConfig{
|
||||||
texture:Option<TextureId>,
|
texture:Option<TextureId>,
|
||||||
@ -136,13 +71,8 @@ pub struct IndexedPhysicsGroup{
|
|||||||
pub groups:Vec<PolygonGroupId>,
|
pub groups:Vec<PolygonGroupId>,
|
||||||
}
|
}
|
||||||
//This is a superset of PhysicsModel and GraphicsModel
|
//This is a superset of PhysicsModel and GraphicsModel
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct IndexedModelId(u32);
|
pub struct IndexedModelId(u32);
|
||||||
impl IndexedModelId{
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct IndexedModel{
|
pub struct IndexedModel{
|
||||||
pub unique_pos:Vec<Planar64Vec3>,//Unit32Vec3
|
pub unique_pos:Vec<Planar64Vec3>,//Unit32Vec3
|
||||||
pub unique_normal:Vec<Planar64Vec3>,//Unit32Vec3
|
pub unique_normal:Vec<Planar64Vec3>,//Unit32Vec3
|
||||||
@ -157,16 +87,8 @@ pub struct IndexedModel{
|
|||||||
pub physics_groups:Vec<IndexedPhysicsGroup>,
|
pub physics_groups:Vec<IndexedPhysicsGroup>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,Hash,Eq,PartialEq)]
|
#[derive(Debug,Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct ModelId(u32);
|
pub struct ModelId(u32);
|
||||||
impl ModelId{
|
|
||||||
pub const fn id(id:u32)->Self{
|
|
||||||
Self(id)
|
|
||||||
}
|
|
||||||
pub const fn get(&self)->u32{
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct Model{
|
pub struct Model{
|
||||||
pub model:IndexedModelId,
|
pub model:IndexedModelId,
|
||||||
pub attributes:gameplay_attributes::CollisionAttributesId,
|
pub attributes:gameplay_attributes::CollisionAttributesId,
|
||||||
|
Loading…
Reference in New Issue
Block a user