title: Custom QQuick3DGeometry does not display
body: <p>Trying to implement a custom geometry for QtQuick3D:</p>
  <p>mycustomgeometry.h:</p>
  <pre><code>#ifndef MYCUSTOMGEOMETRY_H
  #define MYCUSTOMGEOMETRY_H
  
  #include &lt;QQuick3DGeometry&gt;
  
  class MyCustomGeometry : public QQuick3DGeometry
  {
      Q_OBJECT
  public:
      MyCustomGeometry();
      virtual ~MyCustomGeometry();
  
  signals:
  
  public slots:
      void setData(QByteArray vertexData, QByteArray indexData);
  
  };
  
  #endif // MYCUSTOMGEOMETRY_H
  </code></pre>
  <p>mycustomgeometry.cpp:</p>
  <pre><code>#include &quot;mycustomgeometry.h&quot;
  
  #include &lt;QVector3D&gt;
  
  // simulate data coming from my application (should look like a cut cuboid)
  static unsigned char vertexData[] = {
      0x00, 0x00, 0xe0, 0xb3, 0x8c, 0xca, 0x4c, 0xbd, 0x1c, 0x63, 0x89, 0x3d,
      0x00, 0x00, 0x60, 0x35, 0x0c, 0xcf, 0x4c, 0x3d, 0xa4, 0x61, 0x89, 0x3d,
      0x64, 0x2e, 0x37, 0xbd, 0xb8, 0xcc, 0x4c, 0xbd, 0x00, 0x2a, 0xb7, 0xbc,
      0x68, 0x2d, 0x37, 0xbd, 0xe4, 0xcc, 0x4c, 0x3d, 0xe0, 0x2f, 0xb7, 0xbc,
      0x80, 0x2d, 0x37, 0x3d, 0xa4, 0xcb, 0x4c, 0xbd, 0x18, 0x2f, 0x37, 0x3d,
      0x80, 0x2e, 0x37, 0x3d, 0xf0, 0xcd, 0x4c, 0x3d, 0x28, 0x2c, 0x37, 0x3d,
      0xd8, 0x2c, 0x37, 0x3d, 0xf8, 0xce, 0x4c, 0xbd, 0xa0, 0x61, 0x89, 0xbd,
      0xd8, 0x2d, 0x37, 0x3d, 0xa4, 0xca, 0x4c, 0x3d, 0x20, 0x63, 0x89, 0xbd
  };
  static unsigned char indexData[] = {
      0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
      0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
      0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
      0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
      0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
      0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
      0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
      0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
      0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
      0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
  };
  
  MyCustomGeometry::MyCustomGeometry()
  {
      QByteArray v(reinterpret_cast&lt;char*&gt;(::vertexData), sizeof(::vertexData));
      QByteArray i(reinterpret_cast&lt;char*&gt;(::indexData), sizeof(::indexData));
      setData(v, i);
  }
  
  MyCustomGeometry::~MyCustomGeometry()
  {
  }
  
  void MyCustomGeometry::setData(QByteArray vertexData, QByteArray indexData)
  {
      clear();
      setPrimitiveType(PrimitiveType::Triangles);
      addAttribute(Attribute::PositionSemantic, 0, Attribute::F32Type);
      addAttribute(Attribute::IndexSemantic, 0, Attribute::U32Type);
      addAttribute(Attribute::NormalSemantic, 0, Attribute::F32Type);
      setVertexData(vertexData);
      setIndexData(indexData);
      setStride(sizeof(float) * 3);
  
      QVector3D boundsMin, boundsMax;
      auto vertices = reinterpret_cast&lt;const float*&gt;(vertexData.constData());
      for(size_t i = 0; i &lt; vertexData.length() / sizeof(float); i += 3)
      {
          for(size_t j = 0; j &lt; 3; j++)
          {
              boundsMin[j] = (std::min(vertices[i + j], i == 0 ? vertices[i + j] : boundsMin[j]));
              boundsMax[j] = (std::max(vertices[i + j], i == 0 ? vertices[i + j] : boundsMax[j]));
          }
      }
      setBounds(boundsMin, boundsMax);
  }
  </code></pre>
  <p>main.qml:</p>
  <pre><code>import QtQuick 2.15
  import QtQuick.Window 2.15
  import QtQuick3D 1.15
  import QtQuick3D.Helpers 1.15
  import QtQuick.Controls 2.15
  import MyCustomGeometry 1.0
  
  Window {
      id: mainWindow
      width: 400
      height: 300
      visible: true
      flags: Qt.Tool
      title: qsTr(&quot;3D demo&quot;)
  
      View3D {
          id: view
          anchors.fill: parent
          camera: camera
          renderMode: View3D.Overlay
  
          PerspectiveCamera {
              id: camera
              position: Qt.vector3d(0, 200, 300)
              eulerRotation.x: -30
          }
  
          WasdController {
              controlledObject: camera
              mouseEnabled: true
          }
  
          DirectionalLight {
              eulerRotation.x: -30
          }
  
          Model {
              id: cube
              objectName: &quot;cube&quot;
              visible: true
              position: Qt.vector3d(-100, 0, 0)
              scale: Qt.vector3d(slider.k, slider.k, slider.k)
              source: &quot;#Cube&quot;
              materials: [DefaultMaterial {diffuseColor: &quot;red&quot;}]
              eulerRotation.y: 90
          }
  
          Model {
              id: sphere
              objectName: &quot;sphere&quot;
              visible: true
              position: Qt.vector3d(100, 0, 0)
              scale: Qt.vector3d(slider.k, slider.k, slider.k)
              //source: &quot;#Sphere&quot;
              geometry: MyCustomGeometry {}
              materials: [DefaultMaterial {diffuseColor: &quot;blue&quot;}]
              eulerRotation.y: 90
          }
      }
  
      Slider {
          id: slider
          property real k: Math.pow(10, slider.value)
          from: -3; to: 6; value: 3
      }
  }
  </code></pre>
  <p>The cube, and the sphere (when commenting <code>geometry:</code> and uncommenting <code>source:</code>) display correctly.</p>
  <p>But the model with the custom geometry does not.</p>
  <p>I tried also with 16-bit integers as indices, but got the same result.</p>
  <p>Edit: tested on Qt 6.0.0 and it works, so it is a problem limited to Qt 5.15.2</p>