I need to calculate normals of a generated mesh. Not sure if this function is helpful?
this addon might be helpful:
there’s a “calcNormals( ofMesh & mesh, bool bNormalize = true )” which is inspired by:
thanks for your help. But that code, only works if there are no duplicate vertices in list. Can you explain what ofxMeshUtils::getIndiciedMeshFromNonIndiciedMesh does. Does it remove duplicates? Also do have any idea what ofMesh::smoothNormals does?
smooth normals seems to make the mesh indexed (remove redundant vertices) and for every vertex, calculate its normal as the “average” normal of all normals of triangles it’s a part of. it does what my code is doing, except my code has two separate functions – one to make the mesh indicied, the other to calc normals.