Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrenderdefaultmaterialshadergenerator.cpp File Reference
#include <QtQuick3DUtils/private/qssgutils_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderdefaultmaterialshadergenerator_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.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 <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:24

Definition at line 28 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 68 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 121 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 230 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction(), QSSGMaterialShaderGenerator::LightVariableNames::lightColor, and QSSGMaterialShaderGenerator::LightVariableNames::normalizedDirection.

Referenced by generateMainLightCalculation().

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

◆ calculatePointLightAttenuation()

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

Definition at line 723 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction(), QSSGMaterialShaderGenerator::LightVariableNames::lightConstantAttenuation, QSSGMaterialShaderGenerator::LightVariableNames::lightLinearAttenuation, QSSGMaterialShaderGenerator::LightVariableNames::lightQuadraticAttenuation, and QSSGMaterialShaderGenerator::LightVariableNames::relativeDistance.

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 600 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QByteArray::append(), QSSGMaterialVertexPipeline::generateWorldPosition(), QSSGMaterialShaderGenerator::LightVariableNames::lightPos, QSSGMaterialShaderGenerator::LightVariableNames::normalizedDirection, QSSGMaterialShaderGenerator::LightVariableNames::relativeDirection, and QSSGMaterialShaderGenerator::LightVariableNames::relativeDistance.

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 830 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGShaderKeyTextureChannel::A, QSSGMaterialVertexPipeline::addDefinition(), QSSGStageGeneratorBase::addFunction(), QSSGStageGeneratorBase::addInclude(), addLocalVariable(), QSSGStageGeneratorBase::addUniform(), QSSGShaderMaterialAdapter::alphaMode(), QSSGRenderLayer::AmbientOcclusion, QSSGStageGeneratorBase::append(), QSSGShaderKeyTextureChannel::B, QSSGRenderLayer::BaseColor, QSSGMaterialVertexPipeline::beginFragmentGeneration(), QSSGRenderLayer::Binormal, QSSGShaderDefaultMaterialKeyProperties::ClearcoatChannel, QSSGShaderDefaultMaterialKeyProperties::ClearcoatRoughnessChannel, QListSpecialMethodsBase< T >::contains(), QSSGShaderFeatures::CubeShadowPass, QSSGShaderFeatures::DepthPass, QSSGRenderLayer::Diffuse, QSSGRenderLayer::Emission, 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(), QSSGShaderKeyTextureChannel::getTextureChannel(), QSSGShaderKeyBoolean::getValue(), QSSGShaderKeyUnsigned< TBitWidth >::getValue(), hasCustomFunction(), QSSGShaderMaterialAdapter::hasCustomShaderFunction(), QSSGShaderMaterialAdapter::hasCustomShaderSnippet(), QSSGShaderMaterialAdapter::hasLighting(), QSSGShaderFeatures::IblOrientation, QSSGShaderMaterialAdapter::isClearcoatEnabled(), QSSGDataView< T >::isEmpty(), QSSGShaderMaterialAdapter::isMetalnessEnabled(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderFeatures::isSet(), QSSGShaderMaterialAdapter::isSpecularEnabled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), QSSGShaderMaterialAdapter::isTransmissionEnabled(), QSSGShaderMaterialAdapter::isUnshaded(), QSSGShaderMaterialAdapter::isVertexColorsEnabled(), QSSGRenderDefaultMaterial::KGGX, QSSGShaderFeatures::Lightmap, QSSGShaderDefaultMaterialKeyProperties::m_blendParticles, QSSGShaderDefaultMaterialKeyProperties::m_debugMode, QSSGShaderDefaultMaterialKeyProperties::m_fogEnabled, QSSGShaderDefaultMaterialKeyProperties::m_hasIbl, QSSGRenderableImage::m_imageNode, QSSGRenderImage::m_indexUV, QSSGShaderDefaultMaterialKeyProperties::m_isDoubleSided, QSSGRenderableImage::m_mapType, QSSGRenderableImage::m_nextImage, QSSGShaderDefaultMaterialKeyProperties::m_specularAAEnabled, QSSGShaderDefaultMaterialKeyProperties::m_targetBinormalOffset, QSSGShaderDefaultMaterialKeyProperties::m_targetColorOffset, QSSGShaderDefaultMaterialKeyProperties::m_targetCount, QSSGShaderDefaultMaterialKeyProperties::m_targetNormalOffset, QSSGShaderDefaultMaterialKeyProperties::m_targetPositionOffset, QSSGShaderDefaultMaterialKeyProperties::m_targetTangentOffset, QSSGShaderDefaultMaterialKeyProperties::m_targetTexCoord0Offset, QSSGShaderDefaultMaterialKeyProperties::m_targetTexCoord1Offset, QSSGShaderDefaultMaterialKeyProperties::m_textureChannels, QSSGShaderDefaultMaterialKeyProperties::m_usesInstancing, QSSGShaderDefaultMaterialKeyProperties::m_usesInverseProjectionMatrix, QSSGShaderDefaultMaterialKeyProperties::m_usesProjectionMatrix, QSSGRenderDefaultMaterial::Mask, maybeAddMaterialFresnel(), QSSGRenderLayer::Metalness, QSSGShaderDefaultMaterialKeyProperties::MetalnessChannel, QSSGRenderLayer::None, QSSGRenderLayer::Normal, QByteArray::number(), QSSGShaderDefaultMaterialKeyProperties::OcclusionChannel, QSSGShaderDefaultMaterialKeyProperties::OpacityChannel, QSSGRenderDefaultMaterial::Opaque, QSSGShaderFeatures::OpaqueDepthPrePass, QSSGShaderFeatures::OrthoShadowPass, QList< T >::push_back(), Q_ASSERT, Q_UNLIKELY, QByteArrayLiteral, QSSGShaderKeyTextureChannel::R, QSSGShaderFeatures::ReflectionProbe, ret, QSSGRenderLayer::Roughness, QSSGShaderDefaultMaterialKeyProperties::RoughnessChannel, QSSGRenderLayer::ShadowOcclusion, QSSGRenderLayer::Specular, QSSGShaderMaterialAdapter::specularModel(), QSSGShaderFeatures::Ssao, QSSGShaderFeatures::Ssm, QSSGRenderLayer::Tangent, QSSGShaderDefaultMaterialKeyProperties::ThicknessChannel, QSSGShaderDefaultMaterialKeyProperties::TranslucencyChannel, QSSGShaderDefaultMaterialKeyProperties::TransmissionChannel, QSSGShaderMaterialAdapter::usesSharedVariables(), and QSSGShaderCache::Vertex.

Referenced by QSSGMaterialShaderGenerator::generateMaterialRhiShader().

+ Here is the call graph for this function:
+ 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 143 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 199 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addUniform(), QSSGMaterialVertexPipeline::generateUVCoords(), 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 733 of file qssgrenderdefaultmaterialshadergenerator.cpp.

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

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 345 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addInclude(), QSSGStageGeneratorBase::addUniform(), QSSGMaterialVertexPipeline::generateWorldPosition(), QSSGMaterialShaderGenerator::LightVariableNames::lightPos, 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 478 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGShaderMaterialAdapter::isSpecularGlossy(), and QSSGMaterialShaderGenerator::LightVariableNames::lightColor.

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 375 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGRenderGraphObject::type.

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 558 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References handleSpecularLight(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), QSSGMaterialShaderGenerator::LightVariableNames::lightDirection, 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 623 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References handleSpecularLight(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), QSSGMaterialShaderGenerator::LightVariableNames::normalizedDirection, 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 488 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addFunction(), hasCustomFunction(), QSSGShaderMaterialAdapter::isPrincipled(), QSSGShaderMaterialAdapter::isSpecularGlossy(), QSSGMaterialShaderGenerator::LightVariableNames::lightDirection, QSSGMaterialShaderGenerator::LightVariableNames::lightSpecularColor, QSSGMaterialShaderGenerator::LightVariableNames::normalizedDirection, 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

◆ hasCustomFunction()

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

Definition at line 471 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 270 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QSSGStageGeneratorBase::addInclude(), QSSGShaderKeyBoolean::getValue(), and QSSGShaderDefaultMaterialKeyProperties::m_fresnelEnabled.

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 214 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 134 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 288 of file qssgrenderdefaultmaterialshadergenerator.cpp.

References QByteArray::append(), Q_ASSERT, qsnprintf(), and QSSGRenderGraphObject::type.

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 245 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 126 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 391 of file qssgrenderdefaultmaterialshadergenerator.cpp.

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

◆ ZERO_MATRIX

float ZERO_MATRIX[16] = {}
static