本文整理汇总了C++中Drawable::faceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::faceCount方法的具体用法?C++ Drawable::faceCount怎么用?C++ Drawable::faceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawable
的用法示例。
在下文中一共展示了Drawable::faceCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showModelStatistics
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QSRSnippetWidget::showModelStatistics()
{
RenderSequence* renderSeq = m_snippet->renderSequence();
CVF_ASSERT(renderSeq);
size_t totPartCount = 0;
size_t totFaceCount = 0;
int numRenderings = renderSeq->renderingCount();
int ir;
for (ir = 0; ir < numRenderings; ir++)
{
Rendering* rendering = renderSeq->rendering(ir);
CVF_ASSERT(rendering);
Scene* scene = rendering->scene();
CVF_ASSERT(scene);
int numModels = scene->modelCount();
int im;
for (im = 0; im < numModels; im++)
{
Model* model = scene->model(im);
Collection<Part> allParts;
model->allParts(&allParts);
size_t numParts = allParts.size();
size_t ip;
for (ip = 0; ip < numParts; ip++)
{
Part* part = allParts[ip].p();
Drawable* drawable = part->drawable();
totPartCount++;
totFaceCount += drawable->faceCount();
}
}
}
cvf::Trace::show("Total number of parts: %ld", totPartCount);
cvf::Trace::show("Total number of faces: %ld", totFaceCount);
}
示例2: render
//.........这里部分代码省略.........
const RenderStateTextureBindings* textureBindings = static_cast<const RenderStateTextureBindings*>(effect->renderStateOfType(RenderState::TEXTURE_BINDINGS));
if (textureBindings)
{
textureBindings->applySamplerTextureUnitUniforms(oglContext, shaderProgramInUse);
}
// Apply the effect's uniform last so that they win in case of clashes
const UniformSet* uniformSet = effect->uniformSet();
if (uniformSet)
{
shaderProgramInUse->applyUniforms(oglContext, *uniformSet);
}
// Still, the fixed ones have to go at the end for consistency
shaderProgramInUse->applyFixedUniforms(oglContext, matrixState);
lastAppliedMatrixStateVersionTick = matrixState.versionTick();
}
}
prevEffect = effect;
}
if (shaderProgramInUse)
{
if (lastAppliedMatrixStateVersionTick != matrixState.versionTick())
{
shaderProgramInUse->applyFixedUniforms(oglContext, matrixState);
lastAppliedMatrixStateVersionTick = matrixState.versionTick();
}
// Will check that all active uniforms in shader program have been set since last call to >clearUniformApplyTracking()
// Reports error to log if any uniforms are missing.
shaderProgramInUse->checkReportAllUniformsApplied(oglContext);
}
else
{
#ifndef CVF_OPENGL_ES
if (lastAppliedMatrixStateVersionTickFixedFunction != matrixState.versionTick())
{
glLoadMatrixf(matrixState.modelViewMatrix().ptr());
lastAppliedMatrixStateVersionTickFixedFunction = matrixState.versionTick();
}
#endif // CVF_OPENGL_ES
}
// Do actual rendering
if (!m_disableDrawableRender)
{
if (renderUsingImmediateMode)
{
drawable->renderImmediateMode(oglContext, matrixState);
}
else
{
if (shaderProgramInUse)
{
drawable->render(oglContext, shaderProgramInUse, matrixState);
}
else
{
drawable->renderFixedFunction(oglContext, matrixState);
}
}
m_renderedPartCount++;
}
// Must reset the view matrix if it was modified during drawing of this part
if (lastPartModifiedViewMatrix)
{
matrixState.setViewMatrix(camera.viewMatrix());
}
// Update counters
if (m_enableItemCountUpdate)
{
m_renderedVertexCount += drawable->vertexCount();
m_renderedTriangleCount += drawable->triangleCount();
m_renderedOpenGLPrimitiveCount += drawable->faceCount();
}
}
// Do an apply with an empty new render state set to get defaults back before leaving
// This really isn't the optimal place to do this, but until we expose application of render states it's the only place
m_renderStateTracker.applyRenderStates(oglContext, NULL, prevRenderStateSet);
// For now, set back to fixed function
if (contextSupportsShaders)
{
ShaderProgram::useNoProgram(oglContext);
}
// Set back VBO settings (do we need this?)
if (BufferObjectManaged::supportedOpenGL(oglContext))
{
BufferObjectManaged::unbindAllBuffers(oglContext);
}
}