40 mPositionAttribute->setAttributeType( Qt3DQAttribute::VertexAttribute );
41 mPositionAttribute->setBuffer( mVertexBuffer );
42 mPositionAttribute->setVertexBaseType( Qt3DQAttribute::Float );
43 mPositionAttribute->setVertexSize( 3 );
44 mPositionAttribute->setByteOffset( 0 );
45 mPositionAttribute->setByteStride( 3 *
sizeof(
float ) );
46 mPositionAttribute->setName( Qt3DQAttribute::defaultPositionAttributeName() );
48 addAttribute( mPositionAttribute );
54 QByteArray vertexBufferData;
55 vertexBufferData.resize( vertices.size() * 3 *
sizeof(
float ) );
56 float *rawVertexArray =
reinterpret_cast<float *
>( vertexBufferData.data() );
58 for (
const auto &v : vertices )
60 rawVertexArray[idx++] = v.x();
61 rawVertexArray[idx++] = v.y();
62 rawVertexArray[idx++] = v.z();
65 mVertexCount = vertices.count();
66 mVertexBuffer->setData( vertexBufferData );