void Renderer::buildRenderList(QSGNode *node, QSGClipNode *clip) { if (node->isSubtreeBlocked()) return; if (node->type() == QSGNode::GeometryNodeType || node->type() == QSGNode::ClipNodeType) { QSGBasicGeometryNode *gn = static_cast<QSGBasicGeometryNode *>(node); QSGGeometry *g = gn->geometry(); Element e; e.node = gn; if (g->vertexCount() > 0) { e.vboOffset = m_vboSize; int vertexSize = g->sizeOfVertex() * g->vertexCount(); m_vboSize += vertexSize; m_vboData.resize(m_vboSize); memcpy(m_vboData.data() + e.vboOffset, g->vertexData(), vertexSize); } else { e.vboOffset = -1; } if (g->indexCount() > 0) { e.iboOffset = m_iboSize; int indexSize = g->sizeOfIndex() * g->indexCount(); m_iboSize += indexSize; m_iboData.resize(m_iboSize); memcpy(m_iboData.data() + e.iboOffset, g->indexData(), indexSize); } else { e.iboOffset = -1; } m_renderList.add(e); static_cast<BasicGeometryNode_Accessor *>(node)->m_clip_list = clip; if (node->type() == QSGNode::ClipNodeType) clip = static_cast<QSGClipNode *>(node); } QSGNODE_TRAVERSE(node) buildRenderList(child, clip); }
void RenderList::render() { buildRenderList(); for (RenderNode* renderNode : mRenderList) { renderNode->render(); } }