本文整理汇总了C++中QSGGeometry::indexType方法的典型用法代码示例。如果您正苦于以下问题:C++ QSGGeometry::indexType方法的具体用法?C++ QSGGeometry::indexType怎么用?C++ QSGGeometry::indexType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSGGeometry
的用法示例。
在下文中一共展示了QSGGeometry::indexType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setObject
bool SGGeometryExtension::setObject(void* object, const QString& typeName)
{
if (typeName == "QSGGeometryNode") {
m_node = static_cast<QSGGeometryNode*>(object);
m_model->setNode(m_node);
QSGGeometry *geometry = m_node->geometry();
emit geometryChanged(geometry->drawingMode(),
QByteArray::fromRawData(reinterpret_cast<char*>(geometry->indexData()), geometry->indexCount()*geometry->sizeOfIndex()),
geometry->indexType());
return true;
}
return false;
}
示例2: updateFillNode
void QQuickShapeGenericRenderer::updateFillNode(ShapePathData *d, QQuickShapeGenericNode *node)
{
if (!node->m_fillNode)
return;
if (!(d->effectiveDirty & (DirtyFillGeom | DirtyColor | DirtyFillGradient)))
return;
// Make a copy of the data that will be accessed by the material on
// the render thread. This must be done even when we bail out below.
QQuickShapeGenericStrokeFillNode *n = node->m_fillNode;
updateShadowDataInNode(d, n);
QSGGeometry *g = n->geometry();
if (d->fillVertices.isEmpty()) {
if (g->vertexCount() || g->indexCount()) {
g->allocate(0, 0);
n->markDirty(QSGNode::DirtyGeometry);
}
return;
}
if (d->fillGradientActive) {
QQuickShapeGenericStrokeFillNode::Material gradMat;
switch (d->fillGradientActive) {
case LinearGradient:
gradMat = QQuickShapeGenericStrokeFillNode::MatLinearGradient;
break;
case RadialGradient:
gradMat = QQuickShapeGenericStrokeFillNode::MatRadialGradient;
break;
case ConicalGradient:
gradMat = QQuickShapeGenericStrokeFillNode::MatConicalGradient;
break;
default:
Q_UNREACHABLE();
}
n->activateMaterial(m_item->window(), gradMat);
if (d->effectiveDirty & DirtyFillGradient) {
// Gradients are implemented via a texture-based material.
n->markDirty(QSGNode::DirtyMaterial);
// stop here if only the gradient changed; no need to touch the geometry
if (!(d->effectiveDirty & DirtyFillGeom))
return;
}
} else {
n->activateMaterial(m_item->window(), QQuickShapeGenericStrokeFillNode::MatSolidColor);
// fast path for updating only color values when no change in vertex positions
if ((d->effectiveDirty & DirtyColor) && !(d->effectiveDirty & DirtyFillGeom)) {
ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(g->vertexData());
for (int i = 0; i < g->vertexCount(); ++i)
vdst[i].set(vdst[i].x, vdst[i].y, d->fillColor);
n->markDirty(QSGNode::DirtyGeometry);
return;
}
}
const int indexCount = d->indexType == QSGGeometry::UnsignedShortType
? d->fillIndices.count() * 2 : d->fillIndices.count();
if (g->indexType() != d->indexType) {
g = new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(),
d->fillVertices.count(), indexCount, d->indexType);
n->setGeometry(g);
} else {
g->allocate(d->fillVertices.count(), indexCount);
}
g->setDrawingMode(QSGGeometry::DrawTriangles);
memcpy(g->vertexData(), d->fillVertices.constData(), g->vertexCount() * g->sizeOfVertex());
memcpy(g->indexData(), d->fillIndices.constData(), g->indexCount() * g->sizeOfIndex());
n->markDirty(QSGNode::DirtyGeometry);
}