Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96324

decide whether to support multi-touch across two 3D models having the same 2D scene as shared texture

    XMLWordPrintable

    Details

      Description

      https://codereview.qt-project.org/c/qt/qtquick3d/+/323447 and related stuff in Qt Quick is too simple for this use case, because one 2D subscene has one DeliveryAgent, and the DA can only have one ViewportTransformHelper.

      If you press two touchpoints at the same time on two models at different positions, picking works fine; but both of those models could have the same 2D subscene as their texture sourceItems (shared source). QQuick3DViewport::internalPick() has this data structure to keep track temporarily of which 3D model goes with which 2D scene:

          struct SubsceneInfo {
              QQuick3DObject* obj = nullptr;
              QVarLengthArray<QPointF, 16> eventPointScenePositions;
          };
          QFlatMap<QQuickItem*, SubsceneInfo> visitedSubscenes;
      

      which clearly can only accommodate one subscene for each 2D "root" item. To support the same 2D subscene on multiple 3D objects, the mapping would have to be the other way around. But this is not the only limiting factor: there's also the QQuickItemPrivate::ensureSubsceneDeliveryAgent() API which is called in QQuick3DTexture::setSourceItem() (you will only get a new DA if this subscene root didn't already have one), the fact that the DA is stored in ItemPrivate's ExtraData::subsceneDeliveryAgent (we only store at most one DA per subscene), etc.

      So it will be a rather large refactoring to support this by making multiple instances of either the DA or the transform helper. Some thought should be put into whether it's really worth it; due to the time it will take to get this working, it will have the consequence that other things don't get done.

      Alternatively we could just document that we don't support it. It's not so bad if the user needs to make a duplicate instance of the same 2D scene definition, in the cases when she needs to support this use case. Even if she didn't duplicate them, it shouldn't be a problem to use a single mouse, because you can't press two positions on two models at the same time, so one entry in visitedSubscenes is enough on press, and one fresh instance of ViewportTransformHelper is enough for the rest of the mouse events until release. On the next press, we start over.

      So in my opinion: this is low priority for now, unless there are obvious reasons that we need this use case in real UIs.

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-96324
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              qt.team.graphics.and.multimedia Qt Graphics Team
              Reporter:
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews