Posted 07 June 2005  10:17 AM
Posted 07 June 2005  01:06 PM
v0v1




v2
v0v1v2
\ \ 
 \T1  \T3 
T0\ T2\ 
 \  \ 
v3v4v5
\ \ 
 \T5  \T7 
T4\ T6\ 
 \  \ 
v6v7v8
Posted 07 June 2005  01:20 PM
Quote:
Original post by Drazgal
Im fairly drunk/tired right now
Posted 07 June 2005  08:36 PM
a = v1v0
b = v2v0
r = a cross product b
r.Normalize();
for (int v=0; v<num_vertices; v++)
{
int num_adjents=0;
int *storage = new int [num_faces];
for (int f=0; f<num_faces; f++)
{
if (faces[f].a == v)
storage[num_adjents++] = f;
else if (faces[f].b == v)
storage[num_adjents++] = f;
else if (faces[f].c == v)
storage[num_adjents++] = f;
}
for (int a=0; a<num_adjents; a++)
{
vertices[v].n.x += faces[storage[a]].nx;
vertices[v].n.y += faces[storage[a]].ny;
vertices[v].n.z += faces[storage[a]].nz;
}
vertices[v].n.x /= num_adjents;
vertices[v].n.y /= num_adjents;
vertices[v].n.z /= num_adjents;
vertices[v].n.Normalize();
delete [] storage;
}
Posted 08 June 2005  02:11 AM
Quote:
Original post by _DarkWIng_
But try using search next time.. this is anwserd even on the same page you posted...