@@ -242,7 +242,7 @@ AABB Polyhedron::MinimalEnclosingAABB() const
242
242
#ifdef MATH_CONTAINERLIB_SUPPORT
243
243
OBB Polyhedron::MinimalEnclosingOBB () const
244
244
{
245
- return OBB::OptimalEnclosingOBB (&v[0 ], (int )v.size ());
245
+ return OBB::OptimalEnclosingOBB ((vec*) &v[0 ], (int )v.size ());
246
246
}
247
247
#endif
248
248
@@ -1468,24 +1468,24 @@ void Polyhedron::Triangulate(VertexBuffer &vb, bool ccwIsFrontFacing) const
1468
1468
int idx = vb.AppendVertices (3 *(int )tris.size ());
1469
1469
for (size_t j = 0 ; j < tris.size (); ++j)
1470
1470
{
1471
- vb.Set (idx, VDPosition, float4 ( tris[j]. a , 1 . f ));
1471
+ vb.Set (idx, VDPosition, POINT_TO_FLOAT4 ( TRIANGLE ( tris[j]). a ));
1472
1472
if (ccwIsFrontFacing)
1473
1473
{
1474
- vb.Set (idx+1 , VDPosition, float4 ( tris[j]. c , 1 . f ));
1475
- vb.Set (idx+2 , VDPosition, float4 ( tris[j]. b , 1 . f ));
1474
+ vb.Set (idx+1 , VDPosition, POINT_TO_FLOAT4 ( TRIANGLE ( tris[j]). c ));
1475
+ vb.Set (idx+2 , VDPosition, POINT_TO_FLOAT4 ( TRIANGLE ( tris[j]). b ));
1476
1476
}
1477
1477
else
1478
1478
{
1479
- vb.Set (idx+1 , VDPosition, float4 ( tris[j]. b , 1 . f ));
1480
- vb.Set (idx+2 , VDPosition, float4 ( tris[j]. c , 1 . f ));
1479
+ vb.Set (idx+1 , VDPosition, POINT_TO_FLOAT4 ( TRIANGLE ( tris[j]). b ));
1480
+ vb.Set (idx+2 , VDPosition, POINT_TO_FLOAT4 ( TRIANGLE ( tris[j]). c ));
1481
1481
}
1482
1482
// Generate flat normals if VB has space for normals.
1483
1483
if (vb.Declaration ()->TypeOffset (VDNormal) >= 0 )
1484
1484
{
1485
- vec normal = ccwIsFrontFacing ? tris[j].NormalCCW () : tris[j].NormalCW ();
1486
- vb.Set (idx, VDNormal, float4 (normal , 0 . f ));
1487
- vb.Set (idx+1 , VDNormal, float4 (normal , 0 . f ));
1488
- vb.Set (idx+2 , VDNormal, float4 (normal , 0 . f ));
1485
+ vec normal = ccwIsFrontFacing ? TRIANGLE ( tris[j]) .NormalCCW () : TRIANGLE ( tris[j]) .NormalCW ();
1486
+ vb.Set (idx, VDNormal, DIR_TO_FLOAT4 (normal ));
1487
+ vb.Set (idx+1 , VDNormal, DIR_TO_FLOAT4 (normal ));
1488
+ vb.Set (idx+2 , VDNormal, DIR_TO_FLOAT4 (normal ));
1489
1489
}
1490
1490
idx += 3 ;
1491
1491
}
@@ -1494,13 +1494,13 @@ void Polyhedron::Triangulate(VertexBuffer &vb, bool ccwIsFrontFacing) const
1494
1494
1495
1495
void Polyhedron::ToLineList (VertexBuffer &vb) const
1496
1496
{
1497
- std::vector<LineSegment> edges = Edges ();
1497
+ LineSegmentArray edges = Edges ();
1498
1498
1499
1499
int startIndex = vb.AppendVertices ((int )edges.size ()*2 );
1500
1500
for (int i = 0 ; i < (int )edges.size (); ++i)
1501
1501
{
1502
- vb.Set (startIndex+2 *i, VDPosition, float4 (edges[i].a , 1 . f ));
1503
- vb.Set (startIndex+2 *i+1 , VDPosition, float4 (edges[i].b , 1 . f ));
1502
+ vb.Set (startIndex+2 *i, VDPosition, POINT_TO_FLOAT4 (edges[i].a ));
1503
+ vb.Set (startIndex+2 *i+1 , VDPosition, POINT_TO_FLOAT4 (edges[i].b ));
1504
1504
}
1505
1505
}
1506
1506
#endif
0 commit comments