10 #ifndef hifi_DebugDraw_h
11 #define hifi_DebugDraw_h
14 #include <unordered_map>
18 #include <glm/glm.hpp>
19 #include <glm/gtc/quaternion.hpp>
36 class DebugDraw :
public QObject {
39 static DebugDraw& getInstance();
61 Q_INVOKABLE
void drawRay(
const glm::vec3& start,
const glm::vec3& end,
const glm::vec4& color);
86 Q_INVOKABLE
void drawRays(
const std::vector<std::pair<glm::vec3, glm::vec3>>& lines,
const glm::vec4& color,
87 const glm::vec3& translation = glm::vec3(0.0f, 0.0f, 0.0f),
const glm::quat& rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f));
112 Q_INVOKABLE
void addMarker(
const QString& key,
const glm::quat& rotation,
const glm::vec3& position,
113 const glm::vec4& color,
float size = 1.0f);
120 Q_INVOKABLE
void removeMarker(
const QString& key);
145 Q_INVOKABLE
void addMyAvatarMarker(
const QString& key,
const glm::quat& rotation,
const glm::vec3& position,
146 const glm::vec4& color,
float size = 1.0f);
153 Q_INVOKABLE
void removeMyAvatarMarker(
const QString& key);
155 using MarkerInfo = std::tuple<glm::quat, glm::vec3, glm::vec4, float>;
156 using MarkerMap = std::map<QString, MarkerInfo>;
157 using Ray = std::tuple<glm::vec3, glm::vec3, glm::vec4>;
158 using Rays = std::vector<Ray>;
164 MarkerMap getMarkerMap()
const;
165 MarkerMap getMyAvatarMarkerMap()
const;
166 void updateMyAvatarPos(
const glm::vec3& pos) { _myAvatarPos = pos; }
167 const glm::vec3& getMyAvatarPos()
const {
return _myAvatarPos; }
168 void updateMyAvatarRot(
const glm::quat& rot) { _myAvatarRot = rot; }
169 const glm::quat& getMyAvatarRot()
const {
return _myAvatarRot; }
170 Rays getRays()
const;
174 mutable std::mutex _mapMutex;
176 MarkerMap _myAvatarMarkers;
177 glm::quat _myAvatarRot;
178 glm::vec3 _myAvatarPos;