make it work
This commit is contained in:
parent
ffb20c6dc9
commit
20cc3ef96f
@ -1,4 +1,4 @@
|
||||
use strafesnet_common::model::{Color4,TextureCoordinate,IndexedModel,IndexedPolygon,IndexedGroup,IndexedVertex};
|
||||
use strafesnet_common::model::{Color4,TextureCoordinate,IndexedModel,IndexedGraphicsGroup,IndexedPhysicsGroup,IndexedVertex,PolygonGroupId,PolygonGroup::PolygonList,IndexedVertexList,PositionId,TextureCoordinateId,NormalId,ColorId,VertexId,RenderGroupId};
|
||||
use strafesnet_common::integer::Planar64Vec3;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -126,8 +126,8 @@ const CORNERWEDGE_DEFAULT_NORMALS:[Planar64Vec3;5]=[
|
||||
Planar64Vec3::int( 0,-1, 0),//CornerWedge::Bottom
|
||||
Planar64Vec3::int( 0, 0,-1),//CornerWedge::Front
|
||||
];
|
||||
pub fn unit_sphere()->IndexedModel{
|
||||
unit_cube()
|
||||
pub fn unit_sphere(render:RenderGroupId)->IndexedModel{
|
||||
unit_cube(render)
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct CubeFaceDescription([Option<FaceDescription>;6]);
|
||||
@ -139,18 +139,19 @@ impl CubeFaceDescription{
|
||||
self.0.into_iter().enumerate().filter_map(|v|v.1.map(|u|(v.0,u)))
|
||||
}
|
||||
}
|
||||
pub fn unit_cube()->IndexedModel{
|
||||
pub fn unit_cube(render:RenderGroupId)->IndexedModel{
|
||||
let mut t=CubeFaceDescription::default();
|
||||
t.insert(CubeFace::Right,FaceDescription::default());
|
||||
t.insert(CubeFace::Top,FaceDescription::default());
|
||||
t.insert(CubeFace::Back,FaceDescription::default());
|
||||
t.insert(CubeFace::Left,FaceDescription::default());
|
||||
t.insert(CubeFace::Bottom,FaceDescription::default());
|
||||
t.insert(CubeFace::Front,FaceDescription::default());
|
||||
t.insert(CubeFace::Right,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CubeFace::Top,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CubeFace::Back,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CubeFace::Left,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CubeFace::Bottom,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CubeFace::Front,FaceDescription::new_with_render_id(render));
|
||||
generate_partial_unit_cube(t)
|
||||
}
|
||||
pub fn unit_cylinder()->IndexedModel{
|
||||
unit_cube()
|
||||
pub fn unit_cylinder(render:RenderGroupId)->IndexedModel{
|
||||
//lmao
|
||||
unit_cube(render)
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct WedgeFaceDescription([Option<FaceDescription>;5]);
|
||||
@ -162,13 +163,13 @@ impl WedgeFaceDescription{
|
||||
self.0.into_iter().enumerate().filter_map(|v|v.1.map(|u|(v.0,u)))
|
||||
}
|
||||
}
|
||||
pub fn unit_wedge()->IndexedModel{
|
||||
pub fn unit_wedge(render:RenderGroupId)->IndexedModel{
|
||||
let mut t=WedgeFaceDescription::default();
|
||||
t.insert(WedgeFace::Right,FaceDescription::default());
|
||||
t.insert(WedgeFace::TopFront,FaceDescription::default());
|
||||
t.insert(WedgeFace::Back,FaceDescription::default());
|
||||
t.insert(WedgeFace::Left,FaceDescription::default());
|
||||
t.insert(WedgeFace::Bottom,FaceDescription::default());
|
||||
t.insert(WedgeFace::Right,FaceDescription::new_with_render_id(render));
|
||||
t.insert(WedgeFace::TopFront,FaceDescription::new_with_render_id(render));
|
||||
t.insert(WedgeFace::Back,FaceDescription::new_with_render_id(render));
|
||||
t.insert(WedgeFace::Left,FaceDescription::new_with_render_id(render));
|
||||
t.insert(WedgeFace::Bottom,FaceDescription::new_with_render_id(render));
|
||||
generate_partial_unit_wedge(t)
|
||||
}
|
||||
#[derive(Default)]
|
||||
@ -181,26 +182,26 @@ impl CornerWedgeFaceDescription{
|
||||
self.0.into_iter().enumerate().filter_map(|v|v.1.map(|u|(v.0,u)))
|
||||
}
|
||||
}
|
||||
pub fn unit_cornerwedge()->IndexedModel{
|
||||
pub fn unit_cornerwedge(render:RenderGroupId)->IndexedModel{
|
||||
let mut t=CornerWedgeFaceDescription::default();
|
||||
t.insert(CornerWedgeFace::Right,FaceDescription::default());
|
||||
t.insert(CornerWedgeFace::TopBack,FaceDescription::default());
|
||||
t.insert(CornerWedgeFace::TopLeft,FaceDescription::default());
|
||||
t.insert(CornerWedgeFace::Bottom,FaceDescription::default());
|
||||
t.insert(CornerWedgeFace::Front,FaceDescription::default());
|
||||
t.insert(CornerWedgeFace::Right,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CornerWedgeFace::TopBack,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CornerWedgeFace::TopLeft,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CornerWedgeFace::Bottom,FaceDescription::new_with_render_id(render));
|
||||
t.insert(CornerWedgeFace::Front,FaceDescription::new_with_render_id(render));
|
||||
generate_partial_unit_cornerwedge(t)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FaceDescription{
|
||||
pub texture:Option<u32>,
|
||||
pub render:RenderGroupId,
|
||||
pub transform:glam::Affine2,
|
||||
pub color:Color4,
|
||||
}
|
||||
impl std::default::Default for FaceDescription{
|
||||
fn default()->Self {
|
||||
impl FaceDescription{
|
||||
pub fn new_with_render_id(render:RenderGroupId)->Self {
|
||||
Self{
|
||||
texture:None,
|
||||
render,
|
||||
transform:glam::Affine2::IDENTITY,
|
||||
color:Color4::new(1.0,1.0,1.0,0.0),//zero alpha to hide the default texture
|
||||
}
|
||||
@ -214,7 +215,9 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Indexe
|
||||
let mut generated_normal=Vec::new();
|
||||
let mut generated_color=Vec::new();
|
||||
let mut generated_vertices=Vec::new();
|
||||
let mut groups=Vec::new();
|
||||
let mut polygon_groups=Vec::new();
|
||||
let mut graphics_groups=Vec::new();
|
||||
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
|
||||
let mut transforms=Vec::new();
|
||||
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
|
||||
for (face_id,face_description) in face_descriptions.pairs(){
|
||||
@ -242,32 +245,35 @@ 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
|
||||
groups.push(IndexedGroup{
|
||||
texture:face_description.texture,
|
||||
polys:vec![IndexedPolygon{
|
||||
vertices: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
|
||||
}else{
|
||||
//create new pos_index
|
||||
let pos_index=generated_pos.len();
|
||||
generated_pos.push(pos);
|
||||
pos_index
|
||||
} as u32;
|
||||
//always push vertex
|
||||
let vertex=IndexedVertex{
|
||||
pos:pos_index,
|
||||
tex:tup[1]+4*transform_index,
|
||||
normal:normal_index,
|
||||
color:color_index,
|
||||
};
|
||||
let vert_index=generated_vertices.len();
|
||||
generated_vertices.push(vertex);
|
||||
vert_index as u32
|
||||
}).to_vec(),
|
||||
}],
|
||||
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 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
|
||||
}else{
|
||||
//create new pos_index
|
||||
let pos_index=generated_pos.len();
|
||||
generated_pos.push(pos);
|
||||
pos_index
|
||||
} 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),
|
||||
};
|
||||
let vert_index=generated_vertices.len();
|
||||
generated_vertices.push(vertex);
|
||||
VertexId::id(vert_index as u32)
|
||||
}).to_vec(),
|
||||
}]));
|
||||
graphics_groups.push(IndexedGraphicsGroup{
|
||||
render:face_description.render,
|
||||
groups:vec![group_id],
|
||||
});
|
||||
physics_groups[0].groups.push(group_id);
|
||||
}
|
||||
IndexedModel{
|
||||
unique_pos:generated_pos,
|
||||
@ -275,7 +281,9 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Indexe
|
||||
unique_normal:generated_normal,
|
||||
unique_color:generated_color,
|
||||
unique_vertices:generated_vertices,
|
||||
groups,
|
||||
polygon_groups,
|
||||
graphics_groups,
|
||||
physics_groups,
|
||||
}
|
||||
}
|
||||
//don't think too hard about the copy paste because this is all going into the map tool eventually...
|
||||
@ -320,7 +328,9 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Inde
|
||||
let mut generated_normal=Vec::new();
|
||||
let mut generated_color=Vec::new();
|
||||
let mut generated_vertices=Vec::new();
|
||||
let mut groups=Vec::new();
|
||||
let mut polygon_groups=Vec::new();
|
||||
let mut graphics_groups=Vec::new();
|
||||
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
|
||||
let mut transforms=Vec::new();
|
||||
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
|
||||
for (face_id,face_description) in face_descriptions.pairs(){
|
||||
@ -348,32 +358,35 @@ 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
|
||||
groups.push(IndexedGroup{
|
||||
texture:face_description.texture,
|
||||
polys:vec![IndexedPolygon{
|
||||
vertices: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
|
||||
}else{
|
||||
//create new pos_index
|
||||
let pos_index=generated_pos.len();
|
||||
generated_pos.push(pos);
|
||||
pos_index
|
||||
} as u32;
|
||||
//always push vertex
|
||||
let vertex=IndexedVertex{
|
||||
pos:pos_index,
|
||||
tex:tup[1]+4*transform_index,
|
||||
normal:normal_index,
|
||||
color:color_index,
|
||||
};
|
||||
let vert_index=generated_vertices.len();
|
||||
generated_vertices.push(vertex);
|
||||
vert_index as u32
|
||||
}).collect(),
|
||||
}],
|
||||
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 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
|
||||
}else{
|
||||
//create new pos_index
|
||||
let pos_index=generated_pos.len();
|
||||
generated_pos.push(pos);
|
||||
pos_index
|
||||
} 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),
|
||||
};
|
||||
let vert_index=generated_vertices.len();
|
||||
generated_vertices.push(vertex);
|
||||
VertexId::id(vert_index as u32)
|
||||
}).collect()
|
||||
}]));
|
||||
graphics_groups.push(IndexedGraphicsGroup{
|
||||
render:face_description.render,
|
||||
groups:vec![group_id],
|
||||
});
|
||||
physics_groups[0].groups.push(group_id);
|
||||
}
|
||||
IndexedModel{
|
||||
unique_pos:generated_pos,
|
||||
@ -381,7 +394,9 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Inde
|
||||
unique_normal:generated_normal,
|
||||
unique_color:generated_color,
|
||||
unique_vertices:generated_vertices,
|
||||
groups,
|
||||
polygon_groups,
|
||||
graphics_groups,
|
||||
physics_groups,
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,7 +439,9 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
|
||||
let mut generated_normal=Vec::new();
|
||||
let mut generated_color=Vec::new();
|
||||
let mut generated_vertices=Vec::new();
|
||||
let mut groups=Vec::new();
|
||||
let mut polygon_groups=Vec::new();
|
||||
let mut graphics_groups=Vec::new();
|
||||
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
|
||||
let mut transforms=Vec::new();
|
||||
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
|
||||
for (face_id,face_description) in face_descriptions.pairs(){
|
||||
@ -452,9 +469,8 @@ 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
|
||||
groups.push(IndexedGroup{
|
||||
texture:face_description.texture,
|
||||
polys:vec![IndexedPolygon{
|
||||
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 pos=CUBE_DEFAULT_VERTICES[tup[0] as usize];
|
||||
let pos_index=if let Some(pos_index)=generated_pos.iter().position(|&p|p==pos){
|
||||
@ -467,17 +483,22 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
|
||||
} as u32;
|
||||
//always push vertex
|
||||
let vertex=IndexedVertex{
|
||||
pos:pos_index,
|
||||
tex:tup[1]+4*transform_index,
|
||||
normal:normal_index,
|
||||
color:color_index,
|
||||
pos:PositionId::id(pos_index),
|
||||
tex:TextureCoordinateId::id(tup[1]+4*transform_index),
|
||||
normal:NormalId::id(normal_index),
|
||||
color:ColorId::id(color_index),
|
||||
};
|
||||
let vert_index=generated_vertices.len();
|
||||
generated_vertices.push(vertex);
|
||||
vert_index as u32
|
||||
VertexId::id(vert_index as u32)
|
||||
}).collect(),
|
||||
}],
|
||||
));
|
||||
graphics_groups.push(IndexedGraphicsGroup{
|
||||
render:face_description.render,
|
||||
groups:vec![group_id],
|
||||
});
|
||||
physics_groups[0].groups.push(group_id);
|
||||
}
|
||||
IndexedModel{
|
||||
unique_pos:generated_pos,
|
||||
@ -485,6 +506,8 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
|
||||
unique_normal:generated_normal,
|
||||
unique_color:generated_color,
|
||||
unique_vertices:generated_vertices,
|
||||
groups,
|
||||
polygon_groups,
|
||||
graphics_groups,
|
||||
physics_groups,
|
||||
}
|
||||
}
|
||||
|
65
src/rbx.rs
65
src/rbx.rs
@ -6,6 +6,8 @@ use strafesnet_common::gameplay_modes;
|
||||
use strafesnet_common::gameplay_style;
|
||||
use strafesnet_common::gameplay_attributes as attr;
|
||||
use strafesnet_common::integer::{Planar64,Planar64Vec3,Planar64Mat3,Planar64Affine3};
|
||||
use strafesnet_common::model::RenderConfig;
|
||||
use strafesnet_common::model::RenderGroupId;
|
||||
use strafesnet_common::updatable::Updatable;
|
||||
|
||||
fn class_is_a(class: &str, superclass: &str) -> bool {
|
||||
@ -218,6 +220,7 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana
|
||||
force_can_collide=false;
|
||||
assert!(wormhole_in_model_to_id.insert(model_id,captures[2].parse::<u32>().unwrap()).is_none(),"Impossible");
|
||||
},
|
||||
_=>panic!("regex2[1] messed up bad"),
|
||||
}
|
||||
}else if let Some(captures)=lazy_regex::regex!(r"^Bonus(Finish|Anticheat)(\d+)$")
|
||||
.captures(other){
|
||||
@ -230,7 +233,7 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana
|
||||
match &captures[1]{
|
||||
"Finish"=>gameplay_modes::Zone::Finish,
|
||||
"Anticheat"=>gameplay_modes::Zone::Anticheat,
|
||||
_=>panic!("regex2[1] messed up bad"),
|
||||
_=>panic!("regex3[1] messed up bad"),
|
||||
},
|
||||
),
|
||||
);
|
||||
@ -275,13 +278,13 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana
|
||||
|
||||
struct RobloxAssetId(u64);
|
||||
struct RobloxAssetIdParseErr;
|
||||
impl std::str::FromStr for RobloxAssetId {
|
||||
impl std::str::FromStr for RobloxAssetId{
|
||||
type Err=RobloxAssetIdParseErr;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err>{
|
||||
fn from_str(s:&str)->Result<Self,Self::Err>{
|
||||
let regman=lazy_regex::regex!(r"(\d+)$");
|
||||
if let Some(captures) = regman.captures(s) {
|
||||
if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture
|
||||
if let Ok(id) = captures[0].parse::<u64>() {
|
||||
if let Ok(id) = captures[0].parse::<u64>(){
|
||||
return Ok(Self(id));
|
||||
}
|
||||
}
|
||||
@ -298,12 +301,12 @@ struct RobloxTextureTransform{
|
||||
}
|
||||
impl std::cmp::Eq for RobloxTextureTransform{}//????
|
||||
impl std::default::Default for RobloxTextureTransform{
|
||||
fn default() -> Self {
|
||||
fn default()->Self{
|
||||
Self{offset_u:0.0,offset_v:0.0,scale_u:1.0,scale_v:1.0}
|
||||
}
|
||||
}
|
||||
impl std::hash::Hash for RobloxTextureTransform {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
impl std::hash::Hash for RobloxTextureTransform{
|
||||
fn hash<H:std::hash::Hasher>(&self,state:&mut H) {
|
||||
self.offset_u.to_ne_bytes().hash(state);
|
||||
self.offset_v.to_ne_bytes().hash(state);
|
||||
self.scale_u.to_ne_bytes().hash(state);
|
||||
@ -312,16 +315,16 @@ impl std::hash::Hash for RobloxTextureTransform {
|
||||
}
|
||||
#[derive(Clone,PartialEq)]
|
||||
struct RobloxFaceTextureDescription{
|
||||
texture:u32,
|
||||
render:RenderGroupId,
|
||||
color:glam::Vec4,
|
||||
transform:RobloxTextureTransform,
|
||||
}
|
||||
impl std::cmp::Eq for RobloxFaceTextureDescription{}//????
|
||||
impl std::hash::Hash for RobloxFaceTextureDescription {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.texture.hash(state);
|
||||
impl std::hash::Hash for RobloxFaceTextureDescription{
|
||||
fn hash<H:std::hash::Hasher>(&self,state:&mut H){
|
||||
self.render.hash(state);
|
||||
self.transform.hash(state);
|
||||
for &el in self.color.as_ref().iter() {
|
||||
for &el in self.color.as_ref().iter(){
|
||||
el.to_ne_bytes().hash(state);
|
||||
}
|
||||
}
|
||||
@ -329,7 +332,7 @@ impl std::hash::Hash for RobloxFaceTextureDescription {
|
||||
impl RobloxFaceTextureDescription{
|
||||
fn to_face_description(&self)->primitives::FaceDescription{
|
||||
primitives::FaceDescription{
|
||||
texture:Some(self.texture),
|
||||
render:self.render,
|
||||
transform:glam::Affine2::from_translation(
|
||||
glam::vec2(self.transform.offset_u,self.transform.offset_v)
|
||||
)
|
||||
@ -362,7 +365,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
|
||||
let mut models1=Vec::new();
|
||||
let mut indexed_models=Vec::new();
|
||||
let mut indexed_model_id_from_description=std::collections::HashMap::new();
|
||||
let mut indexed_model_id_from_description=HashMap::new();
|
||||
|
||||
let mut unique_attributes=Vec::new();
|
||||
let mut attributes_id_from_attributes=HashMap::new();
|
||||
@ -370,8 +373,11 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
let mut wormhole_in_model_to_id=HashMap::new();
|
||||
let mut wormhole_id_to_out_model=HashMap::new();
|
||||
|
||||
let mut texture_id_from_asset_id=std::collections::HashMap::<u64,u32>::new();
|
||||
let mut asset_id_from_texture_id=Vec::new();
|
||||
//TODO: some sort of thing like RobloxResources that describes where to get each resource
|
||||
//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::<u64,RenderGroupId>::new();
|
||||
let textureless_render_group=RenderGroupId::id(0);
|
||||
|
||||
let mut object_refs=Vec::new();
|
||||
let mut temp_objects=Vec::new();
|
||||
@ -500,14 +506,17 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
decal.properties.get("Transparency"),
|
||||
) {
|
||||
if let Ok(asset_id)=content.clone().into_string().parse::<RobloxAssetId>(){
|
||||
let texture_id=if let Some(&texture_id)=texture_id_from_asset_id.get(&asset_id.0){
|
||||
texture_id
|
||||
let render_id=textureless_render_group;
|
||||
/*
|
||||
let render_id=if let Some(&render_id)=render_id_from_asset_id.get(&asset_id.0){
|
||||
render_id
|
||||
}else{
|
||||
let texture_id=asset_id_from_texture_id.len() as u32;
|
||||
texture_id_from_asset_id.insert(asset_id.0,texture_id);
|
||||
asset_id_from_texture_id.push(asset_id.0);
|
||||
texture_id
|
||||
let render_id=RenderGroupId::id(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
|
||||
};
|
||||
*/
|
||||
let normal_id=normalid.to_u32();
|
||||
if normal_id<6{
|
||||
let (roblox_texture_color,roblox_texture_transform)=if decal.class=="Texture"{
|
||||
@ -547,7 +556,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
(glam::Vec4::ONE,RobloxTextureTransform::default())
|
||||
};
|
||||
part_texture_description[normal_id as usize]=Some(RobloxFaceTextureDescription{
|
||||
texture:texture_id,
|
||||
render:render_id,
|
||||
color:roblox_texture_color,
|
||||
transform:roblox_texture_transform,
|
||||
});
|
||||
@ -613,7 +622,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
},
|
||||
match roblox_face_description{
|
||||
Some(roblox_texture_transform)=>roblox_texture_transform.to_face_description(),
|
||||
None=>primitives::FaceDescription::default(),
|
||||
None=>primitives::FaceDescription::new_with_render_id(textureless_render_group),
|
||||
});
|
||||
}
|
||||
primitives::generate_partial_unit_cube(cube_face_description)
|
||||
@ -632,7 +641,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
},
|
||||
match roblox_face_description{
|
||||
Some(roblox_texture_transform)=>roblox_texture_transform.to_face_description(),
|
||||
None=>primitives::FaceDescription::default(),
|
||||
None=>primitives::FaceDescription::new_with_render_id(textureless_render_group),
|
||||
});
|
||||
}
|
||||
primitives::generate_partial_unit_wedge(wedge_face_description)
|
||||
@ -651,7 +660,7 @@ pub fn convert(dom:rbx_dom_weak::WeakDom)->map::Map{
|
||||
},
|
||||
match roblox_face_description{
|
||||
Some(roblox_texture_transform)=>roblox_texture_transform.to_face_description(),
|
||||
None=>primitives::FaceDescription::default(),
|
||||
None=>primitives::FaceDescription::new_with_render_id(textureless_render_group),
|
||||
});
|
||||
}
|
||||
primitives::generate_partial_unit_cornerwedge(cornerwedge_face_description)
|
||||
@ -696,8 +705,8 @@ 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::new(unique_attributes.len() as u32);
|
||||
attributes_id_from_attributes.insert(model1.attributes,attributes_id);
|
||||
let attributes_id=attr::CollisionAttributesId::id(unique_attributes.len() as u32);
|
||||
attributes_id_from_attributes.insert(model1.attributes.clone(),attributes_id);
|
||||
unique_attributes.push(model1.attributes);
|
||||
attributes_id
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user