이 페이지에서

CubeMapTexture QML Type

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

Import Statement: import QtQuick3D
Inherits:

Texture

상세 설명

CubeMapTexture는 큐브 맵 텍스처를 나타내는 Texture입니다. 큐브 맵 텍스처는 6개의 면(X+, X-, Y+, Y-, Z+, Z-)으로 구성되며, 각 면은 개별적인 2D 이미지입니다. CubeMapTexture를 사용하면 custom materials 및 post-processing effects 에서 셰이더 내에서 큐브 맵 텍스처를 처리할 수 있습니다. 또한 큐브 맵을 사용하여 씬 환경의 skybox 을 정의할 수도 있습니다.

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

여기서 shader.frag는 customTexture 가 GLSL 유형 a 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개의 개별 이미지에서 CubeMapTexture를 생성하는 방법은 두 가지가 있습니다. 하나는 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"는 "posx", "negx", "posy", "negy", "posz", "negz" 문자열로 대체되어 6개의 파일 이름을 생성합니다:

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"
}

참고: 현재 CubeMapTexture에서는 sourceItem 또는 textureData 과 같은 다른 방법을 통한 이미지 데이터가져오기가 지원되지 않습니다.

Texture, CustomMaterial 및 Effect도 참조하십시오 .

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