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 );
53 QByteArray vertexBufferData;
54 vertexBufferData.resize( vertices.size() * 3 *
sizeof(
float ) );
55 float *rawVertexArray =
reinterpret_cast<float *
>( vertexBufferData.data() );
57 for (
const auto &v : vertices )
59 rawVertexArray[idx++] = v.x();
60 rawVertexArray[idx++] = v.y();
61 rawVertexArray[idx++] = v.z();
64 mVertexCount = vertices.count();
65 mVertexBuffer->setData( vertexBufferData );