public DefaultCubePart()
        {
            float side     = 1f;
            float halfSide = side / 2;

            sides = new[]
            {
                ModelBuilder.CreateParallelogram(  // left
                    new Vector3(-halfSide, -halfSide, halfSide),
                    new Vector3(0, 0, -side),
                    new Vector3(0, side, 0),
                    Color.White),
                ModelBuilder.CreateParallelogram(  // right
                    new Vector3(halfSide, -halfSide, halfSide),
                    new Vector3(0, side, 0),
                    new Vector3(0, 0, -side),
                    Color.White),
                ModelBuilder.CreateParallelogram(  // top
                    new Vector3(-halfSide, halfSide, halfSide),
                    new Vector3(0, 0, -side),
                    new Vector3(side, 0, 0),
                    Color.White),
                ModelBuilder.CreateParallelogram(  // bottom
                    new Vector3(-halfSide, -halfSide, halfSide),
                    new Vector3(side, 0, 0),
                    new Vector3(0, 0, -side),
                    Color.White),
                ModelBuilder.CreateParallelogram(  // front
                    new Vector3(-halfSide, -halfSide, halfSide),
                    new Vector3(0, side, 0),
                    new Vector3(side, 0, 0),
                    Color.White),
                ModelBuilder.CreateParallelogram(  // back
                    new Vector3(-halfSide, -halfSide, -halfSide),
                    new Vector3(side, 0, 0),
                    new Vector3(0, side, 0),
                    Color.White),
            };

            allPolygons = new ConcatCollection <Triangle>(sides);
        }
Пример #2
0
        public CircleCubePart()
        {
            float side     = 1f;
            float halfSide = side / 2;

            sides = new[]
            {
                ModelBuilder.CreateCircle(  // left
                    new Vector3(-halfSide, 0, 0),
                    new Vector3(0, halfSide, 0),
                    new Vector3(-1, 0, 0),
                    CirclePointCount, Color.White),
                ModelBuilder.CreateCircle(  // right
                    new Vector3(halfSide, 0, 0),
                    new Vector3(0, halfSide, 0),
                    new Vector3(1, 0, 0),
                    CirclePointCount, Color.White),
                ModelBuilder.CreateCircle(  // top
                    new Vector3(0, halfSide, 0),
                    new Vector3(halfSide, 0, 0),
                    new Vector3(0, 1, 0),
                    CirclePointCount, Color.White),
                ModelBuilder.CreateCircle(  // bottom
                    new Vector3(0, -halfSide, 0),
                    new Vector3(halfSide, 0, 0),
                    new Vector3(0, -1, 0),
                    CirclePointCount, Color.White),
                ModelBuilder.CreateCircle(  // front
                    new Vector3(0, 0, halfSide),
                    new Vector3(halfSide, 0, 0),
                    new Vector3(0, 0, 1),
                    CirclePointCount, Color.White),
                ModelBuilder.CreateCircle(  // back
                    new Vector3(0, 0, -halfSide),
                    new Vector3(halfSide, 0, 0),
                    new Vector3(0, 0, -1),
                    CirclePointCount, Color.White),
            };

            allPolygons = new ConcatCollection <Triangle>(sides);
        }