//TODO: here you may put other informations about this guy public CurvedPolyMeshItem(CurvedPolyVariants curvedPolyVariants, Mesh storedMesh = null) { this.curvedPolyVariants = curvedPolyVariants; this.id = -1; this.timestamp = -1; this.storedMesh = storedMesh; }
public void Execute() { CurvedPolygonsNet cpnet = asset.GetCPN(); CurvedPolyVariants cpnVariants = new CurvedPolyVariants(); cpnVariants.SetCPN(cpnet); short[] loqs = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; CPNTessellationProcess tessellationProcess = ProcessesKeeper.GetTessellationProcess(); TessellationOutput output = tessellationProcess.InitProcess(cpnet, loqs); //Debug.Log("cpnet.GetGeometriesCount() " + cpnet.GetGeometriesCount()); tessellationProcess.BuildProfile(); int[] builtTrianglesCount = output.GetBuiltTrianglesSize(); int builtVerticesCount = output.GetBuiltVerticesSize(); uvs_ = new Vector2[builtVerticesCount]; vertices_ = new Vector3[builtVerticesCount]; normals_ = new Vector3[builtVerticesCount]; indices_ = new int[builtTrianglesCount.Length][]; for (int i = 0; i < builtTrianglesCount.Length; i++) { indices_[i] = new int[builtTrianglesCount[i] * 3]; } OutputMesh mesh = null; mesh = new OutputMesh(vertices_, uvs_, normals_, indices_); tessellationProcess.WriteMesh(mesh); //here int id = cpnVariants.GetFreeTessellationRecordId(); cpnVariants.SetRecord(id, new OutputMesh(vertices_, uvs_, normals_, indices_), output); //this.outMesh = cpnVariants.GetMeshOutput(id).GetNewCloneVariant(); CPNSubset subsSet = new CPNSubset(); TessellationOutput output2 = tessellationProcess.InitProcess(cpnet, loqs, subsSet); this.mesh2 = new OutputMesh(outMesh.GetVertices(), outMesh.GetUVs(), outMesh.GetNormals(), outMesh.GetTriangles()); tessellationProcess.WriteMesh(mesh2); }