mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Fix 3D build on windows
This commit is contained in:
parent
949d216744
commit
d6a12e0ba0
@ -165,6 +165,7 @@ cmake -G Ninja ^
|
||||
-D WITH_SERVER=TRUE ^
|
||||
-D SERVER_SKIP_ECW=TRUE ^
|
||||
-D WITH_GRASS=TRUE ^
|
||||
-D WITH_3D=TRUE ^
|
||||
-D WITH_GRASS7=TRUE ^
|
||||
-D GRASS_PREFIX7=%GRASS72_PATH:\=/% ^
|
||||
-D WITH_GLOBE=FALSE ^
|
||||
@ -324,6 +325,7 @@ exit /b 1
|
||||
:error
|
||||
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
|
||||
if exist %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2
|
||||
exit /b 1
|
||||
|
||||
:end
|
||||
echo FINISHED: %DATE% %TIME%
|
||||
|
@ -203,8 +203,8 @@ void Qgs3DMapScene::onCameraChanged()
|
||||
{
|
||||
Qt3DRender::QCamera *camera = cameraController()->camera();
|
||||
QMatrix4x4 viewMatrix = camera->viewMatrix();
|
||||
float near = 1e9;
|
||||
float far = 0;
|
||||
float fnear = 1e9;
|
||||
float ffar = 0;
|
||||
|
||||
QList<QgsChunkNode *> activeNodes = mTerrain->activeNodes();
|
||||
|
||||
@ -227,27 +227,27 @@ void Qgs3DMapScene::onCameraChanged()
|
||||
QVector4D pc = viewMatrix * p;
|
||||
|
||||
float dst = -pc.z(); // in camera coordinates, x grows right, y grows down, z grows to the back
|
||||
if ( dst < near )
|
||||
near = dst;
|
||||
if ( dst > far )
|
||||
far = dst;
|
||||
if ( dst < fnear )
|
||||
fnear = dst;
|
||||
if ( dst > ffar )
|
||||
ffar = dst;
|
||||
}
|
||||
}
|
||||
if ( near < 1 )
|
||||
near = 1; // does not really make sense to use negative far plane (behind camera)
|
||||
if ( fnear < 1 )
|
||||
fnear = 1; // does not really make sense to use negative far plane (behind camera)
|
||||
|
||||
if ( near == 1e9 && far == 0 )
|
||||
if ( fnear == 1e9 && ffar == 0 )
|
||||
{
|
||||
// the update didn't work out... this should not happen
|
||||
// well at least temprarily use some conservative starting values
|
||||
qDebug() << "oops... this should not happen! couldn't determine near/far plane. defaulting to 1...1e9";
|
||||
near = 1;
|
||||
far = 1e9;
|
||||
fnear = 1;
|
||||
ffar = 1e9;
|
||||
}
|
||||
|
||||
// set near/far plane - with some tolerance in front/behind expected near/far planes
|
||||
camera->setFarPlane( far * 2 );
|
||||
camera->setNearPlane( near / 2 );
|
||||
camera->setFarPlane( ffar * 2 );
|
||||
camera->setNearPlane( fnear / 2 );
|
||||
}
|
||||
else
|
||||
qDebug() << "no terrain - not setting near/far plane";
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "qgs3drendererregistry.h"
|
||||
#include "qgsabstract3drenderer.h"
|
||||
#include "qgsabstract3dsymbol.h"
|
||||
|
||||
#include "qgsphongmaterialsettings.h"
|
||||
#include "qgs3dutils.h"
|
||||
@ -30,8 +31,6 @@
|
||||
|
||||
class QgsVectorLayer;
|
||||
|
||||
class QgsAbstract3DSymbol;
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
|
@ -26,6 +26,11 @@ QgsDemTerrainGenerator::QgsDemTerrainGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
QgsDemTerrainGenerator::~QgsDemTerrainGenerator()
|
||||
{
|
||||
delete mHeightMapGenerator;
|
||||
}
|
||||
|
||||
void QgsDemTerrainGenerator::setLayer( QgsRasterLayer *layer )
|
||||
{
|
||||
mLayer = QgsMapLayerRef( layer );
|
||||
@ -91,11 +96,13 @@ void QgsDemTerrainGenerator::updateGenerator()
|
||||
if ( dem )
|
||||
{
|
||||
mTerrainTilingScheme = QgsTilingScheme( dem->extent(), dem->crs() );
|
||||
mHeightMapGenerator.reset( new QgsDemHeightMapGenerator( dem, mTerrainTilingScheme, mResolution ) );
|
||||
delete mHeightMapGenerator;
|
||||
mHeightMapGenerator = new QgsDemHeightMapGenerator( dem, mTerrainTilingScheme, mResolution );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTerrainTilingScheme = QgsTilingScheme();
|
||||
mHeightMapGenerator.reset();
|
||||
delete mHeightMapGenerator;
|
||||
mHeightMapGenerator = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@
|
||||
|
||||
#include "qgsterraingenerator.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
class QgsDemHeightMapGenerator;
|
||||
|
||||
class QgsRasterLayer;
|
||||
class QgsDemHeightMapGenerator;
|
||||
|
||||
#include "qgsmaplayerref.h"
|
||||
|
||||
@ -37,6 +37,7 @@ class _3D_EXPORT QgsDemTerrainGenerator : public QgsTerrainGenerator
|
||||
{
|
||||
public:
|
||||
QgsDemTerrainGenerator();
|
||||
~QgsDemTerrainGenerator();
|
||||
|
||||
//! Sets raster layer with elevation model to be used for terrain generation
|
||||
void setLayer( QgsRasterLayer *layer );
|
||||
@ -49,7 +50,7 @@ class _3D_EXPORT QgsDemTerrainGenerator : public QgsTerrainGenerator
|
||||
int resolution() const { return mResolution; }
|
||||
|
||||
//! Returns height map generator object - takes care of extraction of elevations from the layer)
|
||||
QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator.get(); }
|
||||
QgsDemHeightMapGenerator *heightMapGenerator() { return mHeightMapGenerator; }
|
||||
|
||||
virtual QgsTerrainGenerator *clone() const override SIP_FACTORY;
|
||||
Type type() const override;
|
||||
@ -64,7 +65,7 @@ class _3D_EXPORT QgsDemTerrainGenerator : public QgsTerrainGenerator
|
||||
private:
|
||||
void updateGenerator();
|
||||
|
||||
std::unique_ptr<QgsDemHeightMapGenerator> mHeightMapGenerator;
|
||||
QgsDemHeightMapGenerator *mHeightMapGenerator = nullptr;
|
||||
|
||||
//! source layer for heights
|
||||
QgsMapLayerRef mLayer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user