示例#1
0
    def onLoadingDone(self):
        self.hoodClock = Qt3DAnimation.QClock(self.rootEntity)
        self.hoodAnimation = Kuesa.AnimationPlayer(self.rootEntity)
        self.hoodAnimation.setClock(self.hoodClock)
        self.hoodAnimation.setSceneEntity(self.rootEntity)
        self.hoodAnimation.setClip("HoodAction")

        self.leftDoorClock = Qt3DAnimation.QClock(self.rootEntity)
        self.leftDoorAnimation = Kuesa.AnimationPlayer(self.rootEntity)
        self.leftDoorAnimation.setClock(self.leftDoorClock)
        self.leftDoorAnimation.setSceneEntity(self.rootEntity)
        self.leftDoorAnimation.setClip("DoorLAction")

        self.rightDoorClock = Qt3DAnimation.QClock(self.rootEntity)
        self.rightDoorAnimation = Kuesa.AnimationPlayer(self.rootEntity)
        self.rightDoorAnimation.setClock(self.rightDoorClock)
        self.rightDoorAnimation.setSceneEntity(self.rootEntity)
        self.rightDoorAnimation.setClip("DoorRAction")

        self.sweepCam = self.rootEntity.camera("SweepCam")
        if self.sweepCam:
            self.sweepCam.setAspectRatio(self.width() / self.height())
            self.sweepCamCenterAnimation = Kuesa.AnimationPlayer(
                self.rootEntity)
            self.sweepCamCenterAnimation.setSceneEntity(self.rootEntity)
            self.sweepCamCenterAnimation.setClip("SweepCamCenterAction")
            self.sweepCamCenterAnimation.setLoopCount(
                Kuesa.AnimationPlayer.Infinite)
            self.sweepCamPitchAnimation = Kuesa.AnimationPlayer(
                self.rootEntity)
            self.sweepCamPitchAnimation.setSceneEntity(self.rootEntity)
            self.sweepCamPitchAnimation.setClip("SweepCamPitchAction")
            self.sweepCamPitchAnimation.setLoopCount(
                Kuesa.AnimationPlayer.Infinite)
示例#2
0
    def __init__(self):
        super(Window, self).__init__()

        self.animationAspect = Qt3DAnimation.QAnimationAspect(self)
        self.registerAspect(self.animationAspect)

        # Camera
        self.camera().setPosition(QVector3D(5.5, 1.5, 5.5))
        self.camera().setViewCenter(QVector3D(0, .5, 0))
        self.camera().setUpVector(QVector3D(0, 1, 0))
        self.camera().setAspectRatio(4. / 3.)

        # For camera controls
        self.createScene()
        self.camController = Qt3DExtras.QOrbitCameraController(self.rootEntity)
        self.camController.setLinearSpeed(50)
        self.camController.setLookSpeed(180)
        self.camController.setCamera(self.camera())

        self.fg = Kuesa.ForwardRenderer()
        self.fg.setCamera(self.camera())
        self.fg.setClearColor("white")
        self.setActiveFrameGraph(self.fg)

        self.setRootEntity(self.rootEntity)
示例#3
0
    def __init__(self):
        super(Window, self).__init__()

        # Since we are going to use animations, we need to register
        # the Qt3D animation aspect :
        self.animationAspect = Qt3DAnimation.QAnimationAspect(self)
        self.registerAspect(self.animationAspect)

        # Default set-up
        self.rootEntity = Kuesa.SceneEntity()
        self.rootEntity.addComponent(DefaultEnvMap(self.rootEntity))

        self.camera().setPosition(QVector3D(25, 1.5, 25))
        self.camera().setViewCenter(QVector3D(0, 3, 0))
        self.camera().setUpVector(QVector3D(0, 1, 0))
        self.camera().setAspectRatio(16. / 9.)

        self.camController = Qt3DExtras.QOrbitCameraController(self.rootEntity)
        self.camController.setCamera(self.camera())

        self.fg = Kuesa.ForwardRenderer()
        self.fg.setCamera(self.camera())
        self.fg.setClearColor("white")
        self.setActiveFrameGraph(self.fg)

        # Load a glTF model
        self.gltfImporter = Kuesa.GLTF2Importer(self.rootEntity)
        self.gltfImporter.setSceneEntity(self.rootEntity)
        self.gltfImporter.setSource(assetsUrl() +
                                    "/models/InterpolationTest.glb")
        self.gltfImporter.statusChanged.connect(self.on_sceneLoaded)

        self.setRootEntity(self.rootEntity)
示例#4
0
    def on_sceneLoaded(self, status):
        if (status != Kuesa.GLTF2Importer.Status.Ready):
            return

        # In this tutorial, we are going to trigger glTF animations.
        # The list of available animations can be checked with the gltfEditor,
        # in the Animation dock.
        self.animationClock = Qt3DAnimation.QClock(self.rootEntity)
        self.animationClock.setPlaybackRate(1)

        self.cubeAnimation = Kuesa.AnimationPlayer(self.rootEntity)
        self.cubeAnimation.setClock(self.animationClock)
        self.cubeAnimation.setSceneEntity(self.rootEntity)
        self.cubeAnimation.setClip("Cube.008Action")
        self.cubeAnimation.setLoopCount(-1)

        self.cubeAnimation.start()
        return