本文整理汇总了C++中QSGGeometryNode::renderOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ QSGGeometryNode::renderOrder方法的具体用法?C++ QSGGeometryNode::renderOrder怎么用?C++ QSGGeometryNode::renderOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSGGeometryNode
的用法示例。
在下文中一共展示了QSGGeometryNode::renderOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildLists
//.........这里部分代码省略.........
int count = list.size();
int currentRenderOrder = 0x80000000;
m_current_projection_matrix.setColumn(2, scale * projectionMatrix().column(2));
//int clipChangeCount = 0;
//int programChangeCount = 0;
//int materialChangeCount = 0;
for (int i = 0; i < count; ++i) {
QSGGeometryNode *geomNode = list.at(i);
QSGMaterialShader::RenderState::DirtyStates updates;
#if defined (QML_RUNTIME_TESTING)
static bool dumpTree = qApp->arguments().contains(QLatin1String("--dump-tree"));
if (dumpTree)
qDebug() << geomNode;
#endif
bool changeMatrix = m_currentMatrix != geomNode->matrix();
if (changeMatrix) {
m_currentMatrix = geomNode->matrix();
if (m_currentMatrix)
m_current_model_view_matrix = *m_currentMatrix;
else
m_current_model_view_matrix.setToIdentity();
updates |= QSGMaterialShader::RenderState::DirtyMatrix;
}
bool changeOpacity = m_current_opacity != geomNode->inheritedOpacity();
if (changeOpacity) {
updates |= QSGMaterialShader::RenderState::DirtyOpacity;
m_current_opacity = geomNode->inheritedOpacity();
}
Q_ASSERT(geomNode->activeMaterial());
QSGMaterial *material = geomNode->activeMaterial();
QSGMaterialShader *program = m_context->prepareMaterial(material);
Q_ASSERT(program->program()->isLinked());
bool changeClip = geomNode->clipList() != m_currentClip;
QSGRenderer::ClipType clipType = QSGRenderer::NoClip;
if (changeClip) {
clipType = updateStencilClip(geomNode->clipList());
m_currentClip = geomNode->clipList();
#ifdef FORCE_NO_REORDER
glDepthMask(false);
#else
glDepthMask((material->flags() & QSGMaterial::Blending) == 0 && m_current_opacity == 1);
#endif
//++clipChangeCount;
}
bool changeProgram = (changeClip && clipType == QSGRenderer::StencilClip) || m_currentProgram != program;
if (changeProgram) {
if (m_currentProgram)
m_currentProgram->deactivate();
m_currentProgram = program;
m_currentProgram->activate();
//++programChangeCount;
updates |= (QSGMaterialShader::RenderState::DirtyMatrix | QSGMaterialShader::RenderState::DirtyOpacity);
#ifdef RENDERER_DEBUG
materialChanges++;
#endif
}
bool changeRenderOrder = currentRenderOrder != geomNode->renderOrder();
if (changeRenderOrder) {
currentRenderOrder = geomNode->renderOrder();
m_current_projection_matrix.setColumn(3, projectionMatrix().column(3)
+ currentRenderOrder
* m_current_projection_matrix.column(2));
updates |= QSGMaterialShader::RenderState::DirtyMatrix;
}
if (changeProgram || m_currentMaterial != material) {
program->updateState(state(updates), material, changeProgram ? 0 : m_currentMaterial);
m_currentMaterial = material;
//++materialChangeCount;
}
//glDepthRange((geomNode->renderOrder() + 0.1) * scale, (geomNode->renderOrder() + 0.9) * scale);
const QSGGeometry *g = geomNode->geometry();
bindGeometry(program, g);
draw(geomNode);
#ifdef RENDERER_DEBUG
geometryNodesDrawn++;
#endif
}
//qDebug("Clip: %i, shader program: %i, material: %i times changed while drawing %s items",
// clipChangeCount, programChangeCount, materialChangeCount,
// &list == &m_transparentNodes ? "transparent" : "opaque");
}
QT_END_NAMESPACE