Qt Quick 3D - 动态纹理范例
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick3D
import QtQuick3D.Helpers
Window {
id: window
width: 1280
height: 720
visible: true
color: "black"
View3D {
id: view
anchors.fill:parent
renderMode: View3D.Underlay
environment: SceneEnvironment {
backgroundMode: SceneEnvironment.Color
clearColor: "black"
}
Doors { id: door }
TapHandler {
gesturePolicy: TapHandler.WithinBounds
onTapped: {
var result = view.pick(point.position.x, point.position.y);
if (result.objectHit) {
console.log("pick dist", result.distance, "hit", result.objectHit,
"scene pos", result.scenePosition, "uv", result.uvPosition);
var pickedDoor = result.objectHit;
if (pickedDoor.state === "")
pickedDoor.state = "opened";
else
pickedDoor.state = "";
}
}
}
}
Rectangle {
id: object2d
width: 500
height: 700
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 10
CorkBoards { }
clip: true
layer.enabled: true
}
}