- Qt 6.12
- Qt Quick 3D
- QML Types
- AddDefine
- Qt Quick 3D | Commercial or GPLv3

# AddDefine QML Type

Adds a preprocessor define to the shader compilation for a pass. More...

Import Statement: | `import QtQuick3D`
Since: | Qt 6.11
Inherits: | Command

- List of all members, including inherited members

## Properties

- name : string
- value : int

## Detailed Description

The AddDefine type is used to inject a `#define` into the shader compilation for a RenderPass. This lets you branch shader behavior at compile time depending on which pass is being executed.

In the shader code, the define can be used with the standard preprocessor `#ifdef` / `#if` directives:

     #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 }
         ]
     }

## Property Documentation

### name : string

The name of the preprocessor macro to define. This becomes the identifier used in `#ifdef` or `#if` checks in the shader code.

### value : int

The integer value assigned to the preprocessor macro. Defaults to `1`. When non-zero, `#if NAME` evaluates to `true` in the shader.