예제 #1
0
        public static void Gambrel(ref BuildRMesh mesh, Vector2[] points, bool[] gabled, float roofBaseHeight, Roof design, List <Surface> surfaceMapping)
        {
            float roofDepth   = design.depth;
            float roofHeightB = design.heightB;
            float roofHeight  = design.height - roofHeightB;
            int   roofSubmesh = surfaceMapping.IndexOf(design.mainSurface);

            for (int p = 0; p < points.Length; p++)
            {
                Vector3 p0 = Utils.ToV3(points[p]);
                Vector3 p1 = Utils.ToV3(points[(p + 1) % points.Length]);
                Debug.DrawLine(p0, p1);
            }

            if (roofDepth > 0)
            {
                //slope one
                OffsetSkeleton offsetRoofPoly = new OffsetSkeleton(points, null, roofDepth);
                offsetRoofPoly.direction = 1;
                offsetRoofPoly.Execute();
                Shape roofShape = offsetRoofPoly.shape;
                ToMesh(ref mesh, roofShape, gabled, roofBaseHeight, roofHeightB, roofSubmesh, design.mainSurface);

                points = new Vector2[roofShape.terminatedNodeCount];
                for (int i = 0; i < roofShape.terminatedNodeCount; i++)
                {
                    points[i] = roofShape.TerminatedNode(i).position;
                }
            }
            else
            {
                roofHeight  = design.height;
                roofHeightB = 0;
            }

            //slope two
            OffsetSkeleton offsetRoofPolyB = new OffsetSkeleton(points);

            offsetRoofPolyB.direction = 1;
            offsetRoofPolyB.Execute();
            Shape roofShapeB = offsetRoofPolyB.shape;

            ToMesh(ref mesh, roofShapeB, gabled, roofBaseHeight + roofHeightB, roofHeight, roofSubmesh, design.mainSurface);
        }
예제 #2
0
        public static void MansardRoof(ref BuildRMesh mesh, Vector2[] points, bool[] gabled, float roofBaseHeight, Roof design, List <Surface> surfaceMapping)
        {
            float floorWidth = design.floorDepth;
            float roofDepth  = design.depth;
            float roofHeight = design.height;

            //mansard floor
            if (floorWidth > 0)
            {
                OffsetSkeleton offsetFloorPoly = new OffsetSkeleton(points, null, floorWidth);
                offsetFloorPoly.direction = 1;
                offsetFloorPoly.Execute();
                Shape floorShape   = offsetFloorPoly.shape;
                int   floorSubmesh = surfaceMapping.IndexOf(design.floorSurface);
                ToMesh(ref mesh, floorShape, gabled, roofBaseHeight, 0, floorSubmesh, design.floorSurface);

                points = new Vector2[floorShape.terminatedNodeCount];
                for (int i = 0; i < floorShape.terminatedNodeCount; i++)
                {
                    points[i] = floorShape.TerminatedNode(i).position;
                }
            }

            //mansard roof
            OffsetSkeleton offsetRoofPoly = new OffsetSkeleton(points, null, roofDepth);

            offsetRoofPoly.direction = 1;
            offsetRoofPoly.Execute();
            Shape roofShape   = offsetRoofPoly.shape;
            int   roofSubmesh = surfaceMapping.IndexOf(design.mainSurface);

            ToMesh(ref mesh, roofShape, gabled, roofBaseHeight, roofHeight, roofSubmesh, design.mainSurface);

            points = new Vector2[roofShape.terminatedNodeCount];
            for (int i = 0; i < roofShape.terminatedNodeCount; i++)
            {
                points[i] = roofShape.TerminatedNode(i).position;
            }

            //mansard top
            int topSubmesh = surfaceMapping.IndexOf(design.floorSurface);

            ToMesh(ref mesh, points, roofBaseHeight + roofHeight, topSubmesh, design.floorSurface);
        }