| 2162 | } |
| 2163 | |
| 2164 | void 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 | |
| 2201 | void DebugDraw::DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, float capScale, const Color& color, float duration, bool depthTest) |
| 2202 | { |