summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-10-13 16:14:43 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2016-11-16 10:29:39 +0000
commitca4a58f3783472c7a1c4f8a6b900b813a6146911 (patch)
tree2684171627f9aa3646864d355bc72b62c56749cd /tools
parentd16bc2b2476de826d3e348b4608c91984ab9257e (diff)
GLTF Scene export plugin
Added a plugin that can export Qt3D entity tree as a GLTF scene. The GLTF format is extended a little to support those cases not covered by standard format. The existing GLTF import plugin was modified to support cases it didn't already support. Any meshes, transformations, default materials from Qt3DExtras, cameras, and lights can be exported and imported. Other components are ignored. Adding support for custom materials is left for the future. The camera fov unit (degrees vs radians) was also fixed to qgltf tool to make it consistent with both assimp and GLTF specs, as well as the fixed implementation in the importer plugin. Change-Id: Iaa0aa6656429abb173f291fb1a768bf98819ac84 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qgltf/qgltf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp
index a26fc487c..9471487a5 100644
--- a/tools/qgltf/qgltf.cpp
+++ b/tools/qgltf/qgltf.cpp
@@ -1014,9 +1014,9 @@ void AssimpImporter::parseCameras()
c.name = name + QStringLiteral("_cam");
c.aspectRatio = qFuzzyIsNull(cam->mAspect) ? 1.5f : cam->mAspect;
- c.yfov = qRadiansToDegrees(cam->mHorizontalFOV);
- if (c.yfov < 10) // this can't be right
- c.yfov = 45;
+ c.yfov = cam->mHorizontalFOV;
+ if (c.yfov < (M_PI / 10.0)) // this can't be right (probably orthographic source camera)
+ c.yfov = M_PI / 4.0;
c.znear = cam->mClipPlaneNear;
c.zfar = cam->mClipPlaneFar;