19#include <QtQuick3DRuntimeRender/private/qssgrenderlayer_p.h>
20#include <QtQuick3DRuntimeRender/private/qssglayerrenderdata_p.h>
22#include <QtQuick3DUtils/private/qssgassert_p.h>
25#include <QSGSimpleTextureNode>
26#include <QSGRendererInterface>
27#include <QQuickWindow>
28#include <QtQuick/private/qquickitem_p.h>
29#include <QtQuick/private/qquickpointerhandler_p.h>
33#include <QtGui/private/qeventpoint_p.h>
35#include <QtCore/private/qnumeric_p.h>
36#include <QtCore/qpointer.h>
57 o->setSceneTransform(
nullptr);
63 da->setSceneTransform(
this);
83 if (rayResult.has_value()) {
85 if (!pickResults.isEmpty()) {
86 const auto pickResult = pickResults.first();
87 auto ret = pickResult.m_localUVCoords.toPointF();
92 const bool outOfModel = pickResult.m_localUVCoords.isNull();
93 qCDebug(lcEv) << viewportPoint <<
"->" << (outOfModel ?
"OOM" :
"") <<
ret <<
"@" << pickResult.m_scenePosition
94 <<
"UV" << pickResult.m_localUVCoords <<
"dist" <<
qSqrt(pickResult.m_distanceSq);
115 static QList<QPointer<QQuickDeliveryAgent>>
owners;
129 if (
const auto idx = that->m_extensions.indexOf(
extension); idx == -1) {
131 extension->setParentItem(that->m_sceneRoot);
133 that->m_extensionListDirty =
true;
143 if (that->m_extensions.size() >
index)
155 ret = that->m_extensions.size();
164 that->m_extensions.clear();
165 that->m_extensionListDirty =
true;
173 if (that->m_extensions.size() > idx && idx > -1) {
174 that->m_extensions.replace(idx,
o);
175 that->m_extensionListDirty =
true;
184 that->m_extensions.removeLast();
185 that->m_extensionListDirty =
true;
261 m_enableInputProcessing =
true;
262 updateInputProcessing();
276 if (m_directRenderer && m_directRenderer->
thread() ==
thread()) {
277 delete m_directRenderer;
278 m_directRenderer =
nullptr;
288 sceneManager->setParent(
nullptr);
289 if (
auto wa = sceneManager->wattached)
290 wa->queueForCleanup(sceneManager);
294 m_sceneRoot =
nullptr;
300 if (!
window() && sceneManager && sceneManager->wattached)
312 itemProperty.append(&itemProperty, sceneObject);
324 return itemProperty.count(&itemProperty);
331 return itemProperty.at(&itemProperty,
i);
338 return itemProperty.clear(&itemProperty);
344 return QQmlListProperty<QObject>(
this,
377 return m_environment;
407 return m_importScene;
481 return m_renderFormat;
495 return m_renderStats;
504 auto rci = wa->rci();
509 QSSG_CHECK_X(rhi !=
nullptr,
"No QRhi from QQuickWindow, this cannot happen");
519 rci = std::make_shared<QSSGRenderContextInterface>(rhi);
527 qWarning(
"The Qt Quick scene is using a rendering method that is not based on QRhi and a 3D graphics API. "
528 "Qt Quick 3D is not functional in such an environment. The View3D item is not going to display anything.");
562 qWarning(
"QSSGView3D::textureProvider: can only be queried on the rendering thread of an exposed window");
575 void run()
override {
delete m_renderer; }
582 if (m_directRenderer) {
583 window()->scheduleRenderJob(
new CleanupJob(m_directRenderer), QQuickWindow::BeforeSynchronizingStage);
584 m_directRenderer =
nullptr;
592 delete m_directRenderer;
593 m_directRenderer =
nullptr;
600 if (newGeometry.
size() != oldGeometry.
size())
607 if (m_renderModeDirty) {
612 m_renderNode =
nullptr;
614 if (m_directRenderer) {
615 delete m_directRenderer;
616 m_directRenderer =
nullptr;
620 m_renderModeDirty =
false;
622 switch (m_renderMode) {
627 setupDirectRenderer(m_renderMode);
631 node = setupOffscreenRenderer(node);
635 node = setupInlineRenderer(node);
641 const auto inputHandlingEnabled =
643 const auto enable = inputHandlingEnabled > 0;
644 if (m_enableInputProcessing !=
enable) {
645 m_enableInputProcessing =
enable;
671 if (m_enableInputProcessing &&
event->isPointerEvent())
702 m_multiViewCameras.
clear();
703 bool sendChangeSignal =
false;
707 if (!
camera->parentItem())
714 sendChangeSignal =
true;
723 if (sendChangeSignal)
735 if (m_environment && !m_environment->parentItem())
753 if (m_sceneRoot ==
scene) {
754 qmlWarning(
this) <<
"Cannot allow self-import or cross-import!";
759 scene = rn ? rn->view3D()->importScene() :
nullptr;
762 m_importScene = inScene;
765 if (!privateObject->sceneManager) {
773 privateObject->refSceneManager(*
manager);
776 Q_ASSERT(privateObject->sceneManager);
785 scene = rn ? rn->view3D()->importScene() :
nullptr;
805 m_renderModeDirty =
true;
812 if (m_renderFormat ==
format)
816 m_renderModeDirty =
true;
817 emit renderFormatChanged();
842 return m_explicitTextureWidth;
845void QQuick3DViewport::setExplicitTextureWidth(
int width)
847 if (m_explicitTextureWidth ==
width)
850 m_explicitTextureWidth =
width;
851 emit explicitTextureWidthChanged();
876 return m_explicitTextureHeight;
879void QQuick3DViewport::setExplicitTextureHeight(
int height)
881 if (m_explicitTextureHeight ==
height)
884 m_explicitTextureHeight =
height;
885 emit explicitTextureHeightChanged();
906 return m_effectiveTextureSize;
929 qmlWarning(
this) <<
"Cannot resolve view position without a camera assigned!";
935 if (_width == 0 || _height == 0)
939 return normalizedPos *
QVector3D(
float(_width),
float(_height), 1);
962 qmlWarning(
this) <<
"Cannot resolve scene position without a camera assigned!";
968 if (_width == 0 || _height == 0)
971 const QVector3D normalizedPos = viewPos /
QVector3D(
float(_width),
float(_height), 1);
990 qreal(
y) *
window()->effectiveDevicePixelRatio() * m_heightMultiplier);
991 std::optional<QSSGRenderRay> rayResult =
renderer->getRayFromViewportPos(
position);
992 if (!rayResult.has_value())
995 const auto resultList =
renderer->syncPick(rayResult.value());
996 return getNearestPickResult(resultList);
1017 std::optional<QSSGRenderRay> rayResult =
renderer->getRayFromViewportPos(
position);
1019 if (!rayResult.has_value())
1023 const auto resultList =
renderer->syncPickOne(rayResult.value(), renderNode);
1024 return getNearestPickResult(resultList);
1042QList<QQuick3DPickResult> QQuick3DViewport::pickSubset(
float x,
float y,
const QJSValue &models)
const
1048 QVarLengthArray<QSSGRenderNode*> renderNodes;
1058 qmlWarning(
this) <<
"Type provided for picking is not a QObject. Needs to be of type QQuick3DModel.";
1062 const auto model = qobject_cast<QQuick3DModel *>(
obj);
1064 qmlWarning(
this) <<
"Type " <<
obj->metaObject()->className() <<
" is not supported for picking. Needs to be of type QQuick3DModel.";
1074 const auto subsetVariant = models.
toVariant();
1081 if (
list.listElementType()->className() != QQuick3DModel::staticMetaObject.className()) {
1082 qmlWarning(
this) <<
"Type " <<
list.listElementType()->className() <<
" is not supported for picking. Needs to be of type QQuick3DModel.";
1096 if (renderNodes.empty())
1101 std::optional<QSSGRenderRay> rayResult =
renderer->getRayFromViewportPos(
position);
1102 if (!rayResult.has_value())
1105 const auto resultList =
renderer->syncPickSubset(rayResult.value(), renderNodes);
1107 QList<QQuick3DPickResult> processedResultList;
1108 processedResultList.reserve(resultList.size());
1109 for (
const auto &
result : resultList)
1112 return processedResultList;
1127QList<QQuick3DPickResult> QQuick3DViewport::pickAll(
float x,
float y)
const
1131 return QList<QQuick3DPickResult>();
1134 qreal(
y) *
window()->effectiveDevicePixelRatio() * m_heightMultiplier);
1135 std::optional<QSSGRenderRay> rayResult =
renderer->getRayFromViewportPos(
position);
1136 if (!rayResult.has_value())
1137 return QList<QQuick3DPickResult>();
1139 const auto resultList =
renderer->syncPickAll(rayResult.value());
1140 QList<QQuick3DPickResult> processedResultList;
1141 processedResultList.reserve(resultList.size());
1142 for (
const auto &
result : resultList)
1145 return processedResultList;
1168 const auto resultList =
renderer->syncPick(ray);
1169 return getNearestPickResult(resultList);
1192 return QList<QQuick3DPickResult>();
1196 const auto resultList =
renderer->syncPickAll(ray);
1197 QList<QQuick3DPickResult> processedResultList;
1198 processedResultList.reserve(resultList.size());
1199 for (
const auto &
result : resultList) {
1200 auto processedResult = processPickResult(
result);
1202 processedResultList.append(processedResult);
1205 return processedResultList;
1220 SyntheticTouchDevice(
QObject *parent =
nullptr)
1223 DeviceType::TouchScreen,
1225 Capability::Position,
1249 auto prevState = m_touchState[
pointId];
1251 const bool sameTarget = prevState.target ==
target;
1252 const bool wasPressed = prevState.isPressed;
1254 const bool isPress = pressed && (!sameTarget || !wasPressed);
1255 const bool isRelease = !pressed && wasPressed && sameTarget;
1260 if (!sameTarget && wasPressed)
1261 qWarning(
"QQuick3DViewport::setTouchpoint missing release event");
1263 if (!pressed && !wasPressed) {
1270 if (!m_syntheticTouchDevice)
1271 m_syntheticTouchDevice =
new SyntheticTouchDevice(
this);
1276 auto epd = devPriv->pointById(
id);
1277 auto &ep = epd->eventPoint;
1287 QList<QEventPoint>
points;
1288 bool otherPoint =
false;
1289 for (
int i = 0;
i < m_touchState.
size(); ++
i) {
1290 const auto &ts = m_touchState[
i];
1294 auto newPoint = makePoint(
i, pointState,
position);
1296 }
else if (ts.isPressed) {
1304 type = QEvent::Type::TouchBegin;
1306 type = QEvent::Type::TouchEnd;
1308 type = QEvent::Type::TouchUpdate;
1315 bool handled = da->event(&ev);
1320 if (ev.isEndEvent()) {
1321 for (
auto &point : ev.
points()) {
1323 ev.setExclusiveGrabber(point,
nullptr);
1324 ev.clearPassiveGrabbers(point);
1331 if (prevState.target && !sameTarget)
1341 return m_lightmapBaker;
1346 if (!m_lightmapBaker)
1349 return m_lightmapBaker;
1369void QQuick3DViewport::invalidateSceneGraph()
1379 }
else if (m_renderNode) {
1381 }
else if (m_directRenderer) {
1387void QQuick3DViewport::updateDynamicTextures()
1393 for (
auto *
texture :
std::as_const(sceneManager->qsgDynamicTextures))
1399 if (importSm != sceneManager) {
1400 for (
auto *
texture :
std::as_const(importSm->qsgDynamicTextures))
1406 scene = rn ? rn->view3D()->importScene() :
nullptr;
1425 n->renderer->fboNode =
n;
1432 QSize desiredFboSize =
QSize(m_explicitTextureWidth, m_explicitTextureHeight);
1433 if (desiredFboSize.isEmpty()) {
1435 n->devicePixelRatio =
dpr;
1437 m_widthMultiplier = 1.0f;
1438 m_heightMultiplier = 1.0f;
1442 m_widthMultiplier = desiredFboSize.width() / float(itemPixelSize.width());
1443 m_heightMultiplier = desiredFboSize.height() / float(itemPixelSize.height());
1444 n->devicePixelRatio = 1.0;
1446 desiredFboSize.setWidth(
qMax(minFboSize.width(), desiredFboSize.width()));
1447 desiredFboSize.setHeight(
qMax(minFboSize.height(), desiredFboSize.height()));
1449 if (desiredFboSize != m_effectiveTextureSize) {
1450 m_effectiveTextureSize = desiredFboSize;
1451 emit effectiveTextureSizeChanged();
1457 n->renderer->synchronize(
this, desiredFboSize,
n->devicePixelRatio);
1458 if (
n->renderer->m_textureNeedsFlip)
1460 updateDynamicTextures();
1461 n->scheduleRender();
1483 if (!m_effectiveTextureSize.
isEmpty()) {
1484 m_effectiveTextureSize =
QSize();
1485 emit effectiveTextureSizeChanged();
1494 n->renderer->synchronize(
this,
targetSize,
window()->effectiveDevicePixelRatio());
1495 updateDynamicTextures();
1503void QQuick3DViewport::setupDirectRenderer(RenderMode
mode)
1507 if (!m_directRenderer) {
1515 if (!m_effectiveTextureSize.
isEmpty()) {
1516 m_effectiveTextureSize =
QSize();
1517 emit effectiveTextureSizeChanged();
1526 updateDynamicTextures();
1533bool QQuick3DViewport::checkIsVisible()
const
1536 return (childPrivate->explicitVisible ||
1537 (childPrivate->extra.isAllocated() && childPrivate->extra->effectRefCount));
1554 QFlatMap<QQuickItem *, SubsceneInfo> &visitedSubscenes)
const
1558 const auto frontendObject = findFrontendNode(backendObject);
1559 if (!frontendObject)
1566 if (frontendObjectPrivate->type == QQuick3DObjectPrivate::Type::Item2D) {
1569 auto item2D = qobject_cast<QQuick3DItem2D *>(frontendObject);
1571 subsceneRootItem = item2D->contentItem();
1572 if (!subsceneRootItem || subsceneRootItem->childItems().isEmpty())
1576 subscenePosition = pickResult.m_localUVCoords.toPointF();
1580 if (!subsceneRootItem->childAt(subscenePosition.x(), subscenePosition.y()))
1582 }
else if (frontendObjectPrivate->type == QQuick3DObjectPrivate::Type::Model) {
1584 int materialSubset = pickResult.m_subset;
1585 const auto backendModel =
static_cast<const QSSGRenderModel *
>(backendObject);
1587 if (backendModel->materials.size() < (pickResult.m_subset + 1))
1588 materialSubset = backendModel->
materials.size() - 1;
1589 if (materialSubset < 0)
1591 const auto backendMaterial = backendModel->materials.at(materialSubset);
1592 const auto frontendMaterial =
static_cast<QQuick3DMaterial*
>(findFrontendNode(backendMaterial));
1593 subsceneRootItem = getSubSceneRootItem(frontendMaterial);
1595 if (subsceneRootItem) {
1597 subscenePosition =
QPointF(subsceneRootItem->x() + pickResult.m_localUVCoords.x() * subsceneRootItem->width(),
1598 subsceneRootItem->y() - pickResult.m_localUVCoords.y() * subsceneRootItem->height() + subsceneRootItem->height());
1603 if (subsceneRootItem) {
1604 SubsceneInfo &subscene = visitedSubscenes[subsceneRootItem];
1605 subscene.obj = frontendObject;
1606 if (subscene.eventPointScenePositions.size() !=
event->pointCount()) {
1609 subscene.eventPointScenePositions.resize(
event->pointCount(), inf);
1611 subscene.eventPointScenePositions[pointIndex] = subscenePosition;
1633 if (frontendMaterialPrivate->type == QQuick3DObjectPrivate::Type::DefaultMaterial) {
1635 const auto defaultMaterial = qobject_cast<QQuick3DDefaultMaterial *>(material);
1636 if (defaultMaterial) {
1638 if (defaultMaterial->diffuseMap() && defaultMaterial->diffuseMap()->sourceItem())
1639 subsceneRootItem = defaultMaterial->diffuseMap()->sourceItem();
1642 }
else if (frontendMaterialPrivate->type == QQuick3DObjectPrivate::Type::PrincipledMaterial) {
1644 const auto principledMaterial = qobject_cast<QQuick3DPrincipledMaterial *>(material);
1645 if (principledMaterial) {
1647 if (principledMaterial->baseColorMap() && principledMaterial->baseColorMap()->sourceItem())
1648 subsceneRootItem = principledMaterial->baseColorMap()->sourceItem();
1650 }
else if (frontendMaterialPrivate->type == QQuick3DObjectPrivate::Type::SpecularGlossyMaterial) {
1652 const auto specularGlossyMaterial = qobject_cast<QQuick3DSpecularGlossyMaterial *>(material);
1653 if (specularGlossyMaterial) {
1655 if (specularGlossyMaterial->albedoMap() && specularGlossyMaterial->albedoMap()->sourceItem())
1656 subsceneRootItem = specularGlossyMaterial->albedoMap()->sourceItem();
1658 }
else if (frontendMaterialPrivate->type == QQuick3DObjectPrivate::Type::CustomMaterial) {
1660 const auto customMaterial = qobject_cast<QQuick3DCustomMaterial *>(material);
1661 if (customMaterial) {
1663 const auto &texturesInputs = customMaterial->m_dynamicTextureMaps;
1664 for (
const auto &textureInput : texturesInputs) {
1665 if (
auto texture = textureInput->texture()) {
1667 subsceneRootItem =
texture->sourceItem();
1674 return subsceneRootItem;
1681QQuick3DPickResult QQuick3DViewport::getNearestPickResult(
const QVarLengthArray<QSSGRenderPickResult, 20> &pickResults)
const
1683 for (
const auto &
result : pickResults) {
1684 auto pickResult = processPickResult(
result);
1701 const QFlatMap<QQuickItem *, SubsceneInfo> &visitedSubscenes)
const
1708 QVarLengthArray<QPointF, 16> originalScenePositions;
1709 originalScenePositions.resize(
event->pointCount());
1710 for (
int pointIndex = 0; pointIndex <
event->pointCount(); ++pointIndex)
1711 originalScenePositions[pointIndex] =
event->point(pointIndex).scenePosition();
1712 for (
auto subscene : visitedSubscenes) {
1714 auto &subsceneInfo = subscene.second;
1715 Q_ASSERT(subsceneInfo.eventPointScenePositions.size() ==
event->pointCount());
1717 for (
int pointIndex = 0; pointIndex <
event->pointCount(); ++pointIndex) {
1718 const auto &pt = subsceneInfo.eventPointScenePositions.at(pointIndex);
1724 QMutableEventPoint::setPosition(ep, pt);
1725 QMutableEventPoint::setScenePosition(ep, pt);
1728 if (
event->isBeginEvent())
1729 da->setSceneTransform(
nullptr);
1730 if (da->event(
event)) {
1738 const bool item2Dcase = (frontendObjectPrivate->type == QQuick3DObjectPrivate::Type::Item2D);
1744 transform->scaleX =
window()->effectiveDevicePixelRatio() * m_widthMultiplier;
1745 transform->scaleY =
window()->effectiveDevicePixelRatio() * m_heightMultiplier;
1746 transform->uvCoordsArePixels = item2Dcase;
1748 qCDebug(lcPick) <<
event->type() <<
"created ViewportTransformHelper on" << da;
1751 qCDebug(lcPick) << subsceneRoot <<
"didn't want" <<
event;
1753 event->setAccepted(
false);
1755 if (visitedSubscenes.isEmpty()) {
1756 event->setAccepted(
false);
1758 for (
int pointIndex = 0; pointIndex <
event->pointCount(); ++pointIndex)
1759 QMutableEventPoint::setScenePosition(
event->point(pointIndex), originalScenePositions.at(pointIndex));
1765 if (
event->isEndEvent() && useRayPicking) {
1766 if (
event->isSinglePointEvent()) {
1768 auto &firstPt =
event->point(0);
1769 event->setExclusiveGrabber(firstPt,
nullptr);
1770 event->clearPassiveGrabbers(firstPt);
1775 event->setExclusiveGrabber(point,
nullptr);
1776 event->clearPassiveGrabbers(point);
1792 QFlatMap<QQuickItem*, SubsceneInfo> visitedSubscenes;
1793 const bool useRayPicking = !
direction.isNull();
1795 for (
int pointIndex = 0; pointIndex <
event->pointCount(); ++pointIndex) {
1796 auto &eventPoint =
event->point(pointIndex);
1797 QVarLengthArray<QSSGRenderPickResult, 20> pickResults;
1801 pickResults = getPickResults(
renderer, eventPoint);
1803 if (!pickResults.isEmpty())
1804 for (
const auto &pickResult : pickResults)
1805 processPickedObject(pickResult.m_hitObject, pickResult, pointIndex,
event, visitedSubscenes);
1807 eventPoint.setAccepted(
false);
1810 return forwardEventToSubscenes(
event, useRayPicking,
renderer, visitedSubscenes);
1823 QVarLengthArray<QSSGRenderPickResult, 20> pickResults;
1826 realPosition.rx() *= m_widthMultiplier;
1827 realPosition.ry() *= m_heightMultiplier;
1828 std::optional<QSSGRenderRay> rayResult =
renderer->getRayFromViewportPos(realPosition);
1829 if (rayResult.has_value())
1830 pickResults =
renderer->syncPickAll(rayResult.value());
1846 QQuick3DObject *frontendObject = sceneManager->lookUpNode(backendObject);
1847 if (!frontendObject && m_importScene) {
1849 frontendObject = importSceneManager->lookUpNode(backendObject);
1851 return frontendObject;
1856 if (!pickResult.m_hitObject)
1859 QQuick3DObject *frontendObject = findFrontendNode(pickResult.m_hitObject);
1864 ::sqrtf(pickResult.m_distanceSq),
1865 pickResult.m_localUVCoords,
1866 pickResult.m_scenePosition,
1867 pickResult.m_localPosition,
1868 pickResult.m_faceNormal,
1869 pickResult.m_instanceIndex);
1871 QQuick3DItem2D *frontend2DItem = qobject_cast<QQuick3DItem2D *>(frontendObject);
1872 if (frontend2DItem && frontend2DItem->contentItem()) {
1874 const QPointF subscenePosition = pickResult.m_localUVCoords.toPointF();
1875 const auto child = frontend2DItem->contentItem()->childAt(subscenePosition.x(), subscenePosition.y());
1878 ::sqrtf(pickResult.m_distanceSq),
1879 QVector2D(frontend2DItem->contentItem()->mapToItem(
child, subscenePosition)),
1880 pickResult.m_scenePosition,
1881 pickResult.m_localPosition,
1882 pickResult.m_faceNormal);
1907void QQuick3DViewport::updateInputProcessing()
1915void QQuick3DViewport::onReleaseCachedResources()
1918 renderer->releaseCachedResources();
1930 return QQmlListProperty<QQuick3DObject>{
this,
1931 &m_extensionListDirty,
1943void QQuick3DViewport::rebuildExtensionList()
1945 m_extensionListDirty =
true;
void run() override
Implement this pure virtual function in your subclass.
CleanupJob(QQuick3DSGDirectRenderer *renderer)
The QEventPoint class provides information about a point in a QPointerEvent.
void setAccepted(bool accepted=true)
State
Specifies the state of this event point.
QPointF position
the position of this point.
Type
This enum type defines the valid event types in Qt.
The QJSValue class acts as a container for Qt/JavaScript data types.
qint32 toInt() const
Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{...
bool isArray() const
Returns true if this QJSValue is an object of the Array class; otherwise returns false.
bool isQObject() const
Returns true if this QJSValue is a QObject; otherwise returns false.
QObject * toQObject() const
If this QJSValue is a QObject, returns the QObject pointer that the QJSValue represents; otherwise,...
QJSValue property(const QString &name) const
Returns the value of this QJSValue's property with the given name.
QVariant toVariant() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
qsizetype count() const noexcept
static Q_GUI_EXPORT void update(const QEventPoint &from, QEventPoint &to)
static QEventPoint withTimeStamp(ulong timestamp, int pointId, QEventPoint::State state, QPointF position, QPointF scenePosition, QPointF globalPosition)
const QObjectList & children() const
Returns a list of child objects.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QThread * thread() const
Returns the thread in which the object lives.
void deleteLater()
\threadsafe
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
A base class for pointer events.
static QPointingDevicePrivate * get(QPointingDevice *q)
QPointingDeviceUniqueId identifies a unique object, such as a tagged token or stylus,...
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
Q_INVOKABLE QVector3D mapFromViewport(const QVector3D &viewportPos) const
\qmlmethod vector3d Camera::mapFromViewport(vector3d viewportPos)
void updateGlobalVariables(const QRectF &inViewport)
Q_INVOKABLE QVector3D mapToViewport(const QVector3D &scenePos) const
\qmlmethod vector3d Camera::mapToViewport(vector3d scenePos)
static void extensionClear(QQmlListProperty< QQuick3DObject > *list)
static void extensionReplace(QQmlListProperty< QQuick3DObject > *list, qsizetype idx, QQuick3DObject *o)
static void extensionAppend(QQmlListProperty< QQuick3DObject > *list, QQuick3DObject *extension)
static QQuick3DObject * extensionAt(QQmlListProperty< QQuick3DObject > *list, qsizetype index)
static void extensionRemoveLast(QQmlListProperty< QQuick3DObject > *list)
static qsizetype extensionCount(QQmlListProperty< QQuick3DObject > *list)
void bake(Callback callback)
Triggers a new frame where lightmap baking will take place.
static void attachWatcherPriv(SceneContext *sceneContext, CallContext *callContext, Setter setter, QQuick3DObject *newO, QObject *oldO)
static QQuick3DObjectPrivate * get(QQuick3DObject *item)
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
void setParentItem(QQuick3DObject *parentItem)
void setWindow(QQuickWindow *window)
QQuick3DSceneRenderer * renderer()
void setViewport(const QRectF &viewport)
void setVisibility(bool visible)
QQuick3DSceneRenderer * renderer
static QQuick3DWindowAttachment * getOrSetWindowAttachment(QQuickWindow &window)
void synchronize(QQuick3DViewport *view3D, const QSize &size, float dpr)
std::optional< QSSGRenderRay > getRayFromViewportPos(const QPointF &pos)
PickResultList syncPickOne(const QSSGRenderRay &ray, QSSGRenderNode *node)
QQuick3DNode * importScene
bool isTextureProvider() const override
Returns true if this item is a texture provider.
QQmlListProperty< QObject > data
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
int explicitTextureHeight
\qmlproperty int QtQuick3D::View3D::explicitTextureHeight
void releaseResources() override
This function is called when an item should release graphics resources which are not already managed ...
QQuick3DLightmapBaker * lightmapBaker()
void processPointerEventFromRay(const QVector3D &origin, const QVector3D &direction, QPointerEvent *event)
void setGlobalPickingEnabled(bool isEnabled)
void setCamera(QQuick3DCamera *camera)
QQuickShaderEffectSource::Format renderFormat
\qmlproperty enumeration QtQuick3D::View3D::renderFormat
const QPointF int pointId
void environmentChanged()
void setImportScene(QQuick3DNode *inScene)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setEnvironment(QQuick3DSceneEnvironment *environment)
~QQuick3DViewport() override
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override
Called when change occurs for this item.
int explicitTextureWidth
\qmlproperty int QtQuick3D::View3D::explicitTextureWidth
Q_INVOKABLE QQuick3DPickResult pick(float x, float y) const
\qmlmethod PickResult View3D::pick(float x, float y)
bool event(QEvent *) override
This virtual function receives events to an object and should return true if the event e was recogniz...
Q_INVOKABLE QVector3D mapTo3DScene(const QVector3D &viewPos) const
\qmlmethod vector3d View3D::mapTo3DScene(vector3d viewPos)
QQuick3DSceneRenderer * createRenderer() const
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
QSGTextureProvider * textureProvider() const override
Returns the texture provider for an item.
void importSceneChanged()
QQuick3DViewport(QQuickItem *parent=nullptr)
\qmltype View3D \inherits QQuickItem \inqmlmodule QtQuick3D
QQuick3DLightmapBaker * maybeLightmapBaker()
Q_INVOKABLE QVector3D mapFrom3DScene(const QVector3D &scenePos) const
\qmlmethod vector3d View3D::mapFrom3DScene(vector3d scenePos)
void setRenderMode(QQuick3DViewport::RenderMode renderMode)
Q_INVOKABLE void bakeLightmap()
QQuick3DRenderStats * renderStats
QQmlListProperty< QQuick3DObject > extensions
\qmlproperty List<QtQuick3D::Object3D> View3D::extensions
QQuick3DSceneEnvironment * environment
QSize effectiveTextureSize
\qmlproperty size QtQuick3D::View3D::effectiveTextureSize
void cleanupDirectRenderer()
void releaseCachedResources()
Q_INVOKABLE void evaluateEol()
static bool anyPointGrabbed(const QPointerEvent *ev)
static void data_append(QQmlListProperty< QObject > *, QObject *)
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QPointF mapToScene(const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within the scene's coor...
bool event(QEvent *) override
\reimp
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setAcceptHoverEvents(bool enabled)
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accept...
QPointF mapFromScene(const QPointF &point) const
Maps the given point in the scene's coordinate system to the equivalent point within this item's coor...
qreal y
Defines the item's y position relative to its parent.
void setAcceptTouchEvents(bool accept)
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accept...
virtual QSGTextureProvider * textureProvider() const
Returns the texture provider for an item.
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal width
This property holds the width of this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
bool smooth
\qmlproperty bool QtQuick::Item::smooth
qreal height
This property holds the height of this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
void update()
Schedules a call to updatePaintNode() for this item.
virtual bool isTextureProvider() const
Returns true if this item is a texture provider.
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
void sceneGraphInvalidated()
\qmlsignal QtQuick::Window::sceneGraphInitialized()
\inmodule QtCore\reentrant
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
\inmodule QtCore\reentrant
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
An interface providing access to some of the graphics API specific internals of the scenegraph.
static bool isApiRhiBased(GraphicsApi api)
The QSGTextureProvider class encapsulates texture based entities in QML.
The QScreen class is used to query screen properties. \inmodule QtGui.
A base class for pointer events containing a single point, such as mouse events.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QTouchEvent class contains parameters that describe a touch event.
constexpr size_type size() const noexcept
void resize(qsizetype sz)
The QVector2D class represents a vector or vertex in 2D space.
The QVector3D class represents a vector or vertex in 3D space.
QQuick3DSceneRenderer * renderer
list append(new Employee("Blackpool", "Stephen"))
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
qfloat16 qSqrt(qfloat16 f)
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
constexpr const T & qMax(const T &a, const T &b)
constexpr static Q_DECL_CONST_FUNCTION double qt_inf() noexcept
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum format
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define Q_QUICK3D_PROFILE_REGISTER(obj)
static QT_BEGIN_NAMESPACE bool isforceInputHandlingSet()
static qsizetype ssgn_count(QQmlListProperty< QObject > *property)
static QObject * ssgn_at(QQmlListProperty< QObject > *property, qsizetype i)
static void ssgn_append(QQmlListProperty< QObject > *property, QObject *obj)
static void ssgn_clear(QQmlListProperty< QObject > *property)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
#define QSSG_CHECK_X(cond, msg)
#define QSSG_ASSERT(cond, action)
#define QStringLiteral(str)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
QSqlQueryModel * model
[16]
myObject disconnect()
[26]
QNetworkAccessManager manager
QSvgRenderer * renderer
[0]
QVector< QSSGRenderGraphObject * > materials