Weighted vertex normals from Rhino STL file

Doing some opengl stuff using Rhino 5 generated STL files and I need to calculate the weighted (by triangle area) vertex normals for lightning purposes. Is there perhaps documentation available about how triangles/vertices are generated for STL files by Rhino?

For now I’m using the triangle normal for each of its vertice normal which causes flat shading for each triangles of course. In specific, my problem is that I don’t know what kind of an approach to take to avoid looping all the mesh vertices several times through. Knowing how the vertices are initially generated would probably help to get the nearby triangles/vertices with less work.


PS. I think I read from somewhere that the Rhino file format is openly available. That would be another route to take later if the vertice normals are present in the Rhino file. However, I need to get this done with STL first.

EDIT: a couple of clarifications



Right, thanks.