Skip to content
Permalink
Browse files

More renaming of 3D-related classes and files. No actual code changes

  • Loading branch information
wonder-sk committed Aug 15, 2017
1 parent ff5ebe9 commit 260f68abc45da6548338e4ead5a65fb0850b34ac
Showing with 319 additions and 309 deletions.
  1. +13 −10 src/3d/CMakeLists.txt
  2. +28 −28 src/3d/{scene.cpp → qgs3dmapscene.cpp}
  3. +7 −7 src/3d/{scene.h → qgs3dmapscene.h}
  4. +26 −26 src/3d/{map3d.cpp → qgs3dmapsettings.cpp}
  5. +7 −7 src/3d/{map3d.h → qgs3dmapsettings.h}
  6. +3 −3 src/3d/{phongmaterialsettings.cpp → qgsphongmaterialsettings.cpp}
  7. +5 −5 src/3d/{phongmaterialsettings.h → qgsphongmaterialsettings.h}
  8. +16 −16 src/3d/{vectorlayer3drenderer.cpp → qgsvectorlayer3drenderer.cpp}
  9. +11 −11 src/3d/{vectorlayer3drenderer.h → qgsvectorlayer3drenderer.h}
  10. +4 −4 src/3d/symbols/qgsline3dsymbol.h
  11. +6 −6 src/3d/symbols/qgsline3dsymbol_p.cpp
  12. +6 −6 src/3d/symbols/qgsline3dsymbol_p.h
  13. +4 −4 src/3d/symbols/qgspoint3dsymbol.h
  14. +9 −9 src/3d/symbols/qgspoint3dsymbol_p.cpp
  15. +9 −9 src/3d/symbols/qgspoint3dsymbol_p.h
  16. +4 −4 src/3d/symbols/qgspolygon3dsymbol.h
  17. +6 −6 src/3d/symbols/qgspolygon3dsymbol_p.cpp
  18. +6 −6 src/3d/symbols/qgspolygon3dsymbol_p.h
  19. +4 −4 src/3d/terrain/demterraingenerator.cpp
  20. +1 −1 src/3d/terrain/demterraingenerator.h
  21. +1 −1 src/3d/terrain/flatterraingenerator.cpp
  22. +2 −2 src/3d/terrain/maptexturegenerator.cpp
  23. +3 −3 src/3d/terrain/maptexturegenerator.h
  24. +6 −6 src/3d/terrain/terrain.cpp
  25. +4 −4 src/3d/terrain/terrain.h
  26. +2 −2 src/3d/terrain/terrainchunkloader.cpp
  27. +4 −4 src/3d/terrain/terraingenerator.cpp
  28. +4 −4 src/3d/terrain/terraingenerator.h
  29. +12 −12 src/3d/testapp/main.cpp
  30. +4 −4 src/3d/testapp/window3d.cpp
  31. +5 −5 src/3d/testapp/window3d.h
  32. +45 −43 src/3d/utils.cpp
  33. +9 −4 src/3d/utils.h
  34. +4 −4 src/app/3d/qgs3dmapcanvas.cpp
  35. +6 −6 src/app/3d/qgs3dmapcanvas.h
  36. +2 −2 src/app/3d/qgs3dmapcanvasdockwidget.cpp
  37. +2 −2 src/app/3d/qgs3dmapcanvasdockwidget.h
  38. +2 −2 src/app/3d/qgs3dmapconfigwidget.cpp
  39. +3 −3 src/app/3d/qgs3dmapconfigwidget.h
  40. +5 −5 src/app/3d/qgsphongmaterialwidget.cpp
  41. +3 −3 src/app/3d/qgsphongmaterialwidget.h
  42. +6 −6 src/app/3d/qgsvectorlayer3drendererwidget.cpp
  43. +4 −4 src/app/3d/qgsvectorlayer3drendererwidget.h
  44. +4 −4 src/app/qgisapp.cpp
  45. +2 −2 src/core/3d/qgsabstract3drenderer.h
@@ -3,14 +3,15 @@

SET(QGIS_3D_SRCS
cameracontroller.cpp
map3d.cpp
phongmaterialsettings.cpp
polygongeometry.cpp
scene.cpp
tessellator.cpp
tilingscheme.cpp
utils.cpp
vectorlayer3drenderer.cpp

qgs3dmapscene.cpp
qgs3dmapsettings.cpp
qgsphongmaterialsettings.cpp
qgsvectorlayer3drenderer.cpp

chunks/chunkboundsentity.cpp
chunks/chunkedentity.cpp
@@ -46,8 +47,9 @@ SET(QGIS_3D_SRCS

SET(QGIS_3D_MOC_HDRS
cameracontroller.h
map3d.h
scene.h

qgs3dmapscene.h
qgs3dmapsettings.h

chunks/chunkedentity.h
chunks/chunkloader.h
@@ -69,14 +71,15 @@ QT5_ADD_RESOURCES(QGIS_3D_RCC_SRCS shaders.qrc)
SET(QGIS_3D_HDRS
aabb.h
cameracontroller.h
map3d.h
phongmaterialsettings.h
polygongeometry.h
scene.h
tessellator.h
tilingscheme.h
utils.h
vectorlayer3drenderer.h

qgs3dmapscene.h
qgs3dmapsettings.h
qgsphongmaterialsettings.h
qgsvectorlayer3drenderer.h

chunks/chunkboundsentity.h
chunks/chunkedentity.h
@@ -1,4 +1,4 @@
#include "scene.h"
#include "qgs3dmapscene.h"

#include <Qt3DRender/QCamera>
#include <Qt3DRender/QPickingSettings>
@@ -14,7 +14,7 @@
#include "cameracontroller.h"
#include "chunknode.h"
#include "qgsvectorlayer.h"
#include "map3d.h"
#include "qgs3dmapsettings.h"
#include "terrain.h"
#include "terraingenerator.h"
//#include "testchunkloader.h"
@@ -26,14 +26,14 @@
#include <Qt3DExtras/QPhongMaterial>


Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph, Qt3DRender::QRenderSettings *renderSettings, Qt3DRender::QCamera *camera, const QRect &viewportRect, Qt3DCore::QNode *parent )
Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph, Qt3DRender::QRenderSettings *renderSettings, Qt3DRender::QCamera *camera, const QRect &viewportRect, Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
, mMap( map )
, mTerrain( nullptr )
, mForwardRenderer( defaultFrameGraph )
{

connect( &map, &Map3D::backgroundColorChanged, this, &Scene::onBackgroundColorChanged );
connect( &map, &Qgs3DMapSettings::backgroundColorChanged, this, &Qgs3DMapScene::onBackgroundColorChanged );
onBackgroundColorChanged();

// TODO: strange - setting OnDemand render policy still keeps QGIS busy (Qt 5.9.0)
@@ -51,7 +51,7 @@ Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph,

mFrameAction = new Qt3DLogic::QFrameAction();
connect( mFrameAction, &Qt3DLogic::QFrameAction::triggered,
this, &Scene::onFrameTriggered );
this, &Qgs3DMapScene::onFrameTriggered );
addComponent( mFrameAction ); // takes ownership

// Camera controlling
@@ -63,11 +63,11 @@ Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph,
// create terrain entity

createTerrain();
connect( &map, &Map3D::terrainGeneratorChanged, this, &Scene::createTerrain );
connect( &map, &Map3D::terrainVerticalScaleChanged, this, &Scene::createTerrain );
connect( &map, &Map3D::mapTileResolutionChanged, this, &Scene::createTerrain );
connect( &map, &Map3D::maxTerrainScreenErrorChanged, this, &Scene::createTerrain );
connect( &map, &Map3D::maxTerrainGroundErrorChanged, this, &Scene::createTerrain );
connect( &map, &Qgs3DMapSettings::terrainGeneratorChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::terrainVerticalScaleChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::mapTileResolutionChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::maxTerrainScreenErrorChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::maxTerrainGroundErrorChanged, this, &Qgs3DMapScene::createTerrain );

// create entities of renderers

@@ -78,7 +78,7 @@ Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph,
}

// listen to changes of layers in order to add/remove 3D renderer entities
connect( &map, &Map3D::layersChanged, this, &Scene::onLayersChanged );
connect( &map, &Qgs3DMapSettings::layersChanged, this, &Qgs3DMapScene::onLayersChanged );

Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity;
Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform;
@@ -101,8 +101,8 @@ Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph,
chunkEntities << testChunkEntity;
#endif

connect( mCameraController, &CameraController::cameraChanged, this, &Scene::onCameraChanged );
connect( mCameraController, &CameraController::viewportChanged, this, &Scene::onCameraChanged );
connect( mCameraController, &CameraController::cameraChanged, this, &Qgs3DMapScene::onCameraChanged );
connect( mCameraController, &CameraController::viewportChanged, this, &Qgs3DMapScene::onCameraChanged );

#if 0
// experiments with loading of existing 3D models.
@@ -147,7 +147,7 @@ Scene::Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph,
onCameraChanged();
}

void Scene::viewZoomFull()
void Qgs3DMapScene::viewZoomFull()
{
QgsRectangle extent = mMap.terrainGenerator()->extent();
float side = qMax( extent.width(), extent.height() );
@@ -166,7 +166,7 @@ SceneState _sceneState( CameraController *cameraController )
return state;
}

void Scene::onCameraChanged()
void Qgs3DMapScene::onCameraChanged()
{
Q_FOREACH ( ChunkedEntity *entity, chunkEntities )
{
@@ -242,7 +242,7 @@ void Scene::onCameraChanged()
//qDebug() << "camera near/far" << mCameraController->camera()->nearPlane() << mCameraController->camera()->farPlane();
}

void Scene::onFrameTriggered( float dt )
void Qgs3DMapScene::onFrameTriggered( float dt )
{
mCameraController->frameTriggered( dt );

@@ -256,7 +256,7 @@ void Scene::onFrameTriggered( float dt )
}
}

void Scene::createTerrain()
void Qgs3DMapScene::createTerrain()
{
if ( mTerrain )
{
@@ -269,12 +269,12 @@ void Scene::createTerrain()
if ( !mTerrainUpdateScheduled )
{
// defer re-creation of terrain: there may be multiple invocations of this slot, so create the new entity just once
QTimer::singleShot( 0, this, &Scene::createTerrainDeferred );
QTimer::singleShot( 0, this, &Qgs3DMapScene::createTerrainDeferred );
mTerrainUpdateScheduled = true;
}
}

void Scene::createTerrainDeferred()
void Qgs3DMapScene::createTerrainDeferred()
{
double tile0width = mMap.terrainGenerator()->extent().width();
int maxZoomLevel = Utils::maxZoomLevel( tile0width, mMap.mapTileResolution(), mMap.maxTerrainGroundError() );
@@ -305,12 +305,12 @@ void Scene::createTerrainDeferred()
mTerrainUpdateScheduled = false;
}

void Scene::onBackgroundColorChanged()
void Qgs3DMapScene::onBackgroundColorChanged()
{
mForwardRenderer->setClearColor( mMap.backgroundColor() );
}

void Scene::onLayerRenderer3DChanged()
void Qgs3DMapScene::onLayerRenderer3DChanged()
{
QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sender() );
Q_ASSERT( layer );
@@ -322,7 +322,7 @@ void Scene::onLayerRenderer3DChanged()
addLayerEntity( layer );
}

void Scene::onLayersChanged()
void Qgs3DMapScene::onLayersChanged()
{
QSet<QgsMapLayer *> layersBefore = QSet<QgsMapLayer *>::fromList( mLayerEntities.keys() );
QList<QgsMapLayer *> layersAdded;
@@ -350,7 +350,7 @@ void Scene::onLayersChanged()
}
}

void Scene::addLayerEntity( QgsMapLayer *layer )
void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
{
QgsAbstract3DRenderer *renderer = layer->renderer3D();
if ( renderer )
@@ -360,26 +360,26 @@ void Scene::addLayerEntity( QgsMapLayer *layer )
mLayerEntities.insert( layer, newEntity );
}

connect( layer, &QgsMapLayer::renderer3DChanged, this, &Scene::onLayerRenderer3DChanged );
connect( layer, &QgsMapLayer::renderer3DChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );

if ( layer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
connect( vlayer, &QgsVectorLayer::selectionChanged, this, &Scene::onLayerRenderer3DChanged );
connect( vlayer, &QgsVectorLayer::selectionChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );
}
}

void Scene::removeLayerEntity( QgsMapLayer *layer )
void Qgs3DMapScene::removeLayerEntity( QgsMapLayer *layer )
{
Qt3DCore::QEntity *entity = mLayerEntities.take( layer );
if ( entity )
entity->deleteLater();

disconnect( layer, &QgsMapLayer::renderer3DChanged, this, &Scene::onLayerRenderer3DChanged );
disconnect( layer, &QgsMapLayer::renderer3DChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );

if ( layer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
disconnect( vlayer, &QgsVectorLayer::selectionChanged, this, &Scene::onLayerRenderer3DChanged );
disconnect( vlayer, &QgsVectorLayer::selectionChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );
}
}
@@ -1,5 +1,5 @@
#ifndef SCENE_H
#define SCENE_H
#ifndef QGS3DMAPSCENE_H
#define QGS3DMAPSCENE_H

#include "qgis_3d.h"

@@ -23,18 +23,18 @@ namespace Qt3DExtras

class QgsMapLayer;
class CameraController;
class Map3D;
class Qgs3DMapSettings;
class Terrain;
class ChunkedEntity;

/**
* Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children.
*/
class _3D_EXPORT Scene : public Qt3DCore::QEntity
class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
{
Q_OBJECT
public:
Scene( const Map3D &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph, Qt3DRender::QRenderSettings *renderSettings, Qt3DRender::QCamera *camera, const QRect &viewportRect, Qt3DCore::QNode *parent = nullptr );
Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph, Qt3DRender::QRenderSettings *renderSettings, Qt3DRender::QCamera *camera, const QRect &viewportRect, Qt3DCore::QNode *parent = nullptr );

CameraController *cameraController() { return mCameraController; }
Terrain *terrain() { return mTerrain; }
@@ -55,7 +55,7 @@ class _3D_EXPORT Scene : public Qt3DCore::QEntity
void removeLayerEntity( QgsMapLayer *layer );

private:
const Map3D &mMap;
const Qgs3DMapSettings &mMap;
//! Provides a way to have a synchronous function executed each frame
Qt3DLogic::QFrameAction *mFrameAction;
CameraController *mCameraController;
@@ -68,4 +68,4 @@ class _3D_EXPORT Scene : public Qt3DCore::QEntity
bool mTerrainUpdateScheduled = false;
};

#endif // SCENE_H
#endif // QGS3DMAPSCENE_H

0 comments on commit 260f68a

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