summaryrefslogtreecommitdiffstats
path: root/src/plugins/sceneparsers
diff options
context:
space:
mode:
authorJim Albamont <jim.albamont@kdab.com>2019-02-07 13:11:48 -0600
committerPaul Lemire <paul.lemire@kdab.com>2019-02-11 06:17:32 +0000
commit3c875662801c213a9c0282de5ef7fadceeb242b3 (patch)
tree30aada420b6346a0fd9b92c653f696ce9c2b053e /src/plugins/sceneparsers
parent3bccd383606572e70e7cf32bd8d591d9f88a9ec3 (diff)
Add support for glDepthRange
Added a new QRenderState to provide access to glDepthRange. Task-number: QTBUG-73059 Change-Id: I434b73e6e499307bfa58b2a1001e4c48328e9d5b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins/sceneparsers')
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp9
-rw-r--r--src/plugins/sceneparsers/gltfexport/gltfexporter.cpp6
2 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index 79f2bf2d3..7cda33113 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -64,6 +64,7 @@
#include <Qt3DRender/qmultisampleantialiasing.h>
#include <Qt3DRender/qpointsize.h>
#include <Qt3DRender/qnodepthmask.h>
+#include <Qt3DRender/qdepthrange.h>
#include <Qt3DRender/qdepthtest.h>
#include <Qt3DRender/qseamlesscubemap.h>
#include <Qt3DRender/qstencilmask.h>
@@ -2403,9 +2404,11 @@ QRenderState* GLTFImporter::buildState(const QString& functionName, const QJsonV
}
if (functionName == QLatin1String("depthRange")) {
- //TODO: support render state depthRange
- qCWarning(GLTFImporterLog, "unsupported render state: %ls", qUtf16PrintableImpl(functionName));
- return nullptr;
+ type = GL_DEPTH_RANGE;
+ QDepthRange *depthRange = new QDepthRange;
+ depthRange->setNearValue(values.at(0).toDouble(0.0));
+ depthRange->setFarValue(values.at(1).toDouble(1.0));
+ return depthRange;
}
if (functionName == QLatin1String("frontFace")) {
diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
index ad657b4f2..40247f911 100644
--- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
+++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
@@ -84,6 +84,7 @@
#include <Qt3DRender/qclipplane.h>
#include <Qt3DRender/qcolormask.h>
#include <Qt3DRender/qcullface.h>
+#include <Qt3DRender/qdepthrange.h>
#include <Qt3DRender/qdepthtest.h>
#include <Qt3DRender/qdithering.h>
#include <Qt3DRender/qfrontface.h>
@@ -1938,6 +1939,11 @@ void GLTFExporter::exportRenderStates(QJsonObject &jsonObj, const QRenderPass *p
auto s = qobject_cast<QCullFace *>(state);
arr << s->mode();
funcObj["cullFace"] = arr;
+ } else if (qobject_cast<QDepthRange *>(state)) {
+ auto s = qobject_cast<QDepthRange *>(state);
+ arr << s->nearValue();
+ arr << s->farValue();
+ funcObj["depthRange"] = arr;
} else if (qobject_cast<QDepthTest *>(state)) {
auto s = qobject_cast<QDepthTest *>(state);
arr << s->depthFunction();