Fixes to code
This commit is contained in:
@@ -923,16 +923,16 @@ void DebugDraw::DrawActors(Actor** selectedActors, int32 selectedActorsCount, bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDraw::DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, const Color& color , float Size, float duration, bool depthTest)
|
void DebugDraw::DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, float size, float duration, bool depthTest)
|
||||||
{
|
{
|
||||||
auto rot = Quaternion::FromDirection(direction.GetNormalized());
|
const auto rot = Quaternion::FromDirection(direction.GetNormalized());
|
||||||
Vector3 Up = (rot * Vector3::Up );
|
const Vector3 up = (rot * Vector3::Up);
|
||||||
Vector3 Forward = (rot * Vector3::Forward);
|
const Vector3 forward = (rot * Vector3::Forward);
|
||||||
Vector3 Right = (rot * Vector3::Right );
|
const Vector3 right = (rot * Vector3::Right);
|
||||||
|
const float sizeHalf = size * 0.5f;
|
||||||
DrawLine(origin, origin + (Up * (Size * 0.5f)) + Up , Color::Green ,duration, depthTest);
|
DrawLine(origin, origin + up * sizeHalf + up, Color::Green, duration, depthTest);
|
||||||
DrawLine(origin, origin + (Forward * (Size * 0.5f)) + Forward, Color::Blue ,duration, depthTest);
|
DrawLine(origin, origin + forward * sizeHalf + forward, Color::Blue, duration, depthTest);
|
||||||
DrawLine(origin, origin + (Right * (Size * 0.5f)) + Right , Color::Red ,duration, depthTest);
|
DrawLine(origin, origin + right * sizeHalf + right, Color::Red, duration, depthTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDraw::DrawDirection(const Vector3& origin, const Vector3& direction, const Color& color, float duration, bool depthTest)
|
void DebugDraw::DrawDirection(const Vector3& origin, const Vector3& direction, const Color& color, float duration, bool depthTest)
|
||||||
@@ -942,14 +942,15 @@ void DebugDraw::DrawDirection(const Vector3& origin, const Vector3& direction, c
|
|||||||
return;
|
return;
|
||||||
DrawLine(origin, origin + direction, color, duration, depthTest);
|
DrawLine(origin, origin + direction, color, duration, depthTest);
|
||||||
}
|
}
|
||||||
void DebugDraw::DrawRay(const Vector3& origin, const Vector3& direction,const Color& color, float length, float duration, bool depthTest)
|
|
||||||
|
void DebugDraw::DrawRay(const Vector3& origin, const Vector3& direction, const Color& color, float length, float duration, bool depthTest)
|
||||||
{
|
{
|
||||||
if (isnan(length) || isinf(length))
|
if (isnan(length) || isinf(length))
|
||||||
return;
|
return;
|
||||||
DrawLine(origin, origin + (direction.GetNormalized() * length), color, duration, depthTest);
|
DrawLine(origin, origin + (direction.GetNormalized() * length), color, duration, depthTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDraw::DrawRay(const Ray& ray,const Color& color, float length, float duration, bool depthTest)
|
void DebugDraw::DrawRay(const Ray& ray, const Color& color, float length, float duration, bool depthTest)
|
||||||
{
|
{
|
||||||
if (isnan(length) || isinf(length))
|
if (isnan(length) || isinf(length))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -72,11 +72,10 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="origin">The origin of the line.</param>
|
/// <param name="origin">The origin of the line.</param>
|
||||||
/// <param name="direction">The direction of the line.</param>
|
/// <param name="direction">The direction of the line.</param>
|
||||||
/// <param name="color">The color.</param>
|
/// <param name="size">The size of the axis.</param>
|
||||||
/// <param name="Size">The size of the axis.</param>
|
|
||||||
/// <param name="duration">The duration (in seconds). Use 0 to draw it only once.</param>
|
/// <param name="duration">The duration (in seconds). Use 0 to draw it only once.</param>
|
||||||
/// <param name="depthTest">If set to <c>true</c> depth test will be performed, otherwise depth will be ignored.</param>
|
/// <param name="depthTest">If set to <c>true</c> depth test will be performed, otherwise depth will be ignored.</param>
|
||||||
API_FUNCTION() static void DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, const Color& color = Color::White, float Size = 100.0f, float duration = 0.0f, bool depthTest = true);
|
API_FUNCTION() static void DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, float size = 100.0f, float duration = 0.0f, bool depthTest = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draws the line in a direction.
|
/// Draws the line in a direction.
|
||||||
@@ -656,7 +655,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
|||||||
API_FUNCTION() static void DrawText(const StringView& text, const Transform& transform, const Color& color = Color::White, int32 size = 32, float duration = 0.0f);
|
API_FUNCTION() static void DrawText(const StringView& text, const Transform& transform, const Color& color = Color::White, int32 size = 32, float duration = 0.0f);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, color, size, duration, depthTest) DebugDraw::DrawAxisFromDirection(origin, direction, color, size, duration, depthTest);
|
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, size, duration, depthTest) DebugDraw::DrawAxisFromDirection(origin, direction, size, duration, depthTest);
|
||||||
#define DEBUG_DRAW_DIRECTION(origin, direction, color, duration, depthTest) DebugDraw::DrawDirection(origin, direction, color, duration, depthTest);
|
#define DEBUG_DRAW_DIRECTION(origin, direction, color, duration, depthTest) DebugDraw::DrawDirection(origin, direction, color, duration, depthTest);
|
||||||
#define DEBUG_DRAW_RAY(origin, direction, color, length, duration, depthTest) DebugDraw::DrawRay(origin, direction, color, length, duration, depthTest);
|
#define DEBUG_DRAW_RAY(origin, direction, color, length, duration, depthTest) DebugDraw::DrawRay(origin, direction, color, length, duration, depthTest);
|
||||||
#define DEBUG_DRAW_RAY(ray, color, length, duration, depthTest) DebugDraw::DrawRay(ray, color, length, duration, depthTest);
|
#define DEBUG_DRAW_RAY(ray, color, length, duration, depthTest) DebugDraw::DrawRay(ray, color, length, duration, depthTest);
|
||||||
@@ -689,7 +688,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, color, size, duration, depthTest)
|
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, size, duration, depthTest)
|
||||||
#define DEBUG_DRAW_DIRECTION(origin, direction,color,duration, depthTest)
|
#define DEBUG_DRAW_DIRECTION(origin, direction,color,duration, depthTest)
|
||||||
#define DEBUG_DRAW_RAY(ray, color, length, duration, depthTest)
|
#define DEBUG_DRAW_RAY(ray, color, length, duration, depthTest)
|
||||||
#define DEBUG_DRAW_LINE(start, end, color, duration, depthTest)
|
#define DEBUG_DRAW_LINE(start, end, color, duration, depthTest)
|
||||||
|
|||||||
Reference in New Issue
Block a user