mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 04:49:01 +08:00
Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - Use vertex attributes and matrices in shaders.
Shader: gouraud_light - GCodeViewer shells
This commit is contained in:
parent
8d43a854c6
commit
3003db411f
@ -714,7 +714,14 @@ void GLVolume::render()
|
|||||||
glsafe(::glCullFace(GL_BACK));
|
glsafe(::glCullFace(GL_BACK));
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
bool use_attributes = boost::algorithm::iends_with(shader->get_name(), "_attr");
|
bool use_attributes = boost::algorithm::iends_with(shader->get_name(), "_attr");
|
||||||
if (!use_attributes) {
|
if (use_attributes) {
|
||||||
|
const GUI::Camera& camera = GUI::wxGetApp().plater()->get_camera();
|
||||||
|
const Transform3d matrix = camera.get_view_matrix() * world_matrix();
|
||||||
|
shader->set_uniform("view_model_matrix", matrix);
|
||||||
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
|
shader->set_uniform("normal_matrix", (Matrix3d)matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
|
||||||
|
}
|
||||||
|
else {
|
||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glMultMatrixd(world_matrix().data()));
|
glsafe(::glMultMatrixd(world_matrix().data()));
|
||||||
|
@ -3235,7 +3235,11 @@ void GCodeViewer::render_shells()
|
|||||||
if (!m_shells.visible || m_shells.volumes.empty())
|
if (!m_shells.visible || m_shells.volumes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light_attr");
|
||||||
|
#else
|
||||||
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||||
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user