Ejemplo n.º 1
0
        public static bool GenerateCylinderAsset(CSGBrushMeshAsset brushMeshAsset, CSGCylinderDefinition definition)
        {
            definition.Validate();

            var tempTop    = definition.top;
            var tempBottom = definition.bottom;

            if (!definition.isEllipsoid)
            {
                tempTop.diameterZ    = tempTop.diameterX;
                tempBottom.diameterZ = tempBottom.diameterX;
            }

            switch (definition.type)
            {
            case CylinderShapeType.Cylinder:       return(BrushMeshAssetFactory.GenerateCylinderAsset(brushMeshAsset, tempBottom, tempTop.height, definition.rotation, definition.sides, definition.surfaceAssets, definition.surfaceDescriptions));

            case CylinderShapeType.ConicalFrustum: return(BrushMeshAssetFactory.GenerateConicalFrustumAsset(brushMeshAsset, tempBottom, tempTop, definition.rotation, definition.sides, definition.surfaceAssets, definition.surfaceDescriptions));

            case CylinderShapeType.Cone:           return(BrushMeshAssetFactory.GenerateConeAsset(brushMeshAsset, tempBottom, tempTop.height, definition.rotation, definition.sides, definition.surfaceAssets, definition.surfaceDescriptions));
            }
            return(false);
        }