Nightly build 2018.04.08 changes ofMesh "addNormals()"?


#1

A project I originally built with default release 0.9.8 I am now trying to upgrade to a recent nightly release 20180408. Following various sources, I declare an ofMesh object (mesh) in ofApp.h; define vertices and colors for the mesh in setup(); and do the .addTriangle() loop using indices.

The last step in setup() is a call to setNormals(mesh) – a convenient function I copied out of “Mastering openframeworks: Creative Coding Demystified”. (This tells you something about my level of expertise.) This function begins:

> int nV = mesh.getNumVertices();
> int nT = mesh.getNumIndices() / 3;
> 
> vector<ofPoint> norm(nV);	// Storage for normals

After a loop over nT to calculate normals at each index and one over nV to normalize normal’s length, the function ends with these:

//Set the normals to mesh
mesh.clearNormals();
mesh.addNormals(norm);

There are several issues raised by Visual Studio 2017 when running this under the nightly build. Some are easily corrected like the preference of method “.getNormalized()” over just “.normalized()”.

But the error I can’t fix is raised by “mesh.addNormals(norm)”. The original type of norm (vector) is in hard conflict with the nightly build. Glancing at the libraries I see openFrameworks>3d now has ofMesh.h and ofMesh.inl – looks like a major rework of ofMesh!

I think my basic question is how do I modify my declaration of the normals vector to successfully build – in the simplest terms possible. (I’m not afraid of a discussion about templates.)


#2

instead of using vector<ofPoint> you need now to use vector<glm::vec3>


#3

Thanks Arturo… and I see release candidate 0.10.0 is available which, I expect, provides many examples and documentation for changes like the move to glm::vec3.