Class Utility
Provides utility methods for Terrain.
Inherited Members
Namespace: UnityEditor .TerrainTools
Assembly: Unity.TerrainTools.Editor.dll
Syntax
public static class Utility
Methods
AnimationCurveToRenderTexture(AnimationCurve, ref Texture2D)
Converts data from a Animation
Declaration
public static Vector2 AnimationCurveToRenderTexture(AnimationCurve curve, ref Texture2D tex)
Parameters
Type | Name | Description |
---|---|---|
Animation |
curve | The Animation |
Texture2D | tex | The Texture2D to convert data into. |
Returns
Type | Description |
---|---|
Vector2 | Returns the range of the Animation |
CollectTexelValidity(Terrain, Rect, int)
Retrieves texel context data used for checking texel validity.
Declaration
public static PaintContext CollectTexelValidity(Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels = 0)
Parameters
Returns
Type | Description |
---|---|
Paint |
Returns the Paint |
GenerateAndSetFilterRT(IBrushUIGroup, IBrushRenderUnderCursor, RenderTexture, Material)
Sets and Generates the filter Render
Declaration
public static void GenerateAndSetFilterRT(IBrushUIGroup commonUI, IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture, Material mat)
Parameters
Type | Name | Description |
---|---|---|
IBrush |
commonUI | The brush's commonUI group. |
IBrush |
brushRender | The brushRender object used for acquiring the heightmap and splatmap texture to blit from. |
Render |
destinationRenderTexture | The Render |
Material | mat | The Material to update. |
See Also
GenerateAndSetFilterRT(IBrushUIGroup, RenderTexture, RenderTexture, Material)
Generate the filter render texture for transformation brushes and bind the texture to the provided Material
Sets and Generates the filter Render
Declaration
public static void GenerateAndSetFilterRT(IBrushUIGroup commonUI, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture, Material mat)
Parameters
Type | Name | Description |
---|---|---|
IBrush |
commonUI | The brush's commonUI group. |
Render |
sourceRenderTexture | The Render |
Render |
destinationRenderTexture | The Render |
Material | mat | The Material to update. |
See Also
GetDefaultPreviewMaterial(bool)
Retrieves the default preview Material for painting on Terrains.
Declaration
public static Material GetDefaultPreviewMaterial(bool filtersPreviewEnabled = false)
Parameters
Type | Name | Description |
---|---|---|
bool | filtersPreviewEnabled | Whether the filter preview is enabled. |
Returns
GetPaintHeightMaterial()
Gets the paint height material to render builtin brush passes.
Declaration
public static Material GetPaintHeightMaterial()
Returns
Type | Description |
---|---|
Material | Material with the Paint Height shader |
Remarks
This material overrides the Builtin PaintHeight shader with Terrain Tools version of PaintHeight.
See Terrain
SetMaterialKeyword(Material, string, bool)
Enable or disable the keyword for the provided Material instance
Declaration
public static void SetMaterialKeyword(Material mat, string keyword, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
Material | mat | The material to set. |
string | keyword | The keyword to enable and disable. |
bool | enabled | Whether to enable or disable the keyword of the material. |
SetupMaterialForPainting(PaintContext, BrushTransform, Material)
Prepares the passed in Material for painting on Terrains.
Declaration
public static void SetupMaterialForPainting(PaintContext paintContext, BrushTransform brushTransform, Material material)
Parameters
Type | Name | Description |
---|---|---|
Paint |
paintContext | The painting context data. |
Brush |
brushTransform | The brush's transformation data. |
Material | material | The material being used for painting on Terrains. |
See Also
SetupMaterialForPaintingWithTexelValidityContext(PaintContext, PaintContext, BrushTransform, Material)
Prepares the passed in Material for painting on Terrains while checking for Texel Validity.
Declaration
public static void SetupMaterialForPaintingWithTexelValidityContext(PaintContext paintContext, PaintContext texelCtx, BrushTransform brushTransform, Material material)
Parameters
Type | Name | Description |
---|---|---|
Paint |
paintContext | The painting context data. |
Paint |
texelCtx | The texel context data. |
Brush |
brushTransform | The brush's transformation data. |
Material | material | The material being used for painting on Terrains. |