이 페이지에서

AddDefine QML Type

pass 에 대한 셰이더 컴파일 시 프리프로세서 정의(define)를 추가합니다. 더 보기...

Import Statement: import QtQuick3D
Since: Qt 6.11
Inherits:

Command

속성

상세 설명

AddDefine 유형은 RenderPass 의 셰이더 컴파일 과정에 #define 를 삽입하는 데 사용됩니다. 이를 통해 실행 중인 패스에 따라 컴파일 시점에 셰이더 동작을 분기시킬 수 있습니다.

셰이더 코드에서 이 정의는 표준 전처리기 지시어인 #ifdef / #if 와 함께 사용할 수 있습니다:

#ifdef CUSTOM_PASS_MODE
// code compiled only when this define is present
#endif
RenderPass {
    commands: [
        ColorAttachment { name: "color0"; target: colorTexture },
        AddDefine { name: "CUSTOM_PASS_MODE" },
        AddDefine { name: "OUTPUT_VERSION"; value: 2 }
    ]
}

속성 설명서

name : string

정의할 전처리기 매크로의 이름입니다. 이 이름은 셰이더 코드 내의 ` #ifdef ` 또는 ` #if ` 검사에서 사용되는 식별자가 됩니다.

value : int

전처리기 매크로에 할당된 정수 값입니다. 기본값은 ` 1`입니다. 0이 아닌 값이 지정된 경우, 셰이더 내에서 ` #if NAME `는 ` true `로 평가됩니다.

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