I was just stupid the whole time
This commit is contained in:
parent
ed96572a24
commit
bfd6f4493f
@ -315,14 +315,32 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//obscure rust syntax "slice pattern"
|
//obscure rust syntax "slice pattern"
|
||||||
let [f0,f1,f2,f3,f4,f5]=part_texture_description;
|
let [
|
||||||
|
f0,//Cube::Right
|
||||||
|
f1,//Cube::Top
|
||||||
|
f2,//Cube::Back
|
||||||
|
f3,//Cube::Left
|
||||||
|
f4,//Cube::Bottom
|
||||||
|
f5,//Cube::Front
|
||||||
|
]=part_texture_description;
|
||||||
let basepart_texture_description=match shape{
|
let basepart_texture_description=match shape{
|
||||||
primitives::Primitives::Sphere=>RobloxBasePartDescription::Sphere,
|
primitives::Primitives::Sphere=>RobloxBasePartDescription::Sphere,
|
||||||
primitives::Primitives::Cube=>RobloxBasePartDescription::Part([f0,f1,f2,f3,f4,f5]),
|
primitives::Primitives::Cube=>RobloxBasePartDescription::Part([f0,f1,f2,f3,f4,f5]),
|
||||||
primitives::Primitives::Cylinder=>RobloxBasePartDescription::Cylinder,
|
primitives::Primitives::Cylinder=>RobloxBasePartDescription::Cylinder,
|
||||||
//use front face texture first and use top face texture as a fallback
|
//use front face texture first and use top face texture as a fallback
|
||||||
primitives::Primitives::Wedge=>RobloxBasePartDescription::Wedge([f0,if f2.is_some(){f2}else{f1},f3,f4,f5]),
|
primitives::Primitives::Wedge=>RobloxBasePartDescription::Wedge([
|
||||||
primitives::Primitives::CornerWedge=>RobloxBasePartDescription::CornerWedge([f1,f3,f4,f5]),
|
f0,//Wedge::Right
|
||||||
|
if f5.is_some(){f5}else{f1},//Wedge::TopFront
|
||||||
|
f2,//Wedge::Back
|
||||||
|
f3,//Wedge::Left
|
||||||
|
f4,//Wedge::Bottom
|
||||||
|
]),
|
||||||
|
primitives::Primitives::CornerWedge=>RobloxBasePartDescription::CornerWedge([
|
||||||
|
f0,//CornerWedge::Right
|
||||||
|
f1,//CornerWedge::Top
|
||||||
|
f4,//CornerWedge::Bottom
|
||||||
|
f5,//CornerWedge::Front
|
||||||
|
]),
|
||||||
};
|
};
|
||||||
//make new model if unit cube has not been created before
|
//make new model if unit cube has not been created before
|
||||||
let model_id=if let Some(&model_id)=model_id_from_description.get(&basepart_texture_description){
|
let model_id=if let Some(&model_id)=model_id_from_description.get(&basepart_texture_description){
|
||||||
|
@ -113,11 +113,11 @@ pub enum CornerWedgeFace{
|
|||||||
Front,
|
Front,
|
||||||
}
|
}
|
||||||
const CORNERWEDGE_DEFAULT_NORMALS:[[f32;3];5]=[
|
const CORNERWEDGE_DEFAULT_NORMALS:[[f32;3];5]=[
|
||||||
[ 1., 0., 0.],//Wedge::Right
|
[ 1., 0., 0.],//CornerWedge::Right
|
||||||
[ 0., 1., 1.],//Wedge::BackTop
|
[ 0., 1., 1.],//CornerWedge::BackTop
|
||||||
[-1., 1., 0.],//Wedge::LeftTop
|
[-1., 1., 0.],//CornerWedge::LeftTop
|
||||||
[ 0.,-1., 0.],//Wedge::Bottom
|
[ 0.,-1., 0.],//CornerWedge::Bottom
|
||||||
[ 0., 0.,-1.],//Wedge::Front
|
[ 0., 0.,-1.],//CornerWedge::Front
|
||||||
];
|
];
|
||||||
//HashMap fits this use case perfectly but feels like using a sledgehammer to drive a nail
|
//HashMap fits this use case perfectly but feels like using a sledgehammer to drive a nail
|
||||||
pub fn unit_sphere()->crate::model::IndexedModel{
|
pub fn unit_sphere()->crate::model::IndexedModel{
|
||||||
|
Loading…
Reference in New Issue
Block a user