Revision control

Copy as Markdown

// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// Baseline: AddDefine injects #define MY_DEFINE 1 into the augment shader.
// The sphere should appear green.
import QtQuick
import QtQuick3D
import QtQuick3D.Helpers
Item {
width: 400
height: 400
View3D {
anchors.fill: parent
renderOverrides: View3D.DisableInternalPasses
environment: SceneEnvironment {
backgroundMode: SceneEnvironment.Color
clearColor: "black"
}
PerspectiveCamera {
position: Qt.vector3d(0, 0, 300)
}
RenderPassTexture {
id: outputTex
format: RenderPassTexture.RGBA8
}
RenderPass {
id: mainPass
materialMode: RenderPass.AugmentMaterial
augmentShader: "adddefine_augment.glsl"
clearColor: "black"
commands: [
ColorAttachment { target: outputTex },
DepthStencilAttachment {},
AddDefine {
name: "MY_DEFINE"
value: 1
}
]
}
SimpleQuadRenderer {
texture: Texture {
textureProvider: RenderOutputProvider {
textureSource: RenderOutputProvider.UserPassTexture
renderPass: mainPass
attachmentSelector: RenderOutputProvider.Attachment0
}
}
}
Model {
source: "#Sphere"
scale: Qt.vector3d(3, 3, 3)
materials: PrincipledMaterial {
baseColor: "white"
lighting: PrincipledMaterial.NoLighting
}
}
}
}