Beispiel #1
0
        public static CircleShape CreateColoredCircle(Scalar radius, int vertexCount)
        {
            CircleShape shape = new CircleShape(radius, vertexCount);

            shape.Tag = DrawableFactory.CreatePolygon(shape.Vertexes, CreateColor3Array(vertexCount));
            return(shape);
        }
Beispiel #2
0
        public static PolygonShape CreatePolygon(Vector2D[] vertexes, Scalar gridSpacing, ScalarColor4[] colors)
        {
            PolygonShape shape = new PolygonShape(vertexes, gridSpacing);

            shape.Tag = DrawableFactory.CreatePolygon(vertexes, colors);
            return(shape);
        }
Beispiel #3
0
        public static CircleShape CreateCircle(Scalar radius, int vertexCount, ScalarColor4[] colors)
        {
            CircleShape shape = new CircleShape(radius, vertexCount);

            shape.Tag = DrawableFactory.CreatePolygon(shape.Vertexes, colors);
            return(shape);
        }
Beispiel #4
0
        public static PolygonShape CreateColoredPolygon(Vector2D[] vertexes, Scalar gridSpacing)
        {
            PolygonShape shape = new PolygonShape(vertexes, gridSpacing);

            Vector2D[] reduced = VertexHelper.Reduce(vertexes);
            shape.Tag = DrawableFactory.CreatePolygon(reduced, CreateColor3Array(reduced.Length));
            return(shape);
        }
Beispiel #5
0
 public static IShape CreateMultiPolygon(Vector2D[][] polygons, Scalar gridSpacing, ScalarColor4[][] colors)
 {
     if (polygons.Length == 1)
     {
         return(CreatePolygon(polygons[0], gridSpacing, colors[0]));
     }
     else
     {
         MultiPolygonShape shape = new MultiPolygonShape(polygons, gridSpacing);
         shape.Tag = DrawableFactory.CreateMultiPolygon(polygons, colors);
         return(shape);
     }
 }
Beispiel #6
0
 public static IShape CreateColoredMultiPolygon(Vector2D[][] polygons, Scalar gridSpacing)
 {
     if (polygons.Length == 1)
     {
         return(CreateColoredPolygon(polygons[0], gridSpacing));
     }
     else
     {
         MultiPolygonShape shape   = new MultiPolygonShape(polygons, gridSpacing);
         ScalarColor3[][]  colors  = new ScalarColor3[polygons.Length][];
         Vector2D[][]      reduced = new Vector2D[polygons.Length][];
         for (int index = 0; index < polygons.Length; ++index)
         {
             reduced[index] = VertexHelper.Reduce(polygons[index]);
             colors[index]  = CreateColor3Array(reduced[index].Length);
         }
         shape.Tag = DrawableFactory.CreateMultiPolygon(reduced, colors);
         return(shape);
     }
 }
Beispiel #7
0
        public static IShape CreateSprite(SurfacePolygons surfacePolygons, Surface bumpmap, bool xInverted, bool yInverted, int reduce, Scalar subdivide, Scalar gridSpacing, Light light)
        {
            Vector2D[][] polygons = surfacePolygons.Polygons;
            for (int index = 1; index < reduce; index++)
            {
                polygons = VertexHelper.ReduceRange(polygons, index);
            }
            polygons = VertexHelper.SubdivideRange(polygons, subdivide);
            Vector2D centroid = surfacePolygons.Offset;
            IShape   shape;

            if (polygons.Length == 1)
            {
                shape = new PolygonShape(polygons[0], gridSpacing);
            }
            else
            {
                shape = new MultiPolygonShape(polygons, gridSpacing);
            }
            shape.Tag = DrawableFactory.CreateSprite(surfacePolygons.Surface, bumpmap, xInverted, yInverted, centroid, light);
            return(shape);
        }