public virtual void OnPaint(Terrain terrain, IOnPaint editContext)
        {
            // Manage brush capture history for playback in tests
            if (isRecording)
            {
                OnPaintOccurrence.history.Add(new OnPaintOccurrence(editContext.brushTexture, brushSize,
                                                                    brushStrength, brushRotation,
                                                                    editContext.uv.x, editContext.uv.y));
            }

            m_Controllers.ForEach((controller) => controller.OnPaint(terrain, editContext));


            if (m_BrushSmoothController != null)
            {
                Vector2 uv = editContext.uv;

                if (ScatterBrushStamp(ref terrain, ref uv))
                {
                    m_BrushSmoothController.kernelSize = 0.03f * m_BrushSizeController.brushSize;
                    m_BrushSmoothController.OnPaint(terrain, editContext, brushSize, brushRotation, brushStrength, uv);
                }
            }

            /// Ensure that we re-randomize where the next scatter operation will place the brush,
            /// that way we can render the preview in a representative manner.
            m_BrushScatterController?.RequestRandomisation();
        }
Exemple #2
0
        public virtual void OnPaint(Terrain terrain, IOnPaint editContext)
        {
            filterContext.ReleaseRTHandles();

            // Manage brush capture history for playback in tests
            if (isRecording)
            {
                OnPaintOccurrence.history.Add(new OnPaintOccurrence(editContext.brushTexture, brushSize,
                                                                    brushStrength, brushRotation,
                                                                    editContext.uv.x, editContext.uv.y));
            }

            m_Controllers.ForEach((controller) => controller.OnPaint(terrain, editContext));

            if (isSmoothing)
            {
                Vector2 uv = editContext.uv;

                m_BrushSmoothController.kernelSize = (int)Mathf.Max(1, 0.1f * m_BrushSizeController.brushSize);
                m_BrushSmoothController.OnPaint(terrain, editContext, brushSize, brushRotation, brushStrength, uv);
            }

            /// Ensure that we re-randomize where the next scatter operation will place the brush,
            /// that way we can render the preview in a representative manner.
            m_BrushScatterController?.RequestRandomisation();

            TerrainToolsAnalytics.UpdateAnalytics(this, m_analyticsCallback);

            filterContext.ReleaseRTHandles();
        }