Qt 3D: 간단한 QML 예제

Qt 3D 에서 장면을 렌더링하는 방법을 보여주는 QML 애플리케이션입니다.

Simple은 Qt 3D 에서 장면을 렌더링하는 방법을 보여줍니다.

예제 실행하기

에서 예제를 실행하려면 Qt Creator에서 Welcome 모드를 열고 Examples 에서 예제를 선택합니다. 자세한 내용은 예제 빌드 및 실행을 참조하십시오.

씬 설정하기

main.qml 파일에서 전체 씬을 설정합니다.

Q3D 및 Q3D 렌더 모듈의 유형을 사용하려면 해당 모듈을 임포트해야 합니다:

import Qt3D.Core 2.0
import Qt3D.Render 2.0

가장 먼저 생성하는 엔티티는 최종 렌더링에 사용되는 카메라를 나타내는 Camera 과 키보드나 마우스를 사용하여 이 카메라를 제어할 수 있는 카메라 컨트롤러입니다:

Camera {
    id: camera
    projectionType: CameraLens.PerspectiveProjection
    fieldOfView: 45
    aspectRatio: 16/9
    nearPlane : 0.1
    farPlane : 1000.0
    position: Qt.vector3d( 0.0, 0.0, -40.0 )
    upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
    viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}

RenderSettings 엔티티는 ForwardRenderer 을 활성 프레임그래프로 지정합니다:

components: [
    RenderSettings {
        activeFrameGraph: ForwardRenderer {
            clearColor: Qt.rgba(0, 0.5, 1, 1)
            camera: camera
            showDebugOverlay: true
        }
    },
    // Event Source will be set by the Qt3DQuickWindow
    InputSettings { }
]

이벤트 소스는 Qt3DQuickWindow에 의해 설정됩니다:

예제 프로젝트 @ code.qt.io

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.