当前位置: 首页>>代码示例>>C++>>正文


C++ AxisAlignedBoundingBox::extend方法代码示例

本文整理汇总了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;
}
开发者ID:donSchoe,项目名称:cgsee,代码行数:26,代码来源:polygonaldrawable.cpp

示例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;
}
开发者ID:donSchoe,项目名称:cgsee,代码行数:20,代码来源:triangleobject.cpp

示例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;
}
开发者ID:Nuos,项目名称:demo_lod,代码行数:20,代码来源:AssimpScene.cpp


注:本文中的AxisAlignedBoundingBox::extend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。