Exemple #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);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
0
        public void Generate(bool randomizeConfig = true)
        {
            if (constantSeed)
            {
                Random.InitState(0);
            }

            if (randomizeConfig)
            {
                GeneratePalette();

                config.color = GetMainColor();
            }

            var chairDraft = ChairGenerator.Chair(config);

            AssignDraftToMeshFilter(chairDraft, chairMeshFilter, ref chairMesh);

            float platformRadius = Geometry.GetCircumradius(config.seatWidth, config.seatDepth) + platformRadiusOffset;
            var   platformDraft  = Platform(platformRadius, platformHeight);

            AssignDraftToMeshFilter(platformDraft, platformMeshFilter, ref platformMesh);
        }