Пример #1
0
        public static void ConvertToDclPrimitive(DclObject dclObject, PrimitiveType primitiveType)
        {
            switch (primitiveType)
            {
            case PrimitiveType.Cube:
                dclObject.dclPrimitiveType = DclPrimitiveType.box;
                break;

            case PrimitiveType.Cylinder:
                dclObject.dclPrimitiveType = DclPrimitiveType.cylinder;
                break;

            case PrimitiveType.Sphere:
                dclObject.dclPrimitiveType = DclPrimitiveType.sphere;
                break;

            case PrimitiveType.Quad:
                dclObject.dclPrimitiveType = DclPrimitiveType.plane;
                break;
            }

            SetDclPrimitiveMesh(dclObject, dclObject.dclPrimitiveType);
        }
Пример #2
0
        public static void SetDclPrimitiveMesh(DclObject dclObject, DclPrimitiveType primitiveType)
        {
            var meshFilter = dclObject.GetComponent <MeshFilter> ();

            switch (primitiveType)
            {
            case DclPrimitiveType.cone:
            {
                meshFilter.sharedMesh = Dcl.DclPrimitiveMeshBuilder.BuildCone(50, 0f, 1f, 2f, 0f, true, false);
            }
            break;

            case DclPrimitiveType.cylinder:
            {
                meshFilter.sharedMesh = Dcl.DclPrimitiveMeshBuilder.BuildCylinder(50, 1f, 1f, 2f, 0f, true, false);
            }
            break;

            case DclPrimitiveType.box:
            {
                meshFilter.sharedMesh = Dcl.DclPrimitiveMeshBuilder.BuildCube(1f);
            }
            break;

            case DclPrimitiveType.plane:
            {
                meshFilter.sharedMesh = Dcl.DclPrimitiveMeshBuilder.BuildPlane(1f);
            }
            break;

            case DclPrimitiveType.sphere:
            {
                meshFilter.sharedMesh = Dcl.DclPrimitiveMeshBuilder.BuildSphere(0.5f);
            }
            break;
            }
        }