joseph.howell Posted January 21, 2016 Share Posted January 21, 2016 Sorry, noob here. Why does neither ObjectMeshDynamic or ObjectMeshStatic have an addNormal method? How do I add vertex normals? I am procedurally generating a mesh here, so I'm not loading one from a file and I need normals. I noticed the Mesh class has an addNormal method but I haven't seen any examples yet of how to use that class. Link to comment
joseph.howell Posted January 21, 2016 Author Share Posted January 21, 2016 Oh, I see, there's an addTangent method. So if I understand this correctly, the normal, tangent and binormal are all rolled into one quaternion. Very nice. I'll play around with that and see if I can get it working. Link to comment
joseph.howell Posted January 22, 2016 Author Share Posted January 22, 2016 Ok I have this working now. Given an array of floats where the normal vectors are stored like x,y,z,x,y,z,x,y,z,etc, this is how I put the normals into the mesh: //inside of a loop interated by j where j is the vertex index. vec3 normal(normals[j*3], normals[j*3+1], normals[j*3+2]); vec3 tangent; vec3 binormal; orthoBasis(normal, tangent, binormal); mesh->addTangent(orthoTangent(tangent, binormal, normal)); Link to comment
Recommended Posts