22 , mPositionAttribute( new
Qt3DRender::QAttribute( this ) )
23 , mVertexBuffer( new
Qt3DRender::QBuffer( this ) )
26 mPositionAttribute->setAttributeType( Qt3DRender::QAttribute::VertexAttribute );
27 mPositionAttribute->setBuffer( mVertexBuffer );
28 mPositionAttribute->setVertexBaseType( Qt3DRender::QAttribute::Float );
29 mPositionAttribute->setVertexSize( 3 );
30 mPositionAttribute->setByteOffset( 0 );
31 mPositionAttribute->setByteStride( 3 *
sizeof(
float ) );
32 mPositionAttribute->setName( Qt3DRender::QAttribute::defaultPositionAttributeName() );
34 addAttribute( mPositionAttribute );
40 QByteArray vertexBufferData;
41 vertexBufferData.resize( vertices.size() * 3 *
sizeof(
float ) );
42 float *rawVertexArray =
reinterpret_cast<float *
>( vertexBufferData.data() );
44 for (
const auto &v : vertices )
46 rawVertexArray[idx++] = v.x();
47 rawVertexArray[idx++] = v.y();
48 rawVertexArray[idx++] = v.z();
51 mVertexCount = vertices.count();
52 mVertexBuffer->setData( vertexBufferData );
void countChanged(int count)
Signal when the number of points changed.
void setPoints(const QVector< QVector3D > &vertices)
Set the points for the billboard with vertices.
QgsBillboardGeometry(Qt3DCore::QNode *parent=nullptr)
Constructor of QgsBillboardGeometry.