Esempio n. 1
0
        public void ManagedUpdate(PlaytimePainter painter)
        {
            if (pixelsDirty)
            {
                if ((Time.time - _repaintTime < _repaintDelay) && !painter.stroke.MouseUpEvent)
                {
                    return;
                }

                if (texture2D)
                {
                    SetAndApply(!dontRedoMipMaps);
                }

                pixelsDirty  = false;
                _repaintTime = Time.time;
            }

            foreach (var m in Modules)
            {
                m.ManagedUpdate();
            }
        }
Esempio n. 2
0
        public override void OnUpdate(PlaytimePainter painter)
        {
            var t = painter.terrain;

            if (!t)
            {
                return;
            }

#if UNITY_2018_3_OR_NEWER
            var sp = t.terrainData.terrainLayers;
#else
            SplatPrototype[] sp = t.terrainData.splatPrototypes;
#endif

            var td  = painter.terrain.terrainData;
            var tds = td.size;

            if (sp.Length != 0 && sp[0] != null)
            {
                var tilingX = tds.x / sp[0].tileSize.x;
                var tilingZ = tds.z / sp[0].tileSize.y;
                PainterDataAndConfig.TerrainTiling.GlobalValue = new Vector4(tilingX, tilingZ, sp[0].tileOffset.x, sp[0].tileOffset.y);

                painter.tilingY = td.size.y / sp[0].tileSize.x;
            }

            PainterDataAndConfig.TerrainScale.GlobalValue = new Vector4(tds.x, tds.y, tds.z, 0.5f / td.heightmapResolution);

            painter.UpdateTerrainPosition();

            var alphaMapTextures = td.alphamapTextures;
            if (!alphaMapTextures.IsNullOrEmpty())
            {
                PainterDataAndConfig.TerrainControlMain.GlobalValue = alphaMapTextures[0].GetDestinationTexture();
            }
        }
Esempio n. 3
0
        public void MergeWith(EditableMesh edm, PlaytimePainter other)
        {
            if (uv2DistributeRow > 1)
            {
                var tile   = Vector2.one / uv2DistributeRow;
                var y      = uv2DistributeCurrent / uv2DistributeRow;
                var x      = uv2DistributeCurrent - y * uv2DistributeRow;
                var offset = tile;
                offset.Scale(new Vector2(x, y));
                edm.TileAndOffsetUVs(offset, tile, 1);
                uv2DistributeCurrent++;
            }


            triangles.AddRange(edm.triangles);

            var tf = other.transform;

            foreach (var v in edm.meshPoints)
            {
                v.WorldPos = tf.TransformPoint(v.localPos);
                meshPoints.Add(v);
            }
        }
Esempio n. 4
0
        public void ManagedUpdate(PlaytimePainter painter)
        {
            if (pixelsDirty)
            {
                var noTimeYet = (QcUnity.TimeSinceStartup() - _repaintTime < _repaintDelay);
                if (noTimeYet && !painter.stroke.MouseUpEvent)
                {
                    return;
                }

                if (texture2D)
                {
                    SetAndApply(!dontRedoMipMaps);
                }

                pixelsDirty  = false;
                _repaintTime = (float)QcUnity.TimeSinceStartup();
            }

            foreach (var m in Modules)
            {
                m.ManagedUpdate();
            }
        }
Esempio n. 5
0
        public void ChangeBufferTarget(TextureMeta newTarget, MaterialMeta mat, ShaderProperty.TextureValue parameter, PlaytimePainter painter)
        {
            if (newTarget != imgMetaUsingRendTex)
            {
                if (materialsUsingRenderTexture.Count > 0)
                {
                    PlaytimePainter.CheckSetOriginalShader();
                }

                if (imgMetaUsingRendTex != null)
                {
                    if (imgMetaUsingRendTex.texture2D)
                    {
                        imgMetaUsingRendTex.RenderTexture_To_Texture2D();
                    }

                    imgMetaUsingRendTex.target = TexTarget.Texture2D;

                    foreach (var m in materialsUsingRenderTexture)
                    {
                        m.SetTextureOnLastTarget(imgMetaUsingRendTex);
                    }
                }

                materialsUsingRenderTexture.Clear();
                autodisabledBufferTarget = null;
                imgMetaUsingRendTex      = newTarget;
            }

            if (mat != null)
            {
                mat.bufferParameterTarget = parameter;
                mat.painterTarget         = painter;
                materialsUsingRenderTexture.Add(mat);
            }
        }
Esempio n. 6
0
        public override bool GetTexture(ShaderProperty.TextureValue field, ref Texture tex, PlaytimePainter painter)
        {
            if (!field.IsGlobalVolume())
            {
                return(false);
            }

            var gl = VolumeTexture.GetGlobal(field);

            if (gl != null)
            {
                tex = gl.ImageMeta.CurrentTexture();
            }
            else
            {
                tex = null;
            }

            return(true);
        }
Esempio n. 7
0
        public override bool SetTextureOnMaterial(ShaderProperty.TextureValue field, ImageMeta id, PlaytimePainter painter)
        {
            if (!field.IsGlobalVolume())
            {
                return(false);
            }

            var gl = VolumeTexture.GetGlobal(field);

            if (gl != null)
            {
                gl.ImageMeta = id;
                gl.UpdateMaterials();
            }

            return(true);
        }
Esempio n. 8
0
 public virtual bool DrawGizmosOnPainter(PlaytimePainter painter) => false;
Esempio n. 9
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. 10
0
        public CfgEncoder EncodeStrokeFor(PlaytimePainter painter)
        {
            var id = painter.TexMeta;

            var rt = id.TargetIsRenderTexture();

            var mode = GetBlitMode(!rt);
            var type = GetBrushType(!rt);

            var worldSpace = rt && painter.Is3DBrush();

            var cody = new CfgEncoder()

                       .Add(rt ? "typeGPU" : "typeCPU", _brushType(!rt));

            if (worldSpace)
            {
                cody.Add("size3D", brush3DRadius);
            }
            else
            {
                cody.Add("size2D", brush2DRadius / id.width);
            }


            cody.Add_Bool("useMask", useMask)
            .Add("modeCPU", _inCpuBlitMode)
            .Add("modeGPU", _inGpuBlitMode);



            if (useMask)
            {
                cody.Add("mask", (int)mask);
            }

            cody.Add("bc", Color);

            if (mode.UsingSourceTexture)
            {
                cody.Add_IfNotZero("source", selectedSourceTexture);
            }

            if (rt)
            {
                if ((mode.GetType() == typeof(BlitModes.Blur)))
                {
                    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("dSpeed", _dFlow);
            //.Add("Speed", speed);

            return(cody);
        }
Esempio n. 11
0
 public virtual void AddIfNew(PlaytimePainter p) => AddIfNew(p.Material);
Esempio n. 12
0
        public override bool UpdateTilingFromMaterial(ShaderProperty.TextureValue fieldName, PlaytimePainter painter)
        {
            if (!fieldName.IsGlobalVolume())
            {
                return(false);
            }
            var id = painter.ImgMeta;

            if (id == null)
            {
                return(true);
            }
            id.tiling = Vector2.one;
            id.offset = Vector2.zero;
            return(true);
        }
Esempio n. 13
0
 public Shader GetBrushShaderDoubleBuffer(PlaytimePainter p) =>
 p.GetVolumeTexture() ? (_enableRayTracing ? _brushShaderFroRayTrace : _brush) : null;
Esempio n. 14
0
        public bool ComponentDependent_PEGI(bool showToggles, PlaytimePainter painter)
        {
            var changed = false;

            var property = painter.GetMaterialTextureProperty;

            var forceOpenUTransparentLayer = false;

            var material = painter.Material;

            var hasAlphaLayerTag = material && (property != null) &&
                                   material.Has(property,
                                                ShaderTags.LayerTypes
                                                .Transparent); //GetTag(PainterDataAndConfig.ShaderTagLayerType + property, false).Equals("Transparent");

            if (!isATransparentLayer && hasAlphaLayerTag)
            {
                "Material Field {0} is a Transparent Layer ".F(property).writeHint();
                forceOpenUTransparentLayer = true;
            }

            if (showToggles || (isATransparentLayer && !hasAlphaLayerTag) || forceOpenUTransparentLayer)
            {
                MsgPainter.TransparentLayer.GetText().toggleIcon(ref isATransparentLayer).changes(ref changed);

                MsgPainter.TransparentLayer.GetDescription()
                .fullWindowDocumentationWithLinkClickOpen(
                    "https://www.quizcanners.com/single-post/2018/09/30/Why-do-I-get-black-outline-around-the-stroke",
                    "More About it");

                if (isATransparentLayer)
                {
                    preserveTransparency = true;
                }


                pegi.nl();
            }


            if (showToggles)
            {
                if (isATransparentLayer)
                {
                    preserveTransparency = true;
                }
                else
                {
                    MsgPainter.PreserveTransparency.GetText().toggleIcon(ref preserveTransparency).changes(ref changed);

                    MsgPainter.PreserveTransparency.DocumentationClick();

                    pegi.nl();
                }
            }

            var forceOpenUv2 = false;
            var hasUv2Tag    = painter.Material.Has(property, ShaderTags.SamplingModes.Uv2);

            if (!useTexCoord2 && hasUv2Tag)
            {
                if (!_useTexCoord2AutoAssigned)
                {
                    useTexCoord2 = true;
                    _useTexCoord2AutoAssigned = true;
                }
                else
                {
                    "Material Field {0} is Sampled using Texture Coordinates 2 ".F(property).writeHint();
                }
                forceOpenUv2 = true;
            }

            if (showToggles || (useTexCoord2 && !hasUv2Tag) || forceOpenUv2)
            {
                "Use UV2".toggleIcon(ref useTexCoord2).nl(ref changed);
            }

            return(changed);
        }
 public static bool AllowEditing(PlaytimePainter targetPainter) =>
 targetPainter && (Application.isPlaying || !targetPainter.IsUiGraphicPainter) &&
 (!targetPainter.LockTextureEditing || targetPainter.IsEditingThisMesh);
Esempio n. 16
0
        public override bool SetTextureOnMaterial(ShaderProperty.TextureValue field, TextureMeta id, PlaytimePainter painter)
        {
            var tex = id.CurrentTexture();

            if (!painter.terrain || !field.Equals(PainterDataAndConfig.TerrainLight))
            {
                return(false);
            }

            FindMergingTerrain(painter);
            if (mergingTerrain && id != null)
            {
                mergingTerrain.lightTexture = id.texture2D;
            }

#if UNITY_EDITOR
            var t2D = tex as Texture2D;

            if (t2D)
            {
                var importer = (t2D).GetTextureImporter();
                if (importer != null)
                {
                    var needReimport = importer.WasClamped();
                    needReimport |= importer.HadNoMipmaps();

                    if (needReimport)
                    {
                        importer.SaveAndReimport();
                    }
                }
            }
#endif

            PainterDataAndConfig.TerrainLight.GlobalValue = tex;



            return(true);
        }
Esempio n. 17
0
        public override bool UpdateTilingFromMaterial(ShaderProperty.TextureValue fieldName, PlaytimePainter painter)
        {
            if (!painter.terrain || fieldName == null ||
                !fieldName.Equals(PainterDataAndConfig.TerrainLight))
            {
                return(false);
            }

            var id = painter.TexMeta;

            if (id == null)
            {
                return(true);
            }
            id.tiling = Vector2.one;
            id.offset = Vector2.zero;
            return(true);
        }
Esempio n. 18
0
        public override bool GetTexture(ShaderProperty.TextureValue field, ref Texture tex, PlaytimePainter painter)
        {
            if (!painter.terrain || !field.Equals(PainterDataAndConfig.TerrainLight))
            {
                return(false);
            }

            tex = mergingTerrain.lightTexture;
            return(true);
        }
Esempio n. 19
0
 public Shader GetPreviewShader(PlaytimePainter p) => p.GetVolumeTexture() ? _preview : null;
Esempio n. 20
0
        public void ChangeDestination(TexTarget changeTo, MaterialMeta mat, ShaderProperty.TextureValue parameter, PlaytimePainter painter)
        {
            if (changeTo != destination)
            {
                if (changeTo == TexTarget.RenderTexture)
                {
                    if (!renderTexture)
                    {
                        PainterCamera.Inst.ChangeBufferTarget(this, mat, parameter, painter);
                    }
                    TextureToRenderTexture(texture2D);
                }
                else
                {
                    if (!texture2D)
                    {
                        return;
                    }

                    if (!renderTexture)
                    {
                        PainterCamera.Inst.EmptyBufferTarget();
                        PainterCamera.Inst.DiscardAlphaBuffer();
                    }
                    else if (painter.initialized && !painter.isBeingDisabled)
                    {
                        // To avoid Clear to black when exiting playmode
                        RenderTexture_To_Texture2D();
                        Debug.Log("Is being switched to Tex2D");
                    }
                }
                destination = changeTo;
                painter.SetTextureOnMaterial(this);
            }
            else
            {
                Debug.Log("Destination already Set");
            }
        }
Esempio n. 21
0
        public void Paint(PaintCommand.UV command)
        {
            var imgData = command.TextureData;

            var cpu          = command.TextureData.TargetIsTexture2D();
            var brushType    = GetBrushType(cpu);
            var blitMode     = GetBlitMode(cpu);
            var isWorldSpace = command.Is3DBrush;

            var painterCommand = command as PaintCommand.ForPainterComponent;

            PlaytimePainter painter = painterCommand?.painter;

            blitMode.PrePaint(command);

            if (cpu)
            {
                if (painter)
                {
                    foreach (var module in imgData.Modules)
                    {
                        module.OnPainting(painter);
                    }
                }

                brushType.PaintPixelsInRam(command);
            }
            else
            {
                if (painter)
                {
                    var materialData = painter.MatDta;

                    if (!imgData.renderTexture && !TexMGMT.materialsUsingRenderTexture.Contains(materialData))
                    {
                        TexMGMT.ChangeBufferTarget(imgData, materialData, painter.GetMaterialTextureProperty(), painter);
                        painter.SetTextureOnMaterial(imgData);
                    }

                    var rendered = false;

                    foreach (var pl in CameraModuleBase.BrushPlugins)
                    {
                        if (pl.IsEnabledFor(painter, imgData, this))
                        {
                            pl.PaintRenderTextureUvSpace(command);
                            rendered = true;
                            break;
                        }
                    }

                    if (!painter.terrain || brushType.SupportedForTerrainRt)
                    {
                        foreach (var module in imgData.Modules)
                        {
                            module.OnPainting(painter);
                        }

                        if (!rendered)
                        {
                            if (isWorldSpace)
                            {
                                brushType.PaintRenderTextureInWorldSpace(command as PaintCommand.WorldSpace);
                            }
                            else
                            {
                                brushType.PaintRenderTextureUvSpace(command);
                            }
                        }
                    }
                }
                else
                {
                    if (isWorldSpace)
                    {
                        brushType.PaintRenderTextureInWorldSpace(command as PaintCommand.WorldSpace);
                    }
                    else
                    {
                        brushType.PaintRenderTextureUvSpace(command);
                    }
                }
            }
        }
Esempio n. 22
0
 public Shader GetBrushShaderSingleBuffer(PlaytimePainter p) => null;
Esempio n. 23
0
 public virtual void OnPrepareRay(PlaytimePainter p, Brush bc, ref Ray ray)
 {
 }
Esempio n. 24
0
 public bool NeedsGrid(PlaytimePainter p) => _useGrid && p.GetVolumeTexture();
Esempio n. 25
0
        public override bool Inspect()
        {
            var changed = false;

            pegi.toggleDefaultInspector(this);

            if (_textureInShaderr != null)
            {
                if (icon.Delete.Click())
                {
                    _textureInShaderr = null;
                }

                _textureInShaderr.GetNameForInspector().nl();
            }

            if (searchedForPainter)
            {
                _painter = GetComponent <PlaytimePainter>();
            }

            if (!_painter)
            {
                "Painter [None]".write();
                if ("Search".Click())
                {
                    _painter = GetComponent <PlaytimePainter>();
                }

                if (icon.Add.Click())
                {
                    _painter = GetComponent <PlaytimePainter>();
                    if (!_painter)
                    {
                        _painter = gameObject.AddComponent <PlaytimePainter>();
                    }
                }

                pegi.nl();
            }
            else
            {
                if (_painter.gameObject != gameObject)
                {
                    "Painter is on a different Game Object".writeWarning();
                    if ("Disconnect".Click())
                    {
                        _painter = null;
                    }
                }

                var mod = _painter.GetModule <VolumeTextureComponentModule>();
                if (!mod.volumeTexture && "Assign volume texture to painter".Click().nl())
                {
                    mod.volumeTexture = this;
                }

                if (mod.volumeTexture)
                {
                    if (mod.volumeTexture == this)
                    {
                        "This volume texture is attached".write();
                    }

                    if (icon.UnLinked.Click("Unlink"))
                    {
                        mod.volumeTexture = null;
                    }
                }

                pegi.nl();
            }

            pegi.fullWindowDocumentationClickOpen(VolumeDocumentation);

            if (inspectedElement == -1)
            {
                "Also set for Global shader parameters".toggleIcon(ref setForGlobal).changes(ref changed);

                pegi.nl();
            }

            if ("Volume Texture".enter(ref inspectedElement, 1).nl())
            {
                var n = NameForPEGI;
                if ("Name".editDelayed(50, ref n).nl(ref changed))
                {
                    NameForPEGI = n;
                }

                if (setForGlobal)
                {
                    "FOR GLOBAL ONLY:".nl();

                    PositionAndScaleProperty.NameForDisplayPEGI().write_ForCopy().nl();

                    SlicesShadeProperty.NameForDisplayPEGI().write_ForCopy().nl();
                }

                var tex = ImageMeta.CurrentTexture();

                if (tex == null)
                {
                    ImageMeta = null;
                }

                if ("Texture".edit(60, ref tex).nl(ref changed))
                {
                    ImageMeta = tex ? tex.GetTextureMeta() : null;
                }

                "Volume Scale".edit(70, ref size).nl(ref changed);
                size = Mathf.Max(0.0001f, size);

                if (ImageMeta == null)
                {
                    if (!TexturesPool.inst)
                    {
                        pegi.nl();
                        "Texture Width".edit(90, ref _tmpWidth).changes(ref changed);

                        if ("Create Pool".Click().nl(ref changed))
                        {
                            _tmpWidth = Mathf.ClosestPowerOfTwo(Mathf.Clamp(_tmpWidth, 128, 2048));
                            TexturesPool.GetOrCreateInstance.width = _tmpWidth;
                        }
                    }
                    else
                    {
                        if ("Get From Pool".Click().nl(ref changed))
                        {
                            ImageMeta = TexturesPool.inst.GetTexture2D().GetTextureMeta();
                        }

                        TexturesPool.inst.Nested_Inspect().nl();
                    }
                }
                pegi.nl();

                "Slices:".edit("How texture will be sliced for height", 80, ref hSlices, 1, 8).nl(ref changed);

                if (changed)
                {
                    UpdateImageMeta();
                }

                var w = Width;
                ("Will result in X:" + w + " Z:" + w + " Y:" + Height + "volume").nl();
            }

            if ("Materials [{0}]".F(materials.Count).enter(ref inspectedElement, 2).nl_ifFoldedOut())
            {
                "Materials".edit_List_UObj(ref materials, ref inspectedMaterial);

                if (inspectedMaterial == -1 && InspectedPainter)
                {
                    var pMat = InspectedPainter.Material;
                    if (pMat != null && materials.Contains(pMat) && "Remove This Material".Click().nl(ref changed))
                    {
                        materials.Remove(pMat);
                    }
                }
            }

            if (changed || icon.Refresh.Click("Update Materials"))
            {
                UpdateMaterials();
            }

            pegi.nl();

            return(changed);
        }
Esempio n. 26
0
        public void PaintPixelsInRam(StrokeVector stroke, float brushAlpha, ImageMeta image, BrushConfig bc, PlaytimePainter painter)
        {
            var volume = image.texture2D.GetVolumeTextureData();

            if (!volume)
            {
                return;
            }

            if (volume.VolumeJobIsRunning)
            {
                return;
            }

            bc.brush3DRadius = Mathf.Min(BrushScaleMaxForCpu(volume), bc.brush3DRadius);

            var volumeScale = volume.size;

            var pos = (stroke.posFrom - volume.transform.position) / volumeScale + 0.5f * Vector3.one;

            var height   = volume.Height;
            var texWidth = image.width;

            BlitFunctions.brAlpha = brushAlpha;
            bc.PrepareCpuBlit(image);
            BlitFunctions.half = bc.Size(true) / volumeScale;

            var pixels = image.Pixels;

            var iHalf  = (int)(BlitFunctions.half - 0.5f);
            var smooth = bc.GetBrushType(true) != BrushTypePixel.Inst;

            if (smooth)
            {
                iHalf += 1;
            }

            BlitFunctions.alphaMode = BlitFunctions.SphereAlpha;

            var sliceWidth = texWidth / volume.hSlices;

            var hw = sliceWidth / 2;

            var y = (int)pos.y;
            var z = (int)(pos.z + hw);
            var x = (int)(pos.x + hw);

            for (BlitFunctions.y = -iHalf; BlitFunctions.y < iHalf + 1; BlitFunctions.y++)
            {
                var h = y + BlitFunctions.y;

                if (h >= height)
                {
                    return;
                }

                if (h < 0)
                {
                    continue;
                }
                var hy        = h / volume.hSlices;
                var hx        = h % volume.hSlices;
                var hTexIndex = (hy * texWidth + hx) * sliceWidth;

                for (BlitFunctions.z = -iHalf; BlitFunctions.z < iHalf + 1; BlitFunctions.z++)
                {
                    var trueZ = z + BlitFunctions.z;

                    if (trueZ < 0 || trueZ >= sliceWidth)
                    {
                        continue;
                    }
                    var yTexIndex = hTexIndex + trueZ * texWidth;

                    for (BlitFunctions.x = -iHalf; BlitFunctions.x < iHalf + 1; BlitFunctions.x++)
                    {
                        if (!BlitFunctions.alphaMode())
                        {
                            continue;
                        }
                        var trueX = x + BlitFunctions.x;

                        if (trueX < 0 || trueX >= sliceWidth)
                        {
                            continue;
                        }
                        var texIndex = yTexIndex + trueX;
                        BlitFunctions.blitMode(ref pixels[texIndex]);
                    }
                }
            }
        }
Esempio n. 27
0
 public virtual void PrePaint(PlaytimePainter painter, BrushConfig br, StrokeVector st)
 {
 }
Esempio n. 28
0
 public bool IsEnabledFor(PlaytimePainter painter, ImageMeta img, BrushConfig cfg) => img.IsVolumeTexture();
Esempio n. 29
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. 30
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));
            }
        }