diff --git a/Cargo.lock b/Cargo.lock index 25c472d..8db2db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,6 +98,16 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +[[package]] +name = "id" +version = "0.1.0" +source = "git+https://git.itzana.me/Quaternions/id?rev=faca9fb6a8eb0c7f0e2796fbfad9eac16875cbd6#faca9fb6a8eb0c7f0e2796fbfad9eac16875cbd6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "lazy-regex" version = "3.1.0" @@ -410,9 +420,10 @@ dependencies = [ [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=5efdd3654ad64666584bdeed65fdc867a946b223#5efdd3654ad64666584bdeed65fdc867a946b223" +source = "git+https://git.itzana.me/StrafesNET/common?rev=ec59d251d2c9f3a6e719dc47924b6ea998ad7bc3#ec59d251d2c9f3a6e719dc47924b6ea998ad7bc3" dependencies = [ "glam", + "id", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 32fa82d..6dfea66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,4 @@ rbx_binary = "0.7.4" rbx_dom_weak = "2.7.0" rbx_reflection_database = "0.2.10" rbx_xml = "0.13.3" -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "5efdd3654ad64666584bdeed65fdc867a946b223" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "ec59d251d2c9f3a6e719dc47924b6ea998ad7bc3" } diff --git a/src/primitives.rs b/src/primitives.rs index ff0efef..ffd2695 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -245,9 +245,9 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Indexe let normal_index=generated_normal.len() as u32; generated_normal.push(CUBE_DEFAULT_NORMALS[face_id]); //push vertices as they are needed - let group_id=PolygonGroupId::id(polygon_groups.len() as u32); - polygon_groups.push(PolygonList(vec![IndexedVertexList{ - vertices:CUBE_DEFAULT_POLYS[face_id].map(|tup|{ + let group_id=PolygonGroupId::new(polygon_groups.len() as u32); + polygon_groups.push(PolygonList(vec![IndexedVertexList::new( + CUBE_DEFAULT_POLYS[face_id].map(|tup|{ let pos=CUBE_DEFAULT_VERTICES[tup[0] as usize]; let pos_index=if let Some(pos_index)=generated_pos.iter().position(|&p|p==pos){ pos_index @@ -259,16 +259,16 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Indexe } as u32; //always push vertex let vertex=IndexedVertex{ - pos:PositionId::id(pos_index), - tex:TextureCoordinateId::id(tup[1]+4*transform_index), - normal:NormalId::id(normal_index), - color:ColorId::id(color_index), + pos:PositionId::new(pos_index), + tex:TextureCoordinateId::new(tup[1]+4*transform_index), + normal:NormalId::new(normal_index), + color:ColorId::new(color_index), }; let vert_index=generated_vertices.len(); generated_vertices.push(vertex); - VertexId::id(vert_index as u32) + VertexId::new(vert_index as u32) }).to_vec(), - }])); + )])); graphics_groups.push(IndexedGraphicsGroup{ render:face_description.render, groups:vec![group_id], @@ -358,9 +358,9 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Inde let normal_index=generated_normal.len() as u32; generated_normal.push(WEDGE_DEFAULT_NORMALS[face_id]); //push vertices as they are needed - let group_id=PolygonGroupId::id(polygon_groups.len() as u32); - polygon_groups.push(PolygonList(vec![IndexedVertexList{ - vertices:wedge_default_polys[face_id].iter().map(|tup|{ + let group_id=PolygonGroupId::new(polygon_groups.len() as u32); + polygon_groups.push(PolygonList(vec![IndexedVertexList::new( + wedge_default_polys[face_id].iter().map(|tup|{ let pos=CUBE_DEFAULT_VERTICES[tup[0] as usize]; let pos_index=if let Some(pos_index)=generated_pos.iter().position(|&p|p==pos){ pos_index @@ -372,16 +372,16 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Inde } as u32; //always push vertex let vertex=IndexedVertex{ - pos:PositionId::id(pos_index), - tex:TextureCoordinateId::id(tup[1]+4*transform_index), - normal:NormalId::id(normal_index), - color:ColorId::id(color_index), + pos:PositionId::new(pos_index), + tex:TextureCoordinateId::new(tup[1]+4*transform_index), + normal:NormalId::new(normal_index), + color:ColorId::new(color_index), }; let vert_index=generated_vertices.len(); generated_vertices.push(vertex); - VertexId::id(vert_index as u32) + VertexId::new(vert_index as u32) }).collect() - }])); + )])); graphics_groups.push(IndexedGraphicsGroup{ render:face_description.render, groups:vec![group_id], @@ -469,9 +469,9 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri let normal_index=generated_normal.len() as u32; generated_normal.push(CORNERWEDGE_DEFAULT_NORMALS[face_id]); //push vertices as they are needed - let group_id=PolygonGroupId::id(polygon_groups.len() as u32); - polygon_groups.push(PolygonList(vec![IndexedVertexList{ - vertices:cornerwedge_default_polys[face_id].iter().map(|tup|{ + let group_id=PolygonGroupId::new(polygon_groups.len() as u32); + polygon_groups.push(PolygonList(vec![IndexedVertexList::new( + cornerwedge_default_polys[face_id].iter().map(|tup|{ let pos=CUBE_DEFAULT_VERTICES[tup[0] as usize]; let pos_index=if let Some(pos_index)=generated_pos.iter().position(|&p|p==pos){ pos_index @@ -483,16 +483,16 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri } as u32; //always push vertex let vertex=IndexedVertex{ - pos:PositionId::id(pos_index), - tex:TextureCoordinateId::id(tup[1]+4*transform_index), - normal:NormalId::id(normal_index), - color:ColorId::id(color_index), + pos:PositionId::new(pos_index), + tex:TextureCoordinateId::new(tup[1]+4*transform_index), + normal:NormalId::new(normal_index), + color:ColorId::new(color_index), }; let vert_index=generated_vertices.len(); generated_vertices.push(vertex); - VertexId::id(vert_index as u32) + VertexId::new(vert_index as u32) }).collect(), - }], + )], )); graphics_groups.push(IndexedGraphicsGroup{ render:face_description.render, diff --git a/src/rbx.rs b/src/rbx.rs index a3d1ff4..2c13e9e 100644 --- a/src/rbx.rs +++ b/src/rbx.rs @@ -77,14 +77,14 @@ impl ModesBuilder{ unique_stages.into_iter().enumerate() .map(|(final_stage_id,(builder_stage_id,stage))|{ mode.push_stage(stage); - (builder_stage_id,gameplay_modes::StageId::id(final_stage_id as u32)) + (builder_stage_id,gameplay_modes::StageId::new(final_stage_id as u32)) }).collect() }), mode, }, ( builder_mode_id, - gameplay_modes::ModeId::id(final_mode_id as u32) + gameplay_modes::ModeId::new(final_mode_id as u32) ) ) }).unzip(); @@ -226,7 +226,7 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana .captures(other){ force_can_collide=false; modes_builder.push_mode_update( - gameplay_modes::ModeId::id(captures[2].parse::().unwrap()), + gameplay_modes::ModeId::new(captures[2].parse::().unwrap()), gameplay_modes::ModeUpdate::zone( model_id, //zone: @@ -243,7 +243,7 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana // match &captures[1]{ // "OrderedCheckpoint"=>modes_builder.push_stage_update( // gameplay_modes::ModeId::MAIN, - // gameplay_modes::StageId::id(0), + // gameplay_modes::StageId::new(0), // gameplay_modes::StageUpdate::ordered_checkpoint(captures[2].parse::().unwrap()), // ), // _=>panic!("regex3[1] messed up bad"), @@ -377,7 +377,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ //this would be another dependency built for downloading resources to keep this one clean let mut unique_render_groups=vec![RenderConfig::default()]; let mut render_id_from_asset_id=HashMap::::new(); - let textureless_render_group=RenderGroupId::id(0); + let textureless_render_group=RenderGroupId::new(0); let mut object_refs=Vec::new(); let mut temp_objects=Vec::new(); @@ -415,7 +415,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ } //at this point a new model is going to be generated for sure. - let model_id=model::ModelId::id(models1.len() as u32); + let model_id=model::ModelId::new(models1.len() as u32); let force_intersecting=match &object.name[..]{ "MapStart"=>{ @@ -434,7 +434,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ match &captures[1]{ "BonusStart"=>{ modes_builder.insert_mode( - gameplay_modes::ModeId::id(captures[2].parse::().unwrap()), + gameplay_modes::ModeId::new(captures[2].parse::().unwrap()), gameplay_modes::Mode::new( gameplay_style::StyleModifiers::roblox_bhop(), model_id @@ -445,7 +445,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ "Spawn"=>{ modes_builder.insert_stage( gameplay_modes::ModeId::MAIN, - gameplay_modes::StageId::id(captures[2].parse::().unwrap()), + gameplay_modes::StageId::new(captures[2].parse::().unwrap()), gameplay_modes::Stage::new(model_id), ); true @@ -511,7 +511,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ let render_id=if let Some(&render_id)=render_id_from_asset_id.get(&asset_id.0){ render_id }else{ - let render_id=RenderGroupId::id(unique_render_groups.len() as u32); + let render_id=RenderGroupId::new(unique_render_groups.len() as u32); render_id_from_asset_id.insert(asset_id.0,render_id); unique_render_groups.push(RenderConfig::texture(asset_id.0)); render_id @@ -602,7 +602,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ //push to existing texture model indexed_model_id }else{ - let indexed_model_id=model::IndexedModelId::id(indexed_models.len() as u32); + let indexed_model_id=model::IndexedModelId::new(indexed_models.len() as u32); indexed_model_id_from_description.insert(basepart_texture_description.clone(),indexed_model_id);//borrow checker going crazy indexed_models.push(match basepart_texture_description{ RobloxBasePartDescription::Sphere(part_texture_description) @@ -687,7 +687,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ } } let models=models1.into_iter().enumerate().map(|(model_id,mut model1)|{ - let model_id=model::ModelId::id(model_id as u32); + let model_id=model::ModelId::new(model_id as u32); //update attributes with wormhole id //TODO: errors/prints if let Some(wormhole_id)=wormhole_in_model_to_id.get(&model_id){ @@ -705,7 +705,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ let attributes_id=if let Some(&attributes_id)=attributes_id_from_attributes.get(&model1.attributes){ attributes_id }else{ - let attributes_id=attr::CollisionAttributesId::id(unique_attributes.len() as u32); + let attributes_id=attr::CollisionAttributesId::new(unique_attributes.len() as u32); attributes_id_from_attributes.insert(model1.attributes.clone(),attributes_id); unique_attributes.push(model1.attributes); attributes_id @@ -721,7 +721,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{ textures:Vec::new(),//asset_id_from_texture_id.iter().map(|t|t.to_string()).collect(), indexed_models:indexed_models.into_iter().enumerate() .map(|(indexed_model_id,indexed_model)| - (model::IndexedModelId::id(indexed_model_id as u32),indexed_model) + (model::IndexedModelId::new(indexed_model_id as u32),indexed_model) ).collect(), models, modes:modes_builder.build(),