protected static MeshDraft AtticVented(Vector3 origin, float width, float height, Color wallColor,
                                               Color holeColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;
            Vector3 center       = origin + widthVector / 2 + heightVector / 2;

            Vector3 holeOrigin = center - Vector3.right * AtticHoleWidth / 2 - Vector3.up * AtticHoleHeight / 2;
            Vector3 holeWidth  = Vector3.right * AtticHoleWidth;
            Vector3 holeHeight = Vector3.up * AtticHoleHeight;
            Vector3 holeDepth  = Vector3.forward * AtticHoleDepth;

            var draft = PerforatedQuad(origin, origin + widthVector + heightVector, holeOrigin,
                                       holeOrigin + holeWidth + holeHeight);

            draft.Paint(wallColor);

            var hexahedron = MeshDraft.PartialBox(holeWidth, holeDepth, holeHeight, Directions.All & ~Directions.Back);

            hexahedron.Move(center + holeDepth / 2);
            hexahedron.FlipFaces();
            hexahedron.Paint(holeColor);
            draft.Add(hexahedron);
            return(draft);
        }
Exemplo n.º 2
0
        private static MeshDraft WindowpaneFrameRods(Vector3 min, Vector3 widthVector, Vector3 heightVector,
                                                     out Vector3 frameWidth, out Vector3 frameHeight, out Vector3 frameDepth, out Vector3 startPosition)
        {
            var frame = new MeshDraft {
                name = WallDraftName
            };

            Vector3 right  = widthVector.normalized;
            Vector3 normal = Vector3.Cross(heightVector, right).normalized;

            float width    = widthVector.magnitude;
            int   rodCount = Mathf.FloorToInt(width / WindowSegmentMinWidth);
            float interval = width / (rodCount + 1);

            frameWidth    = right * WindowFrameWidth / 2;
            frameHeight   = Vector3.up * WindowFrameWidth / 2;
            frameDepth    = -normal * WindowFrameWidth / 2;
            startPosition = min + heightVector / 2 + frameDepth / 2;
            for (int i = 0; i < rodCount; i++)
            {
                var rod = MeshDraft.PartialBox(frameWidth * 2, frameDepth, heightVector - frameHeight * 2,
                                               Directions.Left | Directions.Back | Directions.Right, false)
                          .Move(startPosition + right * (i + 1) * interval);
                frame.Add(rod);
            }
            return(frame);
        }
Exemplo n.º 3
0
        protected static MeshDraft Entrance(Vector3 origin, float width, float height, Color wallColor, Color doorColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;

            Vector3 doorWidth     = Vector3.right * EntranceDoorWidth;
            Vector3 doorHeight    = Vector3.up * EntranceDoorHeight;
            Vector3 doorThickness = Vector3.back * EntranceDoorThickness;
            Vector3 doorOrigin    = origin + widthVector / 2 - doorWidth / 2;

            var draft = EntranceBracket(origin, widthVector, heightVector, doorOrigin, doorWidth, doorHeight)
                        .Paint(wallColor);

            var doorFrame = MeshDraft.PartialBox(doorWidth, -doorThickness, doorHeight, Directions.All & ~Directions.ZAxis, false)
                            .Move(doorOrigin + doorWidth / 2 + doorHeight / 2 + doorThickness / 2)
                            .Paint(doorColor);

            draft.Add(doorFrame);

            var door = new MeshDraft().AddQuad(doorOrigin + doorThickness, doorWidth, doorHeight, true)
                       .Paint(doorColor);

            draft.Add(door);
            return(draft);
        }
        protected static MeshDraft Window(
            Vector3 min,
            float width,
            float height,
            float widthOffset,
            float bottomOffset,
            float topOffset,
            Color wallColor,
            Color frameColor,
            Color glassColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;
            Vector3 max          = min + widthVector + heightVector;
            Vector3 frameMin     = min + Vector3.right * widthOffset + Vector3.up * bottomOffset;
            Vector3 frameMax     = max - Vector3.right * widthOffset - Vector3.up * topOffset;
            Vector3 frameWidth   = Vector3.right * (width - widthOffset * 2);
            Vector3 frameHeight  = Vector3.up * (height - bottomOffset - topOffset);
            Vector3 frameDepth   = Vector3.forward * WindowDepth;
            Vector3 frameSize    = frameMax - frameMin;

            var draft = PerforatedQuad(min, max, frameMin, frameMax);

            var frame = MeshDraft.PartialBox(frameWidth, -frameDepth, frameHeight,
                                             Directions.All & ~Directions.ZAxis);

            frame.Move(frameMin + frameSize / 2 + frameDepth / 2);
            draft.Add(frame);
            draft.Paint(wallColor);

            draft.Add(Windowpane(frameMin + frameDepth, frameMax + frameDepth, frameColor, glassColor));

            return(draft);
        }
Exemplo n.º 5
0
        protected static CompoundMeshDraft SocleWindowed(Vector3 origin, float width, float height, Color wallColor, Color glassColor)
        {
            if (width < SocleWindowMinWidth)
            {
                return(new CompoundMeshDraft().Add(Wall(origin, width, height, wallColor)));
            }

            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;

            Vector3 windowWidth  = Vector3.right * SocleWindowWidth;
            Vector3 windowHeigth = Vector3.up * SocleWindowHeight;
            Vector3 windowDepth  = Vector3.forward * SocleWindowDepth;
            Vector3 windowOrigin = origin + widthVector / 2 - windowWidth / 2 + Vector3.up * SocleWindowHeightOffset;
            Vector3 windowMax    = windowOrigin + windowWidth + windowHeigth;

            var frame = MeshDraft.PartialBox(windowWidth, -windowDepth, windowHeigth, Directions.All & ~Directions.ZAxis, false)
                        .Move(windowOrigin + windowWidth / 2 + windowHeigth / 2 + windowDepth / 2);

            var wall = PerforatedQuad(origin, origin + widthVector + heightVector, windowOrigin, windowMax)
                       .Add(frame)
                       .Paint(wallColor);

            wall.name = WallDraftName;

            var glass = new MeshDraft()
                        .AddQuad(windowOrigin + windowDepth / 2, windowWidth, windowHeigth, true)
                        .Paint(glassColor);

            glass.name = GlassDraftName;

            return(new CompoundMeshDraft().Add(wall).Add(glass));
        }
        protected static MeshDraft SocleWindowed(Vector3 origin, float width, float height, Color wallColor,
                                                 Color glassColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;

            Vector3 windowWidth  = Vector3.right * SocleWindowWidth;
            Vector3 windowHeigth = Vector3.up * SocleWindowHeight;
            Vector3 windowDepth  = Vector3.forward * SocleWindowDepth;
            Vector3 windowOrigin = origin + widthVector / 2 - windowWidth / 2 + Vector3.up * SocleWindowHeightOffset;
            Vector3 windowMax    = windowOrigin + windowWidth + windowHeigth;

            var wall = PerforatedQuad(origin, origin + widthVector + heightVector, windowOrigin, windowMax);

            var frame = MeshDraft.PartialBox(windowWidth, -windowDepth, windowHeigth,
                                             Directions.All & ~Directions.ZAxis);

            frame.Move(windowOrigin + windowWidth / 2 + windowHeigth / 2 + windowDepth / 2);
            wall.Add(frame);
            wall.Paint(wallColor);

            var window = MeshDraft.Quad(windowOrigin + windowDepth / 2, windowWidth, windowHeigth);

            window.Paint(glassColor);
            wall.Add(window);

            return(wall);
        }
Exemplo n.º 7
0
        protected static CompoundMeshDraft AtticVented(Vector3 origin, float width, float height, Color wallColor, Color holeColor)
        {
            if (width < AtticHoleMinWidth)
            {
                return(new CompoundMeshDraft().Add(Wall(origin, width, height, wallColor)));
            }

            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;
            Vector3 center       = origin + widthVector / 2 + heightVector / 2;

            Vector3 holeOrigin = center - Vector3.right * AtticHoleWidth / 2 - Vector3.up * AtticHoleHeight / 2;
            Vector3 holeWidth  = Vector3.right * AtticHoleWidth;
            Vector3 holeHeight = Vector3.up * AtticHoleHeight;
            Vector3 holeDepth  = Vector3.forward * AtticHoleDepth;

            var wall = PerforatedQuad(origin, origin + widthVector + heightVector, holeOrigin, holeOrigin + holeWidth + holeHeight)
                       .Paint(wallColor);

            var hole = MeshDraft.PartialBox(holeWidth, holeDepth, holeHeight, Directions.All & ~Directions.Back, false)
                       .Move(center + holeDepth / 2)
                       .FlipFaces()
                       .Paint(holeColor);

            wall.Add(hole);
            wall.name = WallDraftName;
            return(new CompoundMeshDraft().Add(wall));
        }
Exemplo n.º 8
0
 private static MeshDraft BalconyOuter(Vector3 origin, Vector3 widthVector, Vector3 balconyHeight, Vector3 balconyDepth,
                                       out Vector3 balconyCenter)
 {
     balconyCenter = origin + widthVector / 2 - balconyDepth / 2 + balconyHeight / 2;
     return(MeshDraft.PartialBox(widthVector, balconyDepth, balconyHeight,
                                 Directions.All & ~Directions.Up & ~Directions.Forward, false)
            .Move(balconyCenter));
 }
Exemplo n.º 9
0
        private static MeshDraft WindowpaneOuterFrame(Vector3 min, Vector3 max, Vector3 widthVector, Vector3 frameDepth, Vector3 startPosition,
                                                      Vector3 windowMin, Vector3 windowWidth, Vector3 windowHeight, Vector3 windowMax)
        {
            var outerFrame = new MeshDraft();

            outerFrame.Add(PerforatedQuad(min, max, windowMin, windowMax));
            var box = MeshDraft.PartialBox(windowWidth, frameDepth, windowHeight, Directions.All & ~Directions.ZAxis, false)
                      .FlipFaces()
                      .Move(startPosition + widthVector / 2);

            outerFrame.Add(box);
            return(outerFrame);
        }
Exemplo n.º 10
0
        protected static CompoundMeshDraft Window(
            Vector3 min,
            float width,
            float height,
            float widthOffset,
            float bottomOffset,
            float topOffset,
            Color wallColor,
            Color frameColor,
            Color glassColor,
            bool hasWindowsill = false)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;
            Vector3 max          = min + widthVector + heightVector;
            Vector3 frameMin     = min + Vector3.right * widthOffset + Vector3.up * bottomOffset;
            Vector3 frameMax     = max - Vector3.right * widthOffset - Vector3.up * topOffset;
            Vector3 frameWidth   = Vector3.right * (width - widthOffset * 2);
            Vector3 frameHeight  = Vector3.up * (height - bottomOffset - topOffset);
            Vector3 frameDepth   = Vector3.forward * WindowDepth;
            Vector3 frameSize    = frameMax - frameMin;

            var frame = MeshDraft.PartialBox(frameWidth, frameDepth, frameHeight, Directions.All & ~Directions.ZAxis, false)
                        .FlipFaces()
                        .Move(frameMin + frameSize / 2 + frameDepth / 2);

            var wall = PerforatedQuad(min, max, frameMin, frameMax)
                       .Add(frame)
                       .Paint(wallColor);

            wall.name = WallDraftName;

            var windowpane = Windowpane(frameMin + frameDepth, frameMax + frameDepth, frameColor, glassColor);

            var compoundDraft = new CompoundMeshDraft().Add(wall).Add(windowpane);

            if (hasWindowsill)
            {
                Vector3 windowsillWidth  = frameWidth + Vector3.right * WindowsillWidthOffset;
                Vector3 windowsillDepth  = Vector3.forward * WindowsillDepth;
                Vector3 windowsillHeight = Vector3.up * WindowsillThickness;
                var     windowsill       = MeshDraft.PartialBox(windowsillWidth, windowsillDepth, windowsillHeight,
                                                                Directions.All & ~Directions.Forward, false)
                                           .Move(frameMin + frameWidth / 2 + frameDepth - windowsillDepth / 2)
                                           .Paint(frameColor);
                windowsill.name = WallDraftName;
                compoundDraft.Add(windowsill);
            }
            return(compoundDraft);
        }
Exemplo n.º 11
0
        protected static MeshDraft EntranceRoofed(Vector3 origin, float width, float height, Color wallColor,
                                                  Color doorColor, Color roofColor)
        {
            var     draft       = Entrance(origin, width, height, wallColor, doorColor);
            Vector3 widthVector = Vector3.right * width;
            Vector3 depthVector = Vector3.forward * EntranceRoofDepth;

            var roof = MeshDraft.PartialBox(widthVector, depthVector, Vector3.up * EntranceRoofHeight, Directions.All & ~Directions.Forward, false)
                       .Move(origin + widthVector / 2 + Vector3.up * (height - EntranceRoofHeight / 2) - depthVector / 2)
                       .Paint(roofColor);

            draft.Add(roof);
            return(draft);
        }
Exemplo n.º 12
0
        private static MeshDraft BalconyInner(Vector3 widthVector, Vector3 balconyHeight, Vector3 balconyDepth, Vector3 balconyCenter,
                                              out Vector3 innerWidthOffset, out Vector3 innerWidth, out Vector3 innerDepth)
        {
            innerWidthOffset = Vector3.right * BalconyThickness;
            innerWidth       = widthVector - innerWidthOffset * 2;
            Vector3 innerHeightOffset = Vector3.up * BalconyThickness;
            Vector3 innerHeight       = balconyHeight - innerHeightOffset;
            Vector3 innerDepthOffset  = Vector3.forward * BalconyThickness;

            innerDepth = balconyDepth - innerDepthOffset;
            return(MeshDraft.PartialBox(innerWidth, innerDepth, innerHeight,
                                        Directions.All & ~Directions.Up & ~Directions.Forward, false)
                   .FlipFaces()
                   .Move(balconyCenter + innerDepthOffset / 2 + innerHeightOffset / 2));
        }
Exemplo n.º 13
0
        private static CompoundMeshDraft Windowpane(Vector3 min, Vector3 max, Color frameColor, Color glassColor)
        {
            Vector3 size         = max - min;
            Vector3 widthVector  = size.ToVector3XZ();
            Vector3 heightVector = size.ToVector3Y();
            Vector3 right        = widthVector.normalized;
            Vector3 normal       = Vector3.Cross(widthVector, heightVector).normalized;
            var     frame        = new MeshDraft {
                name = WallDraftName
            };

            int   rodCount = Mathf.FloorToInt(widthVector.magnitude / WindowSegmentMinWidth);
            float interval = widthVector.magnitude / (rodCount + 1);

            Vector3 frameWidth    = right * WindowFrameWidth / 2;
            Vector3 frameHeight   = Vector3.up * WindowFrameWidth / 2;
            Vector3 frameLength   = normal * WindowFrameWidth / 2;
            Vector3 startPosition = min + heightVector / 2 + frameLength / 2;

            for (int i = 0; i < rodCount; i++)
            {
                var rod = MeshDraft.PartialBox(frameWidth * 2, frameLength, heightVector - frameHeight * 2,
                                               Directions.Left | Directions.Back | Directions.Right, false)
                          .Move(startPosition + right * (i + 1) * interval);
                frame.Add(rod);
            }

            Vector3 windowMin    = min + frameWidth + frameHeight;
            Vector3 windowWidth  = widthVector - frameWidth * 2;
            Vector3 windowHeight = heightVector - frameHeight * 2;
            Vector3 windowMax    = windowMin + windowWidth + windowHeight;

            frame.Add(PerforatedQuad(min, max, windowMin, windowMax));

            var hole = MeshDraft.PartialBox(windowWidth, frameLength, windowHeight, Directions.All & ~Directions.ZAxis, false)
                       .Move(startPosition + widthVector / 2)
                       .FlipFaces();

            frame.Add(hole);
            frame.Paint(frameColor);

            var glass = new MeshDraft().AddQuad(windowMin + frameLength, windowWidth, windowHeight)
                        .Paint(glassColor);

            glass.name = GlassDraftName;

            return(new CompoundMeshDraft().Add(frame).Add(glass));
        }
        private static MeshDraft Windowpane(Vector3 min, Vector3 max, Color frameColor, Color glassColor)
        {
            Vector3 size         = max - min;
            Vector3 widthVector  = size.OnlyXZ();
            Vector3 heightVector = size.OnlyY();
            Vector3 right        = widthVector.normalized;
            Vector3 normal       = Vector3.Cross(widthVector, heightVector).normalized;
            var     draft        = new MeshDraft();

            int   rodCount = Mathf.FloorToInt(widthVector.magnitude / WindowSegmentMinWidth);
            float interval = widthVector.magnitude / (rodCount + 1);

            Vector3 frameWidth    = right * WindowFrameWidth / 2;
            Vector3 frameHeight   = Vector3.up * WindowFrameWidth / 2;
            Vector3 frameLength   = normal * WindowFrameWidth / 2;
            Vector3 startPosition = min + heightVector / 2 + frameLength / 2;

            for (int i = 0; i < rodCount; i++)
            {
                var frame = MeshDraft.PartialBox(frameWidth * 2, frameLength, heightVector - frameHeight * 2,
                                                 Directions.Left | Directions.Back | Directions.Right);
                frame.Move(startPosition + right * (i + 1) * interval);
                draft.Add(frame);
            }

            Vector3 windowMin    = min + frameWidth + frameHeight;
            Vector3 windowWidth  = widthVector - frameWidth * 2;
            Vector3 windowHeight = heightVector - frameHeight * 2;
            Vector3 windowMax    = windowMin + windowWidth + windowHeight;
            var     window       = PerforatedQuad(min, max, windowMin, windowMax);

            draft.Add(window);

            var hole = MeshDraft.PartialBox(windowWidth, frameLength, windowHeight, Directions.All & ~Directions.ZAxis);

            hole.Move(startPosition + widthVector / 2);
            hole.FlipFaces();
            draft.Add(hole);
            draft.Paint(frameColor);

            var glass = MeshDraft.Quad(windowMin + frameLength, windowWidth, windowHeight);

            glass.Paint(glassColor);
            draft.Add(glass);

            return(draft);
        }
Exemplo n.º 15
0
        private static MeshDraft Windowpane(Vector3 origin, Vector3 width, Vector3 heigth)
        {
            Vector3 right  = width.normalized;
            Vector3 normal = Vector3.Cross(width, heigth).normalized;
            var     draft  = new MeshDraft();

            int   rodCount = Mathf.FloorToInt(width.magnitude / WindowSegmentMinWidth);
            float interval = width.magnitude / (rodCount + 1);

            Vector3 frameWidth    = right * WindowFrameWidth / 2;
            Vector3 frameHeight   = Vector3.up * WindowFrameWidth / 2;
            Vector3 frameLength   = normal * WindowFrameWidth / 2;
            Vector3 startPosition = origin + heigth / 2 + frameLength / 2;

            for (int i = 0; i < rodCount; i++)
            {
                var frame = MeshDraft.PartialBox(frameWidth * 2, frameLength, heigth - frameHeight * 2,
                                                 Directions.Left | Directions.Back | Directions.Right);
                frame.Move(startPosition + right * (i + 1) * interval);
                draft.Add(frame);
            }

            Vector3 windowCorner = origin + frameWidth + frameHeight;
            Vector3 windowWidth  = width - frameWidth * 2;
            Vector3 windowHeigth = heigth - frameHeight * 2;
            var     window       = PerforatedQuad(origin, width, heigth, windowCorner, windowWidth, windowHeigth);

            draft.Add(window);

            var hole = MeshDraft.PartialBox(windowWidth, frameLength, windowHeigth, Directions.All & ~Directions.ZAxis);

            hole.Move(startPosition + width / 2);
            hole.FlipFaces();
            draft.Add(hole);

            draft.Paint(BuildingGenerator.frameColor);

            var glass = MeshDraft.Quad(windowCorner + frameLength, windowWidth, windowHeigth);

            glass.Paint(BuildingGenerator.glassColor);
            draft.Add(glass);

            return(draft);
        }
Exemplo n.º 16
0
        public static MeshDraft AtticVented(Vector3 origin, Vector3 width, Vector3 height)
        {
            Vector3 right      = width.normalized;
            Vector3 center     = origin + width / 2 + height / 2;
            Vector3 holeOrigin = center - right * AtticHoleWidth / 2 - Vector3.up * AtticHoleHeight / 2;
            Vector3 holeWidth  = right * AtticHoleWidth;
            Vector3 holeHeight = Vector3.up * AtticHoleHeight;
            Vector3 holeDepth  = Vector3.Cross(width, height).normalized *AtticHoleDepth;

            var draft = PerforatedQuad(origin, width, height, holeOrigin, holeWidth, holeHeight);

            draft.Paint(BuildingGenerator.wallColor);

            var hexahedron = MeshDraft.PartialBox(holeWidth, holeDepth, holeHeight, Directions.All & ~Directions.Back);

            hexahedron.Move(center + holeDepth / 2);
            hexahedron.FlipFaces();
            hexahedron.Paint(BuildingGenerator.roofColor);
            draft.Add(hexahedron);
            return(draft);
        }
        protected static MeshDraft BalconyGlazed(Vector3 origin, float width, float height, Color wallColor,
                                                 Color frameColor, Color glassColor, Color roofColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;

            Vector3 balconyHeight = Vector3.up * BalconyHeight;
            Vector3 balconyDepth  = Vector3.back * BalconyDepth;

            var draft   = new MeshDraft();
            var balcony = MeshDraft.PartialBox(widthVector, balconyDepth, balconyHeight,
                                               Directions.All & ~Directions.Up & ~Directions.Back);

            balcony.FlipFaces();
            balcony.Move(origin + widthVector / 2 + balconyDepth / 2 + balconyHeight / 2);
            balcony.Paint(wallColor);
            draft.Add(balcony);

            Vector3 roof0 = origin + heightVector;
            Vector3 roof1 = roof0 + widthVector;
            Vector3 roof2 = roof1 + balconyDepth;
            Vector3 roof3 = roof0 + balconyDepth;
            var     roof  = MeshDraft.Quad(roof0, roof1, roof2, roof3);

            roof.Paint(roofColor);
            draft.Add(roof);

            Vector3 glassHeight = heightVector - balconyHeight;
            Vector3 glass0      = origin + balconyHeight;
            Vector3 glass1      = glass0 + balconyDepth;
            Vector3 glass2      = glass1 + widthVector;
            var     glass       = Windowpane(glass0, glass0 + balconyDepth + glassHeight, frameColor, glassColor);

            glass.Add(Windowpane(glass1, glass1 + widthVector + glassHeight, frameColor, glassColor));
            glass.Add(Windowpane(glass2, glass2 - balconyDepth + glassHeight, frameColor, glassColor));
            draft.Add(glass);

            return(draft);
        }
Exemplo n.º 18
0
        private static MeshDraft Window(Vector3 origin, Vector3 width, Vector3 height, float widthOffset,
                                        float heightOffset, float windowHeight)
        {
            Vector3 right       = width.normalized;
            Vector3 frameOrigin = origin + right * widthOffset + Vector3.up * heightOffset;
            Vector3 frameWidth  = right * (width.magnitude - widthOffset * 2);
            Vector3 frameHeight = Vector3.up * windowHeight;
            Vector3 frameDepth  = Vector3.Cross(width, height).normalized *WindowDepth;

            var draft = PerforatedQuad(origin, width, height, frameOrigin, frameWidth, frameHeight);

            var frame = MeshDraft.PartialBox(frameWidth, -frameDepth, frameHeight, Directions.All & ~Directions.ZAxis);

            frame.Move(frameOrigin + frameWidth / 2 + frameHeight / 2 + frameDepth / 2);
            draft.Add(frame);

            draft.Paint(BuildingGenerator.wallColor);

            draft.Add(Windowpane(frameOrigin + frameDepth, frameWidth, frameHeight));

            return(draft);
        }
        private static MeshDraft Balcony(Vector3 origin, float width, Color wallColor)
        {
            Vector3 widthVector   = Vector3.right * width;
            Vector3 balconyHeight = Vector3.up * BalconyHeight;
            Vector3 balconyDepth  = Vector3.back * BalconyDepth;

            var balconyOuter = MeshDraft.PartialBox(widthVector, balconyDepth, balconyHeight,
                                                    Directions.All & ~Directions.Up & ~Directions.Back);

            balconyOuter.FlipFaces();
            Vector3 balconyCenter = origin + widthVector / 2 + balconyDepth / 2 + balconyHeight / 2;

            balconyOuter.Move(balconyCenter);

            Vector3 innerWidthOffset  = Vector3.right * BalconyThickness;
            Vector3 innerWidth        = widthVector - innerWidthOffset * 2;
            Vector3 innerHeightOffset = Vector3.up * BalconyThickness;
            Vector3 innerHeight       = balconyHeight - innerHeightOffset;
            Vector3 innerDepthOffset  = Vector3.back * BalconyThickness;
            Vector3 innerDepth        = balconyDepth - innerDepthOffset;
            var     balconyInner      = MeshDraft.PartialBox(innerWidth, innerDepth, innerHeight,
                                                             Directions.All & ~Directions.Up & ~Directions.Back);

            balconyInner.Move(balconyCenter - innerDepthOffset / 2 + innerHeightOffset / 2);

            Vector3 borderOrigin      = origin + widthVector + balconyHeight;
            Vector3 borderInnerOrigin = borderOrigin - innerWidthOffset;
            var     balconyBorder     = Bracket(borderOrigin, -widthVector, balconyDepth,
                                                borderInnerOrigin, -innerWidth, innerDepth);

            var balcony = new MeshDraft();

            balcony.Add(balconyOuter);
            balcony.Add(balconyInner);
            balcony.Add(balconyBorder);
            balcony.Paint(wallColor);
            return(balcony);
        }
Exemplo n.º 20
0
        protected static CompoundMeshDraft BalconyGlazed(Vector3 origin, float width, float height, Color wallColor,
                                                         Color frameColor, Color glassColor, Color roofColor)
        {
            Vector3 widthVector  = Vector3.right * width;
            Vector3 heightVector = Vector3.up * height;

            Vector3 balconyHeight = Vector3.up * BalconyHeight;
            Vector3 balconyDepth  = Vector3.back * BalconyDepth;

            var balcony = MeshDraft.PartialBox(widthVector, balconyDepth, balconyHeight,
                                               Directions.All & ~Directions.Up & ~Directions.Back, false)
                          .FlipFaces()
                          .Move(origin + widthVector / 2 + balconyDepth / 2 + balconyHeight / 2)
                          .Paint(wallColor);

            Vector3 roof0 = origin + heightVector;
            Vector3 roof1 = roof0 + widthVector;
            Vector3 roof2 = roof1 + balconyDepth;
            Vector3 roof3 = roof0 + balconyDepth;
            var     roof  = new MeshDraft()
                            .AddQuad(roof0, roof1, roof2, roof3, Vector3.up)
                            .Paint(roofColor);

            var wall = new MeshDraft {
                name = WallDraftName
            }.Add(balcony).Add(roof);

            Vector3 glassHeight = heightVector - balconyHeight;
            Vector3 glass0      = origin + balconyHeight;
            Vector3 glass1      = glass0 + balconyDepth;
            Vector3 glass2      = glass1 + widthVector;
            var     windowpane  = Windowpane(glass0, glass0 + balconyDepth + glassHeight, frameColor, glassColor)
                                  .Add(Windowpane(glass1, glass1 + widthVector + glassHeight, frameColor, glassColor))
                                  .Add(Windowpane(glass2, glass2 - balconyDepth + glassHeight, frameColor, glassColor));

            return(new CompoundMeshDraft().Add(wall).Add(windowpane));
        }
Exemplo n.º 21
0
        public static MeshDraft BalconyGlazed(Vector3 origin, Vector3 width, Vector3 height)
        {
            Vector3 balconyWidth  = width;
            Vector3 balconyHeight = height.normalized * BalconyHeight;
            Vector3 balconyDepth  = Vector3.Cross(height, width).normalized *BalconyDepth;

            var draft   = new MeshDraft();
            var balcony = MeshDraft.PartialBox(balconyWidth, balconyDepth, balconyHeight,
                                               Directions.All & ~Directions.Up & ~Directions.Back);

            balcony.FlipFaces();
            balcony.Move(origin + width / 2 + balconyDepth / 2 + balconyHeight / 2);
            balcony.Paint(BuildingGenerator.wallColor);
            draft.Add(balcony);

            Vector3 roof0 = origin + height;
            Vector3 roof1 = roof0 + balconyWidth;
            Vector3 roof2 = roof1 + balconyDepth;
            Vector3 roof3 = roof0 + balconyDepth;
            var     roof  = MeshDraft.Quad(roof0, roof1, roof2, roof3);

            roof.Paint(BuildingGenerator.roofColor);
            draft.Add(roof);

            Vector3 glassHeight = height - balconyHeight;
            Vector3 glass0      = origin + balconyHeight;
            Vector3 glass1      = glass0 + balconyDepth;
            Vector3 glass2      = glass1 + balconyWidth;
            var     glass       = Windowpane(glass0, balconyDepth, glassHeight);

            glass.Add(Windowpane(glass1, balconyWidth, glassHeight));
            glass.Add(Windowpane(glass2, -balconyDepth, glassHeight));
            draft.Add(glass);

            return(draft);
        }
Exemplo n.º 22
0
        public static MeshDraft SocleWindowed(Vector3 origin, Vector3 width, Vector3 height)
        {
            Vector3 right        = width.normalized;
            Vector3 windowOrigin = origin + width / 2 - right * SocleWindowWidth / 2 + Vector3.up * SocleWindowHeightOffset;
            Vector3 windowWidth  = right * SocleWindowWidth;
            Vector3 windowHeigth = Vector3.up * SocleWindowHeight;
            Vector3 windowDepth  = Vector3.Cross(width, height).normalized *SocleWindowDepth;

            var draft = PerforatedQuad(origin, width, height, windowOrigin, windowWidth, windowHeigth);

            var frame = MeshDraft.PartialBox(windowWidth, -windowDepth, windowHeigth,
                                             Directions.All & ~Directions.ZAxis);

            frame.Move(windowOrigin + windowWidth / 2 + windowHeigth / 2 + windowDepth / 2);
            draft.Add(frame);
            draft.Paint(BuildingGenerator.socleColor);

            var window = MeshDraft.Quad(windowOrigin + windowDepth / 2, windowWidth, windowHeigth);

            window.Paint(BuildingGenerator.socleWindowColor);
            draft.Add(window);

            return(draft);
        }
Exemplo n.º 23
0
        public static MeshDraft Balcony(Vector3 origin, Vector3 width, Vector3 height)
        {
            Vector3 right         = width.normalized;
            Vector3 normal        = Vector3.Cross(height, width).normalized;
            Vector3 balconyWidth  = width;
            Vector3 balconyHeight = Vector3.up * BalconyHeight;
            Vector3 balconyDepth  = normal * BalconyDepth;

            var draft        = new MeshDraft();
            var balconyOuter = MeshDraft.PartialBox(balconyWidth, balconyDepth, balconyHeight,
                                                    Directions.All & ~Directions.Up & ~Directions.Back);

            balconyOuter.FlipFaces();
            Vector3 balconyCenter = origin + width / 2 + balconyDepth / 2 + balconyHeight / 2;

            balconyOuter.Move(balconyCenter);
            balconyOuter.Paint(BuildingGenerator.wallColor);

            Vector3 innerWidthOffset  = right * BalconyThickness;
            Vector3 innerWidth        = balconyWidth - innerWidthOffset * 2;
            Vector3 innerHeightOffset = Vector3.up * BalconyThickness;
            Vector3 innerHeight       = balconyHeight - innerHeightOffset;
            Vector3 innerDepthOffset  = normal * BalconyThickness;
            Vector3 innerDepth        = balconyDepth - innerDepthOffset;
            var     balconyInner      = MeshDraft.PartialBox(innerWidth, innerDepth, innerHeight,
                                                             Directions.All & ~Directions.Up & ~Directions.Back);

            balconyInner.Move(balconyCenter - innerDepthOffset / 2 + innerHeightOffset / 2);

            Vector3 borderOrigin      = origin + balconyWidth + balconyHeight;
            Vector3 borderInnerOrigin = borderOrigin - innerWidthOffset;
            var     balconyBorder     = Bracket(borderOrigin, -balconyWidth, balconyDepth,
                                                borderInnerOrigin, -innerWidth, innerDepth);

            draft.Add(balconyOuter);
            draft.Add(balconyInner);
            draft.Add(balconyBorder);

            Vector3 windowWidthOffset  = right * WindowWidthOffset;
            Vector3 windowHeightOffset = Vector3.up * WindowHeightOffset;
            Vector3 windowWidth        = right * (width.magnitude - WindowWidthOffset * 2);
            Vector3 windowHeight       = Vector3.up * WindowHeight;
            Vector3 windowDepth        = normal * WindowDepth;

            int     rodCount   = Mathf.FloorToInt(windowWidth.magnitude / WindowSegmentMinWidth);
            Vector3 doorWidth  = right * windowWidth.magnitude / (rodCount + 1);
            Vector3 doorHeight = windowHeightOffset + windowHeight;

            List <Vector3> outerFrame = new List <Vector3>
            {
                origin + windowWidthOffset + innerHeightOffset,
                origin + windowWidthOffset + doorHeight,
                origin + windowWidthOffset + windowWidth + doorHeight,
                origin + windowWidthOffset + windowWidth + windowHeightOffset,
                origin + windowWidthOffset + doorWidth + windowHeightOffset,
                origin + windowWidthOffset + doorWidth + innerHeightOffset
            };

            var panel = MeshDraft.TriangleStrip(new List <Vector3>
            {
                outerFrame[0],
                origin,
                outerFrame[1],
                origin + height,
                outerFrame[2],
                origin + width + height,
                outerFrame[3],
                origin + width,
                outerFrame[4],
                origin + width,
                outerFrame[5]
            });

            draft.Add(panel);

            List <Vector3> innerFrame = new List <Vector3>();

            foreach (Vector3 vertex in outerFrame)
            {
                innerFrame.Add(vertex - windowDepth);
            }
            var frame = MeshDraft.FlatBand(innerFrame, outerFrame);

            draft.Add(frame);

            draft.Paint(BuildingGenerator.wallColor);

            draft.Add(Windowpane(outerFrame[0] - windowDepth, doorWidth, doorHeight - innerHeightOffset));
            draft.Add(Windowpane(outerFrame[4] - windowDepth, windowWidth - doorWidth, windowHeight));

            return(draft);
        }