private void DrawSolidPolygon(ref FixedArray8<Vector2> vertices, int count, Color color, bool outline) { if (count == 2) { DrawPolygon(ref vertices, count, color); return; } Color colorFill = color * (outline ? 0.5f : 1.0f); for (int i = 1; i < count - 1; i++) { _vertsFill[_fillCount * 3].Position = new Vector3(vertices[0], 0.0f); _vertsFill[_fillCount * 3].Color = colorFill; _vertsFill[_fillCount * 3 + 1].Position = new Vector3(vertices[i], 0.0f); _vertsFill[_fillCount * 3 + 1].Color = colorFill; _vertsFill[_fillCount * 3 + 2].Position = new Vector3(vertices[i+1], 0.0f); _vertsFill[_fillCount * 3 + 2].Color = colorFill; _fillCount++; } if (outline) { DrawPolygon(ref vertices, count, color); } }
public override void Step(Framework.Settings settings) { Manifold manifold = new Manifold(); Collision.CollidePolygons(ref manifold, _polygonA, ref _transformA, _polygonB, ref _transformB); WorldManifold worldManifold = new WorldManifold(ref manifold, ref _transformA, _polygonA._radius, ref _transformB, _polygonB._radius); _debugDraw.DrawString(50, _textLine, "point count = {0:n}", manifold._pointCount); _textLine += 15; { Color color = new Color(0.9f, 0.9f, 0.9f); FixedArray8<Vector2> v = new FixedArray8<Vector2>(); for (int i = 0; i < _polygonA._vertexCount; ++i) { v[i] = MathUtils.Multiply(ref _transformA, _polygonA._vertices[i]); } _debugDraw.DrawPolygon(ref v, _polygonA._vertexCount, color); for (int i = 0; i < _polygonB._vertexCount; ++i) { v[i] = MathUtils.Multiply(ref _transformB, _polygonB._vertices[i]); } _debugDraw.DrawPolygon(ref v, _polygonB._vertexCount, color); } for (int i = 0; i < manifold._pointCount; ++i) { _debugDraw.DrawPoint(worldManifold._points[i], 0.5f, new Color(0.9f, 0.3f, 0.3f)); } }
public override void DrawPolygon(ref FixedArray8<Vector2> vertices, int count, Color color) { for (Int32 i = 0; i < count - 1; i++) { mPolyRender.DrawLine(mBatch, 1.0f, vertices[i], vertices[i + 1], color); } mPolyRender.DrawLine(mBatch, 1.0f, vertices[count - 1], vertices[0], color); }
public void DrawAABB(ref AABB aabb, Color color) { FixedArray8<Vector2> verts = new FixedArray8<Vector2>(); verts[0] = new Vector2(aabb.lowerBound.X, aabb.lowerBound.Y); verts[1] = new Vector2(aabb.upperBound.X, aabb.lowerBound.Y); verts[2] = new Vector2(aabb.upperBound.X, aabb.upperBound.Y); verts[3] = new Vector2(aabb.lowerBound.X, aabb.upperBound.Y); DrawPolygon(ref verts, 4, color); }
public override void DrawPolygon(ref FixedArray8<Vector2> vertices, int count, Color color) { for (int i = 0; i < count - 1; i ++) { _vertsLines[_lineCount * 2].Position = new Vector3(vertices[i], 0.0f); _vertsLines[_lineCount * 2].Color = color; _vertsLines[_lineCount * 2 + 1].Position = new Vector3(vertices[i + 1], 0.0f); _vertsLines[_lineCount * 2 + 1].Color = color; _lineCount++; } _vertsLines[_lineCount * 2].Position = new Vector3(vertices[count - 1], 0.0f); _vertsLines[_lineCount * 2].Color = color; _vertsLines[_lineCount * 2 + 1].Position = new Vector3(vertices[0], 0.0f); _vertsLines[_lineCount * 2 + 1].Color = color; _lineCount++; }
public override void DrawPolygon(ref FixedArray8<Vector2> vertices, int count, Color color) { for (int i = 0; i < count - 1; i ++) { _vertsLines[_lineCount * 2].Position = new Vector3(PhysicsManager.pInstance.PhysicalWorldToScreen(vertices[i]), 0.0f); _vertsLines[_lineCount * 2].Color = color; _vertsLines[_lineCount * 2 + 1].Position = new Vector3(PhysicsManager.pInstance.PhysicalWorldToScreen(vertices[i + 1]), 0.0f); _vertsLines[_lineCount * 2 + 1].Color = color; _lineCount++; } _vertsLines[_lineCount * 2].Position = new Vector3(PhysicsManager.pInstance.PhysicalWorldToScreen(vertices[count - 1]), 0.0f); _vertsLines[_lineCount * 2].Color = color; _vertsLines[_lineCount * 2 + 1].Position = new Vector3(PhysicsManager.pInstance.PhysicalWorldToScreen(vertices[0]), 0.0f); _vertsLines[_lineCount * 2 + 1].Color = color; _lineCount++; }
void DrawFixture(Fixture fixture) { Color color = new Color(0.95f, 0.95f, 0.6f); Transform xf; fixture.GetBody().GetTransform(out xf); switch (fixture.ShapeType) { case ShapeType.Circle: { CircleShape circle = (CircleShape)fixture.GetShape(); Vector2 center = MathUtils.Multiply(ref xf, circle._p); float radius = circle._radius; _debugDraw.DrawCircle(center, radius, color); } break; case ShapeType.Polygon: { PolygonShape poly = (PolygonShape)fixture.GetShape(); int vertexCount = poly._vertexCount; Debug.Assert(vertexCount <= Settings.b2_maxPolygonVertices); FixedArray8<Vector2> vertices = new FixedArray8<Vector2>(); for (int i = 0; i < vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref xf, poly._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, vertexCount, color); } break; } }
/// Draw a solid closed polygon provided in CCW order. public abstract void DrawSolidPolygon(ref FixedArray8<Vector2> vertices, int count, Color color);
static Vector2 ComputeCentroid(ref FixedArray8<Vector2> vs, int count) { Debug.Assert(count >= 2); Vector2 c = new Vector2(0.0f, 0.0f); float area = 0.0f; if (count == 2) { c = 0.5f * (vs[0] + vs[1]); return c; } // pRef is the reference point for forming triangles. // It's location doesn't change the result (except for rounding error). Vector2 pRef = new Vector2(0.0f, 0.0f); #if false // This code would put the reference point inside the polygon. for (int i = 0; i < count; ++i) { pRef += vs[i]; } pRef *= 1.0f / count; #endif const float inv3 = 1.0f / 3.0f; for (int i = 0; i < count; ++i) { // Triangle vertices. Vector2 p1 = pRef; Vector2 p2 = vs[i]; Vector2 p3 = i + 1 < count ? vs[i + 1] : vs[0]; Vector2 e1 = p2 - p1; Vector2 e2 = p3 - p1; float D = MathUtils.Cross(e1, e2); float triangleArea = 0.5f * D; area += triangleArea; // Area weighted centroid c += triangleArea * inv3 * (p1 + p2 + p3); } // Centroid Debug.Assert(area > Settings.b2_epsilon); c *= 1.0f / area; return c; }
void DrawShape(Fixture fixture, Transform xf, Color color) { switch (fixture.ShapeType) { case ShapeType.Circle: { CircleShape circle = (CircleShape)fixture.GetShape(); Vector2 center = MathUtils.Multiply(ref xf, circle._p); float radius = circle._radius; Vector2 axis = xf.R.col1; DebugDraw.DrawSolidCircle(center, radius, axis, color); } break; case ShapeType.Polygon: { PolygonShape poly = (PolygonShape)fixture.GetShape(); int vertexCount = poly._vertexCount; Debug.Assert(vertexCount <= Settings.b2_maxPolygonVertices); FixedArray8<Vector2> vertices = new FixedArray8<Vector2>(); for (int i = 0; i < vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref xf, poly._vertices[i]); } DebugDraw.DrawSolidPolygon(ref vertices, vertexCount, color); } break; } }
/// <summary> /// Call this to draw shapes and other debug draw data. /// </summary> public void DrawDebugData() { if (DebugDraw == null) { return; } DebugDrawFlags flags = DebugDraw.Flags; if ((flags & DebugDrawFlags.Shape) == DebugDrawFlags.Shape) { for (Body b = _bodyList; b != null; b = b.GetNext()) { Transform xf; b.GetTransform(out xf); for (Fixture f = b.GetFixtureList(); f != null; f = f.GetNext()) { if (b.IsActive() == false) { DrawShape(f, xf, new Color(0.5f, 0.5f, 0.3f)); } else if (b.GetType() == BodyType.Static) { DrawShape(f, xf, new Color(0.5f, 0.9f, 0.5f)); } else if (b.GetType() == BodyType.Kinematic) { DrawShape(f, xf, new Color(0.5f, 0.5f, 0.9f)); } else if (b.IsAwake() == false) { DrawShape(f, xf, new Color(0.6f, 0.6f, 0.6f)); } else { DrawShape(f, xf, new Color(0.9f, 0.7f, 0.7f)); } } } } if ((flags & DebugDrawFlags.Joint) == DebugDrawFlags.Joint) { for (Joint j = _jointList; j != null; j = j.GetNext()) { DrawJoint(j); } } if ((flags & DebugDrawFlags.Pair) == DebugDrawFlags.Pair) { Color color = new Color(0.3f, 0.9f, 0.9f); for (Contact c = _contactManager._contactList; c != null; c = c.GetNext()) { Fixture fixtureA = c.GetFixtureA(); Fixture fixtureB = c.GetFixtureB(); AABB aabbA; AABB aabbB; fixtureA.GetAABB(out aabbA); fixtureB.GetAABB(out aabbB); Vector2 cA = aabbA.GetCenter(); Vector2 cB = aabbB.GetCenter(); DebugDraw.DrawSegment(cA, cB, color); } } if ((flags & DebugDrawFlags.AABB) == DebugDrawFlags.AABB) { Color color = new Color(0.9f, 0.3f, 0.9f); BroadPhase bp = _contactManager._broadPhase; for (Body b = _bodyList; b != null; b = b.GetNext()) { if (b.IsActive() == false) { continue; } for (Fixture f = b.GetFixtureList(); f != null; f = f.GetNext()) { AABB aabb; bp.GetFatAABB(f._proxyId, out aabb); FixedArray8<Vector2> vs = new FixedArray8<Vector2>(); vs[0] = new Vector2(aabb.lowerBound.X, aabb.lowerBound.Y); vs[1] = new Vector2(aabb.upperBound.X, aabb.lowerBound.Y); vs[2] = new Vector2(aabb.upperBound.X, aabb.upperBound.Y); vs[3] = new Vector2(aabb.lowerBound.X, aabb.upperBound.Y); DebugDraw.DrawPolygon(ref vs, 4, color); } } } if ((flags & DebugDrawFlags.CenterOfMass) == DebugDrawFlags.CenterOfMass) { for (Body b = _bodyList; b != null; b = b.GetNext()) { Transform xf; b.GetTransform(out xf); xf.Position = b.GetWorldCenter(); DebugDraw.DrawTransform(ref xf); } } }
/// Initialize the proxy using the given shape. The shape /// must remain in scope while the proxy is in use. public void Set(Shape shape, int index) { switch (shape.ShapeType) { case ShapeType.Circle: { CircleShape circle = (CircleShape)shape; _vertices[0] = circle._p; _count = 1; _radius = circle._radius; } break; case ShapeType.Polygon: { PolygonShape polygon = (PolygonShape)shape; _vertices = polygon._vertices; _count = polygon._vertexCount; _radius = polygon._radius; } break; case ShapeType.Loop: { LoopShape loop = (LoopShape)shape; Debug.Assert(0 <= index && index < loop._count); _buffer[0] = loop._vertices[index]; if (index + 1 < loop._count) { _buffer[1] = loop._vertices[index + 1]; } else { _buffer[1] = loop._vertices[0]; } _vertices[0] = _buffer[0]; _vertices[1] = _buffer[1]; _count = 2; _radius = loop._radius; } break; case ShapeType.Edge: { EdgeShape edge = (EdgeShape)shape; _vertices[0] = edge._vertex1; _vertices[1] = edge._vertex2; _count = 2; _radius = edge._radius; } break; default: Debug.Assert(false); break; } }
public override void Step(Framework.Settings settings) { base.Step(settings); Sweep sweepA = new Sweep(); sweepA.c0 = new Vector2(24.0f, -60.0f); sweepA.a0 = 2.95f; sweepA.c = sweepA.c0; sweepA.a = sweepA.a0; sweepA.localCenter = Vector2.Zero; Sweep sweepB = new Sweep(); sweepB.c0 = new Vector2(53.474274f, -50.252514f); sweepB.a0 = 513.36676f; sweepB.c = new Vector2(54.595478f, -51.083473f); sweepB.a = 513.62781f; sweepB.localCenter = Vector2.Zero; TOIInput input = new TOIInput(); input.proxyA.Set(_shapeA, 0); input.proxyB.Set(_shapeB, 0); input.sweepA = sweepA; input.sweepB = sweepB; input.tMax = 1.0f; TOIOutput output; XNA.TimeOfImpact.CalculateTimeOfImpact(out output, ref input); _debugDraw.DrawString(50, _textLine, "toi = {0:n}", output.t); _textLine += 15; _debugDraw.DrawString(50, _textLine, "max toi iters = {0:n}, max root iters = {1:n}", XNA.TimeOfImpact.b2_toiMaxIters, XNA.TimeOfImpact.b2_toiMaxRootIters); _textLine += 15; FixedArray8<Vector2> vertices = new FixedArray8<Vector2>(); Transform transformA; sweepA.GetTransform(out transformA, 0.0f); for (int i = 0; i < _shapeA._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformA, _shapeA._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeA._vertexCount, new Color(0.9f, 0.9f, 0.9f)); Transform transformB; sweepB.GetTransform(out transformB, 0.0f); Vector2 localPoint = new Vector2(2.0f, -0.1f); Vector2 rB = MathUtils.Multiply(ref transformB, localPoint) - sweepB.c0; float wB = sweepB.a - sweepB.a0; Vector2 vB = sweepB.c - sweepB.c0; Vector2 v = vB + MathUtils.Cross(wB, rB); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.5f, 0.9f, 0.5f)); sweepB.GetTransform(out transformB, output.t); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.5f, 0.7f, 0.9f)); sweepB.GetTransform(out transformB, 1.0f); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.9f, 0.5f, 0.5f)); }
public override void DrawSolidPolygon(ref FixedArray8 <Vector2> vertices, int count, Color color) { DrawSolidPolygon(ref vertices, count, color, true); }
public override void Step(Framework.Settings settings) { base.Step(settings); Sweep sweepA = new Sweep(); sweepA.c0 = new Vector2(24.0f, -60.0f); sweepA.a0 = 2.95f; sweepA.c = sweepA.c0; sweepA.a = sweepA.a0; sweepA.localCenter = Vector2.Zero; Sweep sweepB = new Sweep(); sweepB.c0 = new Vector2(53.474274f, -50.252514f); sweepB.a0 = 513.36676f; sweepB.c = new Vector2(54.595478f, -51.083473f); sweepB.a = 513.62781f; sweepB.localCenter = Vector2.Zero; TOIInput input = new TOIInput(); input.proxyA.Set(_shapeA, 0); input.proxyB.Set(_shapeB, 0); input.sweepA = sweepA; input.sweepB = sweepB; input.tMax = 1.0f; TOIOutput output; Alt.Box2D.TimeOfImpact.CalculateTimeOfImpact(out output, ref input); _debugDraw.DrawString(50, _textLine, "toi = {0:n}", output.t); _textLine += 15; _debugDraw.DrawString(50, _textLine, "max toi iters = {0:n}, max root iters = {1:n}", Alt.Box2D.TimeOfImpact.b2_toiMaxIters, Alt.Box2D.TimeOfImpact.b2_toiMaxRootIters); _textLine += 15; FixedArray8 <Vector2> vertices = new FixedArray8 <Vector2>(); Alt.Box2D.Transform transformA; sweepA.GetTransform(out transformA, 0.0f); for (int i = 0; i < _shapeA._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformA, _shapeA._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeA._vertexCount, new ColorR(0.9, 0.9, 0.9)); Alt.Box2D.Transform transformB; sweepB.GetTransform(out transformB, 0.0f); //NoNeed Vector2 localPoint = new Vector2(2.0f, -0.1f); //NoNeed Vector2 rB = MathUtils.Multiply(ref transformB, localPoint) - sweepB.c0; //NoNeed double wB = sweepB.a - sweepB.a0; //NoNeed Vector2 vB = sweepB.c - sweepB.c0; //Vector2 v = vB + MathUtils.Cross(wB, rB); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new ColorR(0.5, 0.9, 0.5)); sweepB.GetTransform(out transformB, output.t); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new ColorR(0.5f, 0.7f, 0.9f)); sweepB.GetTransform(out transformB, 1.0f); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new ColorR(0.9, 0.5, 0.5)); }
/// Call this to draw shapes and other debug draw data. public void DrawDebugData() { if (DebugDraw == null) { return; } DebugDrawFlags flags = DebugDraw.Flags; if ((flags & DebugDrawFlags.Shape) == DebugDrawFlags.Shape) { for (Body b = _bodyList; b != null; b = b.GetNext()) { XForm xf; b.GetXForm(out xf); for (Fixture f = b.GetFixtureList(); f != null; f = f.GetNext()) { if (b.IsStatic) { DrawShape(f, xf, ColorEx.FromScRgb(0.5f, 0.9f, 0.5f)); } else if (b.IsSleeping) { DrawShape(f, xf, ColorEx.FromScRgb(0.5f, 0.5f, 0.9f)); } else { DrawShape(f, xf, ColorEx.FromScRgb(0.9f, 0.9f, 0.9f)); } } } } if ((flags & DebugDrawFlags.Joint) == DebugDrawFlags.Joint) { for (Joint j = _jointList; j != null; j = j.GetNext()) { if (j.JointType != JointType.Mouse) { DrawJoint(j); } } } if ((flags & DebugDrawFlags.Pair) == DebugDrawFlags.Pair) { // TODO } if ((flags & DebugDrawFlags.AABB) == DebugDrawFlags.AABB) { Color color = ColorEx.FromScRgb(0.9f, 0.3f, 0.9f); BroadPhase bp = _contactManager._broadPhase; for (Body b = _bodyList; b != null; b = b.GetNext()) { for (Fixture f = b.GetFixtureList(); f != null; f = f.GetNext()) { AABB aabb; bp.GetAABB(f._proxyId, out aabb); FixedArray8<Vector2> vs = new FixedArray8<Vector2>(); vs[0] = new Vector2(aabb.lowerBound.X, aabb.lowerBound.Y); vs[1] = new Vector2(aabb.upperBound.X, aabb.lowerBound.Y); vs[2] = new Vector2(aabb.upperBound.X, aabb.upperBound.Y); vs[3] = new Vector2(aabb.lowerBound.X, aabb.upperBound.Y); DebugDraw.DrawPolygon(ref vs, 4, color); } } } if ((flags & DebugDrawFlags.CenterOfMass) == DebugDrawFlags.CenterOfMass) { for (Body b = _bodyList; b != null; b = b.GetNext()) { XForm xf; b.GetXForm(out xf); xf.Position = b.GetWorldCenter(); DebugDraw.DrawXForm(ref xf); } } }
public override void Step(Framework.Settings settings) { base.Step(settings); DistanceInput input = new DistanceInput(); input.proxyA.Set(_polygonA, 0); input.proxyB.Set(_polygonB, 0); input.transformA = _transformA; input.transformB = _transformB; input.useRadii = true; SimplexCache cache = new SimplexCache(); cache.count = 0; DistanceOutput output = new DistanceOutput(); Distance.ComputeDistance( out output, out cache, ref input); _debugDraw.DrawString(50, _textLine, "distance = {0:n}", output.distance); _textLine += 15; _debugDraw.DrawString(50, _textLine, "iterations = {0:n}", output.iterations); _textLine += 15; { Color color = new Color(0.9f, 0.9f, 0.9f); FixedArray8<Vector2> v = new FixedArray8<Vector2>(); for (int i = 0; i < _polygonA._vertexCount; ++i) { v[i] = MathUtils.Multiply(ref _transformA, _polygonA._vertices[i]); } _debugDraw.DrawPolygon(ref v, _polygonA._vertexCount, color); for (int i = 0; i < _polygonB._vertexCount; ++i) { v[i] = MathUtils.Multiply(ref _transformB, _polygonB._vertices[i]); } _debugDraw.DrawPolygon(ref v, _polygonB._vertexCount, color); } Vector2 x1 = output.pointA; Vector2 x2 = output.pointB; _debugDraw.DrawPoint(x1, 0.5f, new Color(1.0f, 0.0f, 0.0f)); _debugDraw.DrawPoint(x2, 0.5f, new Color(1.0f, 0.0f, 0.0f)); _debugDraw.DrawSegment(x1, x2, new Color(1.0f, 1.0f, 0.0f)); }
/// <summary> /// Initialize the proxy using the given shape. The shape /// must remain in scope while the proxy is in use. /// </summary> /// <param name="shape"></param> public void Set(Shape shape) { switch (shape.ShapeType) { case ShapeType.Circle: { CircleShape circle = (CircleShape)shape; _vertices[0] = circle._p; _count = 1; _radius = circle._radius; } break; case ShapeType.Polygon: { PolygonShape polygon = (PolygonShape)shape; _vertices = polygon._vertices; _count = polygon._vertexCount; _radius = polygon._radius; } break; default: Debug.Assert(false); break; } }
public override void DrawPolygon(ref FixedArray8<Vector2> vertices, int count, Color color) { for (int i = 1; i < count; i++) { var start = Level.ConvertFromBox2D(vertices[i - 1]); var end = Level.ConvertFromBox2D(vertices[i]); spriteBatch.DrawLine(start, end, color); } if (count > 1) { spriteBatch.DrawLine(Level.ConvertFromBox2D(vertices[0]), Level.ConvertFromBox2D(vertices[count - 1]), color); } }
public override void DrawSolidPolygon(ref FixedArray8<Vector2> vertices, int count, Color color) { DrawSolidPolygon(ref vertices, count, color, true); }
public override void DrawSolidPolygon(ref FixedArray8 <Vector2> vertices, int count, Color color) { //throw new NotImplementedException(); //for now, render this as an empty shape, not filled DrawPolygon(ref vertices, count, color); }
public void DrawPoint(Vector2 p, float size, Color color) { FixedArray8<Vector2> verts = new FixedArray8<Vector2>(); float hs = size / 2.0f; verts[0] = p + new Vector2(-hs, -hs); verts[1] = p + new Vector2( hs, -hs); verts[2] = p + new Vector2( hs, hs); verts[3] = p + new Vector2(-hs, hs); DrawSolidPolygon(ref verts, 4, color, true); }
private void DrawSolidPolygon(ref FixedArray8<Vector2> vertices, int count, Color color, bool outline) { if (count == 2) { DrawPolygon(ref vertices, count, color); return; } // // NOTE: I have not figured out a way to render fill using sprite batches. // if (outline) { DrawPolygon(ref vertices, count, color); } }