Tech ENABLE_RAYCAST_PICKING - 1st installment - Raytraced picking of printbed

This commit is contained in:
enricoturri1966 2022-06-10 13:20:52 +02:00
parent 8f40270f93
commit cfc3988b9f
13 changed files with 741 additions and 2 deletions

View file

@ -8,6 +8,9 @@
#else
#include "GLModel.hpp"
#endif // ENABLE_WORLD_COORDINATE
#if ENABLE_RAYCAST_PICKING
#include "MeshUtils.hpp"
#endif // ENABLE_RAYCAST_PICKING
#include "libslic3r/BuildVolume.hpp"
#if ENABLE_LEGACY_OPENGL_REMOVAL
@ -108,7 +111,11 @@ private:
GLTexture m_texture;
// temporary texture shown until the main texture has still no levels compressed
GLTexture m_temp_texture;
#if ENABLE_RAYCAST_PICKING
PickingModel m_model;
#else
GLModel m_model;
#endif // ENABLE_RAYCAST_PICKING
Vec3d m_model_offset{ Vec3d::Zero() };
#if !ENABLE_LEGACY_OPENGL_REMOVAL
unsigned int m_vbo_id{ 0 };
@ -153,7 +160,9 @@ public:
#if ENABLE_LEGACY_OPENGL_REMOVAL
void render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_axes, bool show_texture);
#if !ENABLE_RAYCAST_PICKING
void render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor);
#endif // !ENABLE_RAYCAST_PICKING
#else
void render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes, bool show_texture);
void render_for_picking(GLCanvas3D& canvas, bool bottom, float scale_factor);
@ -173,8 +182,13 @@ private:
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
static std::tuple<Type, std::string, std::string> detect_type(const Pointfs& shape);
#if ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_RAYCAST_PICKING
void render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
bool show_axes, bool show_texture);
#else
void render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
bool show_axes, bool show_texture, bool picking);
#endif // ENABLE_RAYCAST_PICKING
#else
void render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor,
bool show_axes, bool show_texture, bool picking);
@ -184,8 +198,13 @@ private:
void render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture);
void render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix);
void render_model(const Transform3d& view_matrix, const Transform3d& projection_matrix);
#if ENABLE_RAYCAST_PICKING
void render_custom(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture);
void render_default(bool bottom, bool show_texture, const Transform3d& view_matrix, const Transform3d& projection_matrix);
#else
void render_custom(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture, bool picking);
void render_default(bool bottom, bool picking, bool show_texture, const Transform3d& view_matrix, const Transform3d& projection_matrix);
#endif // ENABLE_RAYCAST_PICKING
void render_contour(const Transform3d& view_matrix, const Transform3d& projection_matrix);
#else
void render_system(GLCanvas3D& canvas, bool bottom, bool show_texture);
@ -197,6 +216,10 @@ private:
void release_VBOs();
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_RAYCAST_PICKING
void register_raycasters_for_picking(const GLModel::Geometry& geometry, const Transform3d& trafo);
#endif // ENABLE_RAYCAST_PICKING
};
} // GUI