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

A need for toByteArray API for QQuick3DInstancing::InstanceTableEntry

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Quick: 3D
    • None

    Description

      The QQuick3DInstancing Class definition in the Qt Quick 3D document requires users to implement a subclass of a abstract class QQuick3DInstancing, and also a function which overrides the abstarct function getInstanceBuffer(). The function is supposed to convert InstanceTableEntry to QByteArray.
      (See https://doc.qt.io/qt-6/qquick3dinstancing.html#calculateTableEntry )

      Since InstanceTableEntry is not offering a function for the conversion, it should be implemented with a cast at the moment, as the snippet provided there:

      QByteArray MyInstanceTable::getInstanceBuffer(int *instanceCount)
      {
          QByteArray instanceData;
       
          ...
       
          auto entry = calculateTableEntry({xPos, yPos, zPos}, {xScale, yScale, zScale}, {xRot, yRot, zRot}, color, {});
          instanceData.append(reinterpret_cast<const char *>(&entry), sizeof(entry));

       

       

      A more sophisticated way (e.g. QByteArray InstanceTableEntry::toByteArray() const) should be considered.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            hitoshiito Hitoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes