Exemple #1
0
static bool IsClockwise(const DirectX::XMFLOAT3 *vertex, int num_verts, const FbxVector4 &polygon_normal)
{
  // Compute a normal using two edges of the triangle
  FbxVector4 edge_1(vertex[1].x - vertex[0].x, vertex[1].y - vertex[0].y, vertex[1].z - vertex[0].z);
  FbxVector4 edge_2(vertex[2].x - vertex[0].x, vertex[2].y - vertex[0].y, vertex[2].z - vertex[0].z);
  FbxVector4 normal = edge_1.CrossProduct(edge_2);
  // Dot product between computed normal and supplied normal will reveal winding
  double dot = polygon_normal.DotProduct(normal);
  return dot < 0;
}