# quick3d **Repository Path**: yujinghuanqiu/quick3d ## Basic Information - **Project Name**: quick3d - **Description**: Quick3D demo 详细描述了如何使用 qml 显示一个 3D 模型。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 4 - **Created**: 2022-01-19 - **Last Updated**: 2025-07-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Quick 3D Quick3D demo 详细描述了如何使用 qml 显示一个 3D 模型。 ![gif](./screenshot/2022-01-19 16-11-40-332.gif) 在该 demo 中提供一个 boat.obj 3d 模型(./3d/boat.obj),用于测试3D模型显示。 1. 使用 balsam.exe (qt 自带工具) 工具转换 obj 格式的 3d 模型。 ``` balsam.exe boat.obj ``` 此时会生成 `maps` `meshes` `Boat.qml` 文件,把这些全部添加到 qml 资源文件中。 2. 使用 `Qt Quick 3D` 显示3D模型数据。 ``` import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick3D 1.15 import QtQuick3D.Helpers 1.15 Window { id: window width: 640 height: 480 visible: true View3D { id: view anchors.fill: parent environment: SceneEnvironment { clearColor: "#3a4055" backgroundMode: SceneEnvironment.Color } Node { id: scene PerspectiveCamera { id: camera z: 2000 } DirectionalLight { z: 3000 brightness: 250 } Boat { PropertyAnimation on eulerRotation.x { loops: Animation.Infinite duration: 30000 to: 360 from: 0 } PropertyAnimation on eulerRotation.y { loops: Animation.Infinite duration: 30000 to: 360 from: 0 } } } DebugView { source: view } AxisHelper { scale: Qt.vector3d(10, 10, 10) enableAxisLines: true enableXYGrid: true enableXZGrid: false enableYZGrid: false } WasdController { controlledObject: scene } } // view 3d } ```