Catlike Coding
Unity Code Documentation
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
CatlikeCoding.TextBox.TextMeshRenderer Class Reference

TextRenderer that uses a dynamically-growing mesh to show sprites. More...

Inherits CatlikeCoding.TextBox.TextRenderer.

Inherited by CatlikeCoding.TextBox.TextMeshCircleRenderer, CatlikeCoding.TextBox.TextMeshCylinderRenderer, and CatlikeCoding.TextBox.TextMeshTorusRenderer.

Public Member Functions

override void Add (CharMetaData meta, Vector2 offset)
 Add a character. More...
 
override void Apply ()
 Perform any work that needs to be done after character have been added. More...
 
override void Prepare ()
 Perform any work that needs to be done before characters will be added, like clearing old data. More...
 
override void SetClipBounds (Bounds2D clipBounds)
 Perform any work to support clipping. More...
 

Public Attributes

int chunkSize = 1
 The mesh will grow in multiples of the chunk size. Smaller produces less overshoot but potentially more frequent resizing. More...
 
TextMeshRendererUV2Mode uv2Mode
 UV2 mode. More...
 
- Public Attributes inherited from CatlikeCoding.TextBox.TextRenderer
int renderedCharCount
 How many characters to render. Will be set before Prepare is called. More...
 
TextBox textBox
 Text box that uses the renderer. More...
 

Protected Member Functions

void OnDestroy ()
 Called by Unity when the component is destroyed. More...
 

Protected Attributes

Color32[] colors
 Mesh colors. More...
 
int currentVertexIndex
 Increased by 4 after each call to Add. More...
 
int lastRendererCharCount
 Set equal to renderedCharCount after Apply. More...
 
Mesh mesh
 Mesh used to render the characters. More...
 
bool meshResized
 Whether the mesh has been resized during Prepare. More...
 
int[] triangles
 Mesh triangles. More...
 
Vector2[] uv
 Mesh UV. More...
 
Vector2[] uv2
 Mesh UV2. Might not exist. More...
 
Vector3[] vertices
 Mesh vertices. More...
 

Static Protected Attributes

static Vector3 hidden = Vector3.zero
 Quick vector access for hiding unused sprites. More...
 

Properties

override Bounds Bounds [get]
 Get the 3D bounds of the rendered content. More...
 
- Properties inherited from CatlikeCoding.TextBox.TextRenderer
virtual Bounds Bounds [get]
 Get the 3D bounds of the rendered content. More...
 

Detailed Description

TextRenderer that uses a dynamically-growing mesh to show sprites.

This component can be extended to add things like secondary UV. The vertex order of sprites is 0 top left, 1 top right, 2 bottom right, and 3 bottom left. The triangle order of sprites is 0, 1, 3 and 0, 2, 3.

Member Function Documentation

override void CatlikeCoding.TextBox.TextMeshRenderer.Add ( CharMetaData  meta,
Vector2  offset 
)
virtual

Add a character.

Parameters
metaCharacter meta data.
offsetAdditional offset.

Reimplemented from CatlikeCoding.TextBox.TextRenderer.

override void CatlikeCoding.TextBox.TextMeshRenderer.Apply ( )
virtual

Perform any work that needs to be done after character have been added.

Reimplemented from CatlikeCoding.TextBox.TextRenderer.

Reimplemented in CatlikeCoding.TextBox.TextMeshTorusRenderer.

void CatlikeCoding.TextBox.TextMeshRenderer.OnDestroy ( )
protected

Called by Unity when the component is destroyed.

override void CatlikeCoding.TextBox.TextMeshRenderer.Prepare ( )
virtual

Perform any work that needs to be done before characters will be added, like clearing old data.

Reimplemented from CatlikeCoding.TextBox.TextRenderer.

override void CatlikeCoding.TextBox.TextMeshRenderer.SetClipBounds ( Bounds2D  clipBounds)
virtual

Perform any work to support clipping.

It is up to subclasses whether they support clipping.

Parameters
clipBoundsClip bounds.

Reimplemented from CatlikeCoding.TextBox.TextRenderer.

Member Data Documentation

int CatlikeCoding.TextBox.TextMeshRenderer.chunkSize = 1

The mesh will grow in multiples of the chunk size. Smaller produces less overshoot but potentially more frequent resizing.

Color32 [] CatlikeCoding.TextBox.TextMeshRenderer.colors
protected

Mesh colors.

int CatlikeCoding.TextBox.TextMeshRenderer.currentVertexIndex
protected

Increased by 4 after each call to Add.

Vector3 CatlikeCoding.TextBox.TextMeshRenderer.hidden = Vector3.zero
staticprotected

Quick vector access for hiding unused sprites.

int CatlikeCoding.TextBox.TextMeshRenderer.lastRendererCharCount
protected

Set equal to renderedCharCount after Apply.

Mesh CatlikeCoding.TextBox.TextMeshRenderer.mesh
protected

Mesh used to render the characters.

bool CatlikeCoding.TextBox.TextMeshRenderer.meshResized
protected

Whether the mesh has been resized during Prepare.

int [] CatlikeCoding.TextBox.TextMeshRenderer.triangles
protected

Mesh triangles.

Vector2 [] CatlikeCoding.TextBox.TextMeshRenderer.uv
protected

Mesh UV.

Vector2 [] CatlikeCoding.TextBox.TextMeshRenderer.uv2
protected

Mesh UV2. Might not exist.

TextMeshRendererUV2Mode CatlikeCoding.TextBox.TextMeshRenderer.uv2Mode

UV2 mode.

Vector3 [] CatlikeCoding.TextBox.TextMeshRenderer.vertices
protected

Mesh vertices.

Property Documentation

override Bounds CatlikeCoding.TextBox.TextMeshRenderer.Bounds
get

Get the 3D bounds of the rendered content.

Returns the bounds of the used mesh, or zero if it doesn't exist yet.