From d86aed5ae12e68de929a2531e50b9b8623da3330 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 30 Sep 2023 17:59:40 -0700 Subject: [PATCH] teapot transform --- src/primitives.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/primitives.rs b/src/primitives.rs index 53be8cb2..bdda6cbc 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -140,12 +140,11 @@ pub fn unit_cube()->crate::model::IndexedModel{ t.insert(CubeFace::Front,FaceDescription::default()); generate_partial_unit_cube(t) } +const TEAPOT_TRANSFORM:glam::Mat3=glam::mat3(glam::vec3(0.0,0.1,0.0),glam::vec3(-0.1,0.0,0.0),glam::vec3(0.0,0.0,0.1)); pub fn unit_cylinder()->crate::model::IndexedModel{ let mut indexed_model=crate::model::generate_indexed_model_list_from_obj(obj::ObjData::load_buf(&include_bytes!("../models/teapot.obj")[..]).unwrap(),*glam::Vec4::ONE.as_ref()).remove(0); for pos in indexed_model.unique_pos.iter_mut(){ - pos[0]=pos[0]*0.1; - pos[1]=pos[1]*0.1; - pos[2]=pos[2]*0.1; + [pos[0],pos[1],pos[2]]=*(TEAPOT_TRANSFORM*glam::Vec3::from_array(*pos)).as_ref(); } indexed_model }