Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgrenderdefaultmaterialshadergenerator.cpp File Reference

(2a22edfedaedff54f86ac9481290368eda3d83d6)

#include <QtQuick3DUtils/private/qssgutils_p.h>
#include <QtQuick3DUtils/private/qssgassert_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderdefaultmaterialshadergenerator_p.h>
#include "qssgrendercontextcore.h"
#include <QtQuick3DRuntimeRender/private/qssgrendershadercodegenerator_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderimage_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercamera_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendershadowmap_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercustommaterial_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendershaderlibrarymanager_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendershaderkeys_p.h>
#include <QtQuick3DRuntimeRender/private/qssgshadermaterialadapter_p.h>
#include <QtQuick3DRuntimeRender/private/qssgvertexpipelineimpl_p.h>
#include <QtQuick3DRuntimeRender/private/qssglayerrenderdata_p.h>
#include <QtCore/QByteArray>
+ Include dependency graph for qssgrenderdefaultmaterialshadergenerator.cpp:

Go to the source code of this file.

Classes

struct  QT_BEGIN_NAMESPACE::ImageStrings< Type >
 
struct  QT_BEGIN_NAMESPACE::ImageStringSet
 

Namespaces

namespace  QT_BEGIN_NAMESPACE
 Combined button and popup list for selecting options.
 

Macros

#define DefineImageStrings(V)
 
#define DefineImageStringTableEntry(V)
 
#define MAX_MORPH_TARGET   8
 

Typedefs

using QT_BEGIN_NAMESPACE::Type = QSSGRenderableImage::Type
 

Functions

 QT_BEGIN_NAMESPACE::DefineImageStrings (Unknown)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Diffuse)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Opacity)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Specular)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Emissive)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Bump)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (SpecularAmountMap)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Normal)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Translucency)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Roughness)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (BaseColor)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Metalness)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Occlusion)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Height)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Clearcoat)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (ClearcoatRoughness)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (ClearcoatNormal)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Transmission)
 
 QT_BEGIN_NAMESPACE::DefineImageStrings (Thickness)
 
void QT_BEGIN_NAMESPACE::textureCoordVaryingName (char(&outString)[TEXCOORD_VAR_LEN], quint8 uvSet)
 
void QT_BEGIN_NAMESPACE::textureCoordVariableName (char(&outString)[TEXCOORD_VAR_LEN], quint8 uvSet)
 
static void addLocalVariable (QSSGStageGeneratorBase &inGenerator, const QByteArray &inName, const QByteArray &inType)
 
static QByteArray uvTransform (const QByteArray &imageRotations, const QByteArray &imageOffsets)
 
static void sanityCheckImageForSampler (const QSSGRenderableImage &image, const char *samplerName)
 
static void generateImageUVCoordinates (QSSGMaterialVertexPipeline &vertexShader, QSSGStageGeneratorBase &fragmentShader, const QSSGShaderDefaultMaterialKey &key, QSSGRenderableImage &image, bool forceFragmentShader=false, quint32 uvSet=0, bool reuseImageCoords=false)
 
static void generateImageUVSampler (QSSGMaterialVertexPipeline &vertexGenerator, QSSGStageGeneratorBase &fragmentShader, const QSSGShaderDefaultMaterialKey &key, const QSSGRenderableImage &image, char(&outString)[TEXCOORD_VAR_LEN], quint8 uvSet=0)
 
static void outputSpecularEquation (QSSGRenderDefaultMaterial::MaterialSpecularModel inSpecularModel, QSSGStageGeneratorBase &fragmentShader, const QByteArray &inLightDir, const QByteArray &inLightSpecColor)
 
static void addTranslucencyIrradiance (QSSGStageGeneratorBase &infragmentShader, QSSGRenderableImage *image, const QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames)
 
static QSSGMaterialShaderGenerator::ShadowVariableNames setupShadowMapVariableNames (qsizetype lightIdx)
 
static void maybeAddMaterialFresnel (QSSGStageGeneratorBase &fragmentShader, const QSSGShaderDefaultMaterialKeyProperties &keyProps, QSSGDataView< quint32 > inKey, bool hasMetalness)
 
static QSSGMaterialShaderGenerator::LightVariableNames setupLightVariableNames (qint32 lightIdx, QSSGRenderLight &inLight)
 
static void generateShadowMapOcclusion (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialVertexPipeline &vertexShader, quint32 lightIdx, bool inShadowEnabled, QSSGRenderLight::Type inType, const QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, const QSSGShaderDefaultMaterialKey &inKey)
 
static QSSGShaderMaterialAdaptergetMaterialAdapter (const QSSGRenderGraphObject &inMaterial)
 
static bool hasCustomFunction (const QByteArray &funcName, QSSGShaderMaterialAdapter *materialAdapter, QSSGShaderLibraryManager &shaderLibraryManager)
 
static void generateTempLightColor (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, QSSGShaderMaterialAdapter *materialAdapter)
 
static void handleSpecularLight (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, QSSGShaderMaterialAdapter *materialAdapter, QSSGShaderLibraryManager &shaderLibraryManager, bool usesSharedVar, bool hasCustomFrag, bool specularLightingEnabled, bool enableClearcoat, bool enableTransmission, bool useNormalizedDirection)
 
static void handleDirectionalLight (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, bool usesSharedVar, bool hasCustomFrag, QSSGShaderMaterialAdapter *materialAdapter, QSSGShaderLibraryManager &shaderLibraryManager, bool specularLightingEnabled, bool enableClearcoat, bool enableTransmission)
 
static void generateDirections (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, const QByteArray &lightVarPrefix, QSSGMaterialVertexPipeline &vertexShader, const QSSGShaderDefaultMaterialKey &inKey)
 
static void handlePointLight (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, QSSGShaderMaterialAdapter *materialAdapter, QSSGShaderLibraryManager &shaderLibraryManager, bool usesSharedVar, bool hasCustomFrag, bool specularLightingEnabled, bool enableClearcoat, bool enableTransmission)
 
static void handleSpotLight (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames, const QByteArray &lightVarPrefix, QSSGShaderMaterialAdapter *materialAdapter, QSSGShaderLibraryManager &shaderLibraryManager, bool usesSharedVar, bool hasCustomFrag, bool specularLightingEnabled, bool enableClearcoat, bool enableTransmission)
 
static void calculatePointLightAttenuation (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialShaderGenerator::LightVariableNames &lightVarNames)
 
static void generateMainLightCalculation (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialVertexPipeline &vertexShader, const QSSGShaderDefaultMaterialKey &inKey, const QSSGRenderGraphObject &inMaterial, const QSSGShaderLightListView &lights, QSSGShaderLibraryManager &shaderLibraryManager, QSSGRenderableImage *translucencyImage, bool hasCustomFrag, bool usesSharedVar, bool enableLightmap, bool enableShadowMaps, bool specularLightingEnabled, bool enableClearcoat, bool enableTransmission)
 
static void generateFragmentShader (QSSGStageGeneratorBase &fragmentShader, QSSGMaterialVertexPipeline &vertexShader, const QSSGShaderDefaultMaterialKey &inKey, const QSSGShaderDefaultMaterialKeyProperties &keyProps, const QSSGShaderFeatures &featureSet, const QSSGRenderGraphObject &inMaterial, const QSSGShaderLightListView &lights, QSSGRenderableImage *firstImage, QSSGShaderLibraryManager &shaderLibraryManager)
 

Variables

constexpr ImageStringSet QT_BEGIN_NAMESPACE::imageStringTable []
 
const int QT_BEGIN_NAMESPACE::TEXCOORD_VAR_LEN = 16
 
static QVarLengthArray< QSSGMaterialShaderGenerator::ShadowVariableNames, 16 > q3ds_shadowMapVariableNames
 
static constexpr QByteArrayView qssg_shader_arg_names []
 
static float ZERO_MATRIX [16] = {}
 

Macro Definition Documentation

◆ DefineImageStrings

#define DefineImageStrings ( V)
Value:
template<> struct ImageStrings<Type::V> \
{\
static constexpr const char* sampler() { return "qt_"#V"Map_sampler"; }\
static constexpr const char* offsets() { return "qt_"#V"Map_offsets"; }\
static constexpr const char* rotations() { return "qt_"#V"Map_rotations"; }\
static constexpr const char* fragCoords1() { return "qt_"#V"Map_uv_coords1"; }\
static constexpr const char* fragCoords2() { return "qt_"#V"Map_uv_coords2"; }\
static constexpr const char* samplerSize() { return "qt_"#V"Map_size"; }\
}
GLuint sampler
GLuint GLsizei const GLuint const GLintptr * offsets
Definition moc.h:23

Definition at line 31 of file qssgrenderdefaultmaterialshadergenerator.cpp.

◆ DefineImageStringTableEntry

#define DefineImageStringTableEntry ( V)
Value:
{ ImageStrings<Type::V>::sampler(), ImageStrings<Type::V>::fragCoords1(), ImageStrings<Type::V>::fragCoords2(), \
ImageStrings<Type::V>::offsets(), ImageStrings<Type::V>::rotations(), ImageStrings<Type::V>::samplerSize() }

Definition at line 71 of file qssgrenderdefaultmaterialshadergenerator.cpp.

◆ MAX_MORPH_TARGET

#define MAX_MORPH_TARGET   8

Function Documentation

◆ addLocalVariable()

static void addLocalVariable ( QSSGStageGeneratorBase & inGenerator,
const QByteArray & inName,
const QByteArray & inType )
static

Definition at line 124 of file qssgrenderdefaultmaterialshadergenerator.cpp.

Referenced by generateFragmentShader().

+ Here is the caller graph for this function:

◆ addTranslucencyIrradiance()

static void addTranslucencyIrradiance ( QSSGStageGeneratorBase & infragmentShader,
QSSGRenderableImage * image,
const QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames )
static

Definition at line 233 of file qssgrenderdefaultmaterialshadergenerator.cpp.

Referenced by generateMainLightCalculation().

+ Here is the caller graph for this function:

◆ calculatePointLightAttenuation()

static void calculatePointLightAttenuation ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames )
static

Definition at line 726 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction().

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateDirections()

static void generateDirections ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
const QByteArray & lightVarPrefix,
QSSGMaterialVertexPipeline & vertexShader,
const QSSGShaderDefaultMaterialKey & inKey )
static

Definition at line 603 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGMaterialVertexPipeline::generateWorldPosition().

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateFragmentShader()

static void generateFragmentShader ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialVertexPipeline & vertexShader,
const QSSGShaderDefaultMaterialKey & inKey,
const QSSGShaderDefaultMaterialKeyProperties & keyProps,
const QSSGShaderFeatures & featureSet,
const QSSGRenderGraphObject & inMaterial,
const QSSGShaderLightListView & lights,
QSSGRenderableImage * firstImage,
QSSGShaderLibraryManager & shaderLibraryManager )
static

Definition at line 833 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGShaderKeyTextureChannel::A, QSSGMaterialVertexPipeline::addDefinition(), QSSGStageGeneratorBase::addFunction(), QSSGStageGeneratorBase::addInclude(), addLocalVariable(), QSSGStageGeneratorBase::addUniform(), QSSGStageGeneratorBase::addUniformArray(), QSSGShaderMaterialAdapter::alphaMode(), QSSGRenderLayer::AmbientOcclusion, QByteArray::append(), QSSGStageGeneratorBase::append(), QSSGShaderKeyTextureChannel::B, QSSGRenderLayer::BaseColor, QSSGShaderDefaultMaterialKeyProperties::BaseColorChannel, QSSGShaderDefaultMaterialKeyProperties::BaseColorMap, QSSGMaterialVertexPipeline::beginFragmentGeneration(), QSSGRenderLayer::Binormal, QSSGRenderDefaultMaterial::ClearcoatAmountMask, QSSGShaderDefaultMaterialKeyProperties::ClearcoatChannel, QSSGRenderDefaultMaterial::ClearcoatNormalStrengthMask, QSSGRenderDefaultMaterial::ClearcoatRoughnessAmountMask, QSSGShaderDefaultMaterialKeyProperties::ClearcoatRoughnessChannel, QSSGShaderFeatures::CubeShadowPass, QSSGShaderFeatures::DepthPass, QSSGRenderLayer::Diffuse, QSSGShaderFeatures::DisableMultiView, QSSGRenderLayer::Emission, QSSGShaderDefaultMaterialKeyProperties::EmissiveChannel, QSSGRenderLayer::F0, QSSGShaderCache::Fragment, QSSGShaderKeyTextureChannel::G, QSSGMaterialVertexPipeline::generateDepth(), generateImageUVCoordinates(), generateImageUVSampler(), QSSGMaterialVertexPipeline::generateLightmapUVCoords(), generateMainLightCalculation(), QSSGMaterialVertexPipeline::generateShadowWorldPosition(), QSSGMaterialVertexPipeline::generateUVCoords(), QSSGMaterialVertexPipeline::generateVarTangentAndBinormal(), QSSGMaterialVertexPipeline::generateVertexColor(), QSSGMaterialVertexPipeline::generateViewVector(), QSSGMaterialVertexPipeline::generateWorldNormal(), QSSGMaterialVertexPipeline::generateWorldPosition(), getMaterialAdapter(), hasCustomFunction(), QSSGShaderMaterialAdapter::hasCustomShaderFunction(), QSSGShaderMaterialAdapter::hasCustomShaderSnippet(), QSSGShaderMaterialAdapter::hasLighting(), QSSGRenderDefaultMaterial::HeightAmountMask, QSSGShaderFeatures::IblOrientation, QSSGShaderMaterialAdapter::isBaseColorSingleChannelEnabled(), QSSGShaderMaterialAdapter::isClearcoatEnabled(), QSSGShaderMaterialAdapter::isClearcoatFresnelScaleBiasEnabled(), QSSGShaderMaterialAdapter::isEmissiveSingleChannelEnabled(), QSSGDataView< T >::isEmpty(), QSSGShaderMaterialAdapter::isFresnelScaleBiasEnabled(), QSSGShaderMaterialAdapter::isInvertOpacityMapValue(), QSSGShaderMaterialAdapter::isMetalnessEnabled(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderFeatures::isSet(), QSSGShaderMaterialAdapter::isSpecularAmountSingleChannelEnabled(), QSSGShaderMaterialAdapter::isSpecularEnabled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), QSSGShaderMaterialAdapter::isTransmissionEnabled(), QSSGShaderMaterialAdapter::isUnshaded(), QSSGShaderMaterialAdapter::isVertexColorsEnabled(), QSSGShaderMaterialAdapter::isVertexColorsMaskEnabled(), QSSGRenderDefaultMaterial::KGGX, QSSGShaderFeatures::Lightmap, QSSGRenderableImage::m_nextImage, QSSGRenderDefaultMaterial::Mask, maybeAddMaterialFresnel(), QSSGRenderLayer::Metalness, QSSGShaderDefaultMaterialKeyProperties::MetalnessChannel, QSSGRenderDefaultMaterial::MetalnessMask, QSSGRenderLayer::None, QSSGRenderLayer::Normal, QSSGRenderDefaultMaterial::NormalStrengthMask, QByteArray::number(), QSSGRenderDefaultMaterial::OcclusionAmountMask, QSSGShaderDefaultMaterialKeyProperties::OcclusionChannel, QSSGShaderDefaultMaterialKeyProperties::OpacityChannel, QSSGRenderDefaultMaterial::Opaque, QSSGShaderFeatures::OpaqueDepthPrePass, QSSGShaderFeatures::OrthoShadowPass, Q_ASSERT, Q_UNLIKELY, QByteArrayLiteral, QSSGShaderKeyTextureChannel::R, QSSGShaderFeatures::ReflectionProbe, ret, QSSGRenderLayer::Roughness, QSSGShaderDefaultMaterialKeyProperties::RoughnessChannel, QSSGRenderDefaultMaterial::RoughnessMask, QSSGRenderLayer::ShadowOcclusion, QSSGRenderLayer::Specular, QSSGShaderDefaultMaterialKeyProperties::SpecularAmountChannel, QSSGRenderDefaultMaterial::SpecularAmountMask, QSSGShaderMaterialAdapter::specularModel(), QSSGShaderFeatures::Ssao, QSSGShaderFeatures::Ssm, QSSGRenderLayer::Tangent, QSSGShaderDefaultMaterialKeyProperties::ThicknessChannel, QSSGRenderDefaultMaterial::ThicknessFactorMask, QSSGShaderDefaultMaterialKeyProperties::TranslucencyChannel, QSSGShaderDefaultMaterialKeyProperties::TransmissionChannel, QSSGRenderDefaultMaterial::TransmissionFactorMask, QSSGShaderMaterialAdapter::usesSharedVariables(), QSSGShaderCache::Vertex, QSSGShaderMaterialAdapter::vertexColorAlphaMask(), QSSGShaderMaterialAdapter::vertexColorBlueMask(), QSSGShaderMaterialAdapter::vertexColorGreenMask(), and QSSGShaderMaterialAdapter::vertexColorRedMask().

Referenced by QSSGMaterialShaderGenerator::generateMaterialRhiShader().

+ Here is the caller graph for this function:

◆ generateImageUVCoordinates()

static void generateImageUVCoordinates ( QSSGMaterialVertexPipeline & vertexShader,
QSSGStageGeneratorBase & fragmentShader,
const QSSGShaderDefaultMaterialKey & key,
QSSGRenderableImage & image,
bool forceFragmentShader = false,
quint32 uvSet = 0,
bool reuseImageCoords = false )
static

Definition at line 146 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGMaterialVertexPipeline::addFunction(), QSSGStageGeneratorBase::addFunction(), QSSGMaterialVertexPipeline::addOutgoing(), QSSGStageGeneratorBase::addUniform(), QSSGMaterialVertexPipeline::addUniform(), QSSGMaterialVertexPipeline::assignOutput(), QSSGMaterialVertexPipeline::generateEnvMapReflection(), QSSGMaterialVertexPipeline::generateUVCoords(), QSSGRenderImage::Normal, sanityCheckImageForSampler(), and uvTransform().

Referenced by generateFragmentShader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateImageUVSampler()

static void generateImageUVSampler ( QSSGMaterialVertexPipeline & vertexGenerator,
QSSGStageGeneratorBase & fragmentShader,
const QSSGShaderDefaultMaterialKey & key,
const QSSGRenderableImage & image,
char(&) outString[TEXCOORD_VAR_LEN],
quint8 uvSet = 0 )
static

Definition at line 202 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addUniform(), and sanityCheckImageForSampler().

Referenced by generateFragmentShader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateMainLightCalculation()

static void generateMainLightCalculation ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialVertexPipeline & vertexShader,
const QSSGShaderDefaultMaterialKey & inKey,
const QSSGRenderGraphObject & inMaterial,
const QSSGShaderLightListView & lights,
QSSGShaderLibraryManager & shaderLibraryManager,
QSSGRenderableImage * translucencyImage,
bool hasCustomFrag,
bool usesSharedVar,
bool enableLightmap,
bool enableShadowMaps,
bool specularLightingEnabled,
bool enableClearcoat,
bool enableTransmission )
static

Definition at line 736 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References addTranslucencyIrradiance(), QByteArray::append(), QSSGStageGeneratorBase::append(), calculatePointLightAttenuation(), generateDirections(), generateShadowMapOcclusion(), generateTempLightColor(), getMaterialAdapter(), handleDirectionalLight(), handlePointLight(), handleSpotLight(), Q_ASSERT, QSSG_MAX_NUM_SHADOW_MAPS, setupLightVariableNames(), and QSSGDataView< T >::size().

Referenced by generateFragmentShader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateShadowMapOcclusion()

static void generateShadowMapOcclusion ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialVertexPipeline & vertexShader,
quint32 lightIdx,
bool inShadowEnabled,
QSSGRenderLight::Type inType,
const QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
const QSSGShaderDefaultMaterialKey & inKey )
static

Definition at line 348 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addInclude(), QSSGStageGeneratorBase::addUniform(), QSSGMaterialVertexPipeline::generateWorldPosition(), and setupShadowMapVariableNames().

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateTempLightColor()

static void generateTempLightColor ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
QSSGShaderMaterialAdapter * materialAdapter )
static

Definition at line 481 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGShaderMaterialAdapter::isSpecularGlossy().

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaterialAdapter()

static QSSGShaderMaterialAdapter * getMaterialAdapter ( const QSSGRenderGraphObject & inMaterial)
inlinestatic

Definition at line 378 of file qssgrenderdefaultmaterialshadergenerator.cpp.

Referenced by generateFragmentShader(), generateMainLightCalculation(), and QSSGMaterialShaderGenerator::setRhiMaterialProperties().

+ Here is the caller graph for this function:

◆ handleDirectionalLight()

static void handleDirectionalLight ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
bool usesSharedVar,
bool hasCustomFrag,
QSSGShaderMaterialAdapter * materialAdapter,
QSSGShaderLibraryManager & shaderLibraryManager,
bool specularLightingEnabled,
bool enableClearcoat,
bool enableTransmission )
static

Definition at line 561 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References handleSpecularLight(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), and QByteArrayLiteral.

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlePointLight()

static void handlePointLight ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
QSSGShaderMaterialAdapter * materialAdapter,
QSSGShaderLibraryManager & shaderLibraryManager,
bool usesSharedVar,
bool hasCustomFrag,
bool specularLightingEnabled,
bool enableClearcoat,
bool enableTransmission )
static

Definition at line 626 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References handleSpecularLight(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), and QByteArrayLiteral.

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSpecularLight()

static void handleSpecularLight ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
QSSGShaderMaterialAdapter * materialAdapter,
QSSGShaderLibraryManager & shaderLibraryManager,
bool usesSharedVar,
bool hasCustomFrag,
bool specularLightingEnabled,
bool enableClearcoat,
bool enableTransmission,
bool useNormalizedDirection )
static

Definition at line 491 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), outputSpecularEquation(), QByteArrayLiteral, and QSSGShaderMaterialAdapter::specularModel().

Referenced by handleDirectionalLight(), handlePointLight(), and handleSpotLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSpotLight()

static void handleSpotLight ( QSSGStageGeneratorBase & fragmentShader,
QSSGMaterialShaderGenerator::LightVariableNames & lightVarNames,
const QByteArray & lightVarPrefix,
QSSGShaderMaterialAdapter * materialAdapter,
QSSGShaderLibraryManager & shaderLibraryManager,
bool usesSharedVar,
bool hasCustomFrag,
bool specularLightingEnabled,
bool enableClearcoat,
bool enableTransmission )
static

Definition at line 668 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References handleSpecularLight(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), and QByteArrayLiteral.

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCustomFunction()

static bool hasCustomFunction ( const QByteArray & funcName,
QSSGShaderMaterialAdapter * materialAdapter,
QSSGShaderLibraryManager & shaderLibraryManager )
static

Definition at line 474 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGShaderCache::Fragment, and QSSGShaderMaterialAdapter::hasCustomShaderFunction().

Referenced by generateFragmentShader(), handleDirectionalLight(), handlePointLight(), handleSpecularLight(), and handleSpotLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeAddMaterialFresnel()

static void maybeAddMaterialFresnel ( QSSGStageGeneratorBase & fragmentShader,
const QSSGShaderDefaultMaterialKeyProperties & keyProps,
QSSGDataView< quint32 > inKey,
bool hasMetalness )
static

Definition at line 273 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addInclude().

Referenced by generateFragmentShader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outputSpecularEquation()

static void outputSpecularEquation ( QSSGRenderDefaultMaterial::MaterialSpecularModel inSpecularModel,
QSSGStageGeneratorBase & fragmentShader,
const QByteArray & inLightDir,
const QByteArray & inLightSpecColor )
static

Definition at line 217 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction(), QSSGStageGeneratorBase::addInclude(), and QSSGRenderDefaultMaterial::KGGX.

Referenced by handleSpecularLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sanityCheckImageForSampler()

static void sanityCheckImageForSampler ( const QSSGRenderableImage & image,
const char * samplerName )
static

Definition at line 137 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References qWarning.

Referenced by generateImageUVCoordinates(), and generateImageUVSampler().

+ Here is the caller graph for this function:

◆ setupLightVariableNames()

static QSSGMaterialShaderGenerator::LightVariableNames setupLightVariableNames ( qint32 lightIdx,
QSSGRenderLight & inLight )
static

Definition at line 291 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References Q_ASSERT, and qsnprintf().

Referenced by generateMainLightCalculation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setupShadowMapVariableNames()

static QSSGMaterialShaderGenerator::ShadowVariableNames setupShadowMapVariableNames ( qsizetype lightIdx)
static

Definition at line 248 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References q3ds_shadowMapVariableNames, QByteArrayLiteral, and qsnprintf().

Referenced by generateShadowMapOcclusion(), and QSSGMaterialShaderGenerator::setRhiMaterialProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uvTransform()

static QByteArray uvTransform ( const QByteArray & imageRotations,
const QByteArray & imageOffsets )
static

Definition at line 129 of file qssgrenderdefaultmaterialshadergenerator.cpp.

Referenced by generateImageUVCoordinates().

+ Here is the caller graph for this function:

Variable Documentation

◆ q3ds_shadowMapVariableNames

◆ qssg_shader_arg_names

constexpr QByteArrayView qssg_shader_arg_names[]
staticconstexpr
Initial value:
{
{ "DIFFUSE" },
{ "BASE_COLOR" },
{ "METALNESS" },
{ "ROUGHNESS" },
{ "EMISSIVE" },
{ "SPECULAR_AMOUNT" },
{ "EMISSIVE_COLOR" },
{ "LIGHT_COLOR" },
{ "LIGHT_ATTENUATION" },
{ "SPOT_FACTOR" },
{ "SHADOW_CONTRIB" },
{ "FRESNEL_CONTRIB" },
{ "TO_LIGHT_DIR" },
{ "NORMAL" },
{ "VIEW_VECTOR" },
{ "TOTAL_AMBIENT_COLOR" },
{ "COLOR_SUM" },
{ "BINORMAL" },
{ "TANGENT" },
{ "FRESNEL_POWER" },
{ "INSTANCE_MODEL_MATRIX" },
{ "INSTANCE_MODELVIEWPROJECTION_MATRIX" },
{ "UV0" },
{ "UV1" },
{ "VERTEX" }
}

Definition at line 394 of file qssgrenderdefaultmaterialshadergenerator.cpp.

Referenced by QtQuick3DEditorHelpers::CustomMaterial::reservedArgumentNames().

◆ ZERO_MATRIX

float ZERO_MATRIX[16] = {}
static