Skip to content
Permalink
Browse files

More renaming. No code changes

  • Loading branch information
wonder-sk committed Aug 15, 2017
1 parent 260f68a commit d213d31aab07b445074f316b04655a26485a603c
Showing with 137 additions and 135 deletions.
  1. +11 −11 src/3d/CMakeLists.txt
  2. +2 −2 src/3d/chunks/chunkedentity.cpp
  3. +7 −7 src/3d/qgs3dmapscene.cpp
  4. +3 −3 src/3d/qgs3dmapscene.h
  5. +12 −12 src/3d/{utils.cpp → qgs3dutils.cpp}
  6. +4 −4 src/3d/{utils.h → qgs3dutils.h}
  7. +12 −12 src/3d/{cameracontroller.cpp → qgscameracontroller.cpp}
  8. +6 −5 src/3d/{cameracontroller.h → qgscameracontroller.h}
  9. +7 −7 src/3d/{polygongeometry.cpp → qgstessellatedpolygongeometry.cpp}
  10. +7 −6 src/3d/{polygongeometry.h → qgstessellatedpolygongeometry.h}
  11. +3 −3 src/3d/{tessellator.cpp → qgstessellator.cpp}
  12. +5 −5 src/3d/{tessellator.h → qgstessellator.h}
  13. +7 −7 src/3d/{tilingscheme.cpp → qgstilingscheme.cpp}
  14. +6 −6 src/3d/{tilingscheme.h → qgstilingscheme.h}
  15. +1 −1 src/3d/qgsvectorlayer3drenderer.h
  16. +4 −4 src/3d/symbols/qgsline3dsymbol.cpp
  17. +1 −1 src/3d/symbols/qgsline3dsymbol.h
  18. +5 −5 src/3d/symbols/qgsline3dsymbol_p.cpp
  19. +2 −2 src/3d/symbols/qgsline3dsymbol_p.h
  20. +2 −2 src/3d/symbols/qgspoint3dsymbol.cpp
  21. +1 −1 src/3d/symbols/qgspoint3dsymbol.h
  22. +4 −4 src/3d/symbols/qgspoint3dsymbol_p.cpp
  23. +4 −4 src/3d/symbols/qgspolygon3dsymbol.cpp
  24. +1 −1 src/3d/symbols/qgspolygon3dsymbol.h
  25. +5 −5 src/3d/symbols/qgspolygon3dsymbol_p.cpp
  26. +2 −2 src/3d/symbols/qgspolygon3dsymbol_p.h
  27. +3 −3 src/3d/terrain/demterraingenerator.cpp
  28. +2 −2 src/3d/terrain/demterraingenerator.h
  29. +2 −2 src/3d/terrain/flatterraingenerator.cpp
  30. +2 −2 src/3d/terrain/terraingenerator.h
  31. +1 −1 src/3d/testapp/window3d.cpp
  32. +1 −1 src/app/3d/qgs3dmapcanvas.cpp
  33. +2 −2 src/app/3d/qgs3dmapconfigwidget.cpp
@@ -2,15 +2,15 @@
# sources

SET(QGIS_3D_SRCS
cameracontroller.cpp
polygongeometry.cpp
tessellator.cpp
tilingscheme.cpp
utils.cpp

qgs3dmapscene.cpp
qgs3dmapsettings.cpp
qgs3dutils.cpp
qgscameracontroller.cpp
qgsphongmaterialsettings.cpp
qgstessellatedpolygongeometry.cpp
qgstessellator.cpp
qgstilingscheme.cpp
qgsvectorlayer3drenderer.cpp

chunks/chunkboundsentity.cpp
@@ -46,10 +46,10 @@ SET(QGIS_3D_SRCS
)

SET(QGIS_3D_MOC_HDRS
cameracontroller.h

qgs3dmapscene.h
qgs3dmapsettings.h
qgscameracontroller.h

chunks/chunkedentity.h
chunks/chunkloader.h
@@ -70,15 +70,15 @@ QT5_ADD_RESOURCES(QGIS_3D_RCC_SRCS shaders.qrc)

SET(QGIS_3D_HDRS
aabb.h
cameracontroller.h
polygongeometry.h
tessellator.h
tilingscheme.h
utils.h

qgs3dmapscene.h
qgs3dmapsettings.h
qgs3dutils.h
qgscameracontroller.h
qgsphongmaterialsettings.h
qgstessellatedpolygongeometry.h
qgstessellator.h
qgstilingscheme.h
qgsvectorlayer3drenderer.h

chunks/chunkboundsentity.h
@@ -4,7 +4,7 @@
#include "chunklist.h"
#include "chunkloader.h"
#include "chunknode.h"
#include "utils.h"
#include "qgs3dutils.h"

static float screenSpaceError( float epsilon, float distance, float screenSize, float fov )
{
@@ -200,7 +200,7 @@ void ChunkedEntity::updateNodes( const QList<ChunkNode *> &nodes, ChunkQueueJobF

void ChunkedEntity::update( ChunkNode *node, const SceneState &state )
{
if (Utils::isCullable(node->bbox, state.viewProjectionMatrix ) )
if ( Qgs3DUtils::isCullable( node->bbox, state.viewProjectionMatrix ) )
{
++frustumCulled;
return;
@@ -11,15 +11,15 @@

#include "aabb.h"
#include "qgsabstract3drenderer.h"
#include "cameracontroller.h"
#include "qgscameracontroller.h"
#include "chunknode.h"
#include "qgsvectorlayer.h"
#include "qgs3dmapsettings.h"
#include "terrain.h"
#include "terraingenerator.h"
//#include "testchunkloader.h"
#include "chunkedentity.h"
#include "utils.h"
#include "qgs3dutils.h"

#include <Qt3DRender/QMesh>
#include <Qt3DRender/QSceneLoader>
@@ -55,7 +55,7 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardR
addComponent( mFrameAction ); // takes ownership

// Camera controlling
mCameraController = new CameraController( this ); // attaches to the scene
mCameraController = new QgsCameraController( this ); // attaches to the scene
mCameraController->setViewport( viewportRect );
mCameraController->setCamera( camera );
mCameraController->resetView( 1000 );
@@ -101,8 +101,8 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardR
chunkEntities << testChunkEntity;
#endif

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

#if 0
// experiments with loading of existing 3D models.
@@ -154,7 +154,7 @@ void Qgs3DMapScene::viewZoomFull()
mCameraController->resetView( side ); // assuming FOV being 45 degrees
}

SceneState _sceneState( CameraController *cameraController )
SceneState _sceneState( QgsCameraController *cameraController )
{
Qt3DRender::QCamera *camera = cameraController->camera();
SceneState state;
@@ -277,7 +277,7 @@ void Qgs3DMapScene::createTerrain()
void Qgs3DMapScene::createTerrainDeferred()
{
double tile0width = mMap.terrainGenerator()->extent().width();
int maxZoomLevel = Utils::maxZoomLevel( tile0width, mMap.mapTileResolution(), mMap.maxTerrainGroundError() );
int maxZoomLevel = Qgs3DUtils::maxZoomLevel( tile0width, mMap.mapTileResolution(), mMap.maxTerrainGroundError() );

mTerrain = new Terrain( maxZoomLevel, mMap );
//mTerrain->setEnabled(false);
@@ -22,7 +22,7 @@ namespace Qt3DExtras
}

class QgsMapLayer;
class CameraController;
class QgsCameraController;
class Qgs3DMapSettings;
class Terrain;
class ChunkedEntity;
@@ -36,7 +36,7 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
public:
Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardRenderer *defaultFrameGraph, Qt3DRender::QRenderSettings *renderSettings, Qt3DRender::QCamera *camera, const QRect &viewportRect, Qt3DCore::QNode *parent = nullptr );

CameraController *cameraController() { return mCameraController; }
QgsCameraController *cameraController() { return mCameraController; }
Terrain *terrain() { return mTerrain; }

void viewZoomFull();
@@ -58,7 +58,7 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
const Qgs3DMapSettings &mMap;
//! Provides a way to have a synchronous function executed each frame
Qt3DLogic::QFrameAction *mFrameAction;
CameraController *mCameraController;
QgsCameraController *mCameraController;
Terrain *mTerrain;
//! Forward renderer provided by 3D window
Qt3DExtras::QForwardRenderer *mForwardRenderer;
@@ -1,4 +1,4 @@
#include "utils.h"
#include "qgs3dutils.h"

#include "qgslinestring.h"
#include "qgspolygon.h"
@@ -12,7 +12,7 @@



int Utils::maxZoomLevel( double tile0width, double tileResolution, double maxError )
int Qgs3DUtils::maxZoomLevel( double tile0width, double tileResolution, double maxError )
{
if ( maxError <= 0 || tileResolution <= 0 || tile0width <= 0 )
return 0; // invalid input
@@ -25,7 +25,7 @@ int Utils::maxZoomLevel( double tile0width, double tileResolution, double maxErr
return round( zoomLevel ); // we could use ceil() here if we wanted to always get to the desired error
}

QString Utils::altClampingToString( AltitudeClamping altClamp )
QString Qgs3DUtils::altClampingToString( AltitudeClamping altClamp )
{
switch ( altClamp )
{
@@ -37,7 +37,7 @@ QString Utils::altClampingToString( AltitudeClamping altClamp )
}


AltitudeClamping Utils::altClampingFromString( const QString &str )
AltitudeClamping Qgs3DUtils::altClampingFromString( const QString &str )
{
if ( str == "absolute" )
return AltClampAbsolute;
@@ -48,7 +48,7 @@ AltitudeClamping Utils::altClampingFromString( const QString &str )
}


QString Utils::altBindingToString( AltitudeBinding altBind )
QString Qgs3DUtils::altBindingToString( AltitudeBinding altBind )
{
switch ( altBind )
{
@@ -59,7 +59,7 @@ QString Utils::altBindingToString( AltitudeBinding altBind )
}


AltitudeBinding Utils::altBindingFromString( const QString &str )
AltitudeBinding Qgs3DUtils::altBindingFromString( const QString &str )
{
if ( str == "vertex" )
return AltBindVertex;
@@ -68,7 +68,7 @@ AltitudeBinding Utils::altBindingFromString( const QString &str )
}


void Utils::clampAltitudes( QgsLineString *lineString, AltitudeClamping altClamp, AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map )
void Qgs3DUtils::clampAltitudes( QgsLineString *lineString, AltitudeClamping altClamp, AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map )
{
for ( int i = 0; i < lineString->nCoordinates(); ++i )
{
@@ -98,7 +98,7 @@ void Utils::clampAltitudes( QgsLineString *lineString, AltitudeClamping altClamp
}


bool Utils::clampAltitudes( QgsPolygonV2 *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map )
bool Qgs3DUtils::clampAltitudes( QgsPolygonV2 *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map )
{
if ( !polygon->is3D() )
polygon->addZValue( 0 );
@@ -127,7 +127,7 @@ bool Utils::clampAltitudes( QgsPolygonV2 *polygon, AltitudeClamping altClamp, Al
}


QString Utils::matrix4x4toString( const QMatrix4x4 &m )
QString Qgs3DUtils::matrix4x4toString( const QMatrix4x4 &m )
{
const float *d = m.constData();
QStringList elems;
@@ -136,7 +136,7 @@ QString Utils::matrix4x4toString( const QMatrix4x4 &m )
return elems.join( ' ' );
}

QMatrix4x4 Utils::stringToMatrix4x4( const QString &str )
QMatrix4x4 Qgs3DUtils::stringToMatrix4x4( const QString &str )
{
QMatrix4x4 m;
float *d = m.data();
@@ -146,7 +146,7 @@ QMatrix4x4 Utils::stringToMatrix4x4( const QString &str )
return m;
}

QList<QVector3D> Utils::positions( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &request )
QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &request )
{
QList<QVector3D> positions;
QgsFeature f;
@@ -203,7 +203,7 @@ static inline uint outcode( const QVector4D &v )
//! should be equivalent to https://searchcode.com/codesearch/view/35195518/
//! qt3d /src/threed/painting/qglpainter.cpp
//! bool QGLPainter::isCullable(const QBox3D& box) const
bool Utils::isCullable( const AABB &bbox, const QMatrix4x4 &viewProjectionMatrix )
bool Qgs3DUtils::isCullable( const AABB &bbox, const QMatrix4x4 &viewProjectionMatrix )
{
uint out = 0xff;

@@ -1,5 +1,5 @@
#ifndef UTILS_H
#define UTILS_H
#ifndef QGS3DUTILS_H
#define QGS3DUTILS_H

class QgsLineString;
class QgsPolygonV2;
@@ -24,7 +24,7 @@ enum AltitudeBinding
};


class _3D_EXPORT Utils
class _3D_EXPORT Qgs3DUtils
{
public:

@@ -63,4 +63,4 @@ class _3D_EXPORT Utils
static QList<QVector3D> positions(const Map3D &map, QgsVectorLayer *layer, const QgsFeatureRequest &req);
};

#endif // UTILS_H
#endif // QGS3DUTILS_H
@@ -1,10 +1,10 @@
#include "cameracontroller.h"
#include "qgscameracontroller.h"

#include <Qt3DRender/QObjectPicker>
#include <Qt3DRender/QPickEvent>


CameraController::CameraController( Qt3DCore::QNode *parent )
QgsCameraController::QgsCameraController( Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
, mLastPressedHeight( 0 )
, mMouseDevice( new Qt3DInput::QMouseDevice() )
@@ -33,7 +33,7 @@ CameraController::CameraController( Qt3DCore::QNode *parent )
// it is only in action when a mouse button is pressed.
mMouseHandler->setSourceDevice( mMouseDevice );
connect( mMouseHandler, &Qt3DInput::QMouseHandler::positionChanged,
this, &CameraController::onPositionChanged );
this, &QgsCameraController::onPositionChanged );
addComponent( mMouseHandler );

// TODO: keep using QAxis and QAction approach or just switch to using QMouseHandler / QKeyboardHandler?
@@ -106,13 +106,13 @@ CameraController::CameraController( Qt3DCore::QNode *parent )
addComponent( mLogicalDevice );
}

void CameraController::addTerrainPicker( Qt3DRender::QObjectPicker *picker )
void QgsCameraController::addTerrainPicker( Qt3DRender::QObjectPicker *picker )
{
// object picker for terrain for correct map panning
connect( picker, &Qt3DRender::QObjectPicker::pressed, this, &CameraController::onPickerMousePressed );
connect( picker, &Qt3DRender::QObjectPicker::pressed, this, &QgsCameraController::onPickerMousePressed );
}

void CameraController::setCamera( Qt3DRender::QCamera *camera )
void QgsCameraController::setCamera( Qt3DRender::QCamera *camera )
{
if ( mCamera == camera )
return;
@@ -125,7 +125,7 @@ void CameraController::setCamera( Qt3DRender::QCamera *camera )
emit cameraChanged();
}

void CameraController::setViewport( const QRect &viewport )
void QgsCameraController::setViewport( const QRect &viewport )
{
if ( mViewport == viewport )
return;
@@ -134,7 +134,7 @@ void CameraController::setViewport( const QRect &viewport )
emit viewportChanged();
}

void CameraController::setCameraData( float x, float y, float dist, float pitch, float yaw )
void QgsCameraController::setCameraData( float x, float y, float dist, float pitch, float yaw )
{
cd.x = x;
cd.y = y;
@@ -173,7 +173,7 @@ QPointF screen_point_to_point_on_plane( const QPointF &pt, const QRect &viewport
}


void CameraController::frameTriggered( float dt )
void QgsCameraController::frameTriggered( float dt )
{
if ( mCamera == nullptr )
return;
@@ -245,7 +245,7 @@ void CameraController::frameTriggered( float dt )
}
}

void CameraController::resetView( float distance )
void QgsCameraController::resetView( float distance )
{
setCameraData( 0, 0, distance );
// a basic setup to make frustum depth range long enough that it does not cull everything
@@ -255,12 +255,12 @@ void CameraController::resetView( float distance )
emit cameraChanged();
}

void CameraController::onPositionChanged( Qt3DInput::QMouseEvent *mouse )
void QgsCameraController::onPositionChanged( Qt3DInput::QMouseEvent *mouse )
{
mMousePos = QPoint( mouse->x(), mouse->y() );
}

void CameraController::onPickerMousePressed( Qt3DRender::QPickEvent *pick )
void QgsCameraController::onPickerMousePressed( Qt3DRender::QPickEvent *pick )
{
mLastPressedHeight = pick->worldIntersection().y();
}

0 comments on commit d213d31

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