summaryrefslogtreecommitdiffstats
path: root/src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2019-08-29 15:03:13 +0300
committerAntti Määttä <antti.maatta@qt.io>2019-09-12 14:29:39 +0300
commitbc4a0aa611242083403fd11f791f51cbab8d4f3a (patch)
tree3fa11a231a382513560f84db5a8b7999dd84d94b /src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h
parent18138ffc6b063e94b792ef61cbe310f90ea21287 (diff)
Implement two-pass rendering for transparent objects
If object has both opaque parts and transparent parts it will be rendered incorrectly due to no z-buffering. Add two-pass method to render the opaque and transparent parts separately. - Add opaque pixel check to transparency check of images. - Add alpha test rendering to default material shadows too. Task-number: QT3DS-3515 Change-Id: I9700b8fb463df9143c5bb9cbe66c7570081ebf5c Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h')
-rw-r--r--src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h b/src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h
index 7453e1d..871ab1b 100644
--- a/src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h
+++ b/src/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.h
@@ -103,13 +103,35 @@ namespace render {
NVDataRef<SLight *> inLights, SRenderableImage *inFirstImage, bool inHasTransparency,
const char8_t *inVertexPipelineName, const char8_t *inCustomMaterialName = "") override = 0;
+ // generate default material shader for depth only pass
+ virtual NVRenderShaderProgram *GenerateDepthPassShader(
+ const SGraphObject &inMaterial, SShaderDefaultMaterialKey inShaderDescription,
+ IShaderStageGenerator &inVertexPipeline, TShaderFeatureSet inFeatureSet,
+ SRenderableImage *inFirstImage, bool inHasTransparency,
+ const char8_t *inVertexPipelineName, const char8_t *inCustomMaterialName = "") = 0;
+
+ // generate default material shader cube depth shader
+ virtual NVRenderShaderProgram *GenerateCubeDepthShader(
+ const SGraphObject &inMaterial, SShaderDefaultMaterialKey inShaderDescription,
+ IShaderStageGenerator &inVertexPipeline, TShaderFeatureSet inFeatureSet,
+ SRenderableImage *inFirstImage, bool inHasTransparency,
+ const char8_t *inVertexPipelineName, const char8_t *inCustomMaterialName = "") = 0;
+
+ // generate default material shader orthographic depth shader
+ virtual NVRenderShaderProgram *GenerateOrthoDepthShader(
+ const SGraphObject &inMaterial, SShaderDefaultMaterialKey inShaderDescription,
+ IShaderStageGenerator &inVertexPipeline, TShaderFeatureSet inFeatureSet,
+ SRenderableImage *inFirstImage, bool inHasTransparency,
+ const char8_t *inVertexPipelineName, const char8_t *inCustomMaterialName = "") = 0;
+
// Also sets the blend function on the render context.
virtual void
SetMaterialProperties(NVRenderShaderProgram &inProgram, const SGraphObject &inMaterial,
const QT3DSVec2 &inCameraVec, const QT3DSMat44 &inModelViewProjection,
const QT3DSMat33 &inNormalMatrix, const QT3DSMat44 &inGlobalTransform,
SRenderableImage *inFirstImage, QT3DSF32 inOpacity,
- SLayerGlobalRenderProperties inRenderProperties) override = 0;
+ SLayerGlobalRenderProperties inRenderProperties,
+ const QT3DSVec2 &alphaOpRef) override = 0;
static IDefaultMaterialShaderGenerator &
CreateDefaultMaterialShaderGenerator(IQt3DSRenderContext &inRenderContext);