mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 05:01:59 +08:00
70 lines
2.1 KiB
C++
70 lines
2.1 KiB
C++
///|/ Copyright (c) Prusa Research 2023 Enrico Turri @enricoturri1966
|
|
///|/
|
|
///|/ libvgcode is released under the terms of the AGPLv3 or higher
|
|
///|/
|
|
#ifndef VGCODE_COGMARKER_HPP
|
|
#define VGCODE_COGMARKER_HPP
|
|
|
|
//################################################################################################################################
|
|
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
|
#if ENABLE_NEW_GCODE_VIEWER
|
|
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
|
|
//################################################################################################################################
|
|
|
|
#include "Types.hpp"
|
|
|
|
namespace libvgcode {
|
|
|
|
class CogMarker
|
|
{
|
|
public:
|
|
CogMarker() = default;
|
|
~CogMarker();
|
|
CogMarker(const CogMarker& other) = delete;
|
|
CogMarker(CogMarker&& other) = delete;
|
|
CogMarker& operator = (const CogMarker& other) = delete;
|
|
CogMarker& operator = (CogMarker&& other) = delete;
|
|
|
|
//
|
|
// Initialize geometry on gpu
|
|
//
|
|
void init(uint8_t resolution, float radius);
|
|
void render();
|
|
|
|
//
|
|
// Update values used to calculate the center of gravity
|
|
//
|
|
void update(const Vec3& position, float mass);
|
|
|
|
//
|
|
// Reset values used to calculate the center of gravity
|
|
//
|
|
void reset();
|
|
|
|
//
|
|
// Return the calculated center of gravity
|
|
//
|
|
Vec3 get_position() const;
|
|
|
|
private:
|
|
//
|
|
// Values used to calculate the center of gravity
|
|
//
|
|
float m_total_mass{ 0.0f };
|
|
Vec3 m_total_position{ 0.0f, 0.0f, 0.0f };
|
|
|
|
uint16_t m_indices_count{ 0 };
|
|
unsigned int m_vao_id{ 0 };
|
|
unsigned int m_vbo_id{ 0 };
|
|
unsigned int m_ibo_id{ 0 };
|
|
};
|
|
|
|
} // namespace libvgcode
|
|
|
|
//################################################################################################################################
|
|
// PrusaSlicer development only -> !!!TO BE REMOVED!!!
|
|
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
|
|
#endif // ENABLE_NEW_GCODE_VIEWER
|
|
//################################################################################################################################
|
|
|
|
#endif // VGCODE_COGMARKER_HPP
|