0

I am trying to understand how the various settings affect ObjectPicker behavior in Qt3D. When pickingSettings.pickResultMode is set to PickingSettings.FrontAndBackFace, the program crashes with a QtConcurrent exception as soon as the mouse is clicked anywhere on the Scene3D. Removing the setting solves the problem. What's wrong?

Qt Concurrent has caught an exception thrown from a worker thread. This is not supported, exceptions thrown in worker threads must be caught before control returns to Qt Concurrent. terminate called after throwing an instance of 'QUnhandledException' what(): std::exception

import QtQuick 2.15
import Qt3D.Core 2.15
import Qt3D.Render 2.15
import Qt3D.Extras 2.15
import Qt3D.Input 2.0
import QtQuick.Scene3D 2.5

Item {
    id: mainview
    anchors.fill: parent

    Scene3D {
        id: rootScene
        anchors.fill: parent
        aspects: ["render", "logic", "input"]

        Entity {
            id: sceneRoot

            Camera {
                id: camera
                projectionType: CameraLens.PerspectiveProjection
                fieldOfView: 45
                aspectRatio: 16 / 9
                nearPlane: 0.1
                farPlane: 100
                position: Qt.vector3d(0.770913, -8.75507, 12.1231)
                upVector: Qt.vector3d(0.0, 0.0, 1.0)
                viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
            }

            Entity {
                components: [
                    SphereMesh {
                        radius: 3
                    },
                    PhongMaterial {
                        diffuse: 'white'
                    },
                    ObjectPicker {
                        onClicked: {console.log("Sphere clicked");}
                    }
                ]
            }

            components: [
                RenderSettings {
                    activeFrameGraph: ForwardRenderer {
                        clearColor: Qt.rgba(0, 0, 0.1, 1)
                        camera: camera
                        showDebugOverlay: false
                    }
                    pickingSettings.pickMethod: PickingSettings.TrianglePicking

                    // CAUSES CRASH:
                    pickingSettings.pickResultMode: PickingSettings.FrontAndBackFace
                },
                InputSettings {}
            ]                 
        }
    } // Scene3D
}
charles
  • 192
  • 1
  • 14

0 Answers0