Exemple #1
0
        public Geometry Output()
        {
            var transf = new TransformGeometry();

            transf.Input(Input);
            transf.Position = Vector3.zero;

            switch (AlignTo)
            {
            case AlignmentType.Min:
                transf.Position[(int)Axis] = Value - Input.Min(Axis);
                break;

            case AlignmentType.Max:
                transf.Position[(int)Axis] = -(Input.Max(Axis) - Value);
                break;

            case AlignmentType.Center:
                transf.Position[(int)Axis] = (Value - Input.Span(Axis)) / -2f;
                Debug.Log(transf.Position);
                break;
            }

            return(transf.Output());
        }
Exemple #2
0
        public Geometry Output()
        {
            Vector3 scaleDelta = Vector3.one - Scale;

            Vector3 scale    = Scale;
            Vector3 position = Position;
            Vector3 rotation = Rotation;

            var merge = new Merge();

            for (int i = 0; i < Copies; i++)
            {
                var trans = new TransformGeometry(_geometry);
                if (i > 0)
                {
                    trans.Rotation = rotation;
                    trans.Position = position;
                    trans.Scale    = scale;
                }

                merge.Input.Add(trans.Output());

                if (i > 0)
                {
                    position += Position;
                    rotation += Rotation;
                    scale    += scaleDelta;
                }
            }

            return(merge.Output());
        }
Exemple #3
0
		public Geometry Output() {
			// Top
			var top = new Square();
			top.Center = new Vector3(Center.x, Center.y + Size.y/2, Center.z);
			top.Size = new Vector2(Size.x, Size.z);
			top.Surface = Surface.Triangulate;

			// Bottom
			var bottom = new TransformGeometry(top.Output());
			bottom.Position = new Vector3(0f, -Size.y, 0f);

			// Right wall
			var right = new Square();
			right.Orientation = OrientationPreset.ZY;
			right.Center = new Vector3(Center.x + Size.x/2, Center.y, Center.z);
			right.Size = new Vector2(Size.z, Size.y);
			right.Surface = Surface.Triangulate;

			// Left wall
			var left = new TransformGeometry(right.Output());
			left.Position = new Vector3(-Size.x, 0f, 0f);

			// Front wall
			var front = new Square();
			front.Orientation = OrientationPreset.XY;
			front.Center = new Vector3(Center.x, Center.y, Center.z + Size.z/2);
			front.Size = new Vector2(Size.x, Size.y);
			front.Surface = Surface.Triangulate;

			// Back wall
			var back = new TransformGeometry(front.Output());
			back.Position = new Vector3(0f, 0f, -Size.z);

			// Merge all sides
			Merge merge = new Merge();
			merge.Input.Add(FlipFaces.Process(bottom.Output()));
			merge.Input.Add(right.Output());
			merge.Input.Add(FlipFaces.Process(left.Output()));
			merge.Input.Add(front.Output());
			merge.Input.Add(FlipFaces.Process(back.Output()));
			merge.Input.Add(top.Output());

			return merge.Output();
		}