private void CreateVertexList() { var Positions = customMesh.vertices; var Normals = customMesh.normals; var Uv1 = customMesh.uv; m_Attributes = EVertexAttribute.Position; if (Normals != null && Normals.Length > 0) { m_Attributes |= EVertexAttribute.Normal; } if (Uv1 != null && Uv1.Length > 0) { m_Attributes |= EVertexAttribute.UV1; } vertices = new Vertex[Positions.Length]; for (int i = 0; i < Positions.Length; i++) { var v = new Vertex(Positions[i]); v.normal = Normals[i]; if (HasAttr(EVertexAttribute.UV1)) { v.uv1 = Uv1[i]; } vertices[i] = v; } }
private bool HasAttr(EVertexAttribute aAttr) { return((m_Attributes & aAttr) != 0); }
private void CreateVertexList() { var Positions = m_Mesh.vertices; var Normals = m_Mesh.normals; var Tangents = m_Mesh.tangents; var Colors = m_Mesh.colors; var Uv1 = m_Mesh.uv; var Uv2 = m_Mesh.uv2; var Uv3 = m_Mesh.uv3; var Uv4 = m_Mesh.uv4; var BWeights = m_Mesh.boneWeights; m_Attributes = EVertexAttribute.Position; if (Normals != null && Normals.Length > 0) { m_Attributes |= EVertexAttribute.Normal; } if (Tangents != null && Tangents.Length > 0) { m_Attributes |= EVertexAttribute.Tangent; } if (Colors != null && Colors.Length > 0) { m_Attributes |= EVertexAttribute.Color; } if (Uv1 != null && Uv1.Length > 0) { m_Attributes |= EVertexAttribute.UV1; } if (Uv2 != null && Uv2.Length > 0) { m_Attributes |= EVertexAttribute.UV2; } if (Uv3 != null && Uv3.Length > 0) { m_Attributes |= EVertexAttribute.UV3; } if (Uv4 != null && Uv4.Length > 0) { m_Attributes |= EVertexAttribute.UV4; } if (BWeights != null && BWeights.Length > 0) { m_Attributes |= EVertexAttribute.BoneWeight; } vertices = new Vertex[Positions.Length]; for (int i = 0; i < Positions.Length; i++) { var v = new Vertex(Positions[i]); if (HasAttr(EVertexAttribute.Normal)) { v.normal = Normals[i]; } if (HasAttr(EVertexAttribute.Tangent)) { v.tangent = Tangents[i]; } if (HasAttr(EVertexAttribute.Color)) { v.color = Colors[i]; } if (HasAttr(EVertexAttribute.UV1)) { v.uv1 = Uv1[i]; } if (HasAttr(EVertexAttribute.UV2)) { v.uv2 = Uv2[i]; } if (HasAttr(EVertexAttribute.UV3)) { v.uv3 = Uv3[i]; } if (HasAttr(EVertexAttribute.UV4)) { v.uv4 = Uv4[i]; } if (HasAttr(EVertexAttribute.BoneWeight)) { v.bWeight = BWeights[i]; } vertices[i] = v; } }