本文整理汇总了C++中QSGGeometryNode::activeMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ QSGGeometryNode::activeMaterial方法的具体用法?C++ QSGGeometryNode::activeMaterial怎么用?C++ QSGGeometryNode::activeMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSGGeometryNode
的用法示例。
在下文中一共展示了QSGGeometryNode::activeMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildLists
void QSGDefaultRenderer::buildLists(QSGNode *node)
{
if (node->isSubtreeBlocked())
return;
if (node->type() == QSGNode::GeometryNodeType) {
QSGGeometryNode *geomNode = static_cast<QSGGeometryNode *>(node);
qreal opacity = geomNode->inheritedOpacity();
QSGMaterial *m = geomNode->activeMaterial();
#ifdef FORCE_NO_REORDER
if (true) {
#else
if ((m->flags() & QSGMaterial::Blending) || opacity < 1) {
#endif
geomNode->setRenderOrder(m_currentRenderOrder - 1);
m_transparentNodes.add(geomNode);
} else {
geomNode->setRenderOrder(m_currentRenderOrder);
m_opaqueNodes.add(geomNode);
m_currentRenderOrder += 2;
}
}
if (!node->firstChild())
return;
#ifdef FORCE_NO_REORDER
static bool reorder = false;
#else
static bool reorder = !qApp->arguments().contains(QLatin1String("--no-reorder"));
#endif
if (reorder && node->firstChild() != node->lastChild() && (node->flags() & QSGNode::ChildrenDoNotOverlap)) {
QVarLengthArray<int, 16> beginIndices;
QVarLengthArray<int, 16> endIndices;
int baseCount = m_transparentNodes.size();
int count = 0;
for (QSGNode *c = node->firstChild(); c; c = c->nextSibling()) {
beginIndices.append(m_transparentNodes.size());
buildLists(c);
endIndices.append(m_transparentNodes.size());
++count;
}
int childNodeCount = m_transparentNodes.size() - baseCount;
if (childNodeCount) {
m_tempNodes.reset();
m_tempNodes.reserve(childNodeCount);
while (childNodeCount) {
for (int i = 0; i < count; ++i) {
if (beginIndices[i] != endIndices[i])
m_heap.insert(IndexGeometryNodePair(i, m_transparentNodes.at(beginIndices[i]++)));
}
while (!m_heap.isEmpty()) {
IndexGeometryNodePair pair = m_heap.pop();
m_tempNodes.add(pair.second);
--childNodeCount;
int i = pair.first;
if (beginIndices[i] != endIndices[i] && !nodeLessThan(m_transparentNodes.at(beginIndices[i]), pair.second))
m_heap.insert(IndexGeometryNodePair(i, m_transparentNodes.at(beginIndices[i]++)));
}
}
Q_ASSERT(m_tempNodes.size() == m_transparentNodes.size() - baseCount);
qMemCopy(&m_transparentNodes.at(baseCount), &m_tempNodes.at(0), m_tempNodes.size() * sizeof(QSGGeometryNode *));
}
} else {
for (QSGNode *c = node->firstChild(); c; c = c->nextSibling())
buildLists(c);
}
}
void QSGDefaultRenderer::renderNodes(const QDataBuffer<QSGGeometryNode *> &list)
{
const float scale = 1.0f / m_currentRenderOrder;
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)
//.........这里部分代码省略.........