16 #ifndef QGSSHADOWRENDERINGFRAMEGRAPH_H
17 #define QGSSHADOWRENDERINGFRAMEGRAPH_H
20 #include <Qt3DRender/QCamera>
21 #include <Qt3DRender/QRenderSurfaceSelector>
22 #include <Qt3DRender/QViewport>
23 #include <Qt3DRender/QCameraSelector>
24 #include <Qt3DRender/QLayerFilter>
25 #include <Qt3DRender/QLayer>
26 #include <Qt3DRender/QRenderTargetSelector>
27 #include <Qt3DRender/QRenderTarget>
28 #include <Qt3DRender/QTexture>
29 #include <Qt3DRender/QClearBuffers>
30 #include <Qt3DRender/QParameter>
31 #include <Qt3DRender/QFrustumCulling>
32 #include <Qt3DRender/QRenderStateSet>
33 #include <Qt3DRender/QDepthTest>
34 #include <Qt3DRender/QCullFace>
35 #include <Qt3DRender/QPolygonOffset>
36 #include <Qt3DRender/QRenderCapture>
63 Qt3DRender::QFrameGraphNode *
frameGraphRoot() {
return mRenderSurfaceSelector; }
82 Qt3DRender::QCamera *
mainCamera() {
return mMainCamera; }
116 QgsPreviewQuad *
addTexturePreviewOverlay( Qt3DRender::QTexture2D *texture,
const QPointF ¢erNDC,
const QSizeF &size, QVector<Qt3DRender::QParameter *> additionalShaderParameters = QVector<Qt3DRender::QParameter *>() );
140 Qt3DRender::QRenderSurfaceSelector *mRenderSurfaceSelector =
nullptr;
141 Qt3DRender::QViewport *mMainViewPort =
nullptr;
142 Qt3DRender::QCameraSelector *mMainCameraSelector =
nullptr;
143 Qt3DRender::QLayerFilter *mForwardRenderLayerFilter =
nullptr;
144 Qt3DRender::QRenderTargetSelector *mForwardRenderTargetSelector =
nullptr;
145 Qt3DRender::QRenderTarget *mForwardRenderTarget =
nullptr;
146 Qt3DRender::QRenderTargetOutput *mForwardRenderTargetColorOutput =
nullptr;
147 Qt3DRender::QRenderTargetOutput *mForwardRenderTargetDepthOutput =
nullptr;
148 Qt3DRender::QTexture2D *mForwardColorTexture =
nullptr;
149 Qt3DRender::QTexture2D *mForwardDepthTexture =
nullptr;
150 Qt3DRender::QClearBuffers *mForwardClearBuffers =
nullptr;
151 Qt3DRender::QFrustumCulling *mFrustumCulling =
nullptr;
152 bool mFrustumCullingEnabled =
true;
154 Qt3DRender::QCamera *mMainCamera =
nullptr;
155 Qt3DRender::QLayerFilter *mPostprocessPassLayerFilter =
nullptr;
156 Qt3DRender::QClearBuffers *mPostprocessClearBuffers =
nullptr;
159 Qt3DRender::QLayerFilter *mPreviewLayerFilter =
nullptr;
160 Qt3DRender::QRenderStateSet *mPreviewRenderStateSet =
nullptr;
161 Qt3DRender::QDepthTest *mPreviewDepthTest =
nullptr;
162 Qt3DRender::QCullFace *mPreviewCullFace =
nullptr;
165 Qt3DRender::QRenderTargetSelector *mShadowRenderTargetSelector =
nullptr;
166 Qt3DRender::QRenderTarget *mShadowRenderTarget =
nullptr;
167 Qt3DRender::QRenderTargetOutput *mShadowRenderTargetOutput =
nullptr;
168 Qt3DRender::QTexture2D *mShadowMapTexture =
nullptr;
169 Qt3DRender::QClearBuffers *mShadowClearBuffers =
nullptr;
170 Qt3DRender::QCamera *mLightCamera =
nullptr;
171 Qt3DRender::QCameraSelector *mLightCameraSelector =
nullptr;
173 Qt3DRender::QRenderTargetSelector *mRenderCaptureTargetSelector =
nullptr;
174 Qt3DRender::QTexture2D *mRenderCaptureColorTexture =
nullptr;
175 Qt3DRender::QTexture2D *mRenderCaptureDepthTexture =
nullptr;
177 bool mShadowRenderingEnabled =
false;
178 float mShadowBias = 0.00001f;
179 int mShadowMapResolution = 2048;
181 QSize mSize = QSize( 1024, 768 );
183 bool mEyeDomeLightingEnabled =
false;
184 double mEyeDomeLightingStrength = 1000.0;
185 int mEyeDomeLightingDistance = 1;
190 Qt3DRender::QLayerFilter *mShadowSceneEntitiesFilter =
nullptr;
191 Qt3DRender::QRenderStateSet *mShadowRenderStateSet =
nullptr;
192 Qt3DRender::QCullFace *mShadowCullFace =
nullptr;
193 Qt3DRender::QDepthTest *mShadowDepthTest =
nullptr;
195 Qt3DRender::QRenderCapture *mRenderCapture =
nullptr;
197 QVector3D mLightDirection = QVector3D( 0.0, -1.0f, 0.0f );
199 Qt3DCore::QEntity *mRootEntity =
nullptr;
201 Qt3DRender::QLayer *mPostprocessPassLayer =
nullptr;
202 Qt3DRender::QLayer *mPreviewLayer =
nullptr;
203 Qt3DRender::QLayer *mForwardRenderLayer =
nullptr;
204 Qt3DRender::QLayer *mCastShadowsLayer =
nullptr;
208 QVector<QgsPreviewQuad *> mPreviewQuads;
210 Qt3DRender::QFrameGraphNode *constructShadowRenderPass();
211 Qt3DRender::QFrameGraphNode *constructForwardRenderPass();
212 Qt3DRender::QFrameGraphNode *constructTexturesPreviewPass();
213 Qt3DRender::QFrameGraphNode *constructPostprocessingPass();
215 bool mRenderCaptureEnabled =
true;
A rectangle specified with double values.
Qt3DRender::QTexture2D * forwardRenderDepthTexture()
Returns the depth texture of the forward rendering pass.
int shadowMapResolution() const
Returns the shadow map resolution.
void setupDepthMapDebugging(bool enabled, Qt::Corner corner, double size)
Sets the depth map debugging view port.
bool renderCaptureEnabled() const
Returns whether it will be possible to render to an image.
QgsShadowRenderingFrameGraph(QSurface *surface, QSize s, Qt3DRender::QCamera *mainCamera, Qt3DCore::QEntity *root)
Constructor.
Qt3DRender::QTexture2D * shadowMapTexture()
Returns the shadow map (a depth texture for the shadow rendering pass)
Qt3DRender::QTexture2D * forwardRenderColorTexture()
Returns the color texture of the forward rendering pass.
void setupShadowMapDebugging(bool enabled, Qt::Corner corner, double size)
Sets the shadow map debugging view port.
void setShadowBias(float shadowBias)
Sets the shadow bias value.
void setShadowMapResolution(int resolution)
Sets the resolution of the shadow map.
void setSize(QSize s)
Sets the size of the buffers used for rendering.
Qt3DRender::QLayer * castShadowsLayer()
Returns a layer object used to indicate that an entity will cast shadows.
void setupEyeDomeLighting(bool enabled, double strength, int distance)
Sets eye dome lighting shading related settings.
QgsPreviewQuad * addTexturePreviewOverlay(Qt3DRender::QTexture2D *texture, const QPointF ¢erNDC, const QSizeF &size, QVector< Qt3DRender::QParameter * > additionalShaderParameters=QVector< Qt3DRender::QParameter * >())
Adds an preview entity that shows a texture in real time for debugging purposes.
Qt3DRender::QRenderCapture * renderCapture()
Returns the render capture object used to take an image of the scene.
Qt3DRender::QCamera * lightCamera()
Returns the light camera.
bool shadowRenderingEnabled() const
Returns whether shadow rendering is enabled.
Qt3DRender::QLayer * forwardRenderLayer()
Returns a layer object used to indicate that an entity will be rendered during the forward rendering ...
bool frustumCullingEnabled() const
Returns whether frustum culling is enabled.
Qt3DRender::QCamera * mainCamera()
Returns the main camera.
void setFrustumCullingEnabled(bool enabled)
Sets whether frustum culling is enabled.
Qt3DCore::QEntity * rootEntity()
Returns the root entity of the entities related to the frame graph (like the post processing entity a...
QgsPostprocessingEntity * postprocessingEntity()
Returns the postprocessing entity.
void setClearColor(const QColor &clearColor)
Sets the clear color of the scene (background color)
Qt3DRender::QLayer * previewLayer()
Returns a layer object used to indicate that an entity is to be rendered during the preview textures ...
Qt3DRender::QLayer * postprocessingPassLayer()
Returns a layer object used to indicate that an entity is to be rendered during the post processing r...
Qt3DRender::QFrameGraphNode * frameGraphRoot()
Returns the root of the frame graph object.
void setRenderCaptureEnabled(bool enabled)
Sets whether it will be possible to render to an image.
void setupDirectionalLight(const QgsDirectionalLightSettings &light, float maximumShadowRenderingDistance)
Sets shadow rendering to use a directional light.
float shadowBias() const
Returns the shadow bias value.
void setShadowRenderingEnabled(bool enabled)
Sets whether the shadow rendering is enabled.