ENABLE_SLOPE_RENDERING - Do not apply slope shading to modifiers and small refactoring
This commit is contained in:
parent
5378b18f18
commit
abcd01d64a
@ -684,11 +684,8 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||
glsafe(::glUniform4fv(clipping_plane_id, 1, (const GLfloat*)m_clipping_plane));
|
||||
|
||||
#if ENABLE_SLOPE_RENDERING
|
||||
if (slope_active_id != -1)
|
||||
glsafe(::glUniform1i(slope_active_id, type == Opaque && m_slope_active ? 1 : 0));
|
||||
|
||||
if (slope_z_range_id != -1)
|
||||
glsafe(::glUniform2fv(slope_z_range_id, 1, (const GLfloat*)m_slope_z_range.data()));
|
||||
glsafe(::glUniform2fv(slope_z_range_id, 1, (const GLfloat*)m_slope.z_range.data()));
|
||||
#endif // ENABLE_SLOPE_RENDERING
|
||||
|
||||
GLVolumeWithIdAndZList to_render = volumes_to_render(this->volumes, type, view_matrix, filter_func);
|
||||
@ -706,6 +703,9 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||
if (print_box_worldmatrix_id != -1)
|
||||
glsafe(::glUniformMatrix4fv(print_box_worldmatrix_id, 1, GL_FALSE, (const GLfloat*)volume.first->world_matrix().cast<float>().data()));
|
||||
|
||||
if (slope_active_id != -1)
|
||||
glsafe(::glUniform1i(slope_active_id, m_slope.active && !volume.first->is_modifier && !volume.first->is_wipe_tower ? 1 : 0));
|
||||
|
||||
if (slope_normal_matrix_id != -1)
|
||||
{
|
||||
Matrix3f normal_matrix = volume.first->world_matrix().matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>();
|
||||
|
@ -497,10 +497,15 @@ private:
|
||||
float m_clipping_plane[4];
|
||||
|
||||
#if ENABLE_SLOPE_RENDERING
|
||||
// toggle for slope rendering
|
||||
bool m_slope_active { false };
|
||||
// [0] = yellow, [1] = red
|
||||
std::array<float, 2> m_slope_z_range;
|
||||
struct Slope
|
||||
{
|
||||
// toggle for slope rendering
|
||||
bool active{ false };
|
||||
// [0] = yellow, [1] = red
|
||||
std::array<float, 2> z_range;
|
||||
};
|
||||
|
||||
Slope m_slope;
|
||||
#endif // ENABLE_SLOPE_RENDERING
|
||||
|
||||
public:
|
||||
@ -570,12 +575,12 @@ public:
|
||||
void set_clipping_plane(const double* coeffs) { m_clipping_plane[0] = coeffs[0]; m_clipping_plane[1] = coeffs[1]; m_clipping_plane[2] = coeffs[2]; m_clipping_plane[3] = coeffs[3]; }
|
||||
|
||||
#if ENABLE_SLOPE_RENDERING
|
||||
bool is_slope_active() const { return m_slope_active; }
|
||||
void set_slope_active(bool active) { m_slope_active = active; }
|
||||
bool is_slope_active() const { return m_slope.active; }
|
||||
void set_slope_active(bool active) { m_slope.active = active; }
|
||||
|
||||
const std::array<float, 2>& get_slope_z_range() const { return m_slope_z_range; }
|
||||
void set_slope_z_range(const std::array<float, 2>& range) { m_slope_z_range = range; }
|
||||
void set_default_slope_z_range() { m_slope_z_range = { -::cos(Geometry::deg2rad(90.0f - 45.0f)), -::cos(Geometry::deg2rad(90.0f - 70.0f)) }; }
|
||||
const std::array<float, 2>& get_slope_z_range() const { return m_slope.z_range; }
|
||||
void set_slope_z_range(const std::array<float, 2>& range) { m_slope.z_range = range; }
|
||||
void set_default_slope_z_range() { m_slope.z_range = { -::cos(Geometry::deg2rad(90.0f - 45.0f)), -::cos(Geometry::deg2rad(90.0f - 70.0f)) }; }
|
||||
#endif // ENABLE_SLOPE_RENDERING
|
||||
|
||||
// returns true if all the volumes are completely contained in the print volume
|
||||
|
Loading…
Reference in New Issue
Block a user