我正在尝试将 3d 人体对象文件添加到场景中,但我目前对如何向网格添加纹理感到困惑。我尝试在 'id:humanMaterial' 下应用 .webp 纹理,但它使应用程序崩溃。
RenderableEntity{
id: human3d
source: "/image/FinalBaseMesh.obj"
scale: 1.5
position: Qt.vector3d(0.0, -16.0, 0.0)
material: NormalDiffuseMapMaterial{
id:humanMaterial
}
RenderableEntity.qml
import Qt3D.Core 2.0
import Qt3D.Render 2.0
Entity {
id: root
property vector3d position: Qt.vector3d(0, 0, 0)
property real scale: 1.0
property real rotationAngle: 0.0
property vector3d rotationAxis: Qt.vector3d(1, 0, 0)
property alias source: mesh.source
property Material material
components: [ transform, mesh, root.material ]
Transform {
id: transform
scale: root.scale
rotation: fromAxisAndAngle(root.rotationAxis, root.rotationAngle)
translation: root.position
}
Mesh {
id: mesh
}
}