mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 23:15:54 +08:00
Tool marker NOT rendered by the new visualization code
This commit is contained in:
parent
c1ca2097bb
commit
5c06f05cf9
@ -61,7 +61,7 @@
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#define ENABLE_NEW_GCODE_VIEWER 1
|
||||
#define ENABLE_NEW_GCODE_VIEWER_DEBUG (1 && ENABLE_NEW_GCODE_VIEWER)
|
||||
#define ENABLE_NEW_GCODE_VIEWER_DEBUG (0 && ENABLE_NEW_GCODE_VIEWER)
|
||||
#define ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS (1 && ENABLE_NEW_GCODE_VIEWER)
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
|
@ -730,7 +730,7 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, s
|
||||
}
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void GCodeViewer::SequentialView::render(float legend_height, bool show_marker)
|
||||
{
|
||||
if (show_marker)
|
||||
@ -739,7 +739,7 @@ void GCodeViewer::SequentialView::render(float legend_height, bool show_marker)
|
||||
void GCodeViewer::SequentialView::render(float legend_height)
|
||||
{
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
marker.render();
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
@ -1225,14 +1225,14 @@ void GCodeViewer::render()
|
||||
std::memcpy(converted_view_matrix.data(), view_matrix.data(), 16 * sizeof(float));
|
||||
libvgcode::Mat4x4f converted_projetion_matrix;
|
||||
std::memcpy(converted_projetion_matrix.data(), projection_matrix.data(), 16 * sizeof(float));
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
libvgcode::Vec3f converted_tool_marker_position;
|
||||
std::memcpy(converted_tool_marker_position.data(), m_sequential_view.current_position.data(), 3 * sizeof(float));
|
||||
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_new_viewer.set_cog_marker_scale_factor(m_cog_marker_fixed_screen_size ? 10.0f * m_cog_marker_size * camera.get_inv_zoom() : m_cog_marker_size);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_new_viewer.set_tool_marker_position(converted_tool_marker_position);
|
||||
m_new_viewer.set_tool_marker_scale_factor(m_tool_marker_fixed_screen_size ? 10.0f * m_tool_marker_size * camera.get_inv_zoom() : m_tool_marker_size);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_new_viewer.render(converted_view_matrix, converted_projetion_matrix);
|
||||
}
|
||||
else
|
||||
@ -1248,13 +1248,13 @@ void GCodeViewer::render()
|
||||
m_sequential_view.marker.set_world_offset(m_sequential_view.current_offset);
|
||||
m_sequential_view.marker.set_z_offset(m_z_offset);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_sequential_view.render(legend_height, !m_use_new_viewer);
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
m_sequential_view.render(legend_height);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
}
|
||||
}
|
||||
@ -1263,12 +1263,11 @@ void GCodeViewer::render()
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
if (m_use_new_viewer) {
|
||||
ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui();
|
||||
imgui.begin(std::string("LibVGCode Viewer Controller"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
imgui.checkbox("Cog marker fixed screen size", m_cog_marker_fixed_screen_size);
|
||||
if (ImGui::BeginTable("Cog", 2)) {
|
||||
|
||||
@ -1280,7 +1279,6 @@ void GCodeViewer::render()
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
imgui.checkbox("Tool marker fixed screen size", m_tool_marker_fixed_screen_size);
|
||||
if (ImGui::BeginTable("Tool", 2)) {
|
||||
@ -1296,7 +1294,7 @@ void GCodeViewer::render()
|
||||
|
||||
imgui.end();
|
||||
}
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
}
|
||||
|
||||
@ -4827,7 +4825,7 @@ void GCodeViewer::render_legend(float& legend_height)
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
if (type != Preview::OptionType::CenterOfGravity)
|
||||
if (type != Preview::OptionType::CenterOfGravity && type != Preview::OptionType::ToolMarker && type != Preview::OptionType::Shells)
|
||||
#endif // ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_new_viewer.toggle_option_visibility((libvgcode::EOptionType)type);
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
|
@ -813,13 +813,13 @@ public:
|
||||
std::vector<unsigned int> gcode_ids;
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void render(float legend_height, bool show_marker);
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
void render(float legend_height);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
};
|
||||
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace libvgcode {
|
||||
|
||||
class CogMarker
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace libvgcode {
|
||||
|
||||
struct PathVertex
|
||||
|
@ -29,7 +29,10 @@ public:
|
||||
bool operator != (const Range& other) const;
|
||||
|
||||
private:
|
||||
// [0] = min, [1] = max
|
||||
//
|
||||
// [0] = min
|
||||
// [1] = max
|
||||
//
|
||||
std::array<uint32_t, 2> m_range{ 0, 0 };
|
||||
};
|
||||
|
||||
|
@ -37,9 +37,9 @@ struct Settings
|
||||
{ EOptionType::CustomGCodes, false },
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
{ EOptionType::CenterOfGravity, false },
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
{ EOptionType::Shells, false },
|
||||
{ EOptionType::ToolMarker, true }
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
} };
|
||||
|
||||
std::map<EGCodeExtrusionRole, bool> extrusion_roles_visibility{ {
|
||||
|
@ -252,7 +252,6 @@ static const char* Cog_Marker_Fragment_Shader =
|
||||
" vec3 color = delta.x * delta.y * delta.z > 0.0 ? BLACK : WHITE;\n"
|
||||
" out_color = intensity * vec4(color, 1.0);\n"
|
||||
"}\n";
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
static const char* Tool_Marker_Vertex_Shader =
|
||||
"#version 150\n"
|
||||
@ -294,6 +293,7 @@ static const char* Tool_Marker_Fragment_Shader =
|
||||
"void main() {\n"
|
||||
" fragment_color = color;\n"
|
||||
"}\n";
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
} // namespace libvgcode
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
//################################################################################################################################
|
||||
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//################################################################################################################################
|
||||
|
||||
namespace libvgcode {
|
||||
@ -208,5 +208,5 @@ void ToolMarker::set_alpha(float alpha)
|
||||
|
||||
//################################################################################################################################
|
||||
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//################################################################################################################################
|
||||
|
@ -7,13 +7,11 @@
|
||||
|
||||
//################################################################################################################################
|
||||
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//################################################################################################################################
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace libvgcode {
|
||||
|
||||
class ToolMarker
|
||||
@ -57,7 +55,7 @@ private:
|
||||
|
||||
//################################################################################################################################
|
||||
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//################################################################################################################################
|
||||
|
||||
#endif // VGCODE_TOOLMARKER_HPP
|
@ -11,14 +11,27 @@
|
||||
//################################################################################################################################
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
namespace libvgcode {
|
||||
|
||||
static constexpr float PI = 3.141592f;
|
||||
|
||||
using Vec3f = std::array<float, 3>;
|
||||
// 4 by 4 square matrix with column-major order
|
||||
//
|
||||
// 4 by 4 square matrix with column-major order:
|
||||
// | a[0] a[4] a[8] a[12] |
|
||||
// | a[1] a[5] a[9] a[13] |
|
||||
// | a[2] a[6] a[10] a[14] |
|
||||
// | a[3] a[7] a[11] a[15] |
|
||||
//
|
||||
using Mat4x4f = std::array<float, 16>;
|
||||
//
|
||||
// [0] = red
|
||||
// [1] = green
|
||||
// [2] = blue
|
||||
// values should belong to [0..1]
|
||||
//
|
||||
using Color = std::array<float, 3>;
|
||||
|
||||
// Alias for GCodeViewer::EViewType defined into GCodeViewer.hpp
|
||||
@ -90,9 +103,9 @@ enum class EOptionType : uint8_t
|
||||
CustomGCodes,
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
CenterOfGravity,
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
Shells,
|
||||
ToolMarker,
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
COUNT
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace libvgcode {
|
||||
|
@ -133,7 +133,6 @@ void Viewer::set_cog_marker_scale_factor(float factor)
|
||||
{
|
||||
m_impl.set_cog_marker_scale_factor(factor);
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
const Vec3f& Viewer::get_tool_marker_position() const
|
||||
{
|
||||
@ -174,6 +173,7 @@ void Viewer::set_tool_marker_alpha(float alpha)
|
||||
{
|
||||
m_impl.set_tool_marker_alpha(alpha);
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
} // namespace libvgcode
|
||||
|
||||
|
@ -79,7 +79,6 @@ public:
|
||||
|
||||
float get_cog_marker_scale_factor() const;
|
||||
void set_cog_marker_scale_factor(float factor);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
const Vec3f& get_tool_marker_position() const;
|
||||
void set_tool_marker_position(const Vec3f& position);
|
||||
@ -92,6 +91,7 @@ public:
|
||||
|
||||
float get_tool_marker_alpha() const;
|
||||
void set_tool_marker_alpha(float alpha);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
private:
|
||||
ViewerImpl m_impl;
|
||||
|
@ -520,7 +520,6 @@ void ViewerImpl::init()
|
||||
m_uni_cog_marker_projection_matrix != -1);
|
||||
|
||||
m_cog_marker.init(32, 1.0f);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
// tool marker shader
|
||||
m_tool_marker_shader_id = init_shader("tool_marker", Tool_Marker_Vertex_Shader, Tool_Marker_Fragment_Shader);
|
||||
@ -539,6 +538,7 @@ void ViewerImpl::init()
|
||||
m_uni_tool_marker_color_base != -1);
|
||||
|
||||
m_tool_marker.init(32, 2.0f, 4.0f, 1.0f, 8.0f);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
}
|
||||
|
||||
void ViewerImpl::load(const Slic3r::GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors)
|
||||
@ -862,9 +862,9 @@ void ViewerImpl::render(const Mat4x4f& view_matrix, const Mat4x4f& projection_ma
|
||||
|
||||
render_segments(view_matrix, projection_matrix, camera_position);
|
||||
render_options(view_matrix, projection_matrix);
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
if (m_settings.options_visibility.at(EOptionType::ToolMarker))
|
||||
render_tool_marker(view_matrix, projection_matrix);
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
if (m_settings.options_visibility.at(EOptionType::CenterOfGravity))
|
||||
render_cog_marker(view_matrix, projection_matrix);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
@ -1043,7 +1043,6 @@ float ViewerImpl::get_cog_marker_scale_factor() const
|
||||
{
|
||||
return m_cog_marker_scale_factor;
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
const Vec3f& ViewerImpl::get_tool_marker_position() const
|
||||
{
|
||||
@ -1070,12 +1069,10 @@ float ViewerImpl::get_tool_marker_alpha() const
|
||||
return m_tool_marker.get_alpha();
|
||||
}
|
||||
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void ViewerImpl::set_cog_marker_scale_factor(float factor)
|
||||
{
|
||||
m_cog_marker_scale_factor = std::max(factor, 0.001f);
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
void ViewerImpl::set_tool_marker_position(const Vec3f& position)
|
||||
{
|
||||
@ -1101,6 +1098,7 @@ void ViewerImpl::set_tool_marker_alpha(float alpha)
|
||||
{
|
||||
m_tool_marker.set_alpha(alpha);
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
static void delete_textures(unsigned int& id)
|
||||
{
|
||||
@ -1433,7 +1431,6 @@ void ViewerImpl::render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& pr
|
||||
|
||||
glsafe(glUseProgram(curr_shader));
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
void ViewerImpl::render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix)
|
||||
{
|
||||
@ -1479,6 +1476,7 @@ void ViewerImpl::render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& p
|
||||
|
||||
glsafe(glUseProgram(curr_shader));
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
|
||||
void ViewerImpl::render_debug_window()
|
||||
@ -1563,7 +1561,6 @@ void ViewerImpl::render_debug_window()
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
@ -1601,6 +1598,7 @@ void ViewerImpl::render_debug_window()
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
}
|
||||
|
||||
imgui.end();
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "OptionTemplate.hpp"
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
#include "CogMarker.hpp"
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
#include "ToolMarker.hpp"
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
#include "PathVertex.hpp"
|
||||
#include "Bitset.hpp"
|
||||
#include "ColorRange.hpp"
|
||||
@ -110,24 +110,24 @@ public:
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
Vec3f get_cog_marker_position() const;
|
||||
float get_cog_marker_scale_factor() const;
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
const Vec3f& get_tool_marker_position() const;
|
||||
float get_tool_marker_offset_z() const;
|
||||
float get_tool_marker_scale_factor() const;
|
||||
const Color& get_tool_marker_color() const;
|
||||
float get_tool_marker_alpha() const;
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
//
|
||||
// Properties setters
|
||||
//
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void set_cog_marker_scale_factor(float factor);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void set_tool_marker_position(const Vec3f& position);
|
||||
void set_tool_marker_offset_z(float offset_z);
|
||||
void set_tool_marker_scale_factor(float factor);
|
||||
void set_tool_marker_color(const Color& color);
|
||||
void set_tool_marker_alpha(float size);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
private:
|
||||
Settings m_settings;
|
||||
@ -152,13 +152,13 @@ private:
|
||||
//
|
||||
CogMarker m_cog_marker;
|
||||
float m_cog_marker_scale_factor{ 1.0f };
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
//
|
||||
// The OpenGL element used to represent the tool nozzle
|
||||
//
|
||||
ToolMarker m_tool_marker;
|
||||
float m_tool_marker_scale_factor{ 1.0f };
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
//
|
||||
// cpu buffer to store vertices
|
||||
@ -229,7 +229,6 @@ private:
|
||||
int m_uni_cog_marker_scale_factor{ -1 };
|
||||
int m_uni_cog_marker_view_matrix{ -1 };
|
||||
int m_uni_cog_marker_projection_matrix{ -1 };
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
//
|
||||
// Cache for OpenGL uniforms id for tool marker shader
|
||||
@ -239,6 +238,7 @@ private:
|
||||
int m_uni_tool_marker_view_matrix{ -1 };
|
||||
int m_uni_tool_marker_projection_matrix{ -1 };
|
||||
int m_uni_tool_marker_color_base{ -1 };
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
//
|
||||
// gpu buffers to store positions
|
||||
@ -274,8 +274,8 @@ private:
|
||||
void render_options(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix);
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix);
|
||||
#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
|
||||
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
|
||||
// Debug
|
||||
|
Loading…
x
Reference in New Issue
Block a user