Beispiel #1
0
        //public void PaintNavCell(Graphics g, NavCell cell, SizeF size, Vector3 low, Vector3 high, Vector2 min, float scale, int index, Demonbuddy.MeshTool.CachedScene scene)
        public static void PaintNavCell(Brush fillBrush, Pen outlinePen, Graphics g, Vector3 min, Vector3 max, Matrix3 transform, Vector3 sceneOffset)
        {
            /*
            Logging.Write(String.Format("pre min: {0}, max: {1}, sceneOffset: {2}", cell.Min, cell.Max, sceneOffset));
            Vector3 min = new Vector3(cell.Min.X, cell.Min.Y, 1);
            Vector3 max = new Vector3(cell.Max.X, cell.Max.Y, 1);
            min = transform * (min + sceneOffset);
            max = transform * (max + sceneOffset);
            Logging.Write(String.Format("post min: {0}, max: {1}, sceneOffset: {2}", min, max, sceneOffset));
            g.FillRectangle(Demonbuddy.MapViewerConstants.WalkableBrush, min.X, min.Y, (max.X - min.X), (max.Y - min.Y));
            g.DrawRectangle(MapViewerConstants.BlackPen, min.X, min.Y, (max.X - min.X), (max.Y - min.Y));
            */
            Vector3[] vectors = new Vector3[]
                                    {
                                        transform*(new Vector3(min.X, min.Y, 1)+sceneOffset),
                                        transform*(new Vector3(min.X, max.Y, 1)+sceneOffset),
                                        transform*(new Vector3(max.X, max.Y, 1)+sceneOffset),
                                        transform*(new Vector3(max.X, min.Y, 1)+sceneOffset)
                                    };
            PointF[] points = new PointF[4];
            for (int i = 0;  i < vectors.Length;  ++i)
            {
                points[i] = new PointF(vectors[i].X, vectors[i].Y);
            }
            g.FillPolygon(fillBrush, points);
            g.DrawPolygon(outlinePen, points);

            /*
            Vector2 v = min + new Vector2(cell.Min.X, cell.Min.Y);
            Vector2 vector2 = min + new Vector2(cell.Max.X, cell.Max.Y);
            PointF tf = this.ConvertToPoint(size, low, high, v);
            PointF max = this.ConvertToPoint(size, low, high, vector2);
            this.ConvertBounds(ref tf, ref max);

            if (!cell.Flags.HasFlag(NavCellFlags.AllowWalk)) return;

            g.FillRectangle(Demonbuddy.MapViewerConstants.WalkableBrush, (tf.X * scale), (tf.Y * scale), ((max.X - tf.X) * scale), ((max.Y - tf.Y) * scale));
            g.DrawRectangle(MapViewerConstants.BlackPen, (tf.X * scale), (tf.Y * scale), ((max.X - tf.X) * scale), ((max.Y - tf.Y) * scale));
            */
        }
Beispiel #2
0
 public static void PaintPoint(Pen pen, Vector3 position, Matrix3 transform, Graphics g)
 {
     //Logging.Write(String.Format("pre position: {0}", position));
     position = transform * new Vector3(position.X, position.Y, 1);
     //Logging.Write(String.Format("post position: {0}", position));
     //g.DrawRectangle(pen, position.X, position.Y, 1, 1);
     g.DrawEllipse(pen, position.X, position.Y, 1, 1);
 }