Exemple #1
0
            public virtual void AfterStroke(PaintCommand.UV command)
            {
                PaintCommand.ForPainterComponent painterCommand = command as PaintCommand.ForPainterComponent;
                Brush       br = command.Brush;
                Stroke      st = command.Stroke;
                TextureMeta id = command.TextureData;

                command.OnStrokeComplete();

                if (br.useMask && st.MouseUpEvent && br.randomMaskOffset)
                {
                    br.maskOffset = new Vector2(Random.Range(0f, 1f), Random.Range(0f, 1f));
                }

                if (command.usedAlphaBuffer)
                {
                    var sh = br.GetBlitMode(false).ShaderForAlphaBufferBlit;
                    if (painterCommand == null || painterCommand.painter.NotUsingPreview)
                    {
                        TexMGMT.UpdateFromAlphaBuffer(id.CurrentRenderTexture(), sh);
                    }
                    else
                    {
                        TexMGMT.AlphaBufferSetDirtyBeforeRender(id, sh);
                    }
                }
                else if (!br.IsSingleBufferBrush() && !command.Is3DBrush)
                {
                    TexMGMT.UpdateBufferSegment();
                }

                if (painterCommand != null)
                {
                    foreach (var p in painterCommand.painter.Modules)
                    {
                        p.AfterGpuStroke(painterCommand);
                    }
                }
            }
Exemple #2
0
            public void BeforeStroke(PaintCommand.UV command)//Brush br, Stroke st, PlaytimePainter painter = null)
            {
                Brush  br = command.Brush;
                Stroke st = command.Stroke;

                PaintCommand.ForPainterComponent painterCommand = command as PaintCommand.ForPainterComponent;

                var cam = TexMGMT;

                if (!RenderTextureBuffersManager.secondBufferUpdated)
                {
                    RenderTextureBuffersManager.UpdateBufferTwo();
                }

                if (painterCommand != null)
                {
                    foreach (var p in painterCommand.painter.Modules)
                    {
                        p.BeforeGpuStroke(painterCommand);//br, st, this);
                    }
                }
            }