3 using System.Collections;
4 using System.Collections.Generic;
15 private static Vector2 k_InfinityVectorPositive =
new Vector2(32767, 32767);
16 private static Vector2 k_InfinityVectorNegative =
new Vector2(-32767, -32767);
20 public int characterCount;
21 public int spriteCount;
22 public int spaceCount;
28 public int materialCount;
54 this.textComponent = textComponent;
65 meshInfo[0].mesh = textComponent.
mesh;
83 for (
int i = 0; i < this.meshInfo.Length; i++)
85 this.meshInfo[i].vertexCount = 0;
95 for (
int i = 0; i < this.meshInfo.Length; i++)
96 this.meshInfo[i].
Clear(updateMesh);
105 for (
int i = 0; i < this.meshInfo.Length; i++)
106 this.meshInfo[i].
Clear(
true);
115 for (
int i = 0; i < this.meshInfo.Length; i++)
116 this.meshInfo[i].ResizeMeshInfo(0, isVolumetric);
126 for (
int i = 0; i < meshInfo.Length; i++)
139 if (this.lineInfo ==
null)
142 for (
int i = 0; i < this.lineInfo.Length; i++)
144 this.lineInfo[i].characterCount = 0;
145 this.lineInfo[i].spaceCount = 0;
146 this.lineInfo[i].wordCount = 0;
147 this.lineInfo[i].controlCharacterCount = 0;
148 this.lineInfo[i].width = 0;
150 this.lineInfo[i].ascender = k_InfinityVectorNegative.x;
151 this.lineInfo[i].descender = k_InfinityVectorPositive.x;
153 this.lineInfo[i].lineExtents.min = k_InfinityVectorPositive;
154 this.lineInfo[i].lineExtents.max = k_InfinityVectorNegative;
156 this.lineInfo[i].maxAdvance = 0;
169 if (m_CachedMeshInfo ==
null || m_CachedMeshInfo.Length != meshInfo.Length)
174 for (
int i = 0; i < m_CachedMeshInfo.Length; i++)
176 int length = meshInfo[i].vertices.Length;
178 m_CachedMeshInfo[i].vertices =
new Vector3[length];
179 m_CachedMeshInfo[i].uvs0 =
new Vector2[length];
180 m_CachedMeshInfo[i].uvs2 =
new Vector2[length];
181 m_CachedMeshInfo[i].colors32 =
new Color32[length];
189 for (
int i = 0; i < m_CachedMeshInfo.Length; i++)
191 int length = meshInfo[i].vertices.Length;
193 if (m_CachedMeshInfo[i].vertices.Length != length)
195 m_CachedMeshInfo[i].vertices =
new Vector3[length];
196 m_CachedMeshInfo[i].uvs0 =
new Vector2[length];
197 m_CachedMeshInfo[i].uvs2 =
new Vector2[length];
198 m_CachedMeshInfo[i].colors32 =
new Color32[length];
207 Array.Copy(meshInfo[i].vertices, m_CachedMeshInfo[i].vertices, length);
208 Array.Copy(meshInfo[i].uvs0, m_CachedMeshInfo[i].uvs0, length);
209 Array.Copy(meshInfo[i].uvs2, m_CachedMeshInfo[i].uvs2, length);
210 Array.Copy(meshInfo[i].colors32, m_CachedMeshInfo[i].colors32, length);
217 return m_CachedMeshInfo;
231 int newSize = size > 1024 ? size + 256 : Mathf.NextPowerOfTwo(size);
233 Array.Resize(ref array, newSize);
244 public static void Resize<T>(ref T[] array,
int size,
bool isBlockAllocated)
248 if (isBlockAllocated) size = size > 1024 ? size + 256 : Mathf.NextPowerOfTwo(size);
250 if (size == array.Length)
return;
252 Array.Resize(ref array, size);
static void Resize< T >(ref T[] array, int size)
Function to resize any of the structure contained in the TMP_TextInfo class.
void ClearUnusedVertices()
Function to clear the vertices while preserving the Triangles, Normals and Tangents.
Structure which contains information about the individual lines of text.
void ClearUnusedVertices(MaterialReference[] materials)
Function used to mark unused vertices as degenerate.
Class which contains information about every element contained within the text object.
void ResetVertexLayout(bool isVolumetric)
Base class which contains common properties and functions shared between the TextMeshPro and TextMesh...
void ClearLineInfo()
Function to clear and initialize the lineInfo array.
TMP_MeshInfo [] CopyMeshInfoVertexData()
Function to copy the MeshInfo Arrays and their primary vertex data content.
Structure containing information about the individual words contained in the text object.
Structure containing information about individual links contained in the text object.
void Clear()
Function to clear the counters of the text object.
Structure which contains the vertex attributes (geometry) of the text object.
TMP custom data type to represent 32 bit characters.
void ClearAllMeshInfo()
Function to clear the content of all the MeshInfo arrays while preserving their Triangles,...
virtual Mesh mesh
The mesh used by the font asset and material assigned to the text object.
void ClearMeshInfo(bool updateMesh)
Function to clear the content of the MeshInfo array while preserving the Triangles,...