summaryrefslogtreecommitdiff
path: root/debugdraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'debugdraw.cpp')
-rw-r--r--debugdraw.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/debugdraw.cpp b/debugdraw.cpp
index 43527ab..8331a38 100644
--- a/debugdraw.cpp
+++ b/debugdraw.cpp
@@ -67,6 +67,21 @@ void Line_Renderer::add_line(const v3f& s, const v3f& e) {
cur++;
}
+void Line_Renderer::add_arrow(const v3f& s, const v3f& e) {
+ v3f tang(0.0f, 1.0f, 0.0f);
+ v3f dir = v3f::normalised(e - s);
+ v4f dir4 = v4f(dir, 0.0f);
+ float d = v3f::dot(tang, dir);
+ if (d > 0.999f || d < -0.999f)
+ tang = v3f(1.0f, 0.0f, 0.0f);
+ tang = v3f::cross(tang, dir);
+ const m4f a = m4f::rotate(m4f::identity(), 2.8f, tang);
+ const m4f b = m4f::rotate(m4f::identity(), 3.5f, tang);
+ add_line(s, e);
+ add_line(e, e + (a * dir4).xyz() * 0.1f);
+ add_line(e, e + (b * dir4).xyz() * 0.1f);
+}
+
void Line_Renderer::add_box(const AABB& b) {
add_line(v3f(b.max.x, b.max.y, b.max.z), v3f(b.max.x, b.max.y, b.min.z));
add_line(v3f(b.max.x, b.max.y, b.max.z), v3f(b.max.x, b.min.y, b.max.z));