AddDefine QML Type
pass のシェーダーコンパイルにプリプロセッサ定義を追加します。詳細...
| Import Statement: | import QtQuick3D |
| Since: | Qt 6.11 |
| Inherits: |
プロパティ
詳細な説明
AddDefine タイプは、RenderPass のシェーダーコンパイルに#define を挿入するために使用されます。これにより、実行中のパスに応じて、コンパイル時にシェーダーの動作を分岐させることができます。
シェーダーコード内では、この定義を標準のプリプロセッサディレクティブ `#ifdef ` および `#if ` と共に使用できます:
#ifdef CUSTOM_PASS_MODE
// code compiled only when this define is present
#endifRenderPass {
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.