이 페이지에서

Qt 3D 지오메트리 렌더링

Qt 3D Render는 지오메트리 데이터를 저장하고 렌더러가 이를 어떻게 읽어야 하는지 지정하는 일반적인 방법을 제공합니다.

버퍼

Qt3DCore::QBuffer 클래스는 원시 데이터를 저장합니다. 이 클래스는 순수하게 메모리 배열의 역할을 합니다. 대부분의 경우 Qt3DCore::QBuffer는 하나 이상의 Qt3DRender::QAttributes에 의해 참조되어 간접적으로 사용됩니다. 그러나 Uniform Buffer Object(UBO)나 Shader Storage Buffer Object(SSBO)를 다룰 때, QParameter의 value 속성으로 QBuffer 를 직접 사용하는 경우도 있습니다.

Buffer {
    id: vertexBuffer
    type: Buffer.VertexBuffer
    data: buildVertexBufferData()
}

속성

Qt3DCore::QAttribute는 참조된 버퍼에 포함된 데이터를 어떻게 추출하여 버텍스 셰이더의 입력으로 전달해야 하는지를 지정합니다. 이는 Qt3DCore::QBuffer를 참조하며, 버텍스 크기, 데이터 유형, 두 버텍스 간의 스트라이드 및 시작 오프셋을 정의하여 속성의 레이아웃을 지정할 수 있습니다. 속성의 유형에 따라 버텍스 버퍼로 사용될지, 인덱스 버퍼로 사용될지도 결정됩니다. 이를 통해 버퍼 내 데이터 구조에 대한 완전한 유연성을 확보할 수 있습니다. 각 버텍스 속성마다 별도의 버퍼를 사용하거나, 모든 속성의 데이터를 포함하는 인터리브된 버퍼를 사용하거나, 별도의 버퍼와 인터리브된 버퍼를 조합하여 사용할 수 있습니다.

Attribute {
    attributeType: Attribute.VertexAttribute
    vertexBaseType: Attribute.Float
    vertexSize: 3
    byteOffset: 0
    byteStride: 9 * 4
    count: 4
    name: defaultPositionAttributeName()
    buffer: vertexBuffer
}

지오메트리

Qt3DCore::QGeometry는 다양한 속성을 통합하여 하나의 지오메트리를 형성합니다. 일반적으로 적절한 지오메트리는 정점 위치 속성, 정점 법선 속성, 텍스처 좌표 속성을 제공합니다. 지오메트리가 노멀 맵이 적용된 머티리얼과도 호환되도록 하려면 일관된 정점 탄젠트 벡터 세트도 제공해야 합니다.

Geometry {
    Attribute {
        attributeType: Attribute.VertexAttribute
        vertexBaseType: Attribute.Float
        vertexSize: 3
        byteOffset: 0
        byteStride: 9 * 4
        count: 4
        name: defaultPositionAttributeName()
        buffer: vertexBuffer
    }

    Attribute {
        attributeType: Attribute.VertexAttribute
        vertexBaseType: Attribute.Float
        vertexSize: 3
        byteOffset: 3 * 4
        byteStride: 9 * 4
        count: 4
        name: defaultNormalAttributeName()
        buffer: vertexBuffer
}

GeometryView

Qt3DCore::QGeometryView는 Qt3DCore::QGeometry를 인수로 받습니다. 이 클래스는 렌더링할 인스턴스 수, 시작 인스턴스, 사용할 Qt3DCore::QGeometryView::PrimitiveType 의 유형 등과 같이 드로우 콜을 제어하는 속성을 제공합니다.

이 클래스는 메시의 세부 사항을 완벽하게 정의하므로, 메시를 렌더링할 필요 없이 바운딩 볼륨 계산이나 피킹과 같은 연산을 수행할 수 있습니다.

GeometryView {
    instanceCount: 1
    indexOffset: 0
    firstInstance: 0
    primitiveType: GeometryRenderer.Triangles
    geometry: Geometry { ... }
}

GeometryRenderer

Qt3DRender::QGeometryRenderer는 QComponent로, QEntity에 의해 집계되면 참조하는 Qt3DCore::QGeometryView를 그릴 수 있게 해줍니다. Qt3DRender::QGeometryRenderer는 기본 그래픽 API에 대한 드로우 호출로 변환됩니다.

GeometryRenderer {
    view: GeometryView { ... }
}

참고: Qt 6이전에는 Qt3DRender::QGeometryRenderer에 현재 뷰 인스턴스에서 제공하도록 의도된 세부 정보가 포함되어 있었습니다. 해당 속성들은 Qt 6에서도 여전히 존재하지만, Qt 7에서 사용 중단된 후 제거될 예정입니다.

© 2026 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.