diff --git a/src/model.rs b/src/model.rs index 3040a61..45a68e9 100644 --- a/src/model.rs +++ b/src/model.rs @@ -1,11 +1,12 @@ -use bytemuck::{Pod, Zeroable}; -#[derive(Clone, Copy, Pod, Zeroable)] -#[repr(C)] -pub struct Vertex { - pub pos: [f32; 3], - pub tex: [f32; 2], - pub normal: [f32; 3], - pub color: [f32; 4], +use crate::integer::{Unit32Vec3,Planar64,Planar64Vec3,Planar64Affine3}; +pub struct TextureCoordinate([f32;2]); +pub struct Color4(glam::Vec4); + +pub struct ModelVertex { + pub pos:Planar64Vec3, + pub normal:Unit32Vec3, + pub tex:TextureCoordinate, + pub color:Color4, } #[derive(Clone,Hash,PartialEq,Eq)] pub struct IndexedVertex{ @@ -30,42 +31,17 @@ pub struct IndexedModel{ pub groups: Vec, pub instances:Vec, } -pub struct IndexedGroupFixedTexture{ - pub polys:Vec, -} -pub struct IndexedModelSingleTexture{ - pub unique_pos:Vec<[f32; 3]>, - pub unique_tex:Vec<[f32; 2]>, - pub unique_normal:Vec<[f32; 3]>, - pub unique_color:Vec<[f32; 4]>, - pub unique_vertices:Vec, - pub texture:Option,//RenderPattern? material/texture/shader/flat color - pub groups: Vec, - pub instances:Vec, -} -pub struct ModelSingleTexture{ - pub instances: Vec, - pub vertices: Vec, - pub entities: Vec>, - pub texture: Option, -} -#[derive(Clone)] -pub struct ModelGraphicsInstance{ - pub transform:glam::Mat4, - pub normal_transform:glam::Mat3, - pub color:glam::Vec4, -} pub struct ModelInstance{ //pub id:u64,//this does not actually help with map fixes resimulating bots, they must always be resimulated - pub transform:glam::Affine3A, - pub color:glam::Vec4,//transparency is in here + pub transform:Planar64Affine3, + pub color:Color4,//transparency is in here pub attributes:CollisionAttributes, pub temp_indexing:Vec, } impl std::default::Default for ModelInstance{ fn default() -> Self { Self{ - color:glam::Vec4::ONE, + color:Color4(glam::Vec4::ONE), transform:Default::default(), attributes:Default::default(), temp_indexing:Default::default(), @@ -77,7 +53,7 @@ pub struct IndexedModelInstances{ pub models:Vec, //may make this into an object later. pub modes:Vec, - pub spawn_point:glam::Vec3, + pub spawn_point:Planar64Vec3, } //stage description referencing flattened ids is spooky, but the map loading is meant to be deterministic. pub struct ModeDescription{ @@ -131,13 +107,13 @@ pub struct ContactingLadder{ //you have this effect while intersecting #[derive(Clone)] pub struct IntersectingWater{ - pub viscosity:i64, - pub density:i64, - pub current:glam::Vec3, + pub viscosity:Planar64, + pub density:Planar64, + pub current:Planar64Vec3, } #[derive(Clone)] pub struct IntersectingAccelerator{ - pub acceleration:glam::Vec3 + pub acceleration:Planar64Vec3 } //All models can be given these attributes #[derive(Clone)] @@ -146,7 +122,7 @@ pub struct GameMechanicJumpLimit{ } #[derive(Clone)] pub struct GameMechanicBooster{ - pub velocity:glam::Vec3, + pub velocity:Planar64Vec3, } #[derive(Clone)] pub enum ZoneBehaviour{ diff --git a/src/model_graphics.rs b/src/model_graphics.rs new file mode 100644 index 0000000..57bbdd8 --- /dev/null +++ b/src/model_graphics.rs @@ -0,0 +1,35 @@ +use bytemuck::{Pod, Zeroable}; +use crate::model::{IndexedVertex,IndexedPolygon}; +#[derive(Clone, Copy, Pod, Zeroable)] +#[repr(C)] +pub struct GraphicsVertex { + pub pos: [f32; 3], + pub tex: [f32; 2], + pub normal: [f32; 3], + pub color: [f32; 4], +} +pub struct IndexedGroupFixedTexture{ + pub polys:Vec, +} +pub struct IndexedModelGraphicsSingleTexture{ + pub unique_pos:Vec<[f32; 3]>, + pub unique_tex:Vec<[f32; 2]>, + pub unique_normal:Vec<[f32; 3]>, + pub unique_color:Vec<[f32; 4]>, + pub unique_vertices:Vec, + pub texture:Option,//RenderPattern? material/texture/shader/flat color + pub groups: Vec, + pub instances:Vec, +} +pub struct ModelGraphicsSingleTexture{ + pub instances: Vec, + pub vertices: Vec, + pub entities: Vec>, + pub texture: Option, +} +#[derive(Clone)] +pub struct ModelGraphicsInstance{ + pub transform:glam::Mat4, + pub normal_transform:glam::Mat3, + pub color:glam::Vec4, +} \ No newline at end of file diff --git a/src/model_physics.rs b/src/model_physics.rs new file mode 100644 index 0000000..ab0c014 --- /dev/null +++ b/src/model_physics.rs @@ -0,0 +1 @@ +// \ No newline at end of file