Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrenderhelpers.cpp File Reference

(858fcebf0ab6744af6abfee29459268ba26d7e1c)

#include "qssgdebugdrawsystem_p.h"
#include "qssgrenderhelpers_p.h"
#include "qssgrenderer_p.h"
#include "qssglayerrenderdata_p.h"
#include "qssgrhiparticles_p.h"
#include "qssgrhiquadrenderer_p.h"
#include "../qssgrendercontextcore.h"
#include "../qssgrhicustommaterialsystem_p.h"
#include "../resourcemanager/qssgrenderbuffermanager_p.h"
#include "../qssgrenderdefaultmaterialshadergenerator_p.h"
#include "rendererimpl/qssgshadowmaphelpers_p.h"
#include <QtQuick3DUtils/private/qssgassert_p.h>
#include <QtGui/qquaternion.h>
#include <QtCore/qbitarray.h>
#include <cmath>
Include dependency graph for qssgrenderhelpers.cpp:

Go to the source code of this file.

Functions

static QSSGRhiShaderPipelinePtr shadersForDefaultMaterial (QSSGRhiGraphicsPipelineState *ps, QSSGSubsetRenderable &subsetRenderable, const QSSGShaderFeatures &featureSet)
static QSSGRhiShaderPipelinePtr shadersForParticleMaterial (QSSGRhiGraphicsPipelineState *ps, QSSGParticlesRenderable &particleRenderable, QSSGRenderLayer::OITMethod method)
static void updateUniformsForDefaultMaterial (QSSGRhiShaderPipeline &shaderPipeline, QSSGRhiContext *rhiCtx, const QSSGLayerRenderData &inData, char *ubufData, QSSGRhiGraphicsPipelineState *ps, QSSGSubsetRenderable &subsetRenderable, const QSSGRenderCameraList &cameras, const QVector2D *depthAdjust, const QMatrix4x4 *alteredModelViewProjection)
static QSSGBoxPoints computeFrustumBounds (const QMatrix4x4 &projection)
static QSSGBoxPoints sliceFrustum (const QSSGBoxPoints &frustumPoints, float t0, float t1)
static std::unique_ptr< QSSGRenderCameracomputeShadowCameraFromFrustum (const QMatrix4x4 &lightMatrix, const QMatrix4x4 &lightMatrixInverted, const QVector3D &lightPivot, const QVector3D &lightForward, const QVector3D &lightUp, const float shadowMapResolution, const float pcfRadius, const QSSGBoxPoints &frustumPoints, float frustumStartT, float frustumEndT, float frustumRadius, bool lockShadowmapTexels, const QSSGBounds3 &castingBox, const QSSGBounds3 &receivingBox, QSSGDebugDrawSystem *debugDrawSystem, const bool drawCascades, const bool drawSceneCascadeIntersection)
static QVarLengthArray< std::unique_ptr< QSSGRenderCamera >, 4 > setupCascadingCamerasForShadowMap (const QSSGLayerRenderData &data, const QSSGRenderCamera &inCamera, const QSSGRenderLight *inLight, const int shadowMapResolution, const float pcfRadius, const float clipNear, const float clipFar, const QSSGBounds3 &castingObjectsBox, const QSSGBounds3 &receivingObjectsBox, bool lockShadowmapTexels, QSSGDebugDrawSystem *debugDrawSystem, bool drawCascades, bool drawSceneCascadeIntersection)
static void setupCubeReflectionCameras (const QSSGLayerRenderData &inData, const QSSGRenderReflectionProbe *inProbe, QSSGRenderCamera inCameras[6])
static void addOpaqueDepthPrePassBindings (QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRenderableImage *renderableImage, QSSGRhiShaderResourceBindingList &bindings, bool isCustomMaterialMeshSubset=false)
static void setupCubeShadowCameras (const QSSGLayerRenderData &inData, const QSSGRenderLight *inLight, float shadowMapFar, QSSGRenderCamera inCameras[6])
static int setupInstancing (QSSGSubsetRenderable *renderable, QSSGRhiGraphicsPipelineState *ps, QSSGRhiContext *rhiCtx, const QVector3D &cameraDirection, const QVector3D &cameraPosition)
static void rhiPrepareResourcesForReflectionMap (QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGLayerRenderData &inData, QSSGReflectionMapEntry *pEntry, QSSGRhiGraphicsPipelineState *ps, const QSSGRenderableObjectList &sortedOpaqueObjects, QSSGRenderCamera &inCamera, QSSGRenderer &renderer, QSSGRenderTextureCubeFace cubeFace)
static void addDepthTextureBindings (QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRhiShaderResourceBindingList &bindings)
static void addNormalTextureBindings (QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRhiShaderResourceBindingList &bindings)
static void rhiPrepareResourcesForShadowMap (QSSGRhiContext *rhiCtx, const QSSGLayerRenderData &inData, QSSGPassKey passKey, QSSGShadowMapEntry *pEntry, QSSGRhiGraphicsPipelineState *ps, const QVector2D *depthAdjust, const QSSGRenderableObjectList &sortedOpaqueObjects, QSSGRenderCamera &inCamera, bool orthographic, QSSGRenderTextureCubeFace cubeFace, quint32 cascadeIndex)
static void fillTargetBlend (QRhiGraphicsPipeline::TargetBlend *targetBlend, QSSGRenderDefaultMaterial::MaterialBlendMode materialBlend)
static QRhiViewport calculateAtlasViewport (QSize atlasPixelSize, const QSSGShadowMapEntry::AtlasEntry &atlasEntry, bool yIsUp)
static void rhiPrepareSkyBox_helper (QSSGRhiContext *rhiCtx, QSSGPassKey passKey, QSSGRenderLayer &layer, QSSGRenderCameraList &cameras, QSSGRenderer &renderer, QSSGReflectionMapEntry *entry=nullptr, QSSGRenderTextureCubeFace cubeFace=QSSGRenderTextureCubeFaceNone)

Variables

static QT_BEGIN_NAMESPACE constexpr float QSSG_PI = float(M_PI)
static constexpr float QSSG_HALFPI = float(M_PI_2)
static const QRhiShaderResourceBinding::StageFlags RENDERER_VISIBILITY_ALL

Function Documentation

◆ addDepthTextureBindings()

void addDepthTextureBindings ( QSSGRhiContext * rhiCtx,
QSSGRhiShaderPipeline * shaderPipeline,
QSSGRhiShaderResourceBindingList & bindings )
inlinestatic

Definition at line 642 of file qssgrenderhelpers.cpp.

◆ addNormalTextureBindings()

void addNormalTextureBindings ( QSSGRhiContext * rhiCtx,
QSSGRhiShaderPipeline * shaderPipeline,
QSSGRhiShaderResourceBindingList & bindings )
inlinestatic

Definition at line 682 of file qssgrenderhelpers.cpp.

◆ addOpaqueDepthPrePassBindings()

void addOpaqueDepthPrePassBindings ( QSSGRhiContext * rhiCtx,
QSSGRhiShaderPipeline * shaderPipeline,
QSSGRenderableImage * renderableImage,
QSSGRhiShaderResourceBindingList & bindings,
bool isCustomMaterialMeshSubset = false )
static

Definition at line 427 of file qssgrenderhelpers.cpp.

◆ calculateAtlasViewport()

QRhiViewport calculateAtlasViewport ( QSize atlasPixelSize,
const QSSGShadowMapEntry::AtlasEntry & atlasEntry,
bool yIsUp )
static

Definition at line 1332 of file qssgrenderhelpers.cpp.

◆ computeFrustumBounds()

QSSGBoxPoints computeFrustumBounds ( const QMatrix4x4 & projection)
static

Definition at line 133 of file qssgrenderhelpers.cpp.

◆ computeShadowCameraFromFrustum()

std::unique_ptr< QSSGRenderCamera > computeShadowCameraFromFrustum ( const QMatrix4x4 & lightMatrix,
const QMatrix4x4 & lightMatrixInverted,
const QVector3D & lightPivot,
const QVector3D & lightForward,
const QVector3D & lightUp,
const float shadowMapResolution,
const float pcfRadius,
const QSSGBoxPoints & frustumPoints,
float frustumStartT,
float frustumEndT,
float frustumRadius,
bool lockShadowmapTexels,
const QSSGBounds3 & castingBox,
const QSSGBounds3 & receivingBox,
QSSGDebugDrawSystem * debugDrawSystem,
const bool drawCascades,
const bool drawSceneCascadeIntersection )
static

Definition at line 163 of file qssgrenderhelpers.cpp.

◆ fillTargetBlend()

void fillTargetBlend ( QRhiGraphicsPipeline::TargetBlend * targetBlend,
QSSGRenderDefaultMaterial::MaterialBlendMode materialBlend )
static

Definition at line 879 of file qssgrenderhelpers.cpp.

◆ rhiPrepareResourcesForReflectionMap()

void rhiPrepareResourcesForReflectionMap ( QSSGRhiContext * rhiCtx,
QSSGPassKey passKey,
const QSSGLayerRenderData & inData,
QSSGReflectionMapEntry * pEntry,
QSSGRhiGraphicsPipelineState * ps,
const QSSGRenderableObjectList & sortedOpaqueObjects,
QSSGRenderCamera & inCamera,
QSSGRenderer & renderer,
QSSGRenderTextureCubeFace cubeFace )
static

Definition at line 602 of file qssgrenderhelpers.cpp.

◆ rhiPrepareResourcesForShadowMap()

void rhiPrepareResourcesForShadowMap ( QSSGRhiContext * rhiCtx,
const QSSGLayerRenderData & inData,
QSSGPassKey passKey,
QSSGShadowMapEntry * pEntry,
QSSGRhiGraphicsPipelineState * ps,
const QVector2D * depthAdjust,
const QSSGRenderableObjectList & sortedOpaqueObjects,
QSSGRenderCamera & inCamera,
bool orthographic,
QSSGRenderTextureCubeFace cubeFace,
quint32 cascadeIndex )
static

Definition at line 697 of file qssgrenderhelpers.cpp.

◆ rhiPrepareSkyBox_helper()

void rhiPrepareSkyBox_helper ( QSSGRhiContext * rhiCtx,
QSSGPassKey passKey,
QSSGRenderLayer & layer,
QSSGRenderCameraList & cameras,
QSSGRenderer & renderer,
QSSGReflectionMapEntry * entry = nullptr,
QSSGRenderTextureCubeFace cubeFace = QSSGRenderTextureCubeFaceNone )
static

Definition at line 2125 of file qssgrenderhelpers.cpp.

◆ setupCascadingCamerasForShadowMap()

QVarLengthArray< std::unique_ptr< QSSGRenderCamera >, 4 > setupCascadingCamerasForShadowMap ( const QSSGLayerRenderData & data,
const QSSGRenderCamera & inCamera,
const QSSGRenderLight * inLight,
const int shadowMapResolution,
const float pcfRadius,
const float clipNear,
const float clipFar,
const QSSGBounds3 & castingObjectsBox,
const QSSGBounds3 & receivingObjectsBox,
bool lockShadowmapTexels,
QSSGDebugDrawSystem * debugDrawSystem,
bool drawCascades,
bool drawSceneCascadeIntersection )
static

Definition at line 271 of file qssgrenderhelpers.cpp.

◆ setupCubeReflectionCameras()

void setupCubeReflectionCameras ( const QSSGLayerRenderData & inData,
const QSSGRenderReflectionProbe * inProbe,
QSSGRenderCamera inCameras[6] )
static

Definition at line 397 of file qssgrenderhelpers.cpp.

◆ setupCubeShadowCameras()

void setupCubeShadowCameras ( const QSSGLayerRenderData & inData,
const QSSGRenderLight * inLight,
float shadowMapFar,
QSSGRenderCamera inCameras[6] )
static

Definition at line 521 of file qssgrenderhelpers.cpp.

◆ setupInstancing()

int setupInstancing ( QSSGSubsetRenderable * renderable,
QSSGRhiGraphicsPipelineState * ps,
QSSGRhiContext * rhiCtx,
const QVector3D & cameraDirection,
const QVector3D & cameraPosition )
static

Definition at line 584 of file qssgrenderhelpers.cpp.

◆ shadersForDefaultMaterial()

QSSGRhiShaderPipelinePtr shadersForDefaultMaterial ( QSSGRhiGraphicsPipelineState * ps,
QSSGSubsetRenderable & subsetRenderable,
const QSSGShaderFeatures & featureSet )
static

Definition at line 32 of file qssgrenderhelpers.cpp.

◆ shadersForParticleMaterial()

QSSGRhiShaderPipelinePtr shadersForParticleMaterial ( QSSGRhiGraphicsPipelineState * ps,
QSSGParticlesRenderable & particleRenderable,
QSSGRenderLayer::OITMethod method )
static

Definition at line 43 of file qssgrenderhelpers.cpp.

◆ sliceFrustum()

QSSGBoxPoints sliceFrustum ( const QSSGBoxPoints & frustumPoints,
float t0,
float t1 )
static

Definition at line 152 of file qssgrenderhelpers.cpp.

◆ updateUniformsForDefaultMaterial()

void updateUniformsForDefaultMaterial ( QSSGRhiShaderPipeline & shaderPipeline,
QSSGRhiContext * rhiCtx,
const QSSGLayerRenderData & inData,
char * ubufData,
QSSGRhiGraphicsPipelineState * ps,
QSSGSubsetRenderable & subsetRenderable,
const QSSGRenderCameraList & cameras,
const QVector2D * depthAdjust,
const QMatrix4x4 * alteredModelViewProjection )
static

Definition at line 56 of file qssgrenderhelpers.cpp.

Variable Documentation

◆ QSSG_HALFPI

constexpr float QSSG_HALFPI = float(M_PI_2)
staticconstexpr

Definition at line 27 of file qssgrenderhelpers.cpp.

◆ QSSG_PI

QT_BEGIN_NAMESPACE constexpr float QSSG_PI = float(M_PI)
staticconstexpr

Definition at line 26 of file qssgrenderhelpers.cpp.

◆ RENDERER_VISIBILITY_ALL

const QRhiShaderResourceBinding::StageFlags RENDERER_VISIBILITY_ALL
static