Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3d] Add new material type "QgsNullMaterialSettings"
This is a "null" shading material which should be used when rendering models or scenes with native textures and no material should be explicitly set on the loaded entities.
- Loading branch information
1 parent
6224ea9
commit 2dcbf95
Showing
13 changed files
with
321 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
python/3d/auto_generated/materials/qgsnullmaterialsettings.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
/************************************************************************ | |||
* This file has been generated automatically from * | |||
* * | |||
* src/3d/materials/qgsnullmaterialsettings.h * | |||
* * | |||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | |||
************************************************************************/ | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
class QgsNullMaterialSettings : QgsAbstractMaterialSettings | |||
{ | |||
%Docstring | |||
Null shading material used for rendering models and scenes with native textures. | |||
|
|||
.. 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.2 | |||
%End | |||
|
|||
%TypeHeaderCode | |||
#include "qgsnullmaterialsettings.h" | |||
%End | |||
public: | |||
|
|||
QgsNullMaterialSettings(); | |||
%Docstring | |||
Constructor for QgsNullMaterialSettings. | |||
%End | |||
|
|||
virtual QString type() const; | |||
|
|||
|
|||
static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique ); | |||
%Docstring | |||
Returns ``True`` if the specified ``technique`` is supported by the material. | |||
%End | |||
|
|||
static QgsAbstractMaterialSettings *create() /Factory/; | |||
%Docstring | |||
Returns a new instance of QgsNullMaterialSettings. | |||
%End | |||
|
|||
virtual QgsNullMaterialSettings *clone() const /Factory/; | |||
|
|||
|
|||
virtual QMap<QString, QString> toExportParameters() const; | |||
|
|||
|
|||
}; | |||
|
|||
|
|||
/************************************************************************ | |||
* This file has been generated automatically from * | |||
* * | |||
* src/3d/materials/qgsnullmaterialsettings.h * | |||
* * | |||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | |||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
/*************************************************************************** | |||
qgsnullmaterialsettings.cpp | |||
-------------------------------------- | |||
Date : November 2020 | |||
Copyright : (C) 2020 by Nyall Dawson | |||
Email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#include "qgsnullmaterialsettings.h" | |||
#include <QMap> | |||
|
|||
|
|||
QString QgsNullMaterialSettings::type() const | |||
{ | |||
return QStringLiteral( "null" ); | |||
} | |||
|
|||
bool QgsNullMaterialSettings::supportsTechnique( QgsMaterialSettingsRenderingTechnique technique ) | |||
{ | |||
switch ( technique ) | |||
{ | |||
case QgsMaterialSettingsRenderingTechnique::TrianglesFromModel: | |||
return true; | |||
|
|||
case QgsMaterialSettingsRenderingTechnique::Triangles: | |||
case QgsMaterialSettingsRenderingTechnique::InstancedPoints: | |||
case QgsMaterialSettingsRenderingTechnique::Points: | |||
case QgsMaterialSettingsRenderingTechnique::TrianglesWithFixedTexture: | |||
case QgsMaterialSettingsRenderingTechnique::Lines: | |||
return false; | |||
} | |||
return false; | |||
} | |||
|
|||
QgsAbstractMaterialSettings *QgsNullMaterialSettings::create() | |||
{ | |||
return new QgsNullMaterialSettings(); | |||
} | |||
|
|||
QgsNullMaterialSettings *QgsNullMaterialSettings::clone() const | |||
{ | |||
return new QgsNullMaterialSettings( *this ); | |||
} | |||
|
|||
Qt3DRender::QMaterial *QgsNullMaterialSettings::toMaterial( QgsMaterialSettingsRenderingTechnique, const QgsMaterialContext & ) const | |||
{ | |||
return nullptr; | |||
} | |||
|
|||
QMap<QString, QString> QgsNullMaterialSettings::toExportParameters() const | |||
{ | |||
QMap<QString, QString> parameters; | |||
return parameters; | |||
} | |||
|
|||
void QgsNullMaterialSettings::addParametersToEffect( Qt3DRender::QEffect * ) const | |||
{ | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,68 @@ | |||
/*************************************************************************** | |||
qgsnullmaterialsettings.h | |||
-------------------------------------- | |||
Date : November 2020 | |||
Copyright : (C) 2020 by Nyall Dawson | |||
Email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
|
|||
#ifndef QGSNULLMATERIALSETTINGS_H | |||
#define QGSNULLMATERIALSETTINGS_H | |||
|
|||
#include "qgis_3d.h" | |||
#include "qgsabstractmaterialsettings.h" | |||
|
|||
#include <QColor> | |||
|
|||
class QDomElement; | |||
|
|||
/** | |||
* \ingroup 3d | |||
* Null shading material used for rendering models and scenes with native textures. | |||
* | |||
* \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. | |||
* | |||
* \since QGIS 3.16.2 | |||
*/ | |||
class _3D_EXPORT QgsNullMaterialSettings : public QgsAbstractMaterialSettings | |||
{ | |||
public: | |||
|
|||
/** | |||
* Constructor for QgsNullMaterialSettings. | |||
*/ | |||
QgsNullMaterialSettings() = default; | |||
|
|||
QString type() const override; | |||
|
|||
/** | |||
* Returns TRUE if the specified \a technique is supported by the material. | |||
*/ | |||
static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique ); | |||
|
|||
/** | |||
* Returns a new instance of QgsNullMaterialSettings. | |||
*/ | |||
static QgsAbstractMaterialSettings *create() SIP_FACTORY; | |||
|
|||
QgsNullMaterialSettings *clone() const override SIP_FACTORY; | |||
|
|||
QMap<QString, QString> toExportParameters() const override; | |||
#ifndef SIP_RUN | |||
Qt3DRender::QMaterial *toMaterial( QgsMaterialSettingsRenderingTechnique technique, const QgsMaterialContext &context ) const override SIP_FACTORY; | |||
void addParametersToEffect( Qt3DRender::QEffect *effect ) const override; | |||
#endif | |||
|
|||
}; | |||
|
|||
|
|||
#endif // QGSNULLMATERIALSETTINGS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
/*************************************************************************** | |||
qgsnullmaterialwidget.cpp | |||
-------------------------------------- | |||
Date : November 2020 | |||
Copyright : (C) 2020 by Nyall Dawson | |||
Email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#include "qgsnullmaterialwidget.h" | |||
|
|||
#include "qgsnullmaterialsettings.h" | |||
#include "qgis.h" | |||
|
|||
QgsNullMaterialWidget::QgsNullMaterialWidget( QWidget *parent ) | |||
: QgsMaterialSettingsWidget( parent ) | |||
{ | |||
setupUi( this ); | |||
} | |||
|
|||
QgsMaterialSettingsWidget *QgsNullMaterialWidget::create() | |||
{ | |||
return new QgsNullMaterialWidget(); | |||
} | |||
|
|||
void QgsNullMaterialWidget::setSettings( const QgsAbstractMaterialSettings *, QgsVectorLayer * ) | |||
{ | |||
} | |||
|
|||
QgsAbstractMaterialSettings *QgsNullMaterialWidget::settings() | |||
{ | |||
return new QgsNullMaterialSettings(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
/*************************************************************************** | |||
qgsnullmaterialwidget.h | |||
-------------------------------------- | |||
Date : November 2020 | |||
Copyright : (C) 2020 by Nyall Dawson | |||
Email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#ifndef QGSNULLMATERIALWIDGET_H | |||
#define QGSNULLMATERIALWIDGET_H | |||
|
|||
#include "qgsmaterialsettingswidget.h" | |||
|
|||
#include <ui_nullmaterialwidget.h> | |||
|
|||
class QgsNullMaterialSettings; | |||
|
|||
|
|||
//! Widget for configuration of null material settings | |||
class QgsNullMaterialWidget : public QgsMaterialSettingsWidget, private Ui::NullMaterialWidget | |||
{ | |||
Q_OBJECT | |||
public: | |||
explicit QgsNullMaterialWidget( QWidget *parent = nullptr ); | |||
|
|||
static QgsMaterialSettingsWidget *create(); | |||
void setSettings( const QgsAbstractMaterialSettings *settings, QgsVectorLayer *layer ) override; | |||
QgsAbstractMaterialSettings *settings() override; | |||
|
|||
}; | |||
|
|||
#endif // QGSNULLMATERIALWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<ui version="4.0"> | |||
<class>NullMaterialWidget</class> | |||
<widget class="QWidget" name="NullMaterialWidget"> | |||
<property name="geometry"> | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>394</width> | |||
<height>242</height> | |||
</rect> | |||
</property> | |||
<property name="windowTitle"> | |||
<string notr="true">Form</string> | |||
</property> | |||
<layout class="QGridLayout" name="gridLayout"> | |||
<item row="0" column="0"> | |||
<widget class="QLabel" name="lblAmbient"> | |||
<property name="text"> | |||
<string>Embedded textures from source model will be used.</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
<resources/> | |||
<connections/> | |||
</ui> |