protected virtual void Update()
        {
            var finalCounters = counters.Count > 0 ? counters : null;
            var total         = P3dChannelCounter.GetTotal(finalCounters);
            var count         = default(long);

            switch (channel)
            {
            case ChannelType.Red:   count = P3dChannelCounter.GetCountR(finalCounters); break;

            case ChannelType.Green: count = P3dChannelCounter.GetCountG(finalCounters); break;

            case ChannelType.Blue:  count = P3dChannelCounter.GetCountB(finalCounters); break;

            case ChannelType.Alpha: count = P3dChannelCounter.GetCountA(finalCounters); break;
            }

            if (inverse == true)
            {
                count = total - count;
            }

            var final   = format;
            var percent = P3dHelper.RatioToPercentage(P3dHelper.Divide(count, total), decimalPlaces);

            final = final.Replace("{TOTAL}", total.ToString());
            final = final.Replace("{COUNT}", count.ToString());
            final = final.Replace("{PERCENT}", percent.ToString());

            cachedText.text = final;
        }
Exemplo n.º 2
0
        protected virtual void Update()
        {
            var finalCounters = counters.Count > 0 ? counters : null;

            switch (output)
            {
            case OutputType.Percentage:
            {
                var ratios = P3dChannelCounter.GetRatioRGBA(finalCounters);

                switch (channel)
                {
                case ChannelType.Red:   OutputRatio(ratios.x); break;

                case ChannelType.Green: OutputRatio(ratios.y); break;

                case ChannelType.Blue:  OutputRatio(ratios.z); break;

                case ChannelType.Alpha: OutputRatio(ratios.w); break;

                case ChannelType.InverseAlpha: OutputRatio(1.0f - ratios.w); break;
                }
            }
            break;

            case OutputType.Pixels:
            {
                switch (channel)
                {
                case ChannelType.Red:   OutputSolid(P3dChannelCounter.GetSolidR(finalCounters)); break;

                case ChannelType.Green: OutputSolid(P3dChannelCounter.GetSolidG(finalCounters)); break;

                case ChannelType.Blue:  OutputSolid(P3dChannelCounter.GetSolidB(finalCounters)); break;

                case ChannelType.Alpha: OutputSolid(P3dChannelCounter.GetSolidA(finalCounters)); break;

                case ChannelType.InverseAlpha: OutputSolid(P3dChannelCounter.GetTotal(finalCounters) - P3dChannelCounter.GetSolidA(finalCounters)); break;
                }
            }
            break;
            }
        }