How to add Facets to DzFacetMesh from dword* buffer?

I have float* vertex and normal buffer.

And dword* triangles buffer.

Now, In my project for add each triangle to DzFacetMesh, I call addFacet for each triangle.

But when my triangle buffer large this operation took long time. Example.for 131 328 triangles and 66 117 vertexs it take average 6.5 secs.

Now, question.How can I add triangle(facets) buffer to DzMeshFacet in signle operation, without for/while cycle?


  • I went through this a while back and didn't find a way to do it from a buffer, but calling preSize up front makes it much faster. Example below from Ground Control


        vMesh->beginEdit(false);	 	vMesh->preSizeVertexArray(fullMapInfo.mesh->pointCount);	uvList->preSize(fullMapInfo.mesh->pointCount);	for (point = 0; point < fullMapInfo.mesh->pointCount; point++) {		const DzVec3 vertex(XLines[fullMapInfo.mesh->points[point].east], 			fullMapInfo.minElevation + fullMapInfo.mesh->points[point].elevation * sizeY,  			ZLines[fullMapInfo.mesh->points[point].north]);		const DzPnt2 uv = {fullMapInfo.mesh->EPercent[fullMapInfo.mesh->points[point].east], 			fullMapInfo.mesh->NPercent[fullMapInfo.mesh->points[point].north]};		vMesh->addVertex(vertex);		uvList->appendPnt2Value(uv);	}	vMesh->setUVList(uvList);	vMesh->preSizeFacets(fullMapInfo.mesh->facetCount);	for (facet = 0; facet < fullMapInfo.mesh->facetCount; facet++) {		const int vertIdx[4] = {fullMapInfo.mesh->facets[facet].pointIndex[0],			fullMapInfo.mesh->facets[facet].pointIndex[1],			fullMapInfo.mesh->facets[facet].pointIndex[2],			-1};		vMesh->addFacet(vertIdx, vertIdx);	}	vMesh->finishEdit(); 


  • Thanks. It helps.

    But it is very bad when we can't  work with buffers.


Sign In or Register to comment.