using UnityEngine; using UnityEngine.TerrainTools; namespace UnityEditor.TerrainTools { /// /// An interface that represent all of the functionality required to render a /// terrain-brush at a particular UV co-ordinate on a particular terrain. /// public interface IBrushRenderWithTerrain : IPaintContextRender { /// /// Calculates the brush-transform on the specified terrain at the specified UV co-ordinates (taking into account scattering). /// /// The terrain to calculate the brush-transform for. /// The UV co-ordinate on that terrain. /// The brush-transform on the terrain at the specified UV co-ordinates. /// The size of the brush. /// The rotation about the Y axis of the brush. /// The brush-transform on the terrain at the specified UV co-ordinates. /// Returns true if calculated successfully, false otherwise. bool CalculateBrushTransform(Terrain terrain, Vector2 uv, float size, float rotation, out BrushTransform brushTransform); /// /// Calculates the brush-transform on the specified terrain at the specified UV co-ordinates (taking into account scattering). /// /// The terrain to calculate the brush-transform for. /// The UV co-ordinate on that terrain. /// The size of the brush. /// The brush-transform on the terrain at the specified UV co-ordinates. /// Returns "true" if calculated successfully, "false" otherwise. bool CalculateBrushTransform(Terrain terrain, Vector2 uv, float size, out BrushTransform brushTransform); /// /// Calculates the brush-transform on the specified terrain at the specified UV co-ordinates (taking into account scattering). /// /// The terrain to calculate the brush-transform for. /// The UV co-ordinate on that terrain. /// The brush-transform on the terrain at the specified UV co-ordinates. /// Returns "true" if calculated successfully, "false" otherwise. bool CalculateBrushTransform(Terrain terrain, Vector2 uv, out BrushTransform brushTransform); /// /// Gets the PaintContext for the height-map at the bounds specified, /// you need to say whether this is to be writable upon acquisition. /// /// Determines if we wish to allow writing to the height-map. /// The initial terrain to acquire the height-map. /// The bounds of the height-map to use (in pixels). /// Extra padding on the bounds specified. /// Returns the paint context created. PaintContext AcquireHeightmap(bool writable, Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels = 0); /// /// Gets the PaintContext for the texture-map at the bounds specified, /// you need to say whether this is to be writable upon acquisition. /// /// Determines if we wish to allow writing to the texture-map. /// The initial terrain to acquire the texture-map. /// The bounds of the texture-map to use (in pixels). /// The terrain layer to acquire the texture-map for. /// Extra padding on the bounds specified. /// Returns the paint context created. PaintContext AcquireTexture(bool writable, Terrain terrain, Rect boundsInTerrainSpace, TerrainLayer layer, int extraBorderPixels = 0); /// /// Gets the PaintContext for the normal-map at the bounds specified, /// you need to say whether this is to be writable upon acquisition. /// /// Determines if we wish to allow writing to the normal-map. /// The initial terrain to acquire the normal-map. /// The bounds of the normal-map to use (in pixels). /// Extra padding on the bounds specified. /// Returns the paint context created. PaintContext AcquireNormalmap(bool writable, Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels = 0); /// /// Gets the PaintContext for the holes at the bounds specified, /// you need to say whether this is to be writable upon acquisition. /// /// Determines if we wish to allow writing to the normal-map. /// The initial terrain to acquire the normal-map. /// The bounds of the normal-map to use (in pixels). /// Extra padding on the bounds specified. /// Returns the paint context created. PaintContext AcquireHolesTexture(bool writable, Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels = 0); /// /// Releases the PaintContext specified, if this was made writable when /// acquired then we write back into the texture at this point. /// /// The paint context to be released. void Release(PaintContext paintContext); } /// /// An interface that represent the brush renderers preview on a terrain. /// public interface IBrushRenderPreviewWithTerrain : IBrushRenderWithTerrain, IPaintContextRenderPreview { } }