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; }
120 QgsPreviewQuad *
addTexturePreviewOverlay( Qt3DRender::QTexture2D *texture,
const QPointF ¢erNDC,
const QSizeF &size, QVector<Qt3DRender::QParameter *> additionalShaderParameters = QVector<Qt3DRender::QParameter *>() );
144 Qt3DRender::QRenderSurfaceSelector *mRenderSurfaceSelector =
nullptr;
145 Qt3DRender::QViewport *mMainViewPort =
nullptr;
146 bool mFrustumCullingEnabled =
true;
148 Qt3DRender::QCamera *mMainCamera =
nullptr;
149 Qt3DRender::QCamera *mLightCamera =
nullptr;
152 Qt3DRender::QCameraSelector *mMainCameraSelector =
nullptr;
153 Qt3DRender::QLayerFilter *mForwardRenderLayerFilter =
nullptr;
154 Qt3DRender::QRenderTargetSelector *mForwardRenderTargetSelector =
nullptr;
155 Qt3DRender::QClearBuffers *mForwardClearBuffers =
nullptr;
156 Qt3DRender::QFrustumCulling *mFrustumCulling =
nullptr;
158 Qt3DRender::QTexture2D *mForwardColorTexture =
nullptr;
159 Qt3DRender::QTexture2D *mForwardDepthTexture =
nullptr;
162 Qt3DRender::QCameraSelector *mLightCameraSelectorShadowPass =
nullptr;
163 Qt3DRender::QLayerFilter *mShadowSceneEntitiesFilter =
nullptr;
164 Qt3DRender::QRenderTargetSelector *mShadowRenderTargetSelector =
nullptr;
165 Qt3DRender::QClearBuffers *mShadowClearBuffers =
nullptr;
166 Qt3DRender::QRenderStateSet *mShadowRenderStateSet =
nullptr;
168 Qt3DRender::QTexture2D *mShadowMapTexture =
nullptr;
174 Qt3DRender::QCameraSelector *mDepthRenderCameraSelector =
nullptr;
175 Qt3DRender::QRenderStateSet *mDepthRenderStateSet =
nullptr;;
176 Qt3DRender::QLayerFilter *mDepthRenderLayerFilter =
nullptr;
177 Qt3DRender::QRenderTargetSelector *mDepthRenderCaptureTargetSelector =
nullptr;
178 Qt3DRender::QRenderCapture *mDepthRenderCapture =
nullptr;
180 Qt3DRender::QTexture2D *mDepthRenderCaptureDepthTexture =
nullptr;
181 Qt3DRender::QTexture2D *mDepthRenderCaptureColorTexture =
nullptr;
184 Qt3DRender::QCameraSelector *mPostProcessingCameraSelector =
nullptr;
185 Qt3DRender::QLayerFilter *mPostprocessPassLayerFilter =
nullptr;
186 Qt3DRender::QClearBuffers *mPostprocessClearBuffers =
nullptr;
187 Qt3DRender::QRenderTargetSelector *mRenderCaptureTargetSelector =
nullptr;
188 Qt3DRender::QRenderCapture *mRenderCapture =
nullptr;
190 Qt3DRender::QTexture2D *mRenderCaptureColorTexture =
nullptr;
191 Qt3DRender::QTexture2D *mRenderCaptureDepthTexture =
nullptr;
194 Qt3DRender::QLayerFilter *mPreviewLayerFilter =
nullptr;
195 Qt3DRender::QRenderStateSet *mPreviewRenderStateSet =
nullptr;
196 Qt3DRender::QDepthTest *mPreviewDepthTest =
nullptr;
197 Qt3DRender::QCullFace *mPreviewCullFace =
nullptr;
199 bool mShadowRenderingEnabled =
false;
200 float mShadowBias = 0.00001f;
201 int mShadowMapResolution = 2048;
203 QSize mSize = QSize( 1024, 768 );
205 bool mEyeDomeLightingEnabled =
false;
206 double mEyeDomeLightingStrength = 1000.0;
207 int mEyeDomeLightingDistance = 1;
212 QEntity *mDepthRenderQuad =
nullptr;
214 QVector3D mLightDirection = QVector3D( 0.0, -1.0f, 0.0f );
216 Qt3DCore::QEntity *mRootEntity =
nullptr;
218 Qt3DRender::QLayer *mPostprocessPassLayer =
nullptr;
219 Qt3DRender::QLayer *mPreviewLayer =
nullptr;
220 Qt3DRender::QLayer *mForwardRenderLayer =
nullptr;
221 Qt3DRender::QLayer *mCastShadowsLayer =
nullptr;
222 Qt3DRender::QLayer *mDepthRenderPassLayer =
nullptr;
226 QVector<QgsPreviewQuad *> mPreviewQuads;
228 Qt3DRender::QFrameGraphNode *constructShadowRenderPass();
229 Qt3DRender::QFrameGraphNode *constructForwardRenderPass();
230 Qt3DRender::QFrameGraphNode *constructTexturesPreviewPass();
231 Qt3DRender::QFrameGraphNode *constructPostprocessingPass();
232 Qt3DRender::QFrameGraphNode *constructDepthRenderPass();
234 Qt3DCore::QEntity *constructDepthRenderQuad();
236 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.
Qt3DRender::QRenderCapture * depthRenderCapture()
Returns the render capture object used to take an image of the depth buffer of the scene.
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.