void UpdateMesh(ref GeomMesh gm, Mesh dst) { if (dst == null) { return; } dst.Clear(); if (m_ogc.FillPoints(ref gm, m_points)) { dst.SetVertices(m_points.List); } if (m_ogc.FillNormals(ref gm, m_normals)) { dst.SetNormals(m_normals.List); } if (m_ogc.FillTangents(ref gm, m_tangents)) { dst.SetTangents(m_tangents.List); } if (m_ogc.FillUV0(ref gm, m_uv0)) { dst.SetUVs(0, m_uv0.List); } if (m_ogc.FillUV1(ref gm, m_uv1)) { dst.SetUVs(1, m_uv0.List); } if (m_ogc.FillColors(ref gm, m_colors)) { dst.SetColors(m_colors.List); } int si = 0; var subm = new GeomSubmesh(); for (int smi = 0; smi < gm.submeshCount; ++smi) { m_ogc.GetSubmesh(gm.submeshOffset + smi, ref subm); if (subm.topology == Topology.Triangles) { m_ogc.FillIndices(ref subm, m_indices); dst.SetTriangles(m_indices.List, si++, false); } } }
[DllImport("NativeVertexCache")] static extern bool nvcOGCCopyIndices(IntPtr self, ref GeomSubmesh subm, IntPtr dst);
public bool FillIndices(ref GeomSubmesh subm, PinnedList <int> dst) { dst.ResizeDiscard(subm.indexCount); return(nvcOGCCopyIndices(self, ref subm, dst)); }
[DllImport("NativeVertexCache")] static extern void nvcOGCGetSubmesh(IntPtr self, int index, ref GeomSubmesh dst);
public void GetSubmesh(int index, ref GeomSubmesh dst) { nvcOGCGetSubmesh(self, index, ref dst); }