Beispiel #1
0
        public static bool GenerateCapsule(ref BrushMesh brushMesh, ref ChiselCapsuleDefinition definition)
        {
            Vector3[] vertices = null;
            if (!BrushMeshFactory.GenerateCapsuleVertices(ref definition, ref vertices))
            {
                brushMesh.Clear();
                return(false);
            }

            // TODO: share this with GenerateCapsuleVertices
            var bottomCap    = !definition.haveRoundedBottom;
            var topCap       = !definition.haveRoundedTop;
            var sides        = definition.sides;
            var segments     = definition.segments;
            var bottomVertex = definition.bottomVertex;
            var topVertex    = definition.topVertex;

            if (!BrushMeshFactory.GenerateSegmentedSubMesh(ref brushMesh,
                                                           sides, segments,
                                                           vertices,
                                                           topCap, bottomCap,
                                                           topVertex, bottomVertex,
                                                           definition.surfaceDefinition))
            {
                brushMesh.Clear();
                return(false);
            }
            return(true);
        }
        public static bool GenerateStadium(ref BrushMesh brushMesh, ref ChiselStadiumDefinition definition)
        {
            definition.Validate();
            Vector3[] vertices = null;
            if (!GenerateStadiumVertices(definition, ref vertices))
            {
                brushMesh.Clear();
                return(false);
            }

            var surfaceIndices = new int[vertices.Length + 2];

            if (!BrushMeshFactory.CreateExtrudedSubMesh(ref brushMesh, definition.sides, surfaceIndices, 0, 1, vertices, definition.surfaceDefinition))
            {
                brushMesh.Clear();
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        static bool GenerateBox(ref BrushMesh brushMesh, ref ChiselBoxDefinition definition)
        {
            definition.Validate();

            var min = definition.min;
            var max = definition.max;

            if (!BoundsExtensions.IsValid(min, max))
            {
                brushMesh.Clear();
                return(false);
            }

            return(GenerateBox(ref brushMesh, definition.min, definition.max, definition.surfaceDefinition));
        }