AdsEffect.qml Example File
shadow-map-qml/AdsEffect.qml
import Qt3D.Core 2.0
import Qt3D.Render 2.0
Effect {
id: root
property Texture2D shadowTexture
property ShadowMapLight light
//
parameters: [
Parameter { name: "lightViewProjection"; value: root.light.lightViewProjection },
Parameter { name: "lightPosition"; value: root.light.lightPosition },
Parameter { name: "lightIntensity"; value: root.light.lightIntensity },
Parameter { name: "shadowMapTexture"; value: root.shadowTexture }
]
techniques: [
Technique {
graphicsApiFilter {
api: GraphicsApiFilter.OpenGL
profile: GraphicsApiFilter.CoreProfile
majorVersion: 3
minorVersion: 2
}
renderPasses: [
RenderPass {
filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/shadowmap.vert")
fragmentShaderCode: loadSource("qrc:/shaders/shadowmap.frag")
}
renderStates: [
PolygonOffset { scaleFactor: 4; depthSteps: 4 },
DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/ads.vert")
fragmentShaderCode: loadSource("qrc:/shaders/ads.frag")
}
}
]
},
Technique {
graphicsApiFilter {
api: GraphicsApiFilter.OpenGLES
majorVersion: 3
minorVersion: 0
}
renderPasses: [
RenderPass {
filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es3/shadowmap.vert")
fragmentShaderCode: loadSource("qrc:/shaders/es3/shadowmap.frag")
}
renderStates: [
PolygonOffset { scaleFactor: 4; depthSteps: 4 },
DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es3/ads.vert")
fragmentShaderCode: loadSource("qrc:/shaders/es3/ads.frag")
}
}
]
}
]
}