// Update is called once per frame
        void Update()
        {
            bool bOK = CheckPixel();

            if (!bOK)
            {
                return;
            }
            int chlCnt = _PixelRef.GetChannelCount();

            for (int i = 0; i < _Values.Count; i++)
            {
                if (i < chlCnt)
                {
                    _Values[i] = _PixelRef.GetValue(i);
                }
            }
        }
Example #2
0
        public void CopyValueFrom(Pixel RefPixel, bool bCopyTreeStructure = true)
        {
            _Value        = RefPixel._Value;
            _InputWeight  = RefPixel._InputWeight;
            _OutputWeight = RefPixel._OutputWeight;
            int refChdCnt = RefPixel.GetChildCount();
            int chdCnt    = GetChildCount();

            for (int i = 0; i < _ChildPixels.Count; i++)
            {
                if (i < refChdCnt)
                {
                    Pixel refChdPx = RefPixel.GetChildPixel(i);
                    Pixel chdPx    = GetChildPixel(i);
                    float val0     = chdPx.GetValue(0);
                    chdPx.CopyValueFrom(refChdPx, bCopyTreeStructure);
                    float val1 = chdPx.GetValue(0);
                    //Debug.Log ("value Change:" + (val1-val0).ToString());
                }
            }
            if (bCopyTreeStructure)
            {
                bool bOver = chdCnt > refChdCnt;
                bool bLess = chdCnt < refChdCnt;
                if (bOver)
                {
                    int overCnt = chdCnt - refChdCnt;
                    _ChildPixels.RemoveRange(refChdCnt - 1, overCnt);
                }
                else if (bLess)
                {
                    for (int i = chdCnt; i < refChdCnt; i++)
                    {
                        Pixel refChd   = RefPixel.GetChildPixel(i);
                        Pixel newChdPx = NewChildPixel(refChd._InputWeight, refChd._OutputWeight, refChd._Scale);
                        newChdPx.CopyValueFrom(refChd, bCopyTreeStructure);
                    }
                }
            }
        }