Fix tiangle merge direction.

master
Jeremy Hu 2017-01-03 22:01:42 +09:30
parent a8b4d162b7
commit fcb4868d28
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ typedef struct {
int hill2; int hill2;
vec3 hill1Normal; vec3 hill1Normal;
int angleBetweenFaces; int angleBetweenFaces;
int angleWithLevel; int angleWithY;
int face1; int face1;
int face2; int face2;
} edge; } edge;
@ -490,7 +490,7 @@ static int sortEdgeByScore(const void *first, const void *second) {
edge *e2 = (edge *)second; edge *e2 = (edge *)second;
int result = e1->angleBetweenFaces - e2->angleBetweenFaces; int result = e1->angleBetweenFaces - e2->angleBetweenFaces;
if (0 == result) { if (0 == result) {
result = e2->angleWithLevel - e1->angleWithLevel; result = e1->angleWithY - e2->angleWithY;
} }
return result; return result;
} }
@ -542,7 +542,7 @@ int convexHullMergeTriangles(convexHull *hull) {
vec3Normal(v1, vHill1, v2, &f1normal); vec3Normal(v1, vHill1, v2, &f1normal);
vec3Normal(v2, vHill2, v1, &f2normal); vec3Normal(v2, vHill2, v1, &f2normal);
e->angleBetweenFaces = (int)vec3Angle(&f1normal, &f2normal); e->angleBetweenFaces = (int)vec3Angle(&f1normal, &f2normal);
e->angleWithLevel = (int)vec3Angle(&v12, (vec3 *)&yAxis); e->angleWithY = (int)vec3Angle(&v12, (vec3 *)&yAxis);
} }
} }