protected override void Update()
        {
            base.Update();

            if (changeReader == null)
            {
                changeReader = new P3dReader();

                changeReader.OnComplete += HandleCompleteChange;
            }

            if (changeReader.Requested == false && registeredPaintableTexture != null && registeredPaintableTexture.Activated == true)
            {
                if (P3dReader.NeedsUpdating(changeReader, changePixels, registeredPaintableTexture.Current, downsampleSteps) == true || changeDirty == true)
                {
                    changeDirty = false;

                    var desc          = registeredPaintableTexture.Current.descriptor; desc.useMipMap = false;
                    var renderTexture = P3dHelper.GetRenderTexture(desc);

                    P3dCommandReplace.Blit(renderTexture, texture, color);

                    // Request new change
                    changeReader.Request(renderTexture, DownsampleSteps, Async);

                    P3dHelper.ReleaseRenderTexture(renderTexture);
                }
            }

            changeReader.UpdateRequest();
        }
示例#2
0
        protected override void Update()
        {
            base.Update();

            if (maskReader == null)
            {
                maskReader = new P3dReader();

                maskReader.OnComplete += HandleCompleteMask;
            }

            if (maskReader.Requested == false && registeredPaintableTexture != null && registeredPaintableTexture.Activated == true)
            {
                if (P3dReader.NeedsUpdating(maskReader, maskPixels, registeredPaintableTexture.Current, downsampleSteps) == true || maskDirty == true)
                {
                    maskDirty = false;

                    var desc          = registeredPaintableTexture.Current.descriptor; desc.useMipMap = false;
                    var renderTexture = P3dHelper.GetRenderTexture(desc);

                    if (maskTexture != null)
                    {
                        P3dBlit.Texture(renderTexture, P3dHelper.GetQuadMesh(), 0, maskTexture, P3dCoord.First);
                    }
                    else
                    {
                        P3dBlit.White(renderTexture, maskMesh, 0, registeredPaintableTexture.Coord);
                    }

                    // Request new mask
                    maskReader.Request(renderTexture, DownsampleSteps, Async);

                    P3dHelper.ReleaseRenderTexture(renderTexture);
                }
            }

            maskReader.UpdateRequest();
        }
示例#3
0
        protected virtual void Update()
        {
            if (currentReader == null)
            {
                currentReader = new P3dReader();

                currentReader.OnComplete += HandleCompleteCurrent;
            }

            cooldown -= Time.deltaTime;

            if (cooldown <= 0.0f && currentReader.Requested == false && registeredPaintableTexture != null && registeredPaintableTexture.Activated == true)
            {
                if (P3dReader.NeedsUpdating(currentReader, currentPixels, registeredPaintableTexture.Current, downsampleSteps) == true || currentDirty == true)
                {
                    cooldown     = interval;
                    currentDirty = false;

                    currentReader.Request(registeredPaintableTexture.Current, downsampleSteps, async);
                }
            }

            currentReader.UpdateRequest();
        }