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 { /// /// Does the commonUI have a size controller? /// bool hasBrushSize { get; } /// /// Does the commonUI have a rotation controller? /// bool hasBrushRotation { get; } /// /// Does the commonUI have a strength controller? /// bool hasBrushStrength { get; } /// /// Does the commonUI have a spacing controller? /// bool hasBrushSpacing { get; } /// /// Does the commonUI have a scatter controller? /// bool hasBrushScatter { get; } /// /// The normalized size of the brush. /// float brushSize { get; set; } /// /// The size of the brush without jitter. /// float brushSizeVal { get; } /// /// The min size of the brush when applied. /// float brushSizeMin { get; set; } /// /// The max size of the brush when applied. /// float brushSizeMax { get; set; } /// /// The jitter of the brush size when applied. /// float brushSizeJitter { get; set; } /// /// The rotation of the brush (in degrees). /// float brushRotation { get; set; } /// /// The rotation of the brush without jitter (in degrees). /// float brushRotationVal { get; } /// /// The jitter of the brush rotation when applied. /// float brushRotationJitter { get; set; } /// /// The normalized strength of the brush when applied. /// float brushStrength { get; set; } /// /// The strength of the brush without jitter. /// float brushStrengthVal { get; } /// /// The min strength of the brush when applied. /// float brushStrengthMin { get; set; } /// /// The max strength of the brush when applied. /// float brushStrengthMax { get; set; } /// /// The jitter of the brush strength when applied. /// float brushStrengthJitter { get; set; } /// /// The spacing used when applying certain brushes. /// float brushSpacing { get; set; } /// /// The scatter used when applying certain brushes. /// float brushScatter { get; set; } /// /// 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); /// /// Renders the brush's GUI within the inspector view. /// /// The terrain in focus. /// The editcontext used to show the brush GUI. /// The bool to mark true when showing UI specific for overlays. /// The brushflags to use when displaying the brush GUI. /// the overlays brushflags to use when displaying the GUI void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext, bool overlays, BrushGUIEditFlags brushFlags = BrushGUIEditFlags.SelectAndInspect, BrushOverlaysGUIFlags brushOverlaysFlags = BrushOverlaysGUIFlags.All); /// /// 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); /// /// Generates the brush mask. /// /// The brushRender object used for acquiring the heightmap and splatmap texture to blit from. /// The destination render texture for bliting to. /// This overload method enables the use of the Layer Filter. void GenerateBrushMask(IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture); /// /// 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); } }