本文整理汇总了C++中AxisAlignedBoundingBox::extend方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBoundingBox::extend方法的具体用法?C++ AxisAlignedBoundingBox::extend怎么用?C++ AxisAlignedBoundingBox::extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AxisAlignedBoundingBox
的用法示例。
在下文中一共展示了AxisAlignedBoundingBox::extend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundingBox
const AxisAlignedBoundingBox PolygonalDrawable::boundingBox(glm::mat4 transform) const
{
AxisAlignedBoundingBox aabb = AxisAlignedBoundingBox();
glm::mat4 newTransform;
if( m_geometry == nullptr ) {
return aabb;
}
if (m_rf == RF_Absolute) {
newTransform = transform;
} else {
newTransform = this->transform() * transform;
}
t_VertexListP myVList = m_geometry->vertices();
myVList->foreachVertexAttribute<glm::vec3>(0, myVList->size(), "position", nullptr,
[&aabb, &newTransform](int i, const glm::vec3 & pos)
{
aabb.extend( glm::vec3(newTransform * glm::vec4(pos, 1.0f)) );
}
);
return aabb;
}
示例2: boundingBox
const AxisAlignedBoundingBox TriangleObject::boundingBox(glm::mat4 transform) const
{
AxisAlignedBoundingBox aabb = AxisAlignedBoundingBox();
glm::mat4 newTransform;
if ( m_triangles->size() == 0 )
return aabb;
if (m_rf == RF_Absolute) {
newTransform = transform;
} else {
newTransform = this->transform() * transform;
}
for ( auto vertex : *m_triangles ) {
glm::vec4 transformedVertex = newTransform * glm::vec4(vertex, 1.0f);
aabb.extend( transformedVertex.xyz * (1.0f / transformedVertex.w) );
}
return aabb;
}
示例3: retrieveAxisAlignedBoundingBox
AxisAlignedBoundingBox AssimpScene::retrieveAxisAlignedBoundingBox(const aiScene * scene)
{
AxisAlignedBoundingBox aabb;
for (unsigned int m = 0; m < scene->mNumMeshes; ++m)
{
aiMesh * mesh = scene->mMeshes[m];
for (unsigned int v = 0; v < mesh->mNumVertices; ++v)
{
const QVector3D vec3(
mesh->mVertices[v].x
, mesh->mVertices[v].y
, mesh->mVertices[v].z);
aabb.extend(vec3);
}
}
return aabb;
}