using System.Text; using UnityEngine; using UnityEngine.TerrainTools; namespace UnityEditor.TerrainTools { /// /// Calls the methods in its invocation list when a brush's settings are reset. /// public delegate void ResetBrush(); /// /// An interface that represent the brush's common UI. /// public interface IBrushUIGroup { /// /// The normalized size of the brush. /// float brushSize { get; } /// /// The rotation of the brush (in degrees). /// float brushRotation { get; } /// /// The normalized strength of the brush when applied. /// float brushStrength { get; } /// /// The spacing used when applying certain brushes. /// float brushSpacing { get; } /// /// Gets and sets the message for validating terrain parameters. /// string validationMessage { get; set; } /// /// Are we allowed to paint with this brush? /// bool allowPaint { get; } /// /// Inverts the brush's strength. /// bool InvertStrength { get; } /// /// Checks if the brush is in use. /// bool isInUse { get; } /// /// Gets the brush mask's Filter stack view. /// FilterStackView brushMaskFilterStackView { get; } /// /// Gets the brush mask's Filter stack. /// FilterStack brushMaskFilterStack { get; } /// /// Checks if the brush has enabled filters. /// bool hasEnabledFilters { get; } /// /// Gets a reference to the terrain under the cursor. /// Terrain terrainUnderCursor { get; } /// /// Gets and sets the value associated to whether there is a raycast hit detecting a terrain under the cursor. /// bool isRaycastHitUnderCursorValid { get; } /// /// Gets and sets the raycast hit that was under the cursor's position. /// RaycastHit raycastHitUnderCursor { get; } /// /// Renders the brush's GUI within the inspector view. /// /// The terrain in focus. /// The editcontext used to show the brush GUI. /// The brushflags to use when displaying the brush GUI. void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext, BrushGUIEditFlags brushFlags = BrushGUIEditFlags.SelectAndInspect); /// /// Defines data when the brush is selected. /// /// void OnEnterToolMode(); /// /// Defines data when the brush is deselected. /// /// void OnExitToolMode(); /// /// Triggers events when painting on a terrain. /// /// The terrain in focus. /// The editcontext to reference. void OnPaint(Terrain terrain, IOnPaint editContext); /// /// Triggers events to render a 2D GUI within the Scene view. /// /// The terrain in focus. /// The editcontext to reference. /// void OnSceneGUI2D(Terrain terrain, IOnSceneGUI editContext); /// /// Triggers events to render objects and displays within Scene view. /// /// The terrain in focus. /// The editcontext to reference. /// void OnSceneGUI(Terrain terrain, IOnSceneGUI editContext); /// /// Adds basic information to the selected brush. /// /// The Terrain in focus. /// The IOnSceneGUI to reference. /// The StringBuilder containing the brush information. void AppendBrushInfo(Terrain terrain, IOnSceneGUI editContext, StringBuilder builder); /// /// Generates the brush mask. /// /// The source render texture to blit from. /// The destination render texture for bliting to. /// /// Use this overload method to let Unity handle passing the brush's parameters and terrain reference to the main GenerateBrushMask meethod. void GenerateBrushMask(RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture); /// /// Generates the brush mask. /// /// The terrain in focus. /// The source render texture to blit from. /// The destination render texture for bliting to. /// /// Use this overload method to let Unity handle passing the brush's parameters to the main GenerateBrushMask meethod. void GenerateBrushMask(Terrain terrain, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture); /// /// Generates the brush mask. /// /// The terrain in focus. /// The source render texture to blit from. /// The destination render texture for bliting to. /// The brush's position. /// The brush's scale. /// The brush's rotation. /// This is the main overload method for generating brush mask. void GenerateBrushMask(Terrain terrain, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture, Vector3 position, float scale, float rotation); /// /// Scatters the brush around the specified UV on the specified terrain. If the scattered UV leaves /// the current terrain then the terrain AND UV are modified for the terrain the UV is now over. /// /// The terrain the scattered UV co-ordinate is actually on. /// The UV co-ordinate passed in transformed into the UV co-ordinate relative to the scattered terrain. /// "true" if we scattered to a terrain, "false" if we fell off ALL terrains. bool ScatterBrushStamp(ref Terrain terrain, ref Vector2 uv); /// /// Activates a modifier key controller. /// /// The modifier key to activate. /// Returns false when the modifier key controller is null. bool ModifierActive(BrushModifierKey k); } }