| 2129 | } |
| 2130 | |
| 2131 | void DebugDraw::DrawArc(const Vector3& position, const Quaternion& orientation, float radius, float angle, const Color& color, float duration, bool depthTest) |
| 2132 | { |
| 2133 | if (angle <= 0) |
| 2134 | return; |
| 2135 | PROFILE_MEM(EngineDebug); |
| 2136 | if (angle > TWO_PI) |
| 2137 | angle = TWO_PI; |
| 2138 | Array<DebugTriangle>* list; |
| 2139 | if (depthTest) |
| 2140 | list = duration > 0 ? &Context->DebugDrawDepthTest.DefaultTriangles : &Context->DebugDrawDepthTest.OneFrameTriangles; |
| 2141 | else |
| 2142 | list = duration > 0 ? &Context->DebugDrawDefault.DefaultTriangles : &Context->DebugDrawDefault.OneFrameTriangles; |
| 2143 | const int32 resolution = Math::CeilToInt((float)DEBUG_DRAW_CONE_RESOLUTION / TWO_PI * angle); |
| 2144 | const float angleStep = angle / (float)resolution; |
| 2145 | const Float3 positionF = position - Context->Origin; |
| 2146 | const Matrix world = Matrix::RotationQuaternion(orientation) * Matrix::Translation(positionF); |
| 2147 | float currentAngle = 0.0f; |
| 2148 | DebugTriangle t; |
| 2149 | t.Color = Color32(color); |
| 2150 | t.TimeLeft = duration; |
| 2151 | t.V0 = world.GetTranslation(); |
| 2152 | Float3 pos(Math::Cos(0.0f) * radius, Math::Sin(0.0f) * radius, 0); |
| 2153 | Float3::Transform(pos, world, t.V2); |
| 2154 | for (int32 i = 0; i < resolution; i++) |
| 2155 | { |
| 2156 | t.V1 = t.V2; |
| 2157 | currentAngle += angleStep; |
| 2158 | pos = Float3(Math::Cos(currentAngle) * radius, Math::Sin(currentAngle) * radius, 0); |
| 2159 | Float3::Transform(pos, world, t.V2); |
| 2160 | list->Add(t); |
| 2161 | } |
| 2162 | } |
| 2163 | |
| 2164 | void DebugDraw::DrawWireArc(const Vector3& position, const Quaternion& orientation, float radius, float angle, const Color& color, float duration, bool depthTest) |
| 2165 | { |