mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 02:16:07 +08:00
@Enrico's patch for transparent objects
This commit is contained in:
parent
da0d889986
commit
1f03663b3a
@ -1098,9 +1098,15 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||||||
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("flat");
|
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("flat");
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
|
ScopeGuard transparent_sg;
|
||||||
if (type == ERenderType::Transparent) {
|
if (type == ERenderType::Transparent) {
|
||||||
glsafe(::glEnable(GL_BLEND));
|
glsafe(::glEnable(GL_BLEND));
|
||||||
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
||||||
|
glsafe(::glDepthMask(false));
|
||||||
|
transparent_sg = ScopeGuard([]() {
|
||||||
|
glsafe(::glDisable(GL_BLEND));
|
||||||
|
glsafe(::glDepthMask(true));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
glsafe(::glCullFace(GL_BACK));
|
glsafe(::glCullFace(GL_BACK));
|
||||||
@ -1233,9 +1239,6 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||||||
|
|
||||||
if (disable_cullface)
|
if (disable_cullface)
|
||||||
glsafe(::glEnable(GL_CULL_FACE));
|
glsafe(::glEnable(GL_CULL_FACE));
|
||||||
|
|
||||||
if (type == ERenderType::Transparent)
|
|
||||||
glsafe(::glDisable(GL_BLEND));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state) const
|
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user