MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DrawWireArc

Method DrawWireArc

Source/Engine/Debug/DebugDraw.cpp:2164–2199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2162}
2163
2164void DebugDraw::DrawWireArc(const Vector3& position, const Quaternion& orientation, float radius, float angle, const Color& color, float duration, bool depthTest)
2165{
2166 if (angle <= 0)
2167 return;
2168 PROFILE_MEM(EngineDebug);
2169 if (angle > TWO_PI)
2170 angle = TWO_PI;
2171 const int32 resolution = Math::CeilToInt((float)DEBUG_DRAW_CONE_RESOLUTION / TWO_PI * angle);
2172 const float angleStep = angle / (float)resolution;
2173 const Float3 positionF = position - Context->Origin;
2174 const Matrix world = Matrix::RotationQuaternion(orientation) * Matrix::Translation(positionF);
2175 float currentAngle = 0.0f;
2176 Float3 prevPos(world.GetTranslation());
2177 if (angle >= TWO_PI)
2178 {
2179 prevPos = Float3(Math::Cos(TWO_PI - angleStep) * radius, Math::Sin(TWO_PI - angleStep) * radius, 0);
2180 Float3::Transform(prevPos, world, prevPos);
2181 }
2182 const Color32 color32(color);
2183 auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
2184#define ADD_LINE(a, b) if (duration > 0) debugDrawData.DefaultLines.Add({ a, b, color32, duration }); else { debugDrawData.OneFrameLines.Add({ a, color32 }); debugDrawData.OneFrameLines.Add({ b, color32 }); }
2185 for (int32 i = 0; i <= resolution; i++)
2186 {
2187 Float3 pos(Math::Cos(currentAngle) * radius, Math::Sin(currentAngle) * radius, 0);
2188 Float3::Transform(pos, world, pos);
2189 ADD_LINE(prevPos, pos);
2190 currentAngle += angleStep;
2191 prevPos = pos;
2192 }
2193 if (angle < TWO_PI)
2194 {
2195 Float3 pos(world.GetTranslation());
2196 ADD_LINE(prevPos, pos);
2197 }
2198#undef ADD_LINE
2199}
2200
2201void DebugDraw::DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, float capScale, const Color& color, float duration, bool depthTest)
2202{

Callers

nothing calls this directly

Calls 6

RotationQuaternionFunction · 0.85
Float3Class · 0.85
TransformClass · 0.70
CeilToIntFunction · 0.50
CosFunction · 0.50
SinFunction · 0.50

Tested by

no test coverage detected