本文整理汇总了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();
}