esp::gfx::PbrShader class

Public types

class Configuration
PBR Shader configuration.
struct PbrEquationScales
enum (anonymous): Magnum::UnsignedInt { ColorOutput = Magnum::Shaders::GenericGL3D::ColorOutput, ObjectIdOutput = Magnum::Shaders::GenericGL3D::ObjectIdOutput }
enum class Flag: Magnum::UnsignedLong { BaseColorTexture = 1ULL << 0, NoneRoughnessMetallicTexture = 1ULL << 1, OcclusionTexture = 1ULL << 2, NormalTexture = 1ULL << 3, EmissiveTexture = 1ULL << 4, VertexColor = 1ULL << 5, TextureTransformation = 1ULL << 6, PrecomputedTangent = 1ULL << 7, ObjectId = 1ULL << 8, InstancedObjectId = (1ULL << 9) | ObjectId, ClearCoatLayer = 1ULL << 10, ClearCoatTexture = (1ULL << 11) | ClearCoatLayer, ClearCoatRoughnessTexture = (1ULL << 12) | ClearCoatLayer, ClearCoatNormalTexture = (1ULL << 13) | ClearCoatLayer, SpecularLayer = 1ULL << 14, SpecularLayerTexture = (1ULL << 15) | SpecularLayer, SpecularLayerColorTexture = (1ULL << 16) | SpecularLayer, AnisotropyLayer = 1ULL << 17, AnisotropyLayerTexture = (1ULL << 18) | AnisotropyLayer, TransmissionLayer = 1ULL << 19, TransmissionLayerTexture = (1ULL << 20) | TransmissionLayer, VolumeLayer = 1ULL << 21, VolumeLayerThicknessTexture = (1ULL << 22) | VolumeLayer, DoubleSided = 1ULL << 23, SkinnedMesh = 1ULL << 23, DirectLighting = 1ULL << 24, ImageBasedLighting = 1ULL << 25, UseBurleyDiffuse = 1ULL << 26, SkipMissingTBNCalc = 1ULL << 27, UseMikkelsenTBN = 1ULL << 28, MapMatTxtrToLinear = 1ULL << 29, MapIBLTxtrToLinear = 1ULL << 30, MapOutputToSRGB = 1ULL << 31, UseDirectLightTonemap = 1ULL << 32, UseIBLTonemap = 1ULL << 33, SkipClearCoatLayer = 1ULL << 34, SkipSpecularLayer = 1ULL << 35, SkipAnisotropyLayer = 1ULL << 36, DebugDisplay = 1ULL << 37 }
Flags enums describing various features present in shader.
enum class PbrDebugDisplay: uint8_t { None = 0, DirectDiffuse = 1, DirectSpecular = 2, IblDiffuse = 3, IblSpecular = 4, Normal = 5 }
using Position = Magnum::Shaders::GenericGL3D::Position
vertex positions
using Normal = Magnum::Shaders::GenericGL3D::Normal
normal direction
using JointIds = Magnum::Shaders::GenericGL3D::JointIds
Joint ids (See Magnum/Shaders/PhongGL.h)
using Weights = Magnum::Shaders::GenericGL3D::Weights
Weights (See Magnum/Shaders/PhongGL.h)
using SecondaryJointIds = Magnum::Shaders::GenericGL3D::SecondaryJointIds
Secondary joint ids (See Magnum/Shaders/PhongGL.h)
using SecondaryWeights = Magnum::Shaders::GenericGL3D::SecondaryWeights
Secondary weights (See Magnum/Shaders/PhongGL.h)
using TextureCoordinates = Magnum::Shaders::GenericGL3D::TextureCoordinates
2D texture coordinates
using Tangent4 = Magnum::Shaders::GenericGL3D::Tangent4
Tangent direction with the fourth component indicating the handedness.
using Color4 = Magnum::Shaders::GenericGL3D::Color4
Four-component vertex color.
using Flags = Corrade::Containers::EnumSet<Flag>
Flags.

Constructors, destructors, conversion operators

PbrShader(const Configuration& config) explicit
Constructor.
PbrShader(const PbrShader&) deleted
Copying is not allowed.
PbrShader(PbrShader&&) defaulted noexcept
Move constructor.

Public functions

auto operator=(const PbrShader&) -> PbrShader& deleted
Copying is not allowed.
auto operator=(PbrShader&&) -> PbrShader& defaulted noexcept
Move assignment.
auto lightCount() const -> Magnum::UnsignedInt
Get number of lights.
auto directLightingIsEnabled() const -> bool
whether this shader as direct lighting enabled and there are lights defined.
auto lightingIsEnabled() const -> bool
whether this shader has any lighting enabled, either direct or indirect/IBL.
auto directAndIBLIsEnabled() const -> bool
whether this shader has both direct lighting and IBL enabled.
auto isTextured() const -> bool
whether any textures are present in this shader.
auto flags() const -> Flags
Flags.
auto bindBaseColorTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the BaseColor texture.
auto bindMetallicRoughnessTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the metallic-roughness texture NOTE that though MetallicRoughnessTexture exists, it does not mean both metallic texture and roughness texture exist.
auto bindNormalTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the normal texture.
auto bindEmissiveTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the emissive texture.
auto bindClearCoatFactorTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the clearcoat factor texture.
auto bindClearCoatRoughnessTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the clearcoat roughness texture.
auto bindClearCoatNormalTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the clearcoat normal texture.
auto bindSpecularLayerTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the specular layer texture.
auto bindSpecularLayerColorTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the specular layer color texture.
auto bindAnisotropyLayerTexture(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the anisotropy layer texture.
auto bindIrradianceCubeMap(Magnum::GL::CubeMapTexture& texture) -> PbrShader&
Bind the irradiance cubemap texture.
auto bindBrdfLUT(Magnum::GL::Texture2D& texture) -> PbrShader&
Bind the BRDF LUT texture NOTE: requires Flag::ImageBasedLighting is set.
auto bindPrefilteredMap(Magnum::GL::CubeMapTexture& texture) -> PbrShader&
Bind the prefiltered environment map (cubemap texture) NOTE: requires Flag::ImageBasedLighting is set.
auto setTextureMatrix(const Magnum::Matrix3& matrix) -> PbrShader&
set the texture transformation matrix
auto setProjectionMatrix(const Magnum::Matrix4& matrix) -> PbrShader&
Set "projection" matrix to the uniform on GPU.
auto setViewMatrix(const Magnum::Matrix4& matrix) -> PbrShader&
Set view matrix to the uniform on GPU.
auto setModelMatrix(const Magnum::Matrix4& matrix) -> PbrShader&
Set model matrix to the uniform on GPU.
auto setNormalMatrix(const Magnum::Matrix3x3& matrix) -> PbrShader&
Set normal matrix to the uniform on GPU normal = inverse transpose of the up-left 3x3 matrix of the modelview matrix.
auto setBaseColor(const Magnum::Color4& color) -> PbrShader&
Set base color to the uniform on GPU.
auto setEmissiveColor(const Magnum::Color3& color) -> PbrShader&
Set emissive color to the uniform on GPU.
auto setRoughness(float roughness) -> PbrShader&
Set roughness to the uniform on GPU.
auto setMetallic(float metallic) -> PbrShader&
Set metallic to the uniform on GPU.
auto setIndexOfRefraction(float ior) -> PbrShader&
Set index of refraction.
auto setClearCoatFactor(float ccFactor) -> PbrShader&
Set clearcoat intensity/factor.
auto setClearCoatRoughness(float ccRoughness) -> PbrShader&
Set clearcoat roughness.
auto setClearCoatNormalTextureScale(float ccTextureScale) -> PbrShader&
Set clearcoat normal texture scale.
auto setSpecularLayerFactor(float specLayerFactor) -> PbrShader&
Set specular layer factor.
auto setSpecularLayerColorFactor(const Magnum::Color3& color) -> PbrShader&
Set specular layer color factor.
auto setAnisotropyLayerFactor(float anisoLayerFactor) -> PbrShader&
Set anisotropy layer factor.
auto setAnisotropyLayerDirection(const Magnum::Vector2& anisoLayerDirection) -> PbrShader&
Set anisotropy layer direction 2d vector.
auto setObjectId(unsigned int objectId) -> PbrShader&
Set object id to the uniform on GPU.
auto setCameraWorldPosition(const Magnum::Vector3& cameraWorldPos) -> PbrShader&
Set object id to the uniform on GPU.
auto setPrefilteredMapMipLevels(unsigned int mipLevels) -> PbrShader&
Set total mipmap levels of the prefiltered environment map to the uniform on GPU.
auto setLightPositions(Corrade::Containers::ArrayView<const Magnum::Vector4> vectors) -> PbrShader&
Set light positions or directions.
auto setLightPositions(std::initializer_list<Magnum::Vector4> vectors) -> PbrShader&
auto setLightVector(unsigned int lightIndex, const Magnum::Vector4& vec) -> PbrShader&
Set the position or direction of a specific light See vec for details.
auto setLightPosition(unsigned int lightIndex, const Magnum::Vector3& pos) -> PbrShader&
Set the position of a specific light.
auto setLightDirection(unsigned int lightIndex, const Magnum::Vector3& dir) -> PbrShader&
Set the direction of a specific light.
auto setLightRange(unsigned int lightIndex, float range) -> PbrShader&
Set the range of a specific light.
auto setLightColor(unsigned int lightIndex, const Magnum::Vector3& color, float intensity = 1.0f) -> PbrShader&
Set the color of a specific light.
auto setLightColors(Corrade::Containers::ArrayView<const Magnum::Color3> colors) -> PbrShader&
Set the colors of the lights.
auto setLightColors(std::initializer_list<Magnum::Color3> colors) -> PbrShader&
auto setLightRanges(Corrade::Containers::ArrayView<const float> ranges) -> PbrShader&
Set the ranges of the lights.
auto setLightRanges(std::initializer_list<float> ranges) -> PbrShader&
auto setDirectLightIntensity(float lightIntensity) -> PbrShader&
Set the global lighting intensity applied equally across all lights for direct lighting.
auto setGamma(const Magnum::Vector3& gamma) -> PbrShader&
Set the gamma value used for remapping sRGB to linear approximations.
auto setTonemapExposure(float exposure) -> PbrShader&
Set the IBL exposure value.
auto setNormalTextureScale(float scale) -> PbrShader&
Set the scale of the normal texture.
auto setJointMatrices(Corrade::Containers::ArrayView<const Magnum::Matrix4> matrices) -> PbrShader&
Set joint matrices (See Magnum/Shaders/PhongGL.h)
auto setJointMatrices(std::initializer_list<Magnum::Matrix4> matrices) -> PbrShader&
auto setJointMatrix(Magnum::UnsignedInt id, const Magnum::Matrix4& matrix) -> PbrShader&
Set joint matrix for given joint (See Magnum/Shaders/PhongGL.h)
auto setPerInstanceJointCount(Magnum::UnsignedInt count) -> PbrShader&
Set per-instance joint count (See Magnum/Shaders/PhongGL.h)
auto setPbrEquationScales(const PbrEquationScales& scales) -> PbrShader&
Set the scales for different components in the pbr equation.
auto setDebugDisplay(PbrDebugDisplay index) -> PbrShader&
debug display visualization

Protected variables

Flags flags_
Magnum::UnsignedInt lightCount_
Magnum::UnsignedInt jointCount_
Magnum::UnsignedInt perVertexJointCount_
Magnum::UnsignedInt secondaryPerVertexJointCount_
bool isSkinned_
bool isTextured_
bool lightingIsEnabled_
bool directLightingIsEnabled_
bool directAndIBLisEnabled_
bool mapInputToLinear_
int viewMatrixUniform_
int modelMatrixUniform_
int normalMatrixUniform_
int projMatrixUniform_
int baseColorUniform_
int roughnessUniform_
int metallicUniform_
int iorUniform_
int emissiveColorUniform_
int objectIdUniform_
int textureMatrixUniform_
int normalTextureScaleUniform_
int lightColorsUniform_
int lightRangesUniform_
int jointMatricesUniform_
int perInstanceJointCountUniform_
int lightDirectionsUniform_
int directLightingIntensityUniform_
int tonemapExposureUniform_
int gammaUniform_
int invGammaUniform_
int cameraWorldPosUniform_
int prefilteredMapMipLevelsUniform_
int clearCoatFactorUniform_
int clearCoatTextureScaleUniform_
int clearCoatRoughnessUniform_
int specularLayerFactorUniform_
int specularLayerColorFactorUniform_
int anisotropyLayerFactorUniform_
int anisotropyLayerDirectionUniform_
int componentScalesUniform_
int pbrDebugDisplayUniform_

Enum documentation

enum esp::gfx::PbrShader::(anonymous): Magnum::UnsignedInt

Enumerators
ColorOutput

Color shader output. Generic output, present always. Expects three- or four-component floating-point or normalized buffer attachment.

ObjectIdOutput

Object ID shader output. Generic output, present only if Flag::ObjectId is set. Expects a single-component unsigned integral attachment. Writes the value set in setObjectId() there.

enum class esp::gfx::PbrShader::Flag: Magnum::UnsignedLong

Flags enums describing various features present in shader.

Enumerators
BaseColorTexture

Multiply base color with the baseColor texture.

NoneRoughnessMetallicTexture

This flag term means the NoneRoughnessMetallic texture is present, with the Roughness in G channel and metalness in B channel (R and Alpha channels are not used).

OcclusionTexture

NormalTexture

Modify normals according to a texture.

EmissiveTexture

emissive texture

VertexColor

Support mesh vertex colors

TextureTransformation

Enable texture coordinate transformation. If this flag is set, the shader expects that at least one of Flag::BaseColorTexture, Flag::RoughnessTexture, Flag::MetallicTexture, Flag::NormalTexture, Flag::EmissiveTexture Flag::NoneRoughnessMetallicTexture or Flag::OcclusionRoughnessMetallicTexture is enabled as well.

PrecomputedTangent

TODO: Do we need instanced object? (instanced texture, instanced id etc.) TODO: Do we need VertexColor? Multiply diffuse color with a vertex color. Requires either the Color3 or Color4 attribute to be present.

ObjectId

Enable object ID output for this shader.

InstancedObjectId

Support Instanced object ID. Retrieves a per-instance / per-vertex object ID from the ObjectId attribute. If this is false, the shader will use the node's semantic ID

ClearCoatLayer

Has ClearCoat layer.

ClearCoatTexture

Has ClearCoat Texture in ClearCoat layer

ClearCoatRoughnessTexture

Has Roughness Texture in ClearCoat layer

ClearCoatNormalTexture

Has Normal Texture in ClearCoat layer

SpecularLayer

Has KHR_materials_specular layer

SpecularLayerTexture

Has Specular Texture in KHR_materials_specular layer

SpecularLayerColorTexture

Has Specular Color Texture in KHR_materials_specular layer

AnisotropyLayer

Has KHR_materials_anisotropy layer

AnisotropyLayerTexture

Has Anisotropy Texture in KHR_materials_anisotropy layer

TransmissionLayer

Has KHR_materials_transmission layer

TransmissionLayerTexture

Has transmission texture in KHR_materials_transmission layer

VolumeLayer

Has KHR_materials_volume layer

VolumeLayerThicknessTexture

Has Thickness texture in KHR_materials_volume layer

DoubleSided

Enable double-sided rendering.

SkinnedMesh

Enable Skin rendering

DirectLighting

If not set, disable direct lighting regardless of presence of lights. Ignored if no direct lights present.

ImageBasedLighting

Enable image based lighting

UseBurleyDiffuse

Whether or not the direct lighting diffuse calculation should use the Disney/Burley algorithm or the lambertian calculation. If set, the PBR shader uses a calc based on modified to be more energy conserving. https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf Lambertian is simpler and quicker to calculate but may not look as 'nice'

SkipMissingTBNCalc

If set, skip TBN frame calculation in fragment shader. This calculation enables normal textures and anisotropy when no precomputed tangents are provided. TODO : implement in shader.

UseMikkelsenTBN

Use the Mikkelsen algorithm to calculate TBN, as per https://jcgt.org/published/0009/03/04/paper.pdf. If not set, a simplified, faster method will be used to calculate the TBN frame, based on https://github.com/KhronosGroup/Vulkan-Samples/blob/main/shaders/pbr.frag, which empirically seems to give equivalent results.

MapMatTxtrToLinear

Whether we should use shader-based srgb->linear approx remapping of applicable material color textures in PBR rendering for direct lighting and IBL. This field should be removed/ignored when Magnum fully supports sRGB texture conversion on load.

MapIBLTxtrToLinear

Whether we should use shader-based srgb->linear approx remapping of applicable IBL environment textures in PBR rendering for IBL calculations. This field should be removed/ignored when Magnum fully supports sRGB texture conversion on load.

MapOutputToSRGB

Whether we should use shader-based linear->srgb approx remapping of color output in PBR rendering for direct lighting and IBL results. This field should be removed/ignored when an appropriate framebuffer is used for output to handle this conversion.

UseDirectLightTonemap

Whether or not to use tonemappping for direct lighting.

UseIBLTonemap

Whether or not to use tonemappping for image-based lighting.

SkipClearCoatLayer

Whether we should skip all clearcoat layer calcs. Values will still be sent to the shader, but no actual calcuations will be performed if this is set.

SkipSpecularLayer

Whether we should skip all specular layer calcs. Values will still be sent to the shader, but no actual calcuations will be performed if this is set.

SkipAnisotropyLayer

Whether we should skip all anisotropy layer calcs. Values will still be sent to the shader, but no actual calcuations will be performed if this is set.

DebugDisplay

Enable shader debug mode. Then developer can set the uniform PbrDebugDisplay in the fragment shader for debugging

Typedef documentation

typedef Magnum::Shaders::GenericGL3D::TextureCoordinates esp::gfx::PbrShader::TextureCoordinates

2D texture coordinates

Used only if at least one of Flag::BaseColorTexture, Flag::NormalTexture and Flag::RoughnessTexture Flag::MetallicTexture is set.

typedef Magnum::Shaders::GenericGL3D::Tangent4 esp::gfx::PbrShader::Tangent4

Tangent direction with the fourth component indicating the handedness.

T = Tangent, B = BiTangent, N = Normal

1.0 means T, B, N form a right-handed coordinate; -1.0 means T, B, N form a left-handed coordinate;

Used only if Flag::NormalTexture is set.

Function documentation

esp::gfx::PbrShader::PbrShader(const Configuration& config) explicit

Constructor.

Parameters
config : PbrShader::Configuration holding flags structure, number of lights, joints, etc.

PbrShader& esp::gfx::PbrShader::bindBaseColorTexture(Magnum::GL::Texture2D& texture)

Bind the BaseColor texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindMetallicRoughnessTexture(Magnum::GL::Texture2D& texture)

Bind the metallic-roughness texture NOTE that though MetallicRoughnessTexture exists, it does not mean both metallic texture and roughness texture exist.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindNormalTexture(Magnum::GL::Texture2D& texture)

Bind the normal texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindEmissiveTexture(Magnum::GL::Texture2D& texture)

Bind the emissive texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindClearCoatFactorTexture(Magnum::GL::Texture2D& texture)

Bind the clearcoat factor texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindClearCoatRoughnessTexture(Magnum::GL::Texture2D& texture)

Bind the clearcoat roughness texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindClearCoatNormalTexture(Magnum::GL::Texture2D& texture)

Bind the clearcoat normal texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindSpecularLayerTexture(Magnum::GL::Texture2D& texture)

Bind the specular layer texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindSpecularLayerColorTexture(Magnum::GL::Texture2D& texture)

Bind the specular layer color texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindAnisotropyLayerTexture(Magnum::GL::Texture2D& texture)

Bind the anisotropy layer texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindIrradianceCubeMap(Magnum::GL::CubeMapTexture& texture)

Bind the irradiance cubemap texture.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindBrdfLUT(Magnum::GL::Texture2D& texture)

Bind the BRDF LUT texture NOTE: requires Flag::ImageBasedLighting is set.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::bindPrefilteredMap(Magnum::GL::CubeMapTexture& texture)

Bind the prefiltered environment map (cubemap texture) NOTE: requires Flag::ImageBasedLighting is set.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setTextureMatrix(const Magnum::Matrix3& matrix)

set the texture transformation matrix

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setProjectionMatrix(const Magnum::Matrix4& matrix)

Set "projection" matrix to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setViewMatrix(const Magnum::Matrix4& matrix)

Set view matrix to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setModelMatrix(const Magnum::Matrix4& matrix)

Set model matrix to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setNormalMatrix(const Magnum::Matrix3x3& matrix)

Set normal matrix to the uniform on GPU normal = inverse transpose of the up-left 3x3 matrix of the modelview matrix.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setBaseColor(const Magnum::Color4& color)

Set base color to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setEmissiveColor(const Magnum::Color3& color)

Set emissive color to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setRoughness(float roughness)

Set roughness to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setMetallic(float metallic)

Set metallic to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setIndexOfRefraction(float ior)

Set index of refraction.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setClearCoatFactor(float ccFactor)

Set clearcoat intensity/factor.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setClearCoatRoughness(float ccRoughness)

Set clearcoat roughness.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setClearCoatNormalTextureScale(float ccTextureScale)

Set clearcoat normal texture scale.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setSpecularLayerFactor(float specLayerFactor)

Set specular layer factor.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setSpecularLayerColorFactor(const Magnum::Color3& color)

Set specular layer color factor.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setAnisotropyLayerFactor(float anisoLayerFactor)

Set anisotropy layer factor.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setAnisotropyLayerDirection(const Magnum::Vector2& anisoLayerDirection)

Set anisotropy layer direction 2d vector.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setObjectId(unsigned int objectId)

Set object id to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setCameraWorldPosition(const Magnum::Vector3& cameraWorldPos)

Set object id to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setPrefilteredMapMipLevels(unsigned int mipLevels)

Set total mipmap levels of the prefiltered environment map to the uniform on GPU.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setLightPositions(Corrade::Containers::ArrayView<const Magnum::Vector4> vectors)

Set light positions or directions.

Parameters
vectors an array of the light vectors
Returns Reference to self (for method chaining)

when vec.w == 0, it means vec.xyz is the light direction; when vec.w == 1, it means vec.xyz is the light position; vec is an element in the "vectors" array

PbrShader& esp::gfx::PbrShader::setLightPositions(std::initializer_list<Magnum::Vector4> vectors)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

PbrShader& esp::gfx::PbrShader::setLightVector(unsigned int lightIndex, const Magnum::Vector4& vec)

Set the position or direction of a specific light See vec for details.

Parameters
lightIndex the index of the light, MUST be smaller than lightCount_
vec the direction (or position) of the light in camera space; when vec.w == 0, it means vec.xyz is the light direction; when vec.w == 1, it means vec.xyz is the light position;
Returns Reference to self (for method chaining) Note: If the light was a directional (point) light, it will be overridden as a point (directional) light

PbrShader& esp::gfx::PbrShader::setLightPosition(unsigned int lightIndex, const Magnum::Vector3& pos)

Set the position of a specific light.

Parameters
lightIndex the index of the light, MUST be smaller than lightCount_
pos the position of the light in camera space
Returns Reference to self (for method chaining) Note: If the light was a directional light, it will be overridden as a point light;

PbrShader& esp::gfx::PbrShader::setLightDirection(unsigned int lightIndex, const Magnum::Vector3& dir)

Set the direction of a specific light.

Parameters
lightIndex the index of the light, MUST be smaller than lightCount_
dir the direction of the light in camera space
Returns Reference to self (for method chaining) NOTE: If the light was a point light, it will be overridden as a direction light;

PbrShader& esp::gfx::PbrShader::setLightRange(unsigned int lightIndex, float range)

Set the range of a specific light.

Parameters
lightIndex the index of the light, MUST be smaller than lightCount_
range the range of the light
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setLightColor(unsigned int lightIndex, const Magnum::Vector3& color, float intensity = 1.0f)

Set the color of a specific light.

Parameters
lightIndex the index of the light, MUST be smaller than lightCount_
color the color of the light
intensity the intensity of the light
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setLightColors(Corrade::Containers::ArrayView<const Magnum::Color3> colors)

Set the colors of the lights.

Parameters
colors the colors of the lights NOTE: the intensity MUST be included in the color
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setLightColors(std::initializer_list<Magnum::Color3> colors)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

PbrShader& esp::gfx::PbrShader::setLightRanges(Corrade::Containers::ArrayView<const float> ranges)

Set the ranges of the lights.

Parameters
ranges the ranges of the lights
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setLightRanges(std::initializer_list<float> ranges)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

PbrShader& esp::gfx::PbrShader::setDirectLightIntensity(float lightIntensity)

Set the global lighting intensity applied equally across all lights for direct lighting.

Parameters
lightIntensity config-driven global intensity knob to easily control the intensity of the entire scene by a single field
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setGamma(const Magnum::Vector3& gamma)

Set the gamma value used for remapping sRGB to linear approximations.

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setTonemapExposure(float exposure)

Set the IBL exposure value.

Parameters
exposure config-driven exposure value for IBL calculations.
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setNormalTextureScale(float scale)

Set the scale of the normal texture.

Parameters
scale
Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setJointMatrices(Corrade::Containers::ArrayView<const Magnum::Matrix4> matrices)

Set joint matrices (See Magnum/Shaders/PhongGL.h)

Returns Reference to self (for method chaining)

PbrShader& esp::gfx::PbrShader::setJointMatrices(std::initializer_list<Magnum::Matrix4> matrices)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. (See Magnum/Shaders/PhongGL.h)

PbrShader& esp::gfx::PbrShader::setJointMatrix(Magnum::UnsignedInt id, const Magnum::Matrix4& matrix)

Set joint matrix for given joint (See Magnum/Shaders/PhongGL.h)

Returns Reference to self (for method chaining) @m_since_latest

Unlike setJointMatrices() updates just a single joint matrix. Expects that id is less than jointCount().

PbrShader& esp::gfx::PbrShader::setPerInstanceJointCount(Magnum::UnsignedInt count)

Set per-instance joint count (See Magnum/Shaders/PhongGL.h)

Returns Reference to self (for method chaining) @m_since_latest

Offset added to joint IDs in the JointIds and SecondaryJointIds in instanced draws. Should be less than jointCount(). Initial value is 0, meaning every instance will use the same joint matrices, setting it to a non-zero value causes the joint IDs to be interpreted as gl_InstanceID*count + jointId.

PbrShader& esp::gfx::PbrShader::setPbrEquationScales(const PbrEquationScales& scales)

Set the scales for different components in the pbr equation.

Parameters
scales
Returns Reference to self (for method chaining)