Beispiel #1
0
        public static Mesh CreateXYCircleMesh(float circleRadius, int numberOfCircleSlices, Color circleColor)
        {
            if (!ValidateXYCircleRadiusAndSlices(circleRadius, numberOfCircleSlices))
            {
                return(null);
            }

            var vertexPositions = GenerateXYCircleVertexPositions(circleRadius, numberOfCircleSlices);
            var vertexColors    = ListExtensions.GetFilledList(circleColor, vertexPositions.Count);
            var vertexNormals   = ListExtensions.GetFilledList(-Vector3.forward, vertexPositions.Count);
            var vertexIndices   = GenerateXYCircleVertexIndices(numberOfCircleSlices);

            return(ProceduralMeshFactory.CreateTriangleMesh(vertexPositions.ToArray(), vertexIndices, vertexColors.ToArray(), vertexNormals.ToArray()));
        }
Beispiel #2
0
        public static Mesh CreateXZRectangleMesh(float rectangleWidth, float rectangleDepth, Color rectangleColor)
        {
            if (!ValidateXYRectangleDimensions(rectangleWidth, rectangleDepth))
            {
                return(null);
            }

            var vertexPositions = Vector3Extensions.Get3DRectangleCircumferencePoints(rectangleWidth, rectangleDepth, Vector3.right, Vector3.forward, Vector3.zero);
            var vertexColors    = ListExtensions.GetFilledList(rectangleColor, 4);
            var vertexNormals   = ListExtensions.GetFilledList(Vector3.up, 4);
            var vertexIndices   = GenerateXZRectangleVertexIndices();

            return(ProceduralMeshFactory.CreateTriangleMesh(vertexPositions.ToArray(), vertexIndices, vertexColors.ToArray(), vertexNormals.ToArray()));
        }