public bool Mode_Type_PEGI() { PlaytimePainter p = PlaytimePainter.inspectedPainter; inCPUtype = inCPUtype.ClampZeroTo(BrushType.AllTypes.Count); inGPUtype = inGPUtype.ClampZeroTo(BrushType.AllTypes.Count); bool CPU = p != null?p.ImgData.TargetIsTexture2D() : TargetIsTex2D; _inspectedBrush = this; bool changed = false; pegi.newLine(); Msg.BlitMode.Write("How final color will be calculated", 80); var bm = BlitMode; changed |= pegi.select(ref _bliTMode, BlitMode.AllModes); pegi.newLine(); pegi.Space(); pegi.newLine(); if (!CPU) { Msg.BrushType.Write(80); changed |= pegi.select <BrushType>(ref inGPUtype, BrushType.AllTypes); } bool overrideBlitModePegi = false; if (brushConfigPegies != null) { foreach (BrushConfigPEGIplugin pl in brushConfigPegies.GetInvocationList()) { changed |= pl(ref overrideBlitModePegi, this).nl(); } } if (p != null) { foreach (var pl in p.plugins) { if (pl.BrushConfigPEGI().nl()) { pl.SetToDirty(); changed = true; } } } changed |= Type(CPU).PEGI().nl(); if (!overrideBlitModePegi) { changed |= BlitMode.PEGI(); } _inspectedBrush = null; return(changed); }
public StdEncoder EncodeStrokeFor(PlaytimePainter painter) { var id = painter.ImgData; bool rt = id.TargetIsRenderTexture(); BlitMode mode = BlitMode; BrushType type = Type(!rt); bool worldSpace = rt && IsA3Dbrush(painter); StdEncoder cody = new StdEncoder() .Add(rt ? "typeGPU" : "typeCPU", _type(!rt)); if (worldSpace) { cody.Add("size3D", Brush3D_Radius); } else { cody.Add("size2D", Brush2D_Radius / ((float)id.width)); } cody.Add_Bool("useMask", useMask) .Add("mode", _bliTMode); if (useMask) { cody.Add("mask", (int)mask); } cody.Add("bc", colorLinear); if (mode.UsingSourceTexture) { cody.Add("source", selectedSourceTexture); } if (rt) { if ((mode.GetType() == typeof(BlitModeBlur))) { cody.Add("blur", blurAmount); } if (type.IsUsingDecals) { cody.Add("decA", decalAngle) .Add("decNo", selectedDecal); } if (useMask) { cody.Add("Smask", selectedSourceMask) .Add("maskTil", maskTiling) .Add_Bool("maskFlip", flipMaskAlpha) .Add("maskOff", maskOffset); } } cody.Add("hard", Hardness) .Add("speed", speed); return(cody); }
public PlaytimePainter Paint(StrokeVector stroke, PlaytimePainter pntr) { var id = pntr.ImgData; if (id == null) { pntr.InitIfNotInited(); id = pntr.ImgData; if (id == null) { return(pntr); } } var cpu = id.TargetIsTexture2D(); var t = Type(cpu); BlitMode.PrePaint(pntr, this, stroke); if (cpu) { pntr.RecordingMGMT(); t.PaintToTexture2D(pntr, this, stroke); } else { var md = pntr.MatDta; if (id.renderTexture == null && !TexMGMT.materialsUsingTendTex.Contains(md)) { TexMGMT.ChangeBufferTarget(id, md, pntr.MaterialTexturePropertyName, pntr); //materialsUsingTendTex.Add(md); pntr.SetTextureOnMaterial(id); //Debug.Log("Adding RT target"); } bool rendered = false; foreach (var pl in TexMGMT.Plugins) { if (pl.PaintRenderTexture(stroke, id, this, pntr)) { rendered = true; break; } } if ((pntr.terrain != null) && (!t.SupportedForTerrain_RT)) { return(pntr); } pntr.RecordingMGMT(); if (!rendered) { t.PaintRenderTexture(pntr, this, stroke); } } return(pntr); }