Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
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.