Ok, i'm trying to create vertex normals for each vertex.
I'm fairly sure i've got the math right, I'm just having trouble finding out to which faces a point belongs...
The points are store in:vector <texTri> texvert
texTri contains, x, y, z, nx, ny, nz, u, v;
I identify vertices by their location in the array. I.e texvert[1] is point 1.
the faces are store in:vector <texface> facelist
texface contains, p1, p2, p3;
I've got my face normals store in a seperate array:vector <D3DXVECTOR3> normal
and i know how many faces and verts there are, i've got two ints (numFaces, numVerts).
I can't for the life of me figure this out.
How do I easily go through each vert, and find out which facenumber it belongs to, and then use all of those face's normals to get the vertex normal...
It's the searching i'm stuck with. The vert normal maths i've got.
Any ideas?