qml开发3D车载HMI界面

import Qt3D.Core 2.0
import Qt3D.Render 2.0
import Qt3D.Extras 2.0
import Qt3D.Examples 2.0
import QtQuick 2.5 as Quick
import QtQuick.Scene3D 2.0

Entity
{
    id: carModelEntity

    property bool hidden: true
    property Scene3D scene
    property real carRotation: 0.0
    property var previousComponent: undefined
    property var previousMaterial
    property vector3d defaultCameraPosition: Qt.vector3d(0.0, 10.0, 30.0)
    property vector3d defaultLightPosition: Qt.vector3d(0.0, 30.0, 11.0)
    property vector3d lightPosition: defaultLightPosition
    property vector3d cameraPos: defaultCameraPosition
    property vector3d lightPos: defaultLightPosition

    property real lightPosMultiplier: 1.75

    property int door_left: 1
    property int door_right: 2
    property int door_trunk: 4
    property int door_hood: 8

    property bool highlighting: false
    property bool doorAction: false

    property int highlightType: 0
    property int defaultHighlight: 99

    // Preset camera positions for highlights
    // Light positions can use the same vectors, but with a multiplier to move it further or closer
    // Lamp highlights
    property vector3d positionFrontLeftHigh: Qt.vector3d(5.0, 4.0, 15.0)       // Left headlight
    property vector3d positionFrontRightHigh: Qt.vector3d(-5.0, 4.0, 15.0)     // Right headlight
    property vector3d positionFrontLeftLow: Qt.vector3d(3.0, 2.0, 15.0)        // Left day light
    property vector3d positionFrontRightLow: Qt.vector3d(-3.0, 2.0, 15.0)      // Right day light
    property vector3d positionRearLeft: Qt.vector3d(5.0, 5.0, -15.0)           // Left tail light
    property vector3d positionRearRight: Qt.vector3d(-5.0, 5.0, -15.0)         // Right tail light
    // Tire highlights
    property vector3d positionLeftRear: Qt.vector3d(10.0, 2.0, -12.5)
    property vector3d positionLeftFront: Qt.vector3d(10.0, 2.0, 12.5)
    property vector3d positionRightRear: Qt.vector3d(-10.0, 2.0, -12.5)
    property vector3d positionRightFront: Qt.vector3d(-10.0, 2.0, 12.5)
    // Door highlights
    property vector3d positionLeft: Qt.vector3d(35.0, 10.0, 0.0)                // Doors on the left
    property vector3d positionRight: Qt.vector3d(-35.0, 10.0, 0.0)              // Doors on the right
    property vector3d positionTop: Qt.vector3d(0.0, 40.0, 1.0)                  // Doors on both sides
    property vector3d positionBack: Qt.vector3d(0.0, 20.0, -20.0)               // Trunk
    property vector3d positionFront: Qt.vector3d(0.0, 20.0, 20.0)               // Hood

    // Original
    property color bodyColor: Qt.rgba(0.6270588, 0.04137255, 0.04137255, 1.0)
    property color interiorColor: Qt.rgba(0.17, 0.17, 0.18, 1.0)
    property color highlightColor: "orange"


    Camera {
        id: camera
        projectionType: CameraLens.PerspectiveProjection
        fieldOfView: 45
        aspectRatio: scene.width / scene.height
        nearPlane: 0.1
        farPlane: 100.0
        position: defaultCameraPosition
        upVector: Qt.vector3d(0.0, 1.0, 0.0)
        viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
    }

    Entity {
        components: [
            Transform {
                translation: lightPosition
            },
            PointLight {
                color: "white"
                intensity: 1.0
            }
        ]
    }

    RenderSettings {
        Viewport {
            RenderSurfaceSelector {
              
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值