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


C++ BoundingBox::ext方法代码示例

本文整理汇总了C++中BoundingBox::ext方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::ext方法的具体用法?C++ BoundingBox::ext怎么用?C++ BoundingBox::ext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox::ext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateBoundingBox

void Mesh::calculateBoundingBox (BoundingBox& bbox) {
    int numVertices = getNumVertices();
    if (numVertices == 0) gdx_log_error("gdx","No vertices defined");

    float_buffer verts = vertices->getBuffer();
    bbox.inf();
    VertexAttribute& posAttrib = *getVertexAttribute(VertexAttributes::Usage::Position);
    int offset = posAttrib.offset / 4;
    int vertexSize = vertices->getAttributes().vertexSize / 4;
    int idx = offset;

    switch (posAttrib.numComponents) {
    case 1:
        for (int i = 0; i < numVertices; i++) {
            bbox.ext(verts.get(idx), 0, 0);
            idx += vertexSize;
        }
        break;
    case 2:
        for (int i = 0; i < numVertices; i++) {
            bbox.ext(verts.get(idx), verts.get(idx + 1), 0);
            idx += vertexSize;
        }
        break;
    case 3:
        for (int i = 0; i < numVertices; i++) {
            bbox.ext(verts.get(idx), verts.get(idx + 1), verts.get(idx + 2));
            idx += vertexSize;
        }
        break;
    }
}
开发者ID:aevum,项目名称:libgdx-cpp,代码行数:32,代码来源:Mesh.cpp

示例2: getBoundingBox

void StillModel::getBoundingBox ( BoundingBox& bbox )
{
    bbox.inf();
    for ( size_t i = 0; i < subMeshes.size(); i++ ) {
        subMeshes[i]->mesh->calculateBoundingBox ( tmpbox );
        bbox.ext ( tmpbox );
    }
}
开发者ID:MrGlamur,项目名称:libgdx-cpp,代码行数:8,代码来源:StillModel.cpp

示例3: calculateBoundingBox

void Mesh::calculateBoundingBox(BoundingBox& bbox) 
{
    int numVertices = getNumVertices();
    if (numVertices == 0) 
        throw GdxRuntimeException("No vertices defined");
    
    float* verts = m_vertices->getBuffer();
    bbox.inf();
    VertexAttribute posAttrib;
    getVertexAttribute(VertexAttributes::Position, posAttrib);
    int offset = posAttrib.offset / 4;
    int vertexSize = m_vertices->getAttributes().vertexSize() / 4;
    int idx = offset;
    
    switch (posAttrib.numComponents) {
        case 1:
            for (int i = 0; i < numVertices; i++) 
            {
                bbox.ext(verts[idx], 0, 0);
                idx += vertexSize;
            }
            break;
        case 2:
            for (int i = 0; i < numVertices; i++) 
            {
                bbox.ext(verts[idx], verts[idx + 1], 0);
                idx += vertexSize;
            }
            break;
        case 3:
            for (int i = 0; i < numVertices; i++) 
            {
                bbox.ext(verts[idx], verts[idx + 1], verts[idx + 2]);
                idx += vertexSize;
            }
            break;
    }
}
开发者ID:pcman75,项目名称:libgdx-cpp,代码行数:38,代码来源:Mesh.cpp


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