Esempio n. 1
0
        public bool PaintRenderTexture(BrushStrokePainterImage cfg)
        {
            var stroke  = cfg.stroke;
            var image   = cfg.image;
            var painter = cfg.painter;
            var bc      = cfg.brush;

            var vt = painter.GetVolumeTexture();

            stroke.posFrom = stroke.posTo;

            BrushTypeSphere.Inst.BeforeStroke(painter, bc, stroke);

            VOLUME_POSITION_N_SIZE_BRUSH.GlobalValue = vt.PosSize4Shader;
            VOLUME_H_SLICES_BRUSH.GlobalValue        = vt.Slices4Shader;
            VOLUME_BRUSH_DIRECTION.GlobalValue       = stroke.collisionNormal.ToVector4(0);

            image.useTexCoord2 = false;
            bool alphaBuffer;

            TexMGMT.SHADER_STROKE_SEGMENT_UPDATE(bc, bc.Speed * 0.05f, image, stroke, painter, out alphaBuffer);

            stroke.SetWorldPosInShader();

            RenderTextureBuffersManager.Blit(null, image.CurrentRenderTexture(), TexMGMT.brushRenderer.meshRenderer.sharedMaterial.shader);

            BrushTypeSphere.Inst.AfterStroke_Painter(painter, bc, stroke, alphaBuffer, image);

            return(true);
        }
Esempio n. 2
0
        public void Set(ImageMeta from, int globalOrder)
        {
            RenderTextureBuffersManager.Blit(from.CurrentRenderTexture(), rt);

            SetB(from, globalOrder);

            exclusive = from.renderTexture != null;
        }
Esempio n. 3
0
            protected override bool Inspect()
            {
                var changed = base.Inspect().nl();

                var allCstm = Cfg.customBlitModes;

                if ("Config".select_Index(60, ref Cfg.selectedCustomBlitMode, allCstm))
                {
                    Cfg.SetToDirty();
                }

                var cfg = _customCfg;

                if (pegi.edit(ref cfg, 60).nl(ref changed) && cfg)
                {
                    if (allCstm.Contains(cfg))
                    {
                        Cfg.selectedCustomBlitMode = allCstm.IndexOf(cfg);
                    }
                    else
                    {
                        Cfg.customBlitModes.Add(cfg);
                        Cfg.selectedCustomBlitMode = Cfg.customBlitModes.Count - 1;
                    }
                }



                if (_customCfg)
                {
                    if (_customCfg.name.foldout(ref _showConfig).nl(ref changed))
                    {
                        _customCfg.Nested_Inspect(ref changed);
                    }
                }
                else
                {
                    ("Create a BlitModeCustom Scriptable Object and put your custom blit shader into it. " +
                     " Right mouse button in the Project view and select Create->Playtime Painter-> Blit Mode Custom ").writeHint();
                    pegi.nl();
                }

                if (IsBlitReady)
                {
                    if (PlaytimePainter.inspected)
                    {
                        var img = PlaytimePainter.inspected.TexMeta;
                        if (img != null)
                        {
                            var rt = img.CurrentRenderTexture();

                            if (rt)
                            {
                                if ("Grahics BLIT".Click().nl())
                                {
                                    RenderTextureBuffersManager.Blit(
                                        from: _customCfg.sourceTexture ? _customCfg.sourceTexture : rt,
                                        to: rt,
                                        shader: _customCfg.shader);
                                }

                                if ("Painter Camera Render".Click().nl())
                                {
                                    PainterCamera.Inst.Render(
                                        from: _customCfg.sourceTexture ? _customCfg.sourceTexture : rt,
                                        to: rt,
                                        shader: _customCfg.shader);
                                }
                            }
                        }
                    }
                }

                return(false);
            }