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


C++ DynamicObject::setNumFaces方法代码示例

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


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

示例1: assert


//.........这里部分代码省略.........
          dyno->setState(m_state);
          dyno->setSelectState(m_select_state);
          dyno->setUseStencil(m_use_stencil);

        }

        // get the transformed vertices of the submesh
        int vertexCount = pCalRenderer->getVertexCount();
        bool realloc = false;
        float *vertex_ptr, *normal_ptr, *texture_ptr;
        int textureCoordinateCount = 0;

        if (vertexCount > dyno->getNumPoints()) {
          realloc = true;
          vertex_ptr = dyno->createVertexData(vertexCount * 3);  
          pCalRenderer->getVertices(vertex_ptr);
          dyno->releaseVertexDataPtr();

          normal_ptr = dyno->createNormalData(vertexCount * 3);  
          pCalRenderer->getNormals(normal_ptr);
          dyno->releaseNormalDataPtr();
        } else {
          vertex_ptr = dyno->getVertexDataPtr();
          pCalRenderer->getVertices(vertex_ptr);
          dyno->releaseVertexDataPtr();

          normal_ptr = dyno->getNormalDataPtr();
          pCalRenderer->getNormals(normal_ptr);
          dyno->releaseNormalDataPtr();
        }

        int faceCount = pCalRenderer->getFaceCount();

        if (faceCount > 0) {
          int *face_ptr;
          if (faceCount > dyno->getNumFaces()) {
            face_ptr = dyno->createIndices(faceCount * 3);
          } else {
            face_ptr = dyno->getIndicesPtr();
          }
          pCalRenderer->getFaces(face_ptr);
          dyno->releaseIndicesPtr();

          dyno->setNumFaces(faceCount);
        }

        dyno->setNumPoints(vertexCount);

        // There are several situations that can happen here. 
        // Model with/without texture coordinates
        // Model with/without texture maps
        // Model with/without texture mas name defined
        // Each model can be a mixture of the above. We want objects with
        // textures and texture coords.
        bool mapDataFound = false;


        std::vector<std::vector<CalCoreSubmesh::TextureCoordinate> > & vectorvectorTextureCoordinate =
            m_calModel->getVectorMesh()[meshId]->getSubmesh(submeshId)->getCoreSubmesh()->getVectorVectorTextureCoordinate();

        // check if the map id is valid
        if ( vectorvectorTextureCoordinate.size() > 0) {
          textureCoordinateCount = vectorvectorTextureCoordinate[0].size();
        }


        if((pCalRenderer->getMapCount() > 0) && (textureCoordinateCount > 0)) {
          for (int i = 0; i < pCalRenderer->getMapCount(); ++i) {
            MapData *md = reinterpret_cast<MapData*>
                                          (pCalRenderer->getMapUserData(i));
            if (md) {
              dyno->setTexture(i, md->textureID, md->textureMaskID);
              mapDataFound = true;
            } else {
              // Can't have a missing texture map between units.
              break; 
            }
          }
        }

        if (mapDataFound){
          if (realloc) {
            texture_ptr = dyno->createTextureData(vertexCount * 2);
            textureCoordinateCount = pCalRenderer->getTextureCoordinates(0, texture_ptr);
            dyno->releaseTextureDataPtr();
          } else {
            texture_ptr = dyno->getTextureDataPtr();
            textureCoordinateCount = pCalRenderer->getTextureCoordinates(0, texture_ptr);
            dyno->releaseTextureDataPtr();
          }
          if (textureCoordinateCount == -1) {
            // Need to ignore the texture buffer
          }
//          assert(textureCoordinateCount == vertexCount);
        }
      }
    }
  }
  pCalRenderer->endRendering();
}
开发者ID:bsmr-worldforge,项目名称:sear,代码行数:101,代码来源:Cal3dModel.cpp


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