本文整理汇总了C++中Polyhedron::FlipWindingOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::FlipWindingOrder方法的具体用法?C++ Polyhedron::FlipWindingOrder怎么用?C++ Polyhedron::FlipWindingOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::FlipWindingOrder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tetrahedron
/// See http://paulbourke.net/geometry/platonic/
Polyhedron Polyhedron::Tetrahedron(const float3 ¢erPos, float scale, bool ccwIsFrontFacing)
{
const float3 vertices[4] = { float3(1,1,1),
float3(-1,1,-1),
float3(1,-1,-1),
float3(-1,-1,1) };
const int faces[4][3] = { { 0, 1, 2 },
{ 1, 3, 2 },
{ 0, 2, 3 },
{ 0, 3, 1 } };
scale /= 2.f;
Polyhedron p;
for(int i = 0; i < 4; ++i)
p.v.push_back(vertices[i]*scale + centerPos);
for(int i = 0; i < 4; ++i)
{
Face f;
for(int j = 0; j < 3; ++j)
f.v.push_back(faces[i][j]);
p.f.push_back(f);
}
if (!ccwIsFrontFacing)
p.FlipWindingOrder();
return p;
}
示例2: Dodecahedron
/// See http://paulbourke.net/geometry/platonic/
Polyhedron Polyhedron::Dodecahedron(const float3 ¢erPos, float scale, bool ccwIsFrontFacing)
{
float phi = (1.f + Sqrt(5.f)) / 2.f;
float b = 1.f / phi;
float c = 2.f - phi;
const float3 vertices[20] = { float3( c, 0, 1),
float3(-c, 0, 1),
float3(-b, b, b),
float3( 0, 1, c),
float3( b, b, b),
float3( b, -b, b),
float3( 0, -1, c),
float3(-b, -b, b),
float3( 0, -1, -c),
float3( b, -b, -b),
float3(-c, 0, -1),
float3( c, 0, -1),
float3(-b, -b, -b),
float3( b, b, -b),
float3( 0, 1, -c),
float3(-b, b, -b),
float3( 1, c, 0),
float3(-1, c, 0),
float3(-1, -c, 0),
float3( 1, -c, 0) };
const int faces[12][5] = { { 0, 1, 2, 3, 4 },
{ 1, 0, 5, 6, 7 },
{ 11, 10, 12, 8, 9 },
{ 10, 11, 13, 14, 15 },
{ 13, 16, 4, 3, 14 }, // Note: The winding order of this face was flipped from PBourke's original representation.
{ 2, 17, 15, 14, 3 }, // Winding order flipped.
{ 12, 18, 7, 6, 8 }, // Winding order flipped.
{ 5, 19, 9, 8, 6 }, // Winding order flipped.
{ 16, 19, 5, 0, 4 },
{ 19, 16, 13, 11, 9 },
{ 17, 18, 12, 10, 15 },
{ 18, 17, 2, 1, 7 } };
scale /= 2.f;
Polyhedron p;
for(int i = 0; i < 20; ++i)
p.v.push_back(vertices[i]*scale + centerPos);
for(int i = 0; i < 12; ++i)
{
Face f;
for(int j = 0; j < 5; ++j)
f.v.push_back(faces[i][j]);
p.f.push_back(f);
}
if (!ccwIsFrontFacing)
p.FlipWindingOrder();
return p;
}
示例3: Icosahedron
/// See http://paulbourke.net/geometry/platonic/
Polyhedron Polyhedron::Icosahedron(const float3 ¢erPos, float scale, bool ccwIsFrontFacing)
{
float a = 0.5f;
float phi = (1.f + Sqrt(5.f)) / 2.f;
float b = 1.f / (2.f * phi);
const float3 vertices[12] = { float3( 0, b, -a),
float3( b, a, 0),
float3(-b, a, 0),
float3( 0, b, a),
float3( 0, -b, a),
float3(-a, 0, b),
float3( a, 0, b),
float3( 0, -b, -a),
float3(-a, 0, -b),
float3(-b, -a, 0),
float3( b, -a, 0),
float3( a, 0, -b) };
const int faces[20][3] = { { 0, 1, 2 },
{ 3, 2, 1 },
{ 3, 4, 5 },
{ 3, 6, 4 },
{ 0, 7, 11 },
{ 0, 8, 7 },
{ 4, 10, 9 },
{ 7, 9, 10 },
{ 2, 5, 8 },
{ 9, 8, 5 },
{ 1, 11, 6 },
{ 10, 6, 11 },
{ 3, 5, 2 },
{ 3, 1, 6 },
{ 0, 2, 8 },
{ 0, 11, 1 },
{ 7, 8, 9 },
{ 7, 10, 11 },
{ 4, 9, 5 },
{ 4, 6, 10 } };
Polyhedron p;
for(int i = 0; i < 12; ++i)
p.v.push_back(vertices[i]*scale + centerPos);
for(int i = 0; i < 20; ++i)
{
Face f;
for(int j = 0; j < 3; ++j)
f.v.push_back(faces[i][j]);
p.f.push_back(f);
}
if (!ccwIsFrontFacing)
p.FlipWindingOrder();
return p;
}
示例4: Hexahedron
/// See http://paulbourke.net/geometry/platonic/
Polyhedron Polyhedron::Hexahedron(const float3 ¢erPos, float scale, bool ccwIsFrontFacing)
{
AABB aabb(float3(-1,-1,-1), float3(1,1,1));
aabb.Scale(float3::zero, scale * 0.5f);
aabb.Translate(centerPos);
Polyhedron p = aabb.ToPolyhedron();
if (ccwIsFrontFacing)
p.FlipWindingOrder();
return p;
}
示例5: Octahedron
/// See http://paulbourke.net/geometry/platonic/
Polyhedron Polyhedron::Octahedron(const float3 ¢erPos, float scale, bool ccwIsFrontFacing)
{
float a = 1.f / (2.f * Sqrt(2.f));
float b = 0.5f;
const float3 vertices[6] = { float3(-a, 0, a),
float3(-a, 0,-a),
float3( 0, b, 0),
float3( a, 0,-a),
float3( 0,-b, 0),
float3( a, 0, a) };
const int faces[8][3] = { { 0, 1, 2 },
{ 1, 3, 2 },
{ 3, 5, 2 },
{ 5, 0, 2 },
{ 3, 1, 4 },
{ 1, 0, 4 },
{ 5, 3, 4 },
{ 0, 5, 4 } };
scale /= 2.f;
Polyhedron p;
for(int i = 0; i < 6; ++i)
p.v.push_back(vertices[i]*scale + centerPos);
for(int i = 0; i < 8; ++i)
{
Face f;
for(int j = 0; j < 3; ++j)
f.v.push_back(faces[i][j]);
p.f.push_back(f);
}
if (!ccwIsFrontFacing)
p.FlipWindingOrder();
return p;
}