Wipe tower rotation around center point

This commit is contained in:
Lukas Matena 2017-12-05 11:25:38 +01:00
parent cb84a6cfce
commit c34fd10e23
5 changed files with 52 additions and 40 deletions

View file

@ -306,8 +306,11 @@ int GLVolumeCollection::load_wipe_tower_preview(
float color[4] = { 1.0f, 1.0f, 0.0f, 0.5f };
this->volumes.emplace_back(new GLVolume(color));
GLVolume &v = *this->volumes.back();
auto mesh = make_cube(width, depth, height);
mesh.rotate_z(rotation_angle*M_PI/180.);
auto mesh = make_cube(width, depth, height);
mesh.translate(-width/2.f,-depth/2.f,0.f);
Point origin_of_rotation(0.f,0.f);
mesh.rotate(rotation_angle,&origin_of_rotation);
v.indexed_vertex_array.load_mesh_flat_shading(mesh);
v.origin = Pointf3(pos_x, pos_y, 0.);
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().