From c87a8f6afbf5088f9f5ed1b3c58523677b48f43a Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 3 Aug 2020 09:25:50 +1000 Subject: [PATCH] Code shuffle to move all material classes to separate subdirectory --- doc/CMakeLists.txt | 1 + python/3d/3d_auto.sip | 8 +- .../qgsabstractmaterialsettings.py | 2 +- .../qgsabstractmaterialsettings.sip.in | 4 +- .../materials/qgsgoochmaterialsettings.sip.in | 138 ++++++++++++++++++ .../qgsmaterialregistry.sip.in | 4 +- .../qgsphongmaterialsettings.sip.in | 4 +- python/CMakeLists.txt | 1 + src/3d/CMakeLists.txt | 31 ++-- .../qgsabstractmaterialsettings.h | 0 .../qgsgoochmaterialsettings.cpp | 0 .../qgsgoochmaterialsettings.h | 0 .../{ => materials}/qgsmaterialregistry.cpp | 0 src/3d/{ => materials}/qgsmaterialregistry.h | 0 .../qgsphongmaterialsettings.cpp | 0 .../qgsphongmaterialsettings.h | 0 src/3d/qgs3dexportobject.h | 5 + src/3d/qgs3dsceneexporter.h | 5 + src/3d/qgsimagetexture.h | 4 + src/app/CMakeLists.txt | 3 +- 20 files changed, 187 insertions(+), 23 deletions(-) rename python/3d/auto_generated/{ => materials}/qgsabstractmaterialsettings.sip.in (96%) create mode 100644 python/3d/auto_generated/materials/qgsgoochmaterialsettings.sip.in rename python/3d/auto_generated/{ => materials}/qgsmaterialregistry.sip.in (96%) rename python/3d/auto_generated/{ => materials}/qgsphongmaterialsettings.sip.in (97%) rename src/3d/{ => materials}/qgsabstractmaterialsettings.h (100%) rename src/3d/{ => materials}/qgsgoochmaterialsettings.cpp (100%) rename src/3d/{ => materials}/qgsgoochmaterialsettings.h (100%) rename src/3d/{ => materials}/qgsmaterialregistry.cpp (100%) rename src/3d/{ => materials}/qgsmaterialregistry.h (100%) rename src/3d/{ => materials}/qgsphongmaterialsettings.cpp (100%) rename src/3d/{ => materials}/qgsphongmaterialsettings.h (100%) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 1e7436f0293..732717f049c 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -110,6 +110,7 @@ IF(WITH_APIDOC) ${CMAKE_SOURCE_DIR}/src/analysis/vector/geometry_checker ${CMAKE_SOURCE_DIR}/src/3d ${CMAKE_SOURCE_DIR}/src/3d/chunks + ${CMAKE_SOURCE_DIR}/src/3d/materials ${CMAKE_SOURCE_DIR}/src/3d/symbols ${CMAKE_SOURCE_DIR}/src/3d/terrain ${CMAKE_SOURCE_DIR}/src/plugins diff --git a/python/3d/3d_auto.sip b/python/3d/3d_auto.sip index d9336e93061..43be362fef3 100644 --- a/python/3d/3d_auto.sip +++ b/python/3d/3d_auto.sip @@ -3,16 +3,18 @@ %Include auto_generated/qgs3d.sip %Include auto_generated/qgs3dmapsettings.sip %Include auto_generated/qgs3dtypes.sip -%Include auto_generated/qgsabstractmaterialsettings.sip %Include auto_generated/qgsabstractvectorlayer3drenderer.sip %Include auto_generated/qgscamerapose.sip %Include auto_generated/qgslayoutitem3dmap.sip -%Include auto_generated/qgsmaterialregistry.sip -%Include auto_generated/qgsphongmaterialsettings.sip %Include auto_generated/qgspointlightsettings.sip %Include auto_generated/qgsdirectionallightsettings.sip %Include auto_generated/qgsrulebased3drenderer.sip %Include auto_generated/qgsvectorlayer3drenderer.sip +%Include auto_generated/materials/qgsabstractmaterialsettings.sip +%Include auto_generated/materials/qgsgoochmaterialsettings.sip +%Include auto_generated/materials/qgsmaterialregistry.sip +%Include auto_generated/materials/qgsphongmaterialsettings.sip %Include auto_generated/symbols/qgsline3dsymbol.sip %Include auto_generated/symbols/qgspoint3dsymbol.sip %Include auto_generated/symbols/qgspolygon3dsymbol.sip +%Include auto_generated/qgs3dmapexportsettings.sip diff --git a/python/3d/auto_additions/qgsabstractmaterialsettings.py b/python/3d/auto_additions/qgsabstractmaterialsettings.py index 032901cef46..3bb5bb25e25 100644 --- a/python/3d/auto_additions/qgsabstractmaterialsettings.py +++ b/python/3d/auto_additions/qgsabstractmaterialsettings.py @@ -1,4 +1,4 @@ -# The following has been generated automatically from src/3d/qgsabstractmaterialsettings.h +# The following has been generated automatically from src/3d/materials/qgsabstractmaterialsettings.h QgsAbstractMaterialSettings.RenderingTechnique = QgsMaterialSettingsRenderingTechnique # monkey patching scoped based enum QgsAbstractMaterialSettings.Triangles = QgsMaterialSettingsRenderingTechnique.Triangles diff --git a/python/3d/auto_generated/qgsabstractmaterialsettings.sip.in b/python/3d/auto_generated/materials/qgsabstractmaterialsettings.sip.in similarity index 96% rename from python/3d/auto_generated/qgsabstractmaterialsettings.sip.in rename to python/3d/auto_generated/materials/qgsabstractmaterialsettings.sip.in index 087e002deb5..1a6a4520661 100644 --- a/python/3d/auto_generated/qgsabstractmaterialsettings.sip.in +++ b/python/3d/auto_generated/materials/qgsabstractmaterialsettings.sip.in @@ -1,7 +1,7 @@ /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsabstractmaterialsettings.h * + * src/3d/materials/qgsabstractmaterialsettings.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ @@ -131,7 +131,7 @@ during triangulation. /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsabstractmaterialsettings.h * + * src/3d/materials/qgsabstractmaterialsettings.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ diff --git a/python/3d/auto_generated/materials/qgsgoochmaterialsettings.sip.in b/python/3d/auto_generated/materials/qgsgoochmaterialsettings.sip.in new file mode 100644 index 00000000000..277b69b053d --- /dev/null +++ b/python/3d/auto_generated/materials/qgsgoochmaterialsettings.sip.in @@ -0,0 +1,138 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/materials/qgsgoochmaterialsettings.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + +class QgsGoochMaterialSettings : QgsAbstractMaterialSettings +{ +%Docstring +Basic shading material used for rendering based on the Phong shading model +with three color components: ambient, diffuse and specular. + +.. warning:: + + This is not considered stable API, and may change in future QGIS releases. It is + exposed to the Python bindings as a tech preview only. + +.. versionadded:: 3.16 +%End + +%TypeHeaderCode +#include "qgsgoochmaterialsettings.h" +%End + public: + + QgsGoochMaterialSettings(); +%Docstring +Constructor for QgsGoochMaterialSettings. +%End + + virtual QString type() const; + + + static QgsAbstractMaterialSettings *create() /Factory/; +%Docstring +Returns a new instance of QgsGoochMaterialSettings. +%End + + static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique ); +%Docstring +Returns ``True`` if the specified ``technique`` is suppored by the Gooch material. +%End + + virtual QgsGoochMaterialSettings *clone() const /Factory/; + + + QColor warm() const; +%Docstring +Returns warm color component +%End + + QColor cool() const; +%Docstring +Returns cool color component +%End + + QColor diffuse() const; +%Docstring +Returns diffuse color component +%End + QColor specular() const; +%Docstring +Returns specular color component +%End + float shininess() const; +%Docstring +Returns shininess of the surface +%End + + float alpha() const; +%Docstring +Returns the alpha value +%End + + float beta() const; +%Docstring +Returns the beta value +%End + + void setWarm( const QColor &warm ); +%Docstring +Sets warm color component +%End + + void setCool( const QColor &cool ); +%Docstring +Sets cool color component +%End + + void setDiffuse( const QColor &diffuse ); +%Docstring +Sets diffuse color component +%End + void setSpecular( const QColor &specular ); +%Docstring +Sets specular color component +%End + void setShininess( float shininess ); +%Docstring +Sets shininess of the surface +%End + + void setAlpha( float alpha ); +%Docstring +Sets alpha value +%End + + void setBeta( float beta ); +%Docstring +Sets beta value +%End + + virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); + + virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const; + + virtual QMap toExportParameters() const; + + + + bool operator==( const QgsGoochMaterialSettings &other ) const; + +}; + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/materials/qgsgoochmaterialsettings.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/3d/auto_generated/qgsmaterialregistry.sip.in b/python/3d/auto_generated/materials/qgsmaterialregistry.sip.in similarity index 96% rename from python/3d/auto_generated/qgsmaterialregistry.sip.in rename to python/3d/auto_generated/materials/qgsmaterialregistry.sip.in index d8d092fb0ef..a2725b1458a 100644 --- a/python/3d/auto_generated/qgsmaterialregistry.sip.in +++ b/python/3d/auto_generated/materials/qgsmaterialregistry.sip.in @@ -1,7 +1,7 @@ /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsmaterialregistry.h * + * src/3d/materials/qgsmaterialregistry.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ @@ -125,7 +125,7 @@ Returns ``None`` if the specified type is not found in the registry. /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsmaterialregistry.h * + * src/3d/materials/qgsmaterialregistry.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ diff --git a/python/3d/auto_generated/qgsphongmaterialsettings.sip.in b/python/3d/auto_generated/materials/qgsphongmaterialsettings.sip.in similarity index 97% rename from python/3d/auto_generated/qgsphongmaterialsettings.sip.in rename to python/3d/auto_generated/materials/qgsphongmaterialsettings.sip.in index 4d0a7451881..87a211b6d3a 100644 --- a/python/3d/auto_generated/qgsphongmaterialsettings.sip.in +++ b/python/3d/auto_generated/materials/qgsphongmaterialsettings.sip.in @@ -1,7 +1,7 @@ /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsphongmaterialsettings.h * + * src/3d/materials/qgsphongmaterialsettings.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ @@ -180,7 +180,7 @@ Sets the texture rotation in degrees /************************************************************************ * This file has been generated automatically from * * * - * src/3d/qgsphongmaterialsettings.h * + * src/3d/materials/qgsphongmaterialsettings.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index d31d0339733..e070065af11 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -258,6 +258,7 @@ IF (WITH_3D) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/3d ${CMAKE_SOURCE_DIR}/src/3d/chunks + ${CMAKE_SOURCE_DIR}/src/3d/materials ${CMAKE_SOURCE_DIR}/src/3d/processing ${CMAKE_SOURCE_DIR}/src/3d/symbols ${CMAKE_SOURCE_DIR}/src/3d/terrain diff --git a/src/3d/CMakeLists.txt b/src/3d/CMakeLists.txt index 2ffbb231a8f..8a3afe33997 100644 --- a/src/3d/CMakeLists.txt +++ b/src/3d/CMakeLists.txt @@ -7,17 +7,18 @@ SET(QGIS_3D_SRCS qgsabstract3dengine.cpp qgsabstractvectorlayer3drenderer.cpp qgs3danimationsettings.cpp + qgs3dexportobject.cpp + qgs3dmapexportsettings.cpp qgs3dmapscene.cpp qgs3dmapsettings.cpp + qgs3dsceneexporter.cpp qgs3dutils.cpp qgscameracontroller.cpp qgscamerapose.cpp qgsfeature3dhandler_p.cpp - qgsgoochmaterialsettings.cpp + qgsimagetexture.cpp qgslayoutitem3dmap.cpp - qgsmaterialregistry.cpp qgsoffscreen3dengine.cpp - qgsphongmaterialsettings.cpp qgspointlightsettings.cpp qgsdirectionallightsettings.cpp qgsraycastingutils_p.cpp @@ -36,6 +37,10 @@ SET(QGIS_3D_SRCS chunks/qgschunknode_p.cpp chunks/qgschunkqueuejob_p.cpp + materials/qgsgoochmaterialsettings.cpp + materials/qgsmaterialregistry.cpp + materials/qgsphongmaterialsettings.cpp + processing/qgs3dalgorithms.cpp processing/qgsalgorithmtessellate.cpp @@ -70,10 +75,6 @@ SET(QGIS_3D_SRCS mesh/qgsmesh3dentity_p.cpp mesh/qgsmesh3dmaterial_p.cpp mesh/qgsmeshterraingenerator.cpp - qgs3dsceneexporter.cpp - qgs3dexportobject.cpp - qgs3dmapexportsettings.cpp - qgsimagetexture.cpp ) SET(QGIS_3D_HDRS @@ -82,20 +83,17 @@ SET(QGIS_3D_HDRS qgs3danimationsettings.h qgs3dmapscene.h qgs3dmapsettings.h + qgs3dsceneexporter.h qgs3dtypes.h qgs3dutils.h qgsaabb.h qgsabstract3dengine.h - qgsabstractmaterialsettings.h qgsabstractvectorlayer3drenderer.h qgscameracontroller.h qgscamerapose.h - qgsgoochmaterialsettings.h qgslayoutitem3dmap.h - qgsmaterialregistry.h qgsmeshlayer3drenderer.h qgsoffscreen3dengine.h - qgsphongmaterialsettings.h qgspointlightsettings.h qgsdirectionallightsettings.h qgsrulebased3drenderer.h @@ -103,22 +101,30 @@ SET(QGIS_3D_HDRS qgstilingscheme.h qgsvectorlayer3drenderer.h qgswindow3dengine.h + + materials/qgsabstractmaterialsettings.h + materials/qgsgoochmaterialsettings.h + materials/qgsmaterialregistry.h + materials/qgsphongmaterialsettings.h + symbols/qgsbillboardgeometry.h symbols/qgsline3dsymbol.h symbols/qgsmesh3dsymbol.h symbols/qgspoint3dbillboardmaterial.h symbols/qgspoint3dsymbol.h symbols/qgspolygon3dsymbol.h + terrain/qgsdemterraingenerator.h terrain/qgsflatterraingenerator.h terrain/qgsonlineterraingenerator.h terrain/qgsterraindownloader.h terrain/qgsterraingenerator.h terrain/qgsterraintileloader_p.h + chunks/qgschunkloader_p.h chunks/qgschunkqueuejob_p.h + mesh/qgsmeshterraingenerator.h - qgs3dsceneexporter.h ) SET(QGIS_3D_PRIVATE_HDRS @@ -152,6 +158,7 @@ SET (QGIS_3D_RCCS shaders.qrc ../../resources/3d/textures/textures.qrc) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/chunks + ${CMAKE_CURRENT_SOURCE_DIR}/materials ${CMAKE_CURRENT_SOURCE_DIR}/mesh ${CMAKE_CURRENT_SOURCE_DIR}/symbols ${CMAKE_CURRENT_SOURCE_DIR}/terrain diff --git a/src/3d/qgsabstractmaterialsettings.h b/src/3d/materials/qgsabstractmaterialsettings.h similarity index 100% rename from src/3d/qgsabstractmaterialsettings.h rename to src/3d/materials/qgsabstractmaterialsettings.h diff --git a/src/3d/qgsgoochmaterialsettings.cpp b/src/3d/materials/qgsgoochmaterialsettings.cpp similarity index 100% rename from src/3d/qgsgoochmaterialsettings.cpp rename to src/3d/materials/qgsgoochmaterialsettings.cpp diff --git a/src/3d/qgsgoochmaterialsettings.h b/src/3d/materials/qgsgoochmaterialsettings.h similarity index 100% rename from src/3d/qgsgoochmaterialsettings.h rename to src/3d/materials/qgsgoochmaterialsettings.h diff --git a/src/3d/qgsmaterialregistry.cpp b/src/3d/materials/qgsmaterialregistry.cpp similarity index 100% rename from src/3d/qgsmaterialregistry.cpp rename to src/3d/materials/qgsmaterialregistry.cpp diff --git a/src/3d/qgsmaterialregistry.h b/src/3d/materials/qgsmaterialregistry.h similarity index 100% rename from src/3d/qgsmaterialregistry.h rename to src/3d/materials/qgsmaterialregistry.h diff --git a/src/3d/qgsphongmaterialsettings.cpp b/src/3d/materials/qgsphongmaterialsettings.cpp similarity index 100% rename from src/3d/qgsphongmaterialsettings.cpp rename to src/3d/materials/qgsphongmaterialsettings.cpp diff --git a/src/3d/qgsphongmaterialsettings.h b/src/3d/materials/qgsphongmaterialsettings.h similarity index 100% rename from src/3d/qgsphongmaterialsettings.h rename to src/3d/materials/qgsphongmaterialsettings.h diff --git a/src/3d/qgs3dexportobject.h b/src/3d/qgs3dexportobject.h index c3257d678cd..dbfad9bfe7e 100644 --- a/src/3d/qgs3dexportobject.h +++ b/src/3d/qgs3dexportobject.h @@ -24,11 +24,16 @@ #include +#define SIP_NO_FILE + class QgsAbstractMaterialSettings; /** * \brief The Qgs3DExportObject class * Manages the data of each object of the scene (positions, normals, texture coordinates ...) since each object + * + * \note Not available in Python bindings + * * \ingroup 3d * \since QGIS 3.16 */ diff --git a/src/3d/qgs3dsceneexporter.h b/src/3d/qgs3dsceneexporter.h index 1089053a5ba..6e1adf556b0 100644 --- a/src/3d/qgs3dsceneexporter.h +++ b/src/3d/qgs3dsceneexporter.h @@ -42,9 +42,14 @@ class QgsLine3DSymbol; class QgsPoint3DSymbol; class QgsMeshEntity; +#define SIP_NO_FILE + /** * \brief The Qgs3DSceneExporter class * Entity that handles the exporting of 3D scene + * + * \note Not available in Python bindings + * * \ingroup 3d * \since QGIS 3.16 */ diff --git a/src/3d/qgsimagetexture.h b/src/3d/qgsimagetexture.h index 3c7f3a357fe..99d2cf93056 100644 --- a/src/3d/qgsimagetexture.h +++ b/src/3d/qgsimagetexture.h @@ -21,10 +21,14 @@ #include #include +#define SIP_NO_FILE /** * \brief The QgsImageTexture class * Holds an image that can be used as a texture in the 3D view + * + * \note Not available in Python bindings + * * \ingroup 3d * \since QGIS 3.16 */ diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 743b7458ec2..ff8c0fd346c 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -484,8 +484,9 @@ IF (WITH_3D) ${CMAKE_SOURCE_DIR}/src/app/3d ${CMAKE_SOURCE_DIR}/src/core/3d ${CMAKE_SOURCE_DIR}/src/3d - ${CMAKE_SOURCE_DIR}/src/3d/symbols + ${CMAKE_SOURCE_DIR}/src/3d/materials ${CMAKE_SOURCE_DIR}/src/3d/mesh + ${CMAKE_SOURCE_DIR}/src/3d/symbols ${CMAKE_SOURCE_DIR}/src/3d/terrain ${CMAKE_SOURCE_DIR}/src/3d/chunks ${CMAKE_BINARY_DIR}/src/3d