OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Bed3D::Axes Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DBed.hpp>

Collaboration diagram for Slic3r::GUI::Bed3D::Axes:

Public Member Functions

const Vec3d & get_origin () const
void set_origin (const Vec3d &origin)
void set_stem_length (float length)
float get_total_length () const
void render ()

Static Public Attributes

static const float DefaultStemRadius = 0.5f
static const float DefaultStemLength = 25.0f
static const float DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius
static const float DefaultTipLength = 5.0f

Private Attributes

Vec3d m_origin { Vec3d::Zero() }
float m_stem_length { DefaultStemLength }
GLModel m_arrow

Detailed Description

Member Function Documentation

◆ get_origin()

const Vec3d & Slic3r::GUI::Bed3D::Axes::get_origin ( ) const
inline
82{ return m_origin; }
Vec3d m_origin
Definition 3DBed.hpp:77

References m_origin.

◆ get_total_length()

float Slic3r::GUI::Bed3D::Axes::get_total_length ( ) const
inline
88{ return m_stem_length; } // + DefaultTipLength; } // ORCA axis without arrow
float m_stem_length
Definition 3DBed.hpp:78

References m_stem_length.

◆ render()

void Slic3r::GUI::Bed3D::Axes::render ( )
228{
229 auto render_axis = [this](GLShaderProgram* shader, const Transform3d& transform) {
230 const Camera& camera = wxGetApp().plater()->get_camera();
231 const Transform3d& view_matrix = camera.get_view_matrix();
232 shader->set_uniform("view_model_matrix", view_matrix * transform);
233 shader->set_uniform("projection_matrix", camera.get_projection_matrix());
234 //const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * transform.matrix().block(0, 0, 3, 3).inverse().transpose();
235 //shader->set_uniform("view_normal_matrix", view_normal_matrix);
236 m_arrow.render();
237 };
238
239 if (!m_arrow.is_initialized())
240 //m_arrow.init_from(stilized_arrow(16, DefaultTipRadius, DefaultTipLength, DefaultStemRadius, m_stem_length));
241 m_arrow.init_from(smooth_cylinder(16, /*Radius*/ m_stem_length / 75.f, m_stem_length)); // ORCA use simple cylinder and scale thickness depends on length
242
243 GLShaderProgram* shader = wxGetApp().get_shader("flat"); // ORCA dont use shading to get closer color tone
244 if (shader == nullptr)
245 return;
246
248
249 shader->start_using();
250 //shader->set_uniform("emission_factor", 0.0f);
251
252 // x axis
253 m_arrow.set_color(AXIS_X_COLOR);
254 render_axis(shader, Geometry::assemble_transform(m_origin, { 0.0, 0.5 * M_PI, 0.0 }));
255
256 // y axis
257 m_arrow.set_color(AXIS_Y_COLOR);
258 render_axis(shader, Geometry::assemble_transform(m_origin, { -0.5 * M_PI, 0.0, 0.0 }));
259
260 // z axis
261 m_arrow.set_color(AXIS_Z_COLOR);
262 render_axis(shader, Geometry::assemble_transform(m_origin));
263
264 shader->stop_using();
265
267}
#define M_PI
Definition ExtrusionSimulator.cpp:31
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
GLModel m_arrow
Definition 3DBed.hpp:79
static ColorRGBA AXIS_Z_COLOR
Definition 3DBed.hpp:63
static ColorRGBA AXIS_X_COLOR
Definition 3DBed.hpp:61
static ColorRGBA AXIS_Y_COLOR
Definition 3DBed.hpp:62
#define glEnable
Definition gl.h:3667
#define GL_DEPTH_TEST
Definition gl.h:574
#define glDisable
Definition gl.h:3607
@ Camera
Definition Shortcuts.hpp:72
GLModel::Geometry smooth_cylinder(unsigned int resolution, float radius, float height)
Definition GLModel.cpp:1356
void assemble_transform(Transform3d &transform, const Vec3d &translation, const Vec3d &rotation, const Vec3d &scale, const Vec3d &mirror)
Definition Geometry.cpp:319
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
Linef3 transform(const Linef3 &line, const Transform3d &t)
Definition Line.cpp:15

References Slic3r::Geometry::assemble_transform(), Slic3r::GUI::Bed3D::AXIS_X_COLOR, Slic3r::GUI::Bed3D::AXIS_Y_COLOR, Slic3r::GUI::Bed3D::AXIS_Z_COLOR, Slic3r::GUI::Camera::get_projection_matrix(), Slic3r::GUI::Camera::get_view_matrix(), GL_DEPTH_TEST, glDisable, glEnable, glsafe, m_arrow, m_origin, M_PI, m_stem_length, Slic3r::GLShaderProgram::set_uniform(), Slic3r::GUI::smooth_cylinder(), Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), and Slic3r::transform().

Here is the call graph for this function:

◆ set_origin()

void Slic3r::GUI::Bed3D::Axes::set_origin ( const Vec3d & origin)
inline
83{ m_origin = origin; }

References m_origin.

◆ set_stem_length()

void Slic3r::GUI::Bed3D::Axes::set_stem_length ( float length)
inline
84 {
86 m_arrow.reset();
87 }
double length(const Points &pts)
Definition MultiPoint.hpp:181

References Slic3r::length(), m_arrow, and m_stem_length.

Here is the call graph for this function:

Member Data Documentation

◆ DefaultStemLength

const float Slic3r::GUI::Bed3D::Axes::DefaultStemLength = 25.0f
static

◆ DefaultStemRadius

const float Slic3r::GUI::Bed3D::Axes::DefaultStemRadius = 0.5f
static

◆ DefaultTipLength

const float Slic3r::GUI::Bed3D::Axes::DefaultTipLength = 5.0f
static

◆ DefaultTipRadius

◆ m_arrow

GLModel Slic3r::GUI::Bed3D::Axes::m_arrow
private

Referenced by render(), and set_stem_length().

◆ m_origin

Vec3d Slic3r::GUI::Bed3D::Axes::m_origin { Vec3d::Zero() }
private
77{ Vec3d::Zero() };

Referenced by get_origin(), render(), and set_origin().

◆ m_stem_length

float Slic3r::GUI::Bed3D::Axes::m_stem_length { DefaultStemLength }
private
static const float DefaultStemLength
Definition 3DBed.hpp:72

Referenced by get_total_length(), render(), and set_stem_length().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DBed.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DBed.cpp