Skip to content

Commit

Permalink
Rename TerrainBoundsEntity to ChunkBoundsEntity
Browse files Browse the repository at this point in the history
... since it can be used also for other chunked entities - not just terrain
  • Loading branch information
wonder-sk committed Sep 15, 2017
1 parent 3d0ce5f commit 04e12d9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/3d/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@

SET(QGIS_3D_SRCS
cameracontroller.cpp
chunkboundsentity.cpp
chunkedentity.cpp
chunklist.cpp
chunkloader.cpp
Expand All @@ -21,7 +22,6 @@ SET(QGIS_3D_SRCS
#quantizedmeshterraingenerator.cpp
scene.cpp
terrain.cpp
terrainboundsentity.cpp
terrainchunkloader.cpp
terraingenerator.cpp
tessellator.cpp
Expand Down Expand Up @@ -55,6 +55,7 @@ QT5_ADD_RESOURCES(QGIS_3D_RCC_SRCS shaders.qrc)
SET(QGIS_3D_HDRS
aabb.h
cameracontroller.h
chunkboundsentity.h
chunkedentity.h
chunklist.h
chunkloader.h
Expand All @@ -73,7 +74,6 @@ SET(QGIS_3D_HDRS
#quantizedmeshterraingenerator.h
scene.h
terrain.h
terrainboundsentity.h
terrainchunkloader.h
terraingenerator.h
tessellator.h
Expand Down
@@ -1,4 +1,4 @@
#include "terrainboundsentity.h"
#include "chunkboundsentity.h"

#include <Qt3DRender/QAttribute>
#include <Qt3DRender/QBuffer>
Expand Down Expand Up @@ -105,7 +105,7 @@ void AABBMesh::setBoxes( const QList<AABB> &bboxes )
// ----------------


TerrainBoundsEntity::TerrainBoundsEntity( Qt3DCore::QNode *parent )
ChunkBoundsEntity::ChunkBoundsEntity( Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
{
aabbMesh = new AABBMesh;
Expand All @@ -116,7 +116,7 @@ TerrainBoundsEntity::TerrainBoundsEntity( Qt3DCore::QNode *parent )
addComponent( bboxesMaterial );
}

void TerrainBoundsEntity::setBoxes( const QList<AABB> &bboxes )
void ChunkBoundsEntity::setBoxes( const QList<AABB> &bboxes )
{
aabbMesh->setBoxes( bboxes );
}
10 changes: 5 additions & 5 deletions src/3d/terrainboundsentity.h → src/3d/chunkboundsentity.h
@@ -1,21 +1,21 @@
#ifndef TERRAINBOUNDSENTITY_H
#define TERRAINBOUNDSENTITY_H
#ifndef CHUNKBOUNDSENTITY_H
#define CHUNKBOUNDSENTITY_H

#include <Qt3DCore/QEntity>

class AABB;
class AABBMesh;

//! Draws bounds of axis aligned bounding boxes
class TerrainBoundsEntity : public Qt3DCore::QEntity
class ChunkBoundsEntity : public Qt3DCore::QEntity
{
public:
TerrainBoundsEntity( Qt3DCore::QNode *parent = nullptr );
ChunkBoundsEntity( Qt3DCore::QNode *parent = nullptr );

void setBoxes( const QList<AABB> &bboxes );

private:
AABBMesh *aabbMesh;
};

#endif // TERRAINBOUNDSENTITY_H
#endif // CHUNKBOUNDSENTITY_H
7 changes: 4 additions & 3 deletions src/3d/chunkedentity.cpp
@@ -1,9 +1,10 @@
#include "chunkedentity.h"

#include "chunknode.h"
#include "chunkboundsentity.h"
#include "chunklist.h"
#include "chunkloader.h"
#include "terrainboundsentity.h"
#include "chunknode.h"


static float screenSpaceError( float epsilon, float distance, float screenSize, float fov )
{
Expand Down Expand Up @@ -195,7 +196,7 @@ void ChunkedEntity::setShowBoundingBoxes( bool enabled )

if ( enabled )
{
bboxesEntity = new TerrainBoundsEntity( this );
bboxesEntity = new ChunkBoundsEntity( this );
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/3d/chunkedentity.h
Expand Up @@ -9,7 +9,7 @@ class AABB;
class ChunkNode;
class ChunkList;
class ChunkLoaderFactory;
class TerrainBoundsEntity;
class ChunkBoundsEntity;
class LoaderThread;

#include <QVector3D>
Expand Down Expand Up @@ -76,7 +76,7 @@ class ChunkedEntity : public Qt3DCore::QEntity
//! max. length for replacement queue
int maxLoadedChunks;

TerrainBoundsEntity *bboxesEntity;
ChunkBoundsEntity *bboxesEntity;

LoaderThread *loaderThread;
QMutex loaderMutex;
Expand Down

0 comments on commit 04e12d9

Please sign in to comment.