mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 22:14:00 -06:00
FIX:The mirrored patch normal vector needs to be reversed
Change-Id: I3a67322eb59355ed91d1af390eb34f7f3d378198 (cherry picked from commit 3187f2b7944ddd2b9b6dc621da07dac6d4b3b31f)
This commit is contained in:
parent
aa82c67e5f
commit
def87a59c0
2 changed files with 13 additions and 16 deletions
|
@ -44,27 +44,24 @@ void main()
|
|||
float alpha = uniform_color.a;
|
||||
|
||||
vec3 triangle_normal = normalize(cross(dFdx(model_pos.xyz), dFdy(model_pos.xyz)));
|
||||
#ifdef FLIP_TRIANGLE_NORMALS
|
||||
triangle_normal = -triangle_normal;
|
||||
#endif
|
||||
|
||||
if (volume_mirrored)
|
||||
{
|
||||
triangle_normal = -triangle_normal;
|
||||
}
|
||||
vec3 transformed_normal = normalize(slope.volume_world_normal_matrix * triangle_normal);
|
||||
|
||||
if (slope.actived) {
|
||||
if(world_pos.z<0.1&&world_pos.z>-0.1)
|
||||
if(world_pos.z<0.1&&world_pos.z>-0.1)
|
||||
{
|
||||
color = LightBlue;
|
||||
alpha = 1.0;
|
||||
color = LightBlue;
|
||||
alpha = 1.0;
|
||||
}
|
||||
else if( transformed_normal.z < slope.normal_z - EPSILON)
|
||||
{
|
||||
color = color * 0.5 + LightRed * 0.5;
|
||||
alpha = 1.0;
|
||||
}
|
||||
{
|
||||
color = color * 0.5 + LightRed * 0.5;
|
||||
alpha = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (volume_mirrored)
|
||||
triangle_normal = -triangle_normal;
|
||||
|
||||
// First transform the normal into camera space and normalize the result.
|
||||
vec3 eye_normal = normalize(gl_NormalMatrix * triangle_normal);
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
|
|||
shader->set_uniform("volume_world_matrix", trafo_matrix);
|
||||
shader->set_uniform("volume_mirrored", is_left_handed);
|
||||
shader->set_uniform("slope.actived", m_parent.is_using_slope());
|
||||
shader->set_uniform("slope.volume_world_normal_matrix", static_cast<Matrix3f>(trafo_matrix.matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>()));
|
||||
shader->set_uniform("slope.volume_world_normal_matrix", normal_matrix);
|
||||
shader->set_uniform("slope.normal_z", normal_z);
|
||||
m_triangle_selectors[mesh_id]->render(m_imgui);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue