Exemplo n.º 1
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            //payload.ClearBoundVisualizer();

            var volume = VisualizerFactory.InstantiateRectangularVolume();

            //payload.GetTargetBound().ChildWithinBound(volume.transform);
            //.BoundedVisual = volume;

            volume.Initialize(this, payload);

            volume.SetOpaqueMaterial(UseOpaqueMaterial.GetFirstValue(payload.Data));


            var xProportion = XAxis.GetFirstValue(payload.Data);

            if (XMax.CouldResolve(payload.Data) && XMax.GetFirstValue(payload.Data) > .001f)
            {
                xProportion = xProportion / XMax.GetFirstValue(payload.Data);
            }

            var yProportion = YAxis.GetFirstValue(payload.Data);

            if (YMax.CouldResolve(payload.Data) && YMax.GetFirstValue(payload.Data) > .001f)
            {
                yProportion = yProportion / YMax.GetFirstValue(payload.Data);
            }

            var zProportion = ZAxis.GetFirstValue(payload.Data);

            if (ZMax.CouldResolve(payload.Data) && ZMax.GetFirstValue(payload.Data) > .001f)
            {
                zProportion = zProportion / ZMax.GetFirstValue(payload.Data);
            }

            volume.Xscale = xProportion;
            volume.Yscale = yProportion;
            volume.Zscale = zProportion;

            volume.Color = Color.GetFirstValue(payload.Data);

            var newPayload = new VisualPayload(payload.Data, new VisualDescription(volume.Bound));

            var iterator = Router.TransmitAll(newPayload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }