Esempio n. 1
0
            public static void Paint(Vector2 uv, BrushConfig br, RenderTexture rt)
            {
                var stroke = new StrokeVector(uv)
                {
                    firstStroke = false
                };

                var id = rt.GetTextureMeta();

                bool alphaBuffer;

                TexMGMT.SHADER_STROKE_SEGMENT_UPDATE(br, br.Speed * 0.05f, id, stroke, out alphaBuffer);

                float width = br.StrokeWidth(id.width, false);

                RtBrush.localScale = Vector3.one;

                BrushMesh             = PainterCamera.BrushMeshGenerator.GetLongMesh(0, width);
                RtBrush.localRotation = Quaternion.Euler(new Vector3(0, 0, Vector2.Angle(Vector2.up, Vector2.zero)));

                RtBrush.localPosition = StrokeVector.BrushWorldPositionFrom(stroke.uvTo);

                TexMGMT.Render();

                AfterStroke_NoPainter(br, alphaBuffer, rt);
            }
 public override void AfterGpuStroke(PlaytimePainter painter, BrushConfig br, StrokeVector st, BrushTypes.Base type)
 {
     if (br.IsA3DBrush(painter) && painter.IsAtlased())
     {
         PainterDataAndConfig.BRUSH_ATLAS_SECTION_AND_ROWS.GlobalValue = new Vector4(0, 0, 1, 0);
     }
 }
Esempio n. 3
0
            public virtual void AfterStroke_Painter(PlaytimePainter painter, BrushConfig br, StrokeVector st,
                                                    bool alphaBuffer, TextureMeta id)
            {
                painter.AfterStroke(st);

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

                if (alphaBuffer)
                {
                    var sh = br.GetBlitMode(false).ShaderForAlphaBufferBlit;
                    if (painter.NotUsingPreview)
                    {
                        TexMGMT.UpdateFromAlphaBuffer(id.CurrentRenderTexture(), sh);
                    }
                    else
                    {
                        TexMGMT.AlphaBufferSetDirtyBeforeRender(id, sh);
                    }
                }
                else if (!br.IsSingleBufferBrush() && !br.IsA3DBrush(painter))
                {
                    TexMGMT.UpdateBufferSegment();
                }

                foreach (var p in painter.Modules)
                {
                    p.AfterGpuStroke(br, st, this);
                }
            }
Esempio n. 4
0
            public virtual void PaintRenderTexture(PlaytimePainter painter, BrushConfig br, StrokeVector st)
            {
                BeforeStroke(painter, br, st);

                if (st.CrossedASeam())
                {
                    st.uvFrom = st.uvTo;
                }

                var id = painter.TexMeta;

                bool alphaBuffer;

                TexMGMT.SHADER_STROKE_SEGMENT_UPDATE(br, br.Speed * 0.05f, id, st, painter, out alphaBuffer);

                var rb = RtBrush;

                rb.localScale = Vector3.one;
                var direction = st.DeltaUv;
                var length    = direction.magnitude;

                BrushMesh        = PainterCamera.BrushMeshGenerator.GetLongMesh(length * 256, br.StrokeWidth(id.width, false));
                rb.localRotation = Quaternion.Euler(new Vector3(0, 0,
                                                                (direction.x > 0 ? -1 : 1) * Vector2.Angle(Vector2.up, direction)));

                rb.localPosition = StrokeVector.BrushWorldPositionFrom((st.uvFrom + st.uvTo) * 0.5f);

                TexMGMT.Render();

                AfterStroke_Painter(painter, br, st, alphaBuffer, id);
            }
Esempio n. 5
0
        public void PaintRenderTexture(StrokeVector stroke, ImageMeta image, BrushConfig bc, PlaytimePainter painter)
        {
            var vt = painter.GetVolumeTexture();

            if (!vt)
            {
                Debug.LogError("Painted volume was not found");
                return;
            }

            if (_enableRayTracing)
            {
                rayTraceCameraConfiguration.From(stroke);

                bc.useAlphaBuffer = false;

                delayedPaintingConfiguration = new BrushStrokePainterImage(stroke, image, bc, painter);


                //Debug.Log("Setting position: "+stroke.posTo);

                PainterCamera.GetProjectorCamera().RenderRightNow(this);
            }
            else
            {
                PaintRenderTexture(new BrushStrokePainterImage(stroke, image, bc, painter));
            }
        }
Esempio n. 6
0
            public override void PrePaint(PlaytimePainter painter, BrushConfig br, StrokeVector st)
            {
                var v4 = new Vector4(st.unRepeatedUv.x, st.unRepeatedUv.y, Mathf.Floor(st.unRepeatedUv.x),
                                     Mathf.Floor(st.unRepeatedUv.y));

                _pointedUvUnTiledProperty.GlobalValue = v4;

                if (!st.firstStroke)
                {
                    return;
                }

                if (method == (ColorSetMethod.MDownColor))
                {
                    if (painter)
                    {
                        painter.SampleTexture(st.uvTo);
                        FromColor(br, st.unRepeatedUv);
                    }
                }
                else if (method == (ColorSetMethod.MDownPosition))
                {
                    FromUv(st.uvTo);
                }

                PainterDataAndConfig.BRUSH_SAMPLING_DISPLACEMENT.GlobalValue = new Vector4(
                    (currentPixel.x + 0.5f) / Cfg.samplingMaskSize.x,

                    (currentPixel.y + 0.5f) / Cfg.samplingMaskSize.y,

                    Cfg.samplingMaskSize.x, Cfg.samplingMaskSize.y);
            }
Esempio n. 7
0
            public void FromColor(BrushConfig brush, Vector2 uv)
            {
                var c = brush.Color;

                currentPixel.x = (int)Mathf.Floor((uv.x + (c.r - 0.5f) * 2) * Cfg.samplingMaskSize.x);
                currentPixel.y = (int)Mathf.Floor((uv.y + (c.g - 0.5f) * 2) * Cfg.samplingMaskSize.y);
            }
Esempio n. 8
0
 public BrushStrokePainterImage(StrokeVector s, TextureMeta id, BrushConfig br, PlaytimePainter pp)
 {
     stroke  = s;
     image   = id;
     brush   = br;
     painter = pp;
 }
Esempio n. 9
0
        public static void PrepareCpuBlit(this BrushConfig bc, ImageMeta id)
        {
            half = (bc.Size(false)) / 2;

            var smooth = bc.GetBrushType(true) != BrushTypePixel.Inst;

            if (smooth)
            {
                alphaMode = CircleAlpha;
            }
            else
            {
                alphaMode = NoAlpha;
            }

            blitMode = bc.GetBlitMode(true).BlitFunctionTex2D(id);

            alpha = 1;

            var m = bc.mask;

            r = m.HasFlag(BrushMask.R);
            g = m.HasFlag(BrushMask.G);
            b = m.HasFlag(BrushMask.B);
            a = m.HasFlag(BrushMask.A);

            cSrc = bc.Color;
        }
Esempio n. 10
0
            public override void PaintRenderTexture(PlaytimePainter painter, BrushConfig br, StrokeVector st)
            {
                BeforeStroke(br, st, painter);

                if (st.CrossedASeam())
                {
                    st.uvFrom = st.uvTo;
                }

                TextureMeta id = painter.TexMeta;

                bool alphaBuffer;

                TexMGMT.SHADER_STROKE_SEGMENT_UPDATE(br, br.Speed * 0.05f, id, st, out alphaBuffer, painter);

                RtBrush.localScale = Vector3.one * br.StrokeWidth(id.width, false);

                BrushMesh             = PainterCamera.BrushMeshGenerator.GetQuad();
                RtBrush.localRotation = Quaternion.identity;

                RtBrush.localPosition = st.BrushWorldPosition;

                TexMGMT.Render();

                AfterStroke_Painter(painter, br, st, alphaBuffer, id);
            }
Esempio n. 11
0
            public override void OnPrepareRay(PlaytimePainter p, BrushConfig bc, ref Ray rey)
            {
                // Quaternion * Vector3

                rey.direction = Vector3.Lerp(rey.direction, UnityEngine.Random.rotation * rey.direction,
                                             jitterStrength); //  Quaternion.Lerp(cameraConfiguration.rotation, , camShake);
            }
Esempio n. 12
0
        public void SHADER_STROKE_SEGMENT_UPDATE(BrushConfig bc, float brushAlpha, TextureMeta id, StrokeVector stroke, out bool alphaBuffer, PlaytimePainter pntr = null)
        {
            CheckPaintingBuffers();

            var isDoubleBuffer = !id.renderTexture;

            var useSingle = !isDoubleBuffer || bc.IsSingleBufferBrush();

            var blitMode = bc.GetBlitMode(false);

            alphaBuffer = !useSingle && bc.useAlphaBuffer && bc.GetBrushType(false).SupportsAlphaBufferPainting&& blitMode.SupportsAlphaBufferPainting;

            Shader shd = null;

            if (pntr)
            {
                foreach (var pl in CameraModuleBase.BrushPlugins)
                {
                    var bs = useSingle ? pl.GetBrushShaderSingleBuffer(pntr) : pl.GetBrushShaderDoubleBuffer(pntr);
                    if (!bs)
                    {
                        continue;
                    }
                    shd = bs;
                    break;
                }
            }

            if (!shd)
            {
                if (alphaBuffer)
                {
                    shd = blitMode.ShaderForAlphaOutput;
                    AlphaBufferSetDirtyBeforeRender(id, blitMode.ShaderForAlphaBufferBlit);
                }
                else
                {
                    shd = useSingle ? blitMode.ShaderForSingleBuffer : blitMode.ShaderForDoubleBuffer;
                }
            }


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

            //if (stroke.firstStroke)
            SHADER_BRUSH_UPDATE(bc, brushAlpha, id, pntr);

            TargetTexture = alphaBuffer ? AlphaBuffer : id.CurrentRenderTexture();

            if (isDoubleBuffer)
            {
                PainterShaderVariables.DESTINATION_BUFFER.GlobalValue = BackBuffer;
            }

            CurrentShader = shd;
        }
Esempio n. 13
0
 public bool IsA3DBrush(PlaytimePainter painter, BrushConfig bc, ref bool overrideOther)
 {
     if (!painter.GetVolumeTexture())
     {
         return(false);
     }
     overrideOther = true;
     return(true);
 }
        public override void BeforeGpuStroke(PlaytimePainter painter, BrushConfig br, StrokeVector st, BrushTypes.Base type)
        {
            if (!br.IsA3DBrush(painter) || !painter.IsAtlased())
            {
                return;
            }

            var ats = GetAtlasedSection();

            PainterDataAndConfig.BRUSH_ATLAS_SECTION_AND_ROWS.GlobalValue = new Vector4(ats.x, ats.y, atlasRows, 1);
        }
Esempio n. 15
0
        public static void Paint(RenderTexture rt, GameObject go, Mesh mesh, BrushConfig br, StrokeVector st, List <int> subMeshIndex)
        {
            br.GetBlitMode(false).PrePaint(null, br, st);

            bool alphaBuffer;

            PrepareSphereBrush(rt.GetImgData(), br, st, null, out alphaBuffer);
            TexMGMT.brushRenderer.UseMeshAsBrush(go, mesh, subMeshIndex);
            TexMGMT.Render();
            AfterStroke_NoPainter(br, alphaBuffer, rt);
        }
Esempio n. 16
0
        public override void AfterStroke_Painter(PlaytimePainter painter, BrushConfig br, StrokeVector st, bool alphaBuffer, ImageMeta id)
        {
            base.AfterStroke_Painter(painter, br, st, alphaBuffer, id);

            if (br.decalRotationMethod != DecalRotationMethod.Random)
            {
                return;
            }

            br.decalAngle = Random.Range(-90f, 450f);
            OnShaderBrushUpdate(Cfg.brushConfig);
        }
Esempio n. 17
0
            protected static void AfterStroke_NoPainter(BrushConfig br, bool alphaBuffer, RenderTexture rt = null)
            {
                if (br.useMask && br.randomMaskOffset)
                {
                    br.maskOffset = new Vector2(Random.Range(0f, 1f), Random.Range(0f, 1f));
                }

                if (alphaBuffer)
                {
                    var sh = br.GetBlitMode(false).ShaderForAlphaBufferBlit;
                    TexMGMT.UpdateFromAlphaBuffer(rt, sh);
                }
            }
Esempio n. 18
0
            public void BeforeStroke(PlaytimePainter painter, BrushConfig br, StrokeVector st)
            {
                var cam = TexMGMT;

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

                foreach (var p in painter.Modules)
                {
                    p.BeforeGpuStroke(painter, br, st, this);
                }
            }
Esempio n. 19
0
        public static void PaintAtlased(RenderTexture rt, GameObject go, Mesh mesh, BrushConfig br, StrokeVector st, List <int> subMeshIndex, int aTexturesInRow)
        {
            br.GetBlitMode(false).PrePaint(null, br, st);

            PainterDataAndConfig.BRUSH_ATLAS_SECTION_AND_ROWS.GlobalValue = new Vector4(0, 0, aTexturesInRow, 1);

            bool alphaBuffer;

            PrepareSphereBrush(rt.GetImgData(), br, st, null, out alphaBuffer);
            TexMGMT.brushRenderer.UseMeshAsBrush(go, mesh, subMeshIndex);
            TexMGMT.Render();

            AfterStroke_NoPainter(br, alphaBuffer, rt);

            PainterDataAndConfig.BRUSH_ATLAS_SECTION_AND_ROWS.GlobalValue = new Vector4(0, 0, 1, 0);
        }
Esempio n. 20
0
            private static void PrepareSphereBrush(TextureMeta id, BrushConfig br, StrokeVector stroke, out bool alphaBuffer,
                                                   PlaytimePainter painter = null)
            {
                // if (stroke.mouseDwn)
                //    stroke.posFrom = stroke.posTo;

                TexMGMT.SHADER_STROKE_SEGMENT_UPDATE(br, br.Speed * 0.05f, id, stroke, out alphaBuffer, painter);

                var offset = id.offset - stroke.unRepeatedUv.Floor();

                stroke.SetWorldPosInShader();

                PainterShaderVariables.BRUSH_EDITED_UV_OFFSET.GlobalValue =
                    new Vector4(id.tiling.x, id.tiling.y, offset.x, offset.y);
                PainterShaderVariables.BRUSH_ATLAS_SECTION_AND_ROWS.GlobalValue = new Vector4(0, 0, 1, 0);
            }
Esempio n. 21
0
            public override void OnShaderBrushUpdate(BrushConfig brush)
            {
                var vd = TexMGMTdata.decals.TryGet(brush.selectedDecal);

                if (vd == null)
                {
                    return;
                }

                _decalHeightProperty.GlobalValue     = vd.heightMap;
                _decalOverlayProperty.GlobalValue    = vd.overlay;
                _decalParametersProperty.GlobalValue = new Vector4(
                    brush.decalAngle * Mathf.Deg2Rad,
                    (vd.type == VolumetricDecalType.Add) ? 1 : -1,
                    Mathf.Clamp01(brush.Speed / 10f),
                    0);
            }
Esempio n. 22
0
        private void Init()
        {
            if (brushConfig == null)
            {
                brushConfig = new BrushConfig();
            }

            if (meshPackagingSolutions.IsNullOrEmpty())
            {
                Debug.Log("Recreating mash packaging solutions");
                meshPackagingSolutions = new List <MeshPackagingProfile>
                {
                    (new MeshPackagingProfile()).LoadFromResources(MeshPackagingProfile.FolderName, "Simple"),
                    (new MeshPackagingProfile()).LoadFromResources(MeshPackagingProfile.FolderName, "Bevel"),
                    (new MeshPackagingProfile()).LoadFromResources(MeshPackagingProfile.FolderName, "AtlasedProjected"),
                    (new MeshPackagingProfile()).LoadFromResources(MeshPackagingProfile.FolderName, "Standard_Atlased")
                };
            }
            if (samplingMaskSize.x == 0)
            {
                samplingMaskSize = new MyIntVec2(4);
            }

            CheckShaders();

            var decoder = new CfgDecoder(meshToolsStd);

            foreach (var tag in decoder)
            {
                var d = decoder.GetData();
                foreach (var m in MeshToolBase.AllTools)
                {
                    if (m.StdTag.SameAs(tag))
                    {
                        m.Decode(d);
                        break;
                    }
                }
            }

            if (systemLanguage != -1)
            {
                LazyTranslations._systemLanguage = systemLanguage;
            }
        }
Esempio n. 23
0
            public override void PaintRenderTexture(PlaytimePainter painter, BrushConfig br, StrokeVector st)
            {
                var id = painter.TexMeta;

                BeforeStroke(br, st, painter);

                bool alphaBuffer;

                PrepareSphereBrush(id, br, st, out alphaBuffer, painter);

                if (!st.MouseDownEvent)
                {
                    TexMGMT.brushRenderer.UseMeshAsBrush(painter);
                    TexMGMT.Render();
                }

                AfterStroke_Painter(painter, br, st, alphaBuffer, id);
            }
Esempio n. 24
0
 public override bool MouseEventPointedTriangle()
 {
     if ((EditorInputManager.GetMouseButton(0)))
     {
         if (PointedTriangle.SameAsLastFrame)
         {
             return(true);
         }
         BrushConfig bcf = Cfg.brushConfig;
         foreach (var uv in PointedTriangle.vertexes)
         {
             //bcf.colorLinear.ToV4(ref uv.meshPoint.shadowBake, bcf.mask);
             bcf.mask.SetValuesOn(ref uv.meshPoint.shadowBake, bcf.Color);
         }
         EditedMesh.Dirty = true;
         return(true);
     }
     return(false);
 }
Esempio n. 25
0
        public void ManagedOnEnable()
        {
            Decode(stdData);

            if (brushConfig == null)
            {
                brushConfig = new BrushConfig();
            }

            if (meshPackagingSolutions.IsNullOrEmpty())
            {
                ResetMeshPackagingProfiles();
            }

            if (samplingMaskSize.x == 0)
            {
                samplingMaskSize = new MyIntVec2(4);
            }

            CheckShaders();

            var decoder = new CfgDecoder(meshToolsStd);

            foreach (var tag in decoder)
            {
                var d = decoder.GetData();
                foreach (var m in MeshToolBase.AllTools)
                {
                    if (m.StdTag.SameAs(tag))
                    {
                        m.Decode(d);
                        break;
                    }
                }
            }

            if (systemLanguage != -1)
            {
                LazyTranslations._systemLanguage = systemLanguage;
            }
        }
Esempio n. 26
0
        public static void PrepareCpuBlit(this BrushConfig bc, TextureMeta id)
        {
            half = (bc.Size(false)) / 2;

            var smooth = bc.GetBrushType(true) != BrushTypes.Pixel.Inst;

            if (smooth)
            {
                alphaMode = CircleAlpha;
            }
            else
            {
                alphaMode = NoAlpha;
            }

            blitMode = bc.GetBlitMode(true).BlitFunctionTex2D(id);

            alpha = 1;

            Set(bc.mask);

            cSrc = bc.Color;
        }
Esempio n. 27
0
        public static void Paint(StrokeVector stroke, float brushAlpha, ImageMeta image, BrushConfig bc, PlaytimePainter painter)
        {
            if (image?.Pixels == null)
            {
                return;
            }

            var uvCoords = stroke.uvFrom;

            brAlpha = brushAlpha;

            bc.PrepareCpuBlit(image);

            var iHalf = (int)(half);

            Vector2 offset;

            var tmp = image.UvToPixelNumber(uvCoords, out offset);

            var smooth = bc.GetBrushType(true) != BrushTypePixel.Inst;

            if (smooth)
            {
                iHalf += 1;
                offset = Vector2.zero;
            }

            var hf = half - 0.5f;

            var halfFromX = Mathf.RoundToInt(-hf + offset.x);
            var halfFromY = Mathf.RoundToInt(-hf + offset.y);
            var halfToX   = Mathf.RoundToInt(hf + offset.x);
            var halfToY   = Mathf.RoundToInt(hf + offset.y);

            var fromX = tmp.x + halfFromX;

            tmp.y += halfFromY;

            var pixels = image.Pixels;

            for (y = halfFromY; y <= halfToY; y++)
            {
                tmp.x = fromX;

                for (x = halfFromX; x <= halfToX; x++)
                {
                    if (alphaMode())
                    {
                        blitMode(ref pixels[image.PixelNo(tmp)]);
                    }

                    tmp.x += 1;
                }

                tmp.y += 1;
            }
        }
Esempio n. 28
0
        public static void Paint(Vector2 uvCoords, float brushAlpha, Texture2D texture, Vector2 offset, Vector2 tiling, BrushConfig bc, PlaytimePainter pntr)
        {
            var id = texture.GetImgData();

            id.offset = offset;
            id.tiling = tiling;

            Paint(new StrokeVector(uvCoords), brushAlpha, texture.GetImgData(), bc, pntr);
        }
Esempio n. 29
0
 public virtual void PrePaint(PlaytimePainter painter, BrushConfig br, StrokeVector st)
 {
 }
Esempio n. 30
0
        public bool BrushConfigPEGI(ref bool overrideBlitMode, BrushConfig br)
        {
            var changed = false;

            var p = InspectedPainter;

            var volTex = p.GetVolumeTexture();

            if (volTex)
            {
                overrideBlitMode = true;

                var id = p.ImgMeta;

                if (BrushConfig.showAdvanced)
                {
                    "Grid".toggle(50, ref _useGrid).nl();
                }

                var cpuBlit = id.TargetIsTexture2D().nl();

                br.showingSize = !_enableRayTracing || cpuBlit;


                if (!cpuBlit)
                {
                    if (BrushConfig.showAdvanced || _enableRayTracing)
                    {
                        "Ray-Tracing".toggleIcon(ref _enableRayTracing, true).changes(ref changed);

                        if (br.useAlphaBuffer)
                        {
                            icon.Warning.write(
                                "Ray Tracing doesn't use Alpha buffer. Alpha buffer will be automatically disabled");
                        }
                    }

                    if ("Ray Trace Camera".conditional_enter(_enableRayTracing && PainterCamera.depthProjectorCamera,
                                                             ref _exploreRayTaceCamera).nl_ifFoldedOut())
                    {
                        "Min".edit(40, ref minFov, 60, maxFov - 1).nl(ref changed);

                        "Max".edit(40, ref maxFov, minFov + 1, 170).nl(ref changed);

                        rayTraceCameraConfiguration.Nested_Inspect().nl(ref changed);
                    }



                    if (_enableRayTracing && BrushConfig.showAdvanced)
                    {
                        pegi.nl();
                        // "Bounced brightness mltpl".edit(ref arbitraryBrightnessIncrease, 1, 2).changes(ref changed);

                        //"A completely arbitrary value that increases the amount of bounced light. Used to utilize the full 0-1 range of the texture for increased percision"
                        //  .fullWindowDocumentationClick();

                        pegi.nl();
                    }

                    if (!_exploreRayTaceCamera && _enableRayTracing)
                    {
                        var dp = PainterCamera.depthProjectorCamera;

                        if (!dp)
                        {
                            if ("Create Projector Camera".Click().nl())
                            {
                                PainterCamera.GetProjectorCamera();
                            }
                        }
                        else if (dp.pauseAutoUpdates)
                        {
                            pegi.nl();
                            "Light Projectors paused".toggleIcon(ref dp.pauseAutoUpdates).nl(ref changed);
                        }

                        pegi.nl();
                    }
                }

                if (cpuBlit)
                {
                    /*if (_enableRayTracing)
                     *  icon.Warning.write("CPU Brush is slow for volumes");*/
                }
                else
                {
                    pegi.nl();

                    if (!br.GetBrushType(false).IsAWorldSpaceBrush)
                    {
                        "Only World space brush can edit volumes".writeHint();
                        pegi.nl();
                        if ("Change to Sphere brush".Click())
                        {
                            br.SetBrushType(false, BrushTypeSphere.Inst);
                        }
                    }
                }

                pegi.nl();


                if (!_exploreRayTaceCamera && PainterCamera.Data.showVolumeDetailsInPainter && (volTex.name + " " + VolumeEditingExtensions.VolumeSize(id.texture2D, volTex.hSlices)).foldout(ref _exploreVolumeData).nl())
                {
                    volTex.Nested_Inspect().changes(ref changed);
                }

                if (volTex.NeedsToManageMaterials)
                {
                    var painterMaterial = InspectedPainter.Material;
                    if (painterMaterial != null)
                    {
                        if (!volTex.materials.Contains(painterMaterial))
                        {
                            if ("Add This Material".Click().nl())
                            {
                                volTex.AddIfNew(p);
                            }
                        }
                    }
                }

                if (!cpuBlit)
                {
                    MsgPainter.Hardness.GetText().edit(MsgPainter.Hardness.GetDescription(), 70, ref br.hardness, 1f, 22f).nl(ref changed);
                }

                var tmpSpeed = br._dSpeed.value;
                if (MsgPainter.Speed.GetText().edit(40, ref tmpSpeed, 0.01f, 4.5f).nl(ref changed))
                {
                    br._dSpeed.value = tmpSpeed;
                }


                if (br.showingSize)
                {
                    var maxScale = volTex.size * volTex.Width * 4;

                    "Scale:".edit(40, ref br.brush3DRadius, 0.001f * maxScale, maxScale * 0.5f).changes(ref changed);

                    if (cpuBlit && !_brushShaderFroRayTrace && br.brush3DRadius > BrushScaleMaxForCpu(volTex))
                    {
                        icon.Warning.write(
                            "Size will be reduced when panting due to low performance of the CPU brush for volumes");
                    }
                }

                pegi.nl();

                /*
                 * if (br.GetBlitMode(cpuBlit).UsingSourceTexture && id.TargetIsRenderTexture())
                 * {
                 *  if (TexMGMTdata.sourceTextures.Count > 0)
                 *  {
                 *      "Copy From:".write(70);
                 *      changed |= pegi.selectOrAdd(ref br.selectedSourceTexture, ref TexMGMTdata.sourceTextures);
                 *  }
                 *  else
                 *      "Add Textures to Render Camera to copy from".nl();
                 * }*/
            }
            if (changed)
            {
                this.SetToDirty_Obj();
            }

            return(changed);
        }