From 60f42119fe5c341880f4576e0c9ad8d99ee277d5 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Sat, 7 Mar 2020 09:27:16 +0000 Subject: Pull bounding volume info from front end When an entity has a bounding QBoundingVolume component AND that has a QGeometryView, the bounding volume can be computed by the core aspect and the results get pulled to the render backend. Otherwise, we use the old code which computes the bounding volume in the render aspect. This means we have 2 jobs to compute bounding volumes and that the core version must complete before the render aspect runs. Change-Id: I4de45e48fa0c4d40d3d5084f387abfed5ea1a2f8 Reviewed-by: Paul Lemire --- examples/qt3d/scene3d/AnimatedEntity.qml | 6 +++++- examples/qt3d/scene3d/main.qml | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/qt3d/scene3d/AnimatedEntity.qml b/examples/qt3d/scene3d/AnimatedEntity.qml index 3e24dc785..962317a6b 100644 --- a/examples/qt3d/scene3d/AnimatedEntity.qml +++ b/examples/qt3d/scene3d/AnimatedEntity.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import Qt3D.Core 2.0 +import Qt3D.Core 2.15 import Qt3D.Render 2.15 import Qt3D.Input 2.0 import Qt3D.Extras 2.15 @@ -60,6 +60,10 @@ Entity { id: sceneRoot property RenderCapabilities capabilities : renderSettings.renderCapabilities + property bool validBounds: sphereMesh.implicitPointsValid + property vector3d sphereMinPt: sphereMesh.implicitMinPoint + property vector3d sphereMaxPt: sphereMesh.implicitMaxPoint + Camera { id: camera projectionType: CameraLens.PerspectiveProjection diff --git a/examples/qt3d/scene3d/main.qml b/examples/qt3d/scene3d/main.qml index 6d5617ca3..f7ba24ab4 100644 --- a/examples/qt3d/scene3d/main.qml +++ b/examples/qt3d/scene3d/main.qml @@ -151,6 +151,27 @@ Item { } } + Rectangle { + radius: 10 + color: "#aaffffff" + border.width: 1 + border.color: "black" + width: childrenRect.width + anchors.margins + height: childrenRect.height + anchors.margins + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.margins: 20 + visible: rootEntity.validBounds + + Column { + x: parent.anchors.margins / 2 + y: x + + Text { text: "Sphere:\n Min Extent: " + rootEntity.sphereMinPt } + Text { text: " Max Extent: " + rootEntity.sphereMaxPt } + } + } + SequentialAnimation { id: animation -- cgit v1.2.3