MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / edit

Method edit

gui/mesh_previewer.cpp:102–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void MeshPreviewer::edit(Ref<Mesh> p_mesh) {
103 mesh = p_mesh;
104 mesh_instance->set_mesh(mesh);
105
106 rot_x = Math::deg_to_rad(-15.0);
107 rot_y = Math::deg_to_rad(30.0);
108 scale = Vector3(1.0, 1.0, 1.0);
109 _update_rotation();
110
111 AABB aabb = mesh->get_aabb();
112 Vector3 ofs = aabb.get_center();
113 float m = aabb.get_longest_axis_size();
114 if (m != 0) {
115 m = 1.0 / m;
116 m *= 0.5;
117 Transform3D xform;
118 xform.basis.scale(Vector3(m, m, m));
119 xform.origin = -xform.basis.xform(ofs); //-ofs*m;
120 //xform.origin.z -= aabb.get_longest_axis_size() * 2;
121 mesh_instance->set_transform(xform);
122 }
123}
124
125void MeshPreviewer::reset() {
126 mesh_instance->set_transform(Transform3D());

Callers

nothing calls this directly

Calls 1

get_aabbMethod · 0.80

Tested by

no test coverage detected