Skip to main content

ProceduralBladeTemplate

A class in Root.Township, Alta.Environmental.Vegetation.

Asset with ranges for generating random grass blades: bend, height and width. Used by the grass editor tools.

Constructors​

MemberWhat it is
ProceduralBladeTemplate()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

12 private and internal fields
MemberWhat it is
private List<int> baseTrianglesFixed triangle list for the nine-vertex blade.
private bool isAvailableBacking field for IsAvailable.
private bool isWidthVariableWhen set, width narrows toward the top; otherwise it stays the same.
private float maxBendingFrontMost forward bend at the tip.
private float maxBendingSidewaysMost sideways bend at the tip.
private float maxHeightTallest blade.
private float maxWidthAtTopWidest top width when width varies.
private float maxWidthAverageWidest base width.
private float minHeightShortest blade.
private float minWidthAtTopNarrowest top width when width varies.
private float minWidthAverageNarrowest base width.
private string templateNameBacking field for Name.

Properties​

MemberWhat it is
bool IsAvailable { get; set; }Whether the template is offered for use.
string Name { get; set; }Template name.

Methods​

MemberWhat it is
void GetMesh(out Vector3[] vertices, out int[] triangles, out Color[] colors, out Vector2[] uv)Generates a random nine-vertex blade with UVs and vertex colours (height, side, random value) for the wind shader.
void LoadTemplate(out float maxBendingFront, out float maxBendingSideways, out float minHeight, out float maxHeight, out float minWidth, out float maxWidth, out bool isWidthVariable, out float minWidthAtTop, out float maxWidthAtTop)Copies the template's ranges out.
void SaveTemplate(float maxBendingFront, float maxBendingSideways, float minHeight, float maxHeight, float minWidthAverage, float maxWidthAverage, bool isWidthVariable, float minWidthAtTop, float maxWidthAtTop)Stores new ranges in the template.
1 private and internal method
MemberWhat it is
private void GetSpineAndWidth(ref List<Vector3> spine, ref List<float> width)Rolls a random five-point bent spine and the width at each point within the template's ranges.