mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-03 12:04:05 -06:00
GCodeViewer -> Pass vertex normal to shaders for toolpaths
This commit is contained in:
parent
d41781f674
commit
69de5c8c9f
13 changed files with 431 additions and 265 deletions
|
@ -7,6 +7,10 @@
|
|||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
#include <chrono>
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
|
||||
static const float INCHES_TO_MM = 25.4f;
|
||||
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
||||
|
||||
|
@ -89,9 +93,17 @@ void GCodeProcessor::reset()
|
|||
|
||||
void GCodeProcessor::process_file(const std::string& filename)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
auto start_time = std::chrono::high_resolution_clock::now();
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
|
||||
m_result.id = ++s_result_id;
|
||||
m_result.moves.emplace_back(MoveVertex());
|
||||
m_parser.parse_file(filename, [this](GCodeReader& reader, const GCodeReader::GCodeLine& line) { process_gcode_line(line); });
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||
|
|
|
@ -106,7 +106,12 @@ namespace Slic3r {
|
|||
{
|
||||
unsigned int id;
|
||||
std::vector<MoveVertex> moves;
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
long long time{ 0 };
|
||||
void reset() { time = 0; moves = std::vector<MoveVertex>(); }
|
||||
#else
|
||||
void reset() { moves = std::vector<MoveVertex>(); }
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
|
||||
// Enable G-Code viewer
|
||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS (1 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (1 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_AS_STATE (1 && ENABLE_GCODE_VIEWER)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue