Esempio n. 1
0
        public static MeshDraft Armrests0(float seatWidth, float seatDepth, Vector3 backCenter, float backHeight,
                                          float legWidth)
        {
            var   draft         = new MeshDraft();
            float armrestHeight = RandomE.Range(backHeight / 4, backHeight * 3 / 4, 3);
            float armrestLength = seatDepth - legWidth;

            Vector3 corner = backCenter + Vector3.left * (seatWidth / 2 - legWidth / 2) + Vector3.back * legWidth / 2;

            float offset = 0;

            if (RandomE.Chance(0.5f))
            {
                offset = RandomE.Range(legWidth / 2, legWidth, 2);
            }
            Vector3 v0 = corner + Vector3.back * (armrestLength - legWidth / 2);
            Vector3 v1 = v0 + Vector3.up * (armrestHeight - legWidth / 2);
            Vector3 v2 = corner + Vector3.up * armrestHeight;
            Vector3 v3 = v2 + Vector3.back * (armrestLength + offset);

            var armrest = ChairGenerator.BeamDraft(v0, v1, legWidth);

            armrest.Add(ChairGenerator.BeamDraft(v2, v3, legWidth));
            draft.Add(armrest);
            armrest.Move(Vector3.right * (seatWidth - legWidth));
            draft.Add(armrest);
            return(draft);
        }
Esempio n. 2
0
        public static MeshDraft Armrests1(Vector3 seatDimensions, Vector3 backCenter, float backHeight, float legWidth)
        {
            var   draft         = new MeshDraft();
            float armrestHeight = RandomE.Range(backHeight / 4, backHeight * 3 / 4, 3);
            float armrestLength = RandomE.Range(seatDimensions.z * 3 / 4, seatDimensions.z, 2);

            legWidth = RandomE.Range(legWidth * 3 / 4, legWidth, 2);

            Vector3 corner = backCenter + Vector3.left * (seatDimensions.x / 2 + legWidth / 2) +
                             Vector3.forward * legWidth / 2;

            float offset = 0;

            if (RandomE.Chance(0.5f))
            {
                offset = RandomE.Range(armrestLength / 4, armrestLength / 2, 2) - legWidth / 2;
            }
            Vector3 v0 = corner + Vector3.back * (armrestLength - legWidth / 2 - offset) + Vector3.down * legWidth;
            Vector3 v1 = v0 + Vector3.up * (armrestHeight + legWidth / 2);
            Vector3 v2 = corner + Vector3.up * armrestHeight;
            Vector3 v3 = v2 + Vector3.back * armrestLength;

            var armrest = ChairGenerator.BeamDraft(v0, v1, legWidth);

            armrest.Add(ChairGenerator.BeamDraft(v2, v3, legWidth));
            draft.Add(armrest);
            armrest.Move(Vector3.right * (seatDimensions.x + legWidth));
            draft.Add(armrest);
            return(draft);
        }
Esempio n. 3
0
        public static MeshDraft XStretchers(Vector3[] legCenters, float legWidth, float legHeight)
        {
            var draft = new MeshDraft();

            legWidth = RandomE.Range(legWidth / 2, legWidth * 3 / 4, 2);
            draft.Add(ChairGenerator.BeamDraft(legCenters[0], legCenters[2], legWidth));
            draft.Add(ChairGenerator.BeamDraft(legCenters[1], legCenters[3], legWidth));
            draft.Move(Vector3.up * RandomE.Range(legHeight / 4, legHeight / 2, 2));
            return(draft);
        }
Esempio n. 4
0
        public static MeshDraft HStretchers(Vector3[] legCenters, float legWidth, float legHeight)
        {
            var draft = new MeshDraft();

            legWidth = RandomE.Range(legWidth / 2, legWidth, 3);
            draft.Add(ChairGenerator.BeamDraft(legCenters[0], legCenters[3], legWidth));
            draft.Add(ChairGenerator.BeamDraft(legCenters[1], legCenters[2], legWidth));
            Vector3 leftCenter  = (legCenters[3] + legCenters[0]) / 2;
            Vector3 rightCenter = (legCenters[2] + legCenters[1]) / 2;

            draft.Add(ChairGenerator.BeamDraft(leftCenter, rightCenter, legWidth));
            draft.Move(Vector3.up * RandomE.Range(legHeight / 4, legHeight * 3 / 4, 3));
            return(draft);
        }
Esempio n. 5
0
        public static MeshDraft BoxStretchers(Vector3[] legCenters, float legWidth, float legHeight)
        {
            var draft = new MeshDraft();

            legWidth = RandomE.Range(legWidth / 2, legWidth, 3);
            MeshDraft stretcher0 = ChairGenerator.BeamDraft(legCenters[0], legCenters[1], legWidth);

            stretcher0.Add(ChairGenerator.BeamDraft(legCenters[2], legCenters[3], legWidth));
            stretcher0.Move(Vector3.up * RandomE.Range(legHeight / 4, legHeight * 3 / 4, 3));
            MeshDraft stretcher1 = ChairGenerator.BeamDraft(legCenters[0], legCenters[3], legWidth);

            stretcher1.Add(ChairGenerator.BeamDraft(legCenters[1], legCenters[2], legWidth));
            stretcher1.Move(Vector3.up * RandomE.Range(legHeight / 4, legHeight * 3 / 4, 3));
            draft.Add(stretcher0);
            draft.Add(stretcher1);
            return(draft);
        }