Skip to content
Permalink
Browse files

Law & order in "chunks" subdir (variable naming, no public member vars)

No actual code changes, just renames / moves
  • Loading branch information
wonder-sk committed Sep 27, 2017
1 parent e9d0dc1 commit 692c1a898bacf71005005e38811230615c9ada9a
@@ -18,36 +18,31 @@ class LineMeshGeometry : public Qt3DRender::QGeometry

int vertexCount()
{
return _vertices.size();
return mVertices.size();
}

void setVertices( QList<QVector3D> vertices );

private:
Qt3DRender::QAttribute *_positionAttribute;
Qt3DRender::QBuffer *_vertexBuffer;
QList<QVector3D> _vertices;
Qt3DRender::QAttribute *mPositionAttribute;
Qt3DRender::QBuffer *mVertexBuffer;
QList<QVector3D> mVertices;

};


LineMeshGeometry::LineMeshGeometry( Qt3DCore::QNode *parent )
: Qt3DRender::QGeometry( parent )
, _positionAttribute( new Qt3DRender::QAttribute( this ) )
, _vertexBuffer( new Qt3DRender::QBuffer( Qt3DRender::QBuffer::VertexBuffer, this ) )
, mPositionAttribute( new Qt3DRender::QAttribute( this ) )
, mVertexBuffer( new Qt3DRender::QBuffer( Qt3DRender::QBuffer::VertexBuffer, this ) )
{
_positionAttribute->setAttributeType( Qt3DRender::QAttribute::VertexAttribute );
_positionAttribute->setBuffer( _vertexBuffer );
#if QT_VERSION >= 0x050800
_positionAttribute->setVertexBaseType( Qt3DRender::QAttribute::Float );
_positionAttribute->setVertexSize( 3 );
#else
_positionAttribute->setDataType( Qt3DRender::QAttribute::Float );
_positionAttribute->setDataSize( 3 );
#endif
_positionAttribute->setName( Qt3DRender::QAttribute::defaultPositionAttributeName() );

addAttribute( _positionAttribute );
mPositionAttribute->setAttributeType( Qt3DRender::QAttribute::VertexAttribute );
mPositionAttribute->setBuffer( mVertexBuffer );
mPositionAttribute->setVertexBaseType( Qt3DRender::QAttribute::Float );
mPositionAttribute->setVertexSize( 3 );
mPositionAttribute->setName( Qt3DRender::QAttribute::defaultPositionAttributeName() );

addAttribute( mPositionAttribute );
}

void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
@@ -61,10 +56,10 @@ void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
rawVertexArray[idx++] = v.x();
rawVertexArray[idx++] = v.y();
rawVertexArray[idx++] = v.z();
_vertices.append( v );
mVertices.append( v );
}

_vertexBuffer->setData( vertexBufferData );
mVertexBuffer->setData( vertexBufferData );
}


@@ -80,30 +75,29 @@ class AABBMesh : public Qt3DRender::QGeometryRenderer
void setBoxes( const QList<QgsAABB> &bboxes );

private:
LineMeshGeometry *_lineMeshGeo;
LineMeshGeometry *mLineMeshGeo = nullptr;
};


AABBMesh::AABBMesh( Qt3DCore::QNode *parent )
: Qt3DRender::QGeometryRenderer( parent )
, _lineMeshGeo( nullptr )
{
setInstanceCount( 1 );
setIndexOffset( 0 );
setFirstInstance( 0 );
setPrimitiveType( Qt3DRender::QGeometryRenderer::Lines );

_lineMeshGeo = new LineMeshGeometry( this );
setGeometry( _lineMeshGeo );
mLineMeshGeo = new LineMeshGeometry( this );
setGeometry( mLineMeshGeo );
}

void AABBMesh::setBoxes( const QList<QgsAABB> &bboxes )
{
QList<QVector3D> vertices;
Q_FOREACH ( const QgsAABB &bbox, bboxes )
vertices << bbox.verticesForLines();
_lineMeshGeo->setVertices( vertices );
setVertexCount( _lineMeshGeo->vertexCount() );
mLineMeshGeo->setVertices( vertices );
setVertexCount( mLineMeshGeo->vertexCount() );
}


@@ -113,8 +107,8 @@ void AABBMesh::setBoxes( const QList<QgsAABB> &bboxes )
QgsChunkBoundsEntity::QgsChunkBoundsEntity( Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
{
aabbMesh = new AABBMesh;
addComponent( aabbMesh );
mAabbMesh = new AABBMesh;
addComponent( mAabbMesh );

Qt3DExtras::QPhongMaterial *bboxesMaterial = new Qt3DExtras::QPhongMaterial;
bboxesMaterial->setAmbient( Qt::red );
@@ -123,7 +117,7 @@ QgsChunkBoundsEntity::QgsChunkBoundsEntity( Qt3DCore::QNode *parent )

void QgsChunkBoundsEntity::setBoxes( const QList<QgsAABB> &bboxes )
{
aabbMesh->setBoxes( bboxes );
mAabbMesh->setBoxes( bboxes );
}

/// @endcond
@@ -32,7 +32,7 @@ class QgsChunkBoundsEntity : public Qt3DCore::QEntity
void setBoxes( const QList<QgsAABB> &bboxes );

private:
AABBMesh *aabbMesh;
AABBMesh *mAabbMesh;
};

/// @endcond

0 comments on commit 692c1a8

Please sign in to comment.
You can’t perform that action at this time.