本文整理汇总了C++中BBox::BoundingSphere方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::BoundingSphere方法的具体用法?C++ BBox::BoundingSphere怎么用?C++ BBox::BoundingSphere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::BoundingSphere方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: b
// Bounding Sphere Tests
TEST_F(BBoxTest, BoundingSphereWorks) {
BBox b (Point (0, 0, 0), Point (1, 1, 1));
Point center;
float radius;
b.BoundingSphere (¢er, &radius);
EXPECT_EQ (.5, center.x);
EXPECT_EQ (.5, center.y);
EXPECT_EQ (.5, center.z);
EXPECT_EQ (sqrtf(.75), radius);
}
示例2: ProcessVertices
//.........这里部分代码省略.........
// line indices
m_HairAsset.m_LineIndices.push_back(id);
m_HairAsset.m_LineIndices.push_back(id + 1);
// triangle indices
m_HairAsset.m_TriangleIndices.push_back(2 * id);
m_HairAsset.m_TriangleIndices.push_back(2 * id + 1);
m_HairAsset.m_TriangleIndices.push_back(2 * id + 2);
m_HairAsset.m_TriangleIndices.push_back(2 * id + 2);
m_HairAsset.m_TriangleIndices.push_back(2 * id + 1);
m_HairAsset.m_TriangleIndices.push_back(2 * id + 3);
id++;
}
id++;
TressFXHairVertex* vertices = &m_Vertices[indexRootVert];
for ( int j = 0; j < m_HairAsset.m_NumOfVerticesInStrand; j++ )
{
// triangle vertices
StrandVertex strandVertex;
strandVertex.position = XMFLOAT3(vertices[j].position.x, vertices[j].position.y, vertices[j].position.z);
strandVertex.tangent = XMFLOAT3(vertices[j].tangent.x, vertices[j].tangent.y, vertices[j].tangent.z);
strandVertex.texcoord = XMFLOAT4(vertices[j].texcoord.x, vertices[j].texcoord.y, vertices[j].texcoord.z, 0);
m_HairAsset.m_pTriangleVertices[index] = strandVertex;
float tVal = m_HairAsset.m_pTriangleVertices[index].texcoord.z;
m_HairAsset.m_pThicknessCoeffs[index] = sqrt(1.f - tVal * tVal);
XMFLOAT4 v;
// temp vertices
v.x = vertices[j].position.x;
v.y = vertices[j].position.y;
v.z = vertices[j].position.z;
v.w = vertices[j].invMass;
m_HairAsset.m_pVertices[index] = v;
// global rotations
v.x = vertices[j].globalTransform.GetRotation().x;
v.y = vertices[j].globalTransform.GetRotation().y;
v.z = vertices[j].globalTransform.GetRotation().z;
v.w = vertices[j].globalTransform.GetRotation().w;
m_HairAsset.m_pGlobalRotations[index] = v;
// local rotations
v.x = vertices[j].localTransform.GetRotation().x;
v.y = vertices[j].localTransform.GetRotation().y;
v.z = vertices[j].localTransform.GetRotation().z;
v.w = vertices[j].localTransform.GetRotation().w;
m_HairAsset.m_pLocalRotations[index] = v;
// ref vectors
v.x = vertices[j].referenceVector.x;
v.y = vertices[j].referenceVector.y;
v.z = vertices[j].referenceVector.z;
m_HairAsset.m_pRefVectors[index].x = v.x;
m_HairAsset.m_pRefVectors[index].y = v.y;
m_HairAsset.m_pRefVectors[index].z = v.z;
index++;
}
int groupId = m_HairStrands[i].m_GroupID;
m_HairAsset.m_pHairStrandType[i] = groupId;
if ( m_usingPerStrandTexCoords )
{
m_HairAsset.m_pStrandTexCoords[i] = m_HairStrands[i].m_texCoord;
}
if ( m_HairStrands[i].m_bGuideHair )
{
indexGuideHairStrand = i;
pGuideHair = &m_HairStrands[i];
m_HairAsset.m_pFollowRootOffset[i] = XMFLOAT4(0, 0, 0, (float)indexGuideHairStrand); // forth component is an index to the guide hair strand. For guide hair, it points itself.
}
else
{
assert(pGuideHair);
tressfx_vec3& offset = m_SlaveOffset[i];
m_HairAsset.m_pFollowRootOffset[i] = XMFLOAT4(offset.x, offset.y, offset.z, (float)indexGuideHairStrand);
}
}
// Find the bounding sphere
BBox bBox;
for ( int i = 0; i < (int)m_Vertices.size(); ++i )
{
const TressFXHairVertex& vertex = m_Vertices[i];
bBox = Union(bBox, Float3(vertex.position.x, vertex.position.y, vertex.position.z));
}
Float3 c; float radius;
bBox.BoundingSphere(&c, &radius);
m_HairAsset.m_bSphere.center = XMFLOAT3(c.x, c.y, c.z);
m_HairAsset.m_bSphere.radius = radius;
}