本文整理汇总了C#中UnityEngine.Mesh.SetTangents方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.SetTangents方法的具体用法?C# Mesh.SetTangents怎么用?C# Mesh.SetTangents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Mesh
的用法示例。
在下文中一共展示了Mesh.SetTangents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillMesh
/// <summary>
/// <para>Fill the given mesh with the stream data.</para>
/// </summary>
/// <param name="mesh"></param>
public void FillMesh(Mesh mesh)
{
mesh.Clear();
if (this.m_Positions.Count >= 0xfde8)
{
throw new ArgumentException("Mesh can not have more than 65000 vertices");
}
mesh.SetVertices(this.m_Positions);
mesh.SetColors(this.m_Colors);
mesh.SetUVs(0, this.m_Uv0S);
mesh.SetUVs(1, this.m_Uv1S);
mesh.SetNormals(this.m_Normals);
mesh.SetTangents(this.m_Tangents);
mesh.SetTriangles(this.m_Indices, 0);
mesh.RecalculateBounds();
}
示例2: SetVertices
public void SetVertices(UIVertex[] vertices, int size)
{
Mesh mesh = new Mesh();
List<Vector3> inVertices = new List<Vector3>();
List<Color32> inColors = new List<Color32>();
List<Vector2> uvs1 = new List<Vector2>();
List<Vector2> uvs2 = new List<Vector2>();
List<Vector3> inNormals = new List<Vector3>();
List<Vector4> inTangents = new List<Vector4>();
List<int> intList = new List<int>();
int num = 0;
while (num < size)
{
for (int index = 0; index < 4; ++index)
{
inVertices.Add(vertices[num + index].position);
inColors.Add(vertices[num + index].color);
uvs1.Add(vertices[num + index].uv0);
uvs2.Add(vertices[num + index].uv1);
inNormals.Add(vertices[num + index].normal);
inTangents.Add(vertices[num + index].tangent);
}
intList.Add(num);
intList.Add(num + 1);
intList.Add(num + 2);
intList.Add(num + 2);
intList.Add(num + 3);
intList.Add(num);
num += 4;
}
mesh.SetVertices(inVertices);
mesh.SetColors(inColors);
mesh.SetNormals(inNormals);
mesh.SetTangents(inTangents);
mesh.SetUVs(0, uvs1);
mesh.SetUVs(1, uvs2);
mesh.SetIndices(intList.ToArray(), MeshTopology.Triangles, 0);
this.SetMesh(mesh);
Object.DestroyImmediate((Object) mesh);
}
示例3: SetVertices
public void SetVertices(UIVertex[] vertices, int size)
{
Mesh mesh = new Mesh();
List<Vector3> inVertices = new List<Vector3>();
List<Color32> inColors = new List<Color32>();
List<Vector2> uvs = new List<Vector2>();
List<Vector2> list4 = new List<Vector2>();
List<Vector3> inNormals = new List<Vector3>();
List<Vector4> inTangents = new List<Vector4>();
List<int> list7 = new List<int>();
for (int i = 0; i < size; i += 4)
{
for (int j = 0; j < 4; j++)
{
inVertices.Add(vertices[i + j].position);
inColors.Add(vertices[i + j].color);
uvs.Add(vertices[i + j].uv0);
list4.Add(vertices[i + j].uv1);
inNormals.Add(vertices[i + j].normal);
inTangents.Add(vertices[i + j].tangent);
}
list7.Add(i);
list7.Add(i + 1);
list7.Add(i + 2);
list7.Add(i + 2);
list7.Add(i + 3);
list7.Add(i);
}
mesh.SetVertices(inVertices);
mesh.SetColors(inColors);
mesh.SetNormals(inNormals);
mesh.SetTangents(inTangents);
mesh.SetUVs(0, uvs);
mesh.SetUVs(1, list4);
mesh.SetIndices(list7.ToArray(), MeshTopology.Triangles, 0);
this.SetMesh(mesh);
UnityEngine.Object.DestroyImmediate(mesh);
}
示例4: FillMesh
public void FillMesh(Mesh mesh)
{
mesh.Clear();
mesh.SetVertices(this.m_Positions);
mesh.SetColors(this.m_Colors);
mesh.SetUVs(0, this.m_Uv0S);
mesh.SetUVs(1, this.m_Uv1S);
mesh.SetNormals(this.m_Normals);
mesh.SetTangents(this.m_Tangents);
mesh.SetTriangles(this.m_Indicies, 0);
mesh.RecalculateBounds();
}