C# Class TerrainHelpers, tf_client

Utility class for working with terrains
Inheritance: System.Object
Mostra file Open project: wids-eria/tf_client Class Usage Examples

Public Methods

Method Description
Clone ( TerrainData source, int detailResolutionPerPatch ) : TerrainData

Clone TerrainData object

ControlTextureToFloatArray ( Texture2D tex, int xBase, int yBase, int width, int height, float scale ) : ].float[

Return a control texture as a float[height,width] for e.g., height or splat

ControlTextureToIntArray ( Texture2D tex, int xBase, int yBase, int width, int height, int res ) : ].int[

Return a control texture as an int[height,width] for e.g., detail distribution

SetTextureFromDetails ( Texture2D tex, int xBase, int yBase, int details, int res ) : void

Update a grayscale control texture using the supplied information

TerrainToTreePosition ( Terrain terrain, Vector3 terrainSpacePosition ) : Vector3

Convert terrainSpacePosition into a tree-space position

TerrainToTreePosition ( Vector3 inverseTerrainSize, Vector3 terrainSpacePosition ) : Vector3

Convert terrainSpacePosition into a tree-space position

TreeToTerrainPosition ( Terrain terrain, Vector3 treeSpacePosition ) : Vector3

Convert treeSpacePosition into a terrain-space position

Method Details

Clone() public static method

Clone TerrainData object
public static Clone ( TerrainData source, int detailResolutionPerPatch ) : TerrainData
source TerrainData /// A ///
detailResolutionPerPatch int /// A ///
return TerrainData

ControlTextureToFloatArray() public static method

Return a control texture as a float[height,width] for e.g., height or splat
public static ControlTextureToFloatArray ( Texture2D tex, int xBase, int yBase, int width, int height, float scale ) : ].float[
tex UnityEngine.Texture2D /// A ///
xBase int /// A ///
yBase int /// A ///
width int /// A ///
height int /// A ///
scale float /// A ///
return ].float[

ControlTextureToIntArray() public static method

Return a control texture as an int[height,width] for e.g., detail distribution
public static ControlTextureToIntArray ( Texture2D tex, int xBase, int yBase, int width, int height, int res ) : ].int[
tex UnityEngine.Texture2D /// A ///
xBase int /// A ///
yBase int /// A ///
width int /// A ///
height int /// A ///
res int /// A detail resolution ///
return ].int[

SetTextureFromDetails() public static method

Update a grayscale control texture using the supplied information
public static SetTextureFromDetails ( Texture2D tex, int xBase, int yBase, int details, int res ) : void
tex UnityEngine.Texture2D /// A ///
xBase int /// A ///
yBase int /// A ///
details int /// A ///
res int /// A ///
return void

TerrainToTreePosition() public static method

Convert terrainSpacePosition into a tree-space position
public static TerrainToTreePosition ( Terrain terrain, Vector3 terrainSpacePosition ) : Vector3
terrain Terrain /// A ///
terrainSpacePosition Vector3 /// A in terrain's local space ///
return Vector3

TerrainToTreePosition() public static method

Convert terrainSpacePosition into a tree-space position
public static TerrainToTreePosition ( Vector3 inverseTerrainSize, Vector3 terrainSpacePosition ) : Vector3
inverseTerrainSize Vector3 /// A inverse of the size of the terrain of interest (e.g., (1/x, 1/y, 1/z)) ///
terrainSpacePosition Vector3 /// A in the local space of the terrain of interest ///
return Vector3

TreeToTerrainPosition() public static method

Convert treeSpacePosition into a terrain-space position
public static TreeToTerrainPosition ( Terrain terrain, Vector3 treeSpacePosition ) : Vector3
terrain Terrain /// A ///
treeSpacePosition Vector3 /// A homogenous coordinate ///
return Vector3