mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 01:37:53 -06:00
Tech ENABLE_LEGACY_OPENGL_REMOVAL - Fixed calculation of normal matrices sent to shaders
(cherry picked from commit prusa3d/PrusaSlicer@c468dcbed7)
This commit is contained in:
parent
4fb5b1f904
commit
19ad0ca4d9
29 changed files with 175 additions and 152 deletions
|
@ -912,13 +912,14 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||
glcheck();
|
||||
|
||||
volume.first->model.set_color(volume.first->render_color);
|
||||
const Transform3d matrix = view_matrix * volume.first->world_matrix();
|
||||
shader->set_uniform("view_model_matrix", matrix);
|
||||
const Transform3d model_matrix = volume.first->world_matrix();
|
||||
shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
|
||||
shader->set_uniform("projection_matrix", projection_matrix);
|
||||
shader->set_uniform("normal_matrix", (Matrix3d)matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
|
||||
//BBS: add outline related logic
|
||||
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
|
||||
shader->set_uniform("view_normal_matrix", view_normal_matrix);
|
||||
//BBS: add outline related logic
|
||||
if (with_outline && volume.first->selected)
|
||||
volume.first->render_with_outline(matrix);
|
||||
volume.first->render_with_outline(view_matrix * model_matrix);
|
||||
else
|
||||
volume.first->render();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue