private int CheckMeshSize(int numberOfNewVerts) { int meshIndex = _meshes.Count - 1; if (meshIndex < 0)//check there is a mesh to begin with { DynamicMeshGenericMultiMaterial newMesh = new DynamicMeshGenericMultiMaterial(); newMesh.name = name + " " + (meshIndex + 2); newMesh.subMeshCount = _subMeshCount; _meshes.Add(newMesh); _vertexCount += numberOfNewVerts; return(0); } int newVertCount = numberOfNewVerts + _vertexCount - (meshIndex * 65000); if (newVertCount >= 64990 || !_meshes[meshIndex].usable) { // Debug.Log("CheckMeshSize " + meshIndex); DynamicMeshGenericMultiMaterial newMesh = new DynamicMeshGenericMultiMaterial(); newMesh.name = name + " " + (meshIndex + 2); newMesh.subMeshCount = _subMeshCount; _meshes.Add(newMesh); meshIndex++; } // if (newVertCount > 64990) Debug.Log(newVertCount + " " + numberOfNewVerts + " " + _vertexCount + " " + meshIndex+" "+(meshIndex*65000)); _vertexCount += numberOfNewVerts; return(meshIndex); }
public void ForceNewMesh() { int meshIndex = _meshes.Count - 1; _meshes[meshIndex].usable = false; DynamicMeshGenericMultiMaterial newMesh = new DynamicMeshGenericMultiMaterial(); newMesh.name = name + " " + (meshIndex + 2); newMesh.subMeshCount = _subMeshCount; _meshes.Add(newMesh); meshIndex++; }
private int CheckMeshSize(int numberOfNewVerts) { int meshIndex = _meshes.Count-1; if(meshIndex<0)//check there is a mesh to begin with { DynamicMeshGenericMultiMaterial newMesh = new DynamicMeshGenericMultiMaterial(); newMesh.name = name + " " + (meshIndex + 2); newMesh.subMeshCount = _subMeshCount; _meshes.Add(newMesh); _vertexCount += numberOfNewVerts; return 0; } int newVertCount = numberOfNewVerts + _vertexCount - (meshIndex*65000); if (newVertCount >= 64990 || !_meshes[meshIndex].usable) { // Debug.Log("CheckMeshSize " + meshIndex); DynamicMeshGenericMultiMaterial newMesh = new DynamicMeshGenericMultiMaterial(); newMesh.name = name + " " + (meshIndex+2); newMesh.subMeshCount = _subMeshCount; _meshes.Add(newMesh); meshIndex++; } // if (newVertCount > 64990) Debug.Log(newVertCount + " " + numberOfNewVerts + " " + _vertexCount + " " + meshIndex+" "+(meshIndex*65000)); _vertexCount += numberOfNewVerts; return meshIndex; }