40 , mWithNormals( _withNormals )
41 , mInvertNormals( _invertNormals )
42 , mAddBackFaces( _addBackFaces )
43 , mAddTextureCoords( _addTextureCoords )
47 const QgsTessellator tmpTess( 0, 0, mWithNormals,
false,
false,
false, mAddTextureCoords );
48 const int stride = tmpTess.
stride();
51 mPositionAttribute->setName( Qt3DQAttribute::defaultPositionAttributeName() );
52 mPositionAttribute->setVertexBaseType( Qt3DQAttribute::Float );
53 mPositionAttribute->setVertexSize( 3 );
54 mPositionAttribute->setAttributeType( Qt3DQAttribute::VertexAttribute );
55 mPositionAttribute->setBuffer( mVertexBuffer );
56 mPositionAttribute->setByteStride( stride );
57 mPositionAttribute->setByteOffset( 0 );
58 addAttribute( mPositionAttribute );
63 mNormalAttribute->setName( Qt3DQAttribute::defaultNormalAttributeName() );
64 mNormalAttribute->setVertexBaseType( Qt3DQAttribute::Float );
65 mNormalAttribute->setVertexSize( 3 );
66 mNormalAttribute->setAttributeType( Qt3DQAttribute::VertexAttribute );
67 mNormalAttribute->setBuffer( mVertexBuffer );
68 mNormalAttribute->setByteStride( stride );
69 mNormalAttribute->setByteOffset( 3 *
sizeof(
float ) );
70 addAttribute( mNormalAttribute );
72 if ( mAddTextureCoords )
75 mTextureCoordsAttribute->setName( Qt3DQAttribute::defaultTextureCoordinateAttributeName() );
76 mTextureCoordsAttribute->setVertexBaseType( Qt3DQAttribute::Float );
77 mTextureCoordsAttribute->setVertexSize( 2 );
78 mTextureCoordsAttribute->setAttributeType( Qt3DQAttribute::VertexAttribute );
79 mTextureCoordsAttribute->setBuffer( mVertexBuffer );
80 mTextureCoordsAttribute->setByteStride( stride );
81 mTextureCoordsAttribute->setByteOffset( mWithNormals ? 6 *
sizeof(
float ) : 3 *
sizeof( float ) );
82 addAttribute( mTextureCoordsAttribute );
89 mTriangleIndexFids = triangleIndexFids;
91 mVertexBuffer->setData( vertexBufferData );
92 mPositionAttribute->setCount( vertexCount );
93 if ( mNormalAttribute )
94 mNormalAttribute->setCount( vertexCount );
95 if ( mTextureCoordsAttribute )
96 mTextureCoordsAttribute->setCount( vertexCount );
void setData(const QByteArray &vertexBufferData, int vertexCount, const QVector< QgsFeatureId > &triangleIndexFids, const QVector< uint > &triangleIndexStartingIndices)
Initializes vertex buffer (and other members) from data that were already tessellated.