mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Refactoring into rendering pipeline
This commit is contained in:
parent
9bcdb2ebd0
commit
77857f7292
4 changed files with 11 additions and 30 deletions
|
@ -266,6 +266,8 @@ void Bed3D::render(GLCanvas3D& canvas, float theta, float scale_factor) const
|
|||
{
|
||||
m_scale_factor = scale_factor;
|
||||
|
||||
render_axes();
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
case MK2:
|
||||
|
@ -292,12 +294,6 @@ void Bed3D::render(GLCanvas3D& canvas, float theta, float scale_factor) const
|
|||
}
|
||||
}
|
||||
|
||||
void Bed3D::render_axes() const
|
||||
{
|
||||
if (!m_shape.empty())
|
||||
m_axes.render();
|
||||
}
|
||||
|
||||
void Bed3D::calc_bounding_boxes() const
|
||||
{
|
||||
m_bounding_box = BoundingBoxf3();
|
||||
|
@ -393,6 +389,12 @@ Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const
|
|||
return type;
|
||||
}
|
||||
|
||||
void Bed3D::render_axes() const
|
||||
{
|
||||
if (!m_shape.empty())
|
||||
m_axes.render();
|
||||
}
|
||||
|
||||
void Bed3D::render_prusa(GLCanvas3D& canvas, const std::string& key, bool bottom) const
|
||||
{
|
||||
if (!bottom)
|
||||
|
@ -598,9 +600,7 @@ void Bed3D::render_default(bool bottom) const
|
|||
{
|
||||
bool has_model = !m_model.get_filename().empty();
|
||||
|
||||
glsafe(::glEnable(GL_LIGHTING));
|
||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
glsafe(::glEnable(GL_BLEND));
|
||||
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
||||
|
||||
|
@ -615,11 +615,7 @@ void Bed3D::render_default(bool bottom) const
|
|||
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount));
|
||||
}
|
||||
|
||||
glsafe(::glDisable(GL_LIGHTING));
|
||||
|
||||
// draw grid
|
||||
// we need depth test for grid, otherwise it would disappear when looking the object from below
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
glsafe(::glLineWidth(3.0f * m_scale_factor));
|
||||
if (has_model && !bottom)
|
||||
glsafe(::glColor4f(0.75f, 0.75f, 0.75f, 1.0f));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue