Merge branch 'RuanLucasGD-arrow-debug-draw-improviment'
This commit is contained in:
@@ -23,7 +23,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
base.OnDebugDraw(data);
|
||||
|
||||
var transform = Actor.Transform;
|
||||
DebugDraw.DrawWireArrow(transform.Translation, transform.Orientation, 1.0f, Color.Red, 0.0f, false);
|
||||
DebugDraw.DrawWireArrow(transform.Translation, transform.Orientation, 1.0f, 0.5f, Color.Red, 0.0f, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
base.OnDebugDraw(data);
|
||||
|
||||
var transform = Actor.Transform;
|
||||
DebugDraw.DrawWireArrow(transform.Translation, transform.Orientation, 0.3f, Color.Red, 0.0f, false);
|
||||
DebugDraw.DrawWireArrow(transform.Translation, transform.Orientation, 0.3f, 0.15f, Color.Red, 0.0f, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace FlaxEditor.Viewport
|
||||
LocalOrientation = RootNode.RaycastNormalRotation(ref hitNormal),
|
||||
Name = item.ShortName
|
||||
};
|
||||
DebugDraw.DrawWireArrow(PostProcessSpawnedActorLocation(actor, ref hitNormal), actor.LocalOrientation, 1.0f, Color.Red, 1000000);
|
||||
DebugDraw.DrawWireArrow(PostProcessSpawnedActorLocation(actor, ref hitNormal), actor.LocalOrientation, 1.0f, 0.5f, Color.Red, 1000000);
|
||||
Spawn(actor, ref hitLocation, ref hitNormal);
|
||||
}
|
||||
else if (hit is StaticModelNode staticModelNode)
|
||||
|
||||
@@ -1940,15 +1940,15 @@ void DebugDraw::DrawWireArc(const Vector3& position, const Quaternion& orientati
|
||||
DrawLine(prevPos, world.GetTranslation(), color, duration, depthTest);
|
||||
}
|
||||
|
||||
void DebugDraw::DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, const Color& color, float duration, bool depthTest)
|
||||
void DebugDraw::DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, float capScale, const Color& color, float duration, bool depthTest)
|
||||
{
|
||||
Float3 direction, up, right;
|
||||
Float3::Transform(Float3::Forward, orientation, direction);
|
||||
Float3::Transform(Float3::Up, orientation, up);
|
||||
Float3::Transform(Float3::Right, orientation, right);
|
||||
const Vector3 end = position + direction * (100.0f * scale);
|
||||
const Vector3 capEnd = position + direction * (70.0f * scale);
|
||||
const float arrowSidesRatio = scale * 30.0f;
|
||||
const Vector3 capEnd = end - (direction * (100 * Math::Min(capScale, scale * 0.5f)));
|
||||
const float arrowSidesRatio = Math::Min(capScale, scale * 0.5f) * 30.0f;
|
||||
|
||||
DrawLine(position, end, color, duration, depthTest);
|
||||
DrawLine(end, capEnd + up * arrowSidesRatio, color, duration, depthTest);
|
||||
|
||||
@@ -218,10 +218,11 @@ namespace FlaxEngine
|
||||
/// <param name="position">The arrow origin position.</param>
|
||||
/// <param name="orientation">The orientation (defines the arrow direction).</param>
|
||||
/// <param name="scale">The arrow scale (used to adjust the arrow size).</param>
|
||||
/// <param name="capScale">The arrow cap scale.</param>
|
||||
/// <param name="color">The color.</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>
|
||||
public static void DrawWireArrow(Vector3 position, Quaternion orientation, float scale, Color color, float duration = 0.0f, bool depthTest = true)
|
||||
public static void DrawWireArrow(Vector3 position, Quaternion orientation, float scale, float capScale, Color color, float duration = 0.0f, bool depthTest = true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -570,10 +570,11 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
/// <param name="position">The arrow origin position.</param>
|
||||
/// <param name="orientation">The orientation (defines the arrow direction).</param>
|
||||
/// <param name="scale">The arrow scale (used to adjust the arrow size).</param>
|
||||
/// <param name="capScale">The arrow cap scale.</param>
|
||||
/// <param name="color">The color.</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>
|
||||
API_FUNCTION() static void DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, const Color& color, float duration = 0.0f, bool depthTest = true);
|
||||
API_FUNCTION() static void DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, float capScale, const Color& color, float duration = 0.0f, bool depthTest = true);
|
||||
|
||||
/// <summary>
|
||||
/// Draws the box.
|
||||
@@ -650,7 +651,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
#define DEBUG_DRAW_WIRE_CYLINDER(position, orientation, radius, height, color, duration, depthTest) DebugDraw::DrawWireCylinder(position, orientation, radius, height, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_CONE(position, orientation, radius, angleXY, angleXZ, color, duration, depthTest) DebugDraw::DrawWireCone(position, orientation, radius, angleXY, angleXZ, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARC(position, orientation, radius, angle, color, duration, depthTest) DebugDraw::DrawWireArc(position, orientation, radius, angle, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, color, duration, depthTest) DebugDraw::DrawWireArrow(position, orientation, scale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, capScale, color, duration, depthTest) DebugDraw::DrawWireArrow(position, orientation, scale, capScale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_TEXT(text, position, color, size, duration) DebugDraw::DrawText(text, position, color, size, duration)
|
||||
|
||||
#else
|
||||
@@ -679,7 +680,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
#define DEBUG_DRAW_WIRE_CYLINDER(position, orientation, radius, height, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_CONE(position, orientation, radius, angleXY, angleXZ, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARC(position, orientation, radius, angle, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, capScale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_TEXT(text, position, color, size, duration)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -159,7 +159,8 @@ void D6Joint::OnDebugDrawSelected()
|
||||
const float twistSize = 9.0f;
|
||||
const Color swingColor = Color::Green.AlphaMultiplied(0.6f);
|
||||
const Color twistColor = Color::Yellow.AlphaMultiplied(0.5f);
|
||||
DEBUG_DRAW_WIRE_ARROW(target, targetRotation, swingSize / 100.0f * 0.5f, Color::Red, 0, false);
|
||||
const float arrowSize = swingSize / 100.0f * 0.5f;
|
||||
DEBUG_DRAW_WIRE_ARROW(target, targetRotation, arrowSize, arrowSize * 0.5f, Color::Red, 0, false);
|
||||
if (_motion[(int32)D6JointAxis::SwingY] == D6JointMotion::Locked && _motion[(int32)D6JointAxis::SwingZ] == D6JointMotion::Locked)
|
||||
{
|
||||
// Swing is locked
|
||||
|
||||
@@ -63,8 +63,9 @@ void HingeJoint::OnDebugDrawSelected()
|
||||
const Quaternion targetRotation = GetTargetOrientation() * xRotation;
|
||||
const float size = 15.0f;
|
||||
const Color color = Color::Green.AlphaMultiplied(0.6f);
|
||||
DEBUG_DRAW_WIRE_ARROW(source, sourceRotation, size / 100.0f * 0.5f, Color::Red, 0, false);
|
||||
DEBUG_DRAW_WIRE_ARROW(target, targetRotation, size / 100.0f * 0.5f, Color::Blue, 0, false);
|
||||
const float arrowSize = size / 100.0f * 0.5f;
|
||||
DEBUG_DRAW_WIRE_ARROW(source, sourceRotation, arrowSize, arrowSize * 0.5f, Color::Red, 0, false);
|
||||
DEBUG_DRAW_WIRE_ARROW(target, targetRotation, arrowSize, arrowSize * 0.5f, Color::Blue, 0, false);
|
||||
if (EnumHasAnyFlags(_flags, HingeJointFlag::Limit))
|
||||
{
|
||||
const float upper = Math::Max(_limit.Upper, _limit.Lower);
|
||||
|
||||
@@ -38,8 +38,9 @@ void SphericalJoint::OnDebugDrawSelected()
|
||||
const Vector3 source = GetPosition();
|
||||
const Vector3 target = GetTargetPosition();
|
||||
const float size = 15.0f;
|
||||
const float arrowSize = size / 100.0f * 0.5f;
|
||||
const Color color = Color::Green.AlphaMultiplied(0.6f);
|
||||
DEBUG_DRAW_WIRE_ARROW(source, GetOrientation(), size / 100.0f * 0.5f, Color::Red, 0, false);
|
||||
DEBUG_DRAW_WIRE_ARROW(source, GetOrientation(), arrowSize, arrowSize * 0.5f, Color::Red, 0, false);
|
||||
if (EnumHasAnyFlags(_flags, SphericalJointFlag::Limit))
|
||||
{
|
||||
DEBUG_DRAW_CONE(source, GetOrientation(), size, _limit.YLimitAngle * DegreesToRadians, _limit.ZLimitAngle * DegreesToRadians, color, 0, false);
|
||||
|
||||
Reference in New Issue
Block a user