示例#1
0
        public override bool BlitMethod(TextureBuffer sourceBuffer, Material material, Shader shader)
        {
            var other = sourceBuffer;

            if (other != null && lastReadVersion != other.Version)
            {
                var tex = other.GetTextureNext();
                if (tex != null)
                {
                    InitIfNull();

                    buffer.CopyFrom(TexMGMT.Downscale_ToBuffer(tex, width, width, material, shader));
                    lastReadVersion = other.Version;

                    var px = buffer.GetPixels();

                    // px.ToLinear();

                    buffer.SetPixels(px);

                    buffer.Apply();

                    Version++;

                    return(true);
                }
            }

            return(false);
        }
示例#2
0
        public virtual bool BlitMethod(TextureBuffer sourceBuffer, Material material, Shader shader)
        {
            var trg = GetTargetTextureNext();
            var src = sourceBuffer?.GetTextureNext();

            if (trg)
            {
                if (src)
                {
                    Shader.SetGlobalTexture(PainterDataAndConfig.SOURCE_TEXTURE, src);
                }

                if (material)
                {
                    Graphics.Blit(src, trg, material);
                }
                else
                {
                    PainterCamera.Inst.Render(src, trg, shader);
                }
                AfterRender();

                Version++;

                return(true);
            }


            return(false);
        }