Beispiel #1
0
        internal void DrawOutlines(Camera camera, Color outlineColor, Type type)
        {
            var zoomMatrix  = IgnoresZoom ? Matrix.Identity : Matrix.CreateScale((float)(camera.ZoomFactor), (float)(camera.ZoomFactor), 1f);
            var worldMatrix =
                Matrix.CreateTranslation((float)(-camera.Position.X * RelativeTransition.X), (float)(-camera.Position.Y * RelativeTransition.Y), 0)
                * zoomMatrix;

            Graphics.ShapeBatch.Begin(ref worldMatrix, PrimitiveType.OpenGLLines);

            // TODO: Millainen tämä ratkaisu tyyppien suhteen on suorituskyvyn kannalta?
            foreach (var o in Objects.Where(type.IsInstanceOfType))
            {
                if (o.Shape.Cache.Triangles is not null)
                {
                    Graphics.ShapeBatch.DrawOutlines(o.Shape.Cache, outlineColor, o.Position, o.Size, (float)o.Angle.Radians);
                }
            }
            Graphics.ShapeBatch.End();
        }