CubeMapTexture QML Type

3D 씬에서 사용할 큐브 맵 텍스처를 정의합니다. 더 보기...

Import Statement: import QtQuick3D
Inherits:

Texture

상세 설명

큐브맵 텍스처는 큐브맵 텍스처를 나타내는 텍스처입니다. 큐브맵 텍스처에는 6개의 면(X+, X-, Y+, Y-, Z+, Z-)이 있으며, 각 면은 개별 2D 이미지입니다. CubeMapTexture를 사용하면 custom materialspost-processing effects 셰이더에서 큐브 맵 텍스처로 작업할 수 있습니다. 큐브 맵은 씬 환경의 skybox 을 정의하는 데에도 사용할 수 있습니다.

CustomMaterial {
    property TextureInput customTexture: TextureInput {
        texture: CubeMapTexture {
            source: "cubemap.ktx"
        }
    }
    fragmentShader: "shader.frag"
}

여기서 shader.frag은 customTexture 이 샘플러 유니폼이고 GLSL 유형이 samplerCube 이라고 가정하여 구현할 수 있습니다. 즉, texture() GLSL 함수는 해당 샘플러의 텍스처 좌표로 vec3 을 취합니다. Texture 을 사용했다면 유형은 sampler2D 이 되었을 것입니다.

void MAIN()
{
    vec4 c = texture(customTexture, NORMAL);
    BASE_COLOR = vec4(c.rgb, 1.0);
}

큐브맵이 있는 컨테이너에서 텍스처를 소싱하면 면 0(X+)만 로드되고 2D 텍스처가 생성됩니다. 반면 동일한 에셋에서 CubeMapTexture를 소싱하면 6개의 면이 모두 로드되고 큐브맵 텍스처가 생성됩니다.

CubeMapTexture는 Texture에서 모든 프로퍼티를 상속받습니다. 중요한 차이점은 source 은 큐브맵이 포함된 이미지 파일 또는 이미지 파일 목록을 참조해야 한다는 것입니다. 실제로 단일 파일은 6개의 얼굴 이미지가 포함된 KTX 컨테이너를 의미합니다.

6개의 개별 이미지에서 큐브맵 텍스처를 소싱하는 방법은 두 가지가 있습니다. 세미콜론으로 구분된 파일 이름을 X+, X-, Y+, Y-, Z+, Z- 순서로 나열하는 방식입니다:

CubeMapTexture {
    source: "maps/right.jpg;maps/left.jpg;maps/top.jpg;maps/bottom.jpg;maps/front.jpg;maps/back.jpg"
}

또는 "%p" 자리 표시자가 포함된 문자열로, 여기서 "%p"는 6개의 파일명을 생성하기 위해 "posx", "negx", "posy", "negy", "posz" 및 "negz" 문자열로 대체됩니다:

CubeMapTexture {
    source: "maps/sky_%p.png"
    // equivalent to:
    // source: "maps/sky_posx.png;maps/sky_negx.png;maps/sky_posy.png;maps/sky_negy.png;maps/sky_posz.png;maps/sky_negz.png"
}

참고: sourceItem 또는 textureData 과 같은 다른 수단을 통한 이미지 데이터 소싱은 현재 CubeMapTexture에서 지원되지 않습니다.

Texture, CustomMaterial, Effect참조하세요 .

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