Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Static Public Member Functions | List of all members
castor3d::shader::Utils Class Reference

#include <GlslUtils.hpp>

Public Member Functions

C3D_API Utils (sdw::ShaderWriter &writer)
 
C3D_API sdw::Float saturate (sdw::Float const v)
 
C3D_API sdw::Vec3 saturate (sdw::Vec3 const v)
 
C3D_API sdw::Vec2 topDownToBottomUp (sdw::Vec2 const texCoord)
 
C3D_API sdw::Vec3 topDownToBottomUp (sdw::Vec3 const texCoord)
 
C3D_API sdw::Vec4 topDownToBottomUp (sdw::Vec4 const texCoord)
 
C3D_API sdw::Vec2 negateTopDownToBottomUp (sdw::Vec2 const texCoord)
 
C3D_API sdw::Vec3 negateTopDownToBottomUp (sdw::Vec3 const texCoord)
 
C3D_API sdw::Vec4 negateTopDownToBottomUp (sdw::Vec4 const texCoord)
 
C3D_API sdw::Vec2 calcTexCoord (sdw::Vec2 const renderPos, sdw::Vec2 const renderSize)
 
C3D_API sdw::Vec3 applyGamma (sdw::Float const gamma, sdw::Vec3 const HDR)
 
C3D_API sdw::Vec3 removeGamma (sdw::Float const gamma, sdw::Vec3 const sRGB)
 
C3D_API sdw::Float remap (sdw::Float const originalValue, sdw::Float const originalMin, sdw::Float const originalMax, sdw::Float const newMin, sdw::Float const newMax)
 
C3D_API sdw::Float threshold (sdw::Float const v, sdw::Float const t)
 
C3D_API sdw::Float beer (sdw::Float const d)
 
C3D_API sdw::Float powder (sdw::Float const d)
 
C3D_API sdw::Float powder (sdw::Float const d, sdw::Float const cosTheta)
 
C3D_API sdw::Vec4 sampleMap (sdw::CombinedImage2DRgba32 const map, sdw::Vec2 const texCoords)
 
C3D_API sdw::Vec4 sampleMap (sdw::CombinedImage2DRgba32 const map, sdw::Vec3 const texCoords)
 
C3D_API sdw::Vec4 sampleMap (sdw::CombinedImage2DRgba32 const map, sdw::Vec2 const texCoords, sdw::Float const lod)
 
C3D_API sdw::Vec4 sampleMap (sdw::CombinedImage2DRgba32 const map, sdw::Vec3 const texCoords, sdw::Float const lod)
 
C3D_API sdw::Vec4 sampleMap (sdw::CombinedImage2DRgba32 const map, DerivTex const texCoords)
 
C3D_API sdw::RetVec2 transformUV (TextureConfigData const &config, TextureTransformData const &anim, sdw::Vec2 const uv)
 
C3D_API sdw::RetVec3 transformUVW (TextureConfigData const &config, TextureTransformData const &anim, sdw::Vec3 const uv)
 
C3D_API void swap (sdw::Float const A, sdw::Float const &B)
 
C3D_API sdw::RetFloat distanceSquared (sdw::Vec2 const A, sdw::Vec2 const &B)
 
C3D_API sdw::RetFloat distanceSquared (sdw::Vec3 const A, sdw::Vec3 const &B)
 
C3D_API sdw::RetVec3 calcVSPosition (sdw::Vec2 const &uv, sdw::Float const &depth, sdw::Mat4 const &invProj)
 
C3D_API sdw::RetVec3 calcWSPosition (sdw::Vec2 const &uv, sdw::Float const &depth, sdw::Mat4 const &invViewProj)
 
C3D_API sdw::RetVec3 getMapNormal (sdw::Vec2 const &uv, sdw::Vec3 const &normal, sdw::Vec3 const &position)
 
C3D_API sdw::RetFloat rescaleDepth (sdw::Float const &depth, sdw::Float const &nearPlane, sdw::Float const &farPlane)
 
C3D_API sdw::Float lineariseDepth (sdw::Float const &depth, sdw::Float const &nearPlane, sdw::Float const &farPlane) const
 
C3D_API sdw::RetVec4 computeAccumulation (sdw::Float const &depth, sdw::Vec3 const &colour, sdw::Float const &alpha, sdw::Float const &nearPlane, sdw::Float const &farPlane, sdw::UInt const &accumulationOperator)
 
C3D_API sdw::RetFloat conductorFresnel (sdw::Float const &product, sdw::Float const &f0, sdw::Float const &f90)
 
C3D_API sdw::RetFloat conductorFresnel (sdw::Float const &product, sdw::Float const &f0)
 
C3D_API sdw::RetVec3 conductorFresnel (sdw::Float const &product, sdw::Vec3 const &f0, sdw::Vec3 const &f90)
 
C3D_API sdw::RetVec3 conductorFresnel (sdw::Float const &product, sdw::Vec3 const &f0)
 
C3D_API RetDerivVec3 conductorFresnel (DerivFloat const &product, sdw::Vec3 const &f0, sdw::Vec3 const &f90)
 
C3D_API RetDerivVec3 conductorFresnel (DerivFloat const &product, sdw::Vec3 const &f0)
 
C3D_API sdw::RetFloat fresnelMix (sdw::Float const &VdotH, sdw::Float const &refractionRatio)
 
C3D_API sdw::RetFloat fresnelMix (sdw::Vec3 const &incident, sdw::Vec3 const &normal, sdw::Float const &refractionRatio)
 
C3D_API sdw::RetVec4 clipToScreen (sdw::Vec4 const &in)
 
C3D_API sdw::RetFloat reconstructCSZ (sdw::Float const &depth, sdw::Vec3 const clipInfo)
 
C3D_API sdw::RetBoolean isSaturated (sdw::Vec3 const &p)
 
C3D_API sdw::RetBoolean isSaturated (sdw::IVec3 const &p, sdw::Int const &imax)
 
C3D_API sdw::RetUInt encodeColor (sdw::Vec4 const &color)
 Encode HDR color to a 32 bit uint. Alpha is 1 bit + 7 bit HDR remapping.
 
C3D_API sdw::RetUInt encodeNormal (sdw::Vec3 const &normal)
 Encode specified normal (normalized) into 32 bits uint. Each axis of the normal is encoded into 9 bits (1 for the sign/ 8 for the value).
 
C3D_API sdw::RetVec4 decodeColor (sdw::UInt const &colorMask)
 
C3D_API sdw::RetVec3 decodeNormal (sdw::UInt const &normalMask)
 
C3D_API sdw::RetVec4 encodeFloatRGBA (sdw::Float const &v)
 Converts a 32 bit float to store as 4 8 bit floats.
 
C3D_API sdw::RetUInt flatten (sdw::UVec3 const &p, sdw::UVec3 const &dim)
 3D array index to flattened 1D array index
 
C3D_API sdw::RetUVec3 unflatten (sdw::UInt const &p, sdw::UVec3 const &dim)
 Flattened array index to 3D array index.
 
sdw::RetFloat iorToFresnel0 (sdw::Float const &transmittedIor, sdw::Float const &incidentIor)
 
sdw::RetVec3 iorToFresnel0 (sdw::Vec3 const &transmittedIor, sdw::Float const &incidentIor)
 
sdw::RetVec3 fresnel0ToIor (sdw::Vec3 const &fresnel0)
 
C3D_API sdw::RetVec3 fresnelToF0 (sdw::Vec3 const &fresnel, sdw::Float const &VdotH)
 
C3D_API sdw::RetVec3 evalIridescence (sdw::Float const &outsideIOR, sdw::Float const &eta2, sdw::Float const &cosTheta1, sdw::Float const &thinFilmThickness, sdw::Vec3 const &baseF0)
 
C3D_API sdw::RetVec3 evalSensitivity (sdw::Float const &OPD, sdw::Vec3 const &shift)
 

Static Public Member Functions

static C3D_API sdw::Mat3 getTBN (sdw::Vec3 const &normal, sdw::Vec3 const &tangent, sdw::Vec3 const &bitangent)
 
static C3D_API sdw::Float computeF0 (sdw::Float const &ior)
 
static C3D_API sdw::Vec3 reconstructNormal (sdw::Vec2 const &normal)
 
static C3D_API sdw::Vec3 reconstructNormal (sdw::Float const &normalX, sdw::Float const &normalY)
 

Constructor & Destructor Documentation

◆ Utils()

C3D_API castor3d::shader::Utils::Utils ( sdw::ShaderWriter & writer)
explicit

Member Function Documentation

◆ applyGamma()

C3D_API sdw::Vec3 castor3d::shader::Utils::applyGamma ( sdw::Float const gamma,
sdw::Vec3 const HDR )

◆ beer()

C3D_API sdw::Float castor3d::shader::Utils::beer ( sdw::Float const d)

◆ calcTexCoord()

C3D_API sdw::Vec2 castor3d::shader::Utils::calcTexCoord ( sdw::Vec2 const renderPos,
sdw::Vec2 const renderSize )

◆ calcVSPosition()

C3D_API sdw::RetVec3 castor3d::shader::Utils::calcVSPosition ( sdw::Vec2 const & uv,
sdw::Float const & depth,
sdw::Mat4 const & invProj )

◆ calcWSPosition()

C3D_API sdw::RetVec3 castor3d::shader::Utils::calcWSPosition ( sdw::Vec2 const & uv,
sdw::Float const & depth,
sdw::Mat4 const & invViewProj )

◆ clipToScreen()

C3D_API sdw::RetVec4 castor3d::shader::Utils::clipToScreen ( sdw::Vec4 const & in)

◆ computeAccumulation()

C3D_API sdw::RetVec4 castor3d::shader::Utils::computeAccumulation ( sdw::Float const & depth,
sdw::Vec3 const & colour,
sdw::Float const & alpha,
sdw::Float const & nearPlane,
sdw::Float const & farPlane,
sdw::UInt const & accumulationOperator )

◆ computeF0()

static C3D_API sdw::Float castor3d::shader::Utils::computeF0 ( sdw::Float const & ior)
static

◆ conductorFresnel() [1/6]

C3D_API RetDerivVec3 castor3d::shader::Utils::conductorFresnel ( DerivFloat const & product,
sdw::Vec3 const & f0 )

◆ conductorFresnel() [2/6]

C3D_API RetDerivVec3 castor3d::shader::Utils::conductorFresnel ( DerivFloat const & product,
sdw::Vec3 const & f0,
sdw::Vec3 const & f90 )

◆ conductorFresnel() [3/6]

C3D_API sdw::RetFloat castor3d::shader::Utils::conductorFresnel ( sdw::Float const & product,
sdw::Float const & f0 )

◆ conductorFresnel() [4/6]

C3D_API sdw::RetFloat castor3d::shader::Utils::conductorFresnel ( sdw::Float const & product,
sdw::Float const & f0,
sdw::Float const & f90 )

◆ conductorFresnel() [5/6]

C3D_API sdw::RetVec3 castor3d::shader::Utils::conductorFresnel ( sdw::Float const & product,
sdw::Vec3 const & f0 )

◆ conductorFresnel() [6/6]

C3D_API sdw::RetVec3 castor3d::shader::Utils::conductorFresnel ( sdw::Float const & product,
sdw::Vec3 const & f0,
sdw::Vec3 const & f90 )

◆ decodeColor()

C3D_API sdw::RetVec4 castor3d::shader::Utils::decodeColor ( sdw::UInt const & colorMask)

◆ decodeNormal()

C3D_API sdw::RetVec3 castor3d::shader::Utils::decodeNormal ( sdw::UInt const & normalMask)

◆ distanceSquared() [1/2]

C3D_API sdw::RetFloat castor3d::shader::Utils::distanceSquared ( sdw::Vec2 const A,
sdw::Vec2 const & B )

◆ distanceSquared() [2/2]

C3D_API sdw::RetFloat castor3d::shader::Utils::distanceSquared ( sdw::Vec3 const A,
sdw::Vec3 const & B )

◆ encodeColor()

C3D_API sdw::RetUInt castor3d::shader::Utils::encodeColor ( sdw::Vec4 const & color)

Encode HDR color to a 32 bit uint. Alpha is 1 bit + 7 bit HDR remapping.

◆ encodeFloatRGBA()

C3D_API sdw::RetVec4 castor3d::shader::Utils::encodeFloatRGBA ( sdw::Float const & v)

Converts a 32 bit float to store as 4 8 bit floats.

◆ encodeNormal()

C3D_API sdw::RetUInt castor3d::shader::Utils::encodeNormal ( sdw::Vec3 const & normal)

Encode specified normal (normalized) into 32 bits uint. Each axis of the normal is encoded into 9 bits (1 for the sign/ 8 for the value).

◆ evalIridescence()

C3D_API sdw::RetVec3 castor3d::shader::Utils::evalIridescence ( sdw::Float const & outsideIOR,
sdw::Float const & eta2,
sdw::Float const & cosTheta1,
sdw::Float const & thinFilmThickness,
sdw::Vec3 const & baseF0 )

◆ evalSensitivity()

C3D_API sdw::RetVec3 castor3d::shader::Utils::evalSensitivity ( sdw::Float const & OPD,
sdw::Vec3 const & shift )

◆ flatten()

C3D_API sdw::RetUInt castor3d::shader::Utils::flatten ( sdw::UVec3 const & p,
sdw::UVec3 const & dim )

3D array index to flattened 1D array index

◆ fresnel0ToIor()

sdw::RetVec3 castor3d::shader::Utils::fresnel0ToIor ( sdw::Vec3 const & fresnel0)

◆ fresnelMix() [1/2]

C3D_API sdw::RetFloat castor3d::shader::Utils::fresnelMix ( sdw::Float const & VdotH,
sdw::Float const & refractionRatio )

◆ fresnelMix() [2/2]

C3D_API sdw::RetFloat castor3d::shader::Utils::fresnelMix ( sdw::Vec3 const & incident,
sdw::Vec3 const & normal,
sdw::Float const & refractionRatio )

◆ fresnelToF0()

C3D_API sdw::RetVec3 castor3d::shader::Utils::fresnelToF0 ( sdw::Vec3 const & fresnel,
sdw::Float const & VdotH )

◆ getMapNormal()

C3D_API sdw::RetVec3 castor3d::shader::Utils::getMapNormal ( sdw::Vec2 const & uv,
sdw::Vec3 const & normal,
sdw::Vec3 const & position )

◆ getTBN()

static C3D_API sdw::Mat3 castor3d::shader::Utils::getTBN ( sdw::Vec3 const & normal,
sdw::Vec3 const & tangent,
sdw::Vec3 const & bitangent )
static

◆ iorToFresnel0() [1/2]

sdw::RetFloat castor3d::shader::Utils::iorToFresnel0 ( sdw::Float const & transmittedIor,
sdw::Float const & incidentIor )

◆ iorToFresnel0() [2/2]

sdw::RetVec3 castor3d::shader::Utils::iorToFresnel0 ( sdw::Vec3 const & transmittedIor,
sdw::Float const & incidentIor )

◆ isSaturated() [1/2]

C3D_API sdw::RetBoolean castor3d::shader::Utils::isSaturated ( sdw::IVec3 const & p,
sdw::Int const & imax )

◆ isSaturated() [2/2]

C3D_API sdw::RetBoolean castor3d::shader::Utils::isSaturated ( sdw::Vec3 const & p)

◆ lineariseDepth()

C3D_API sdw::Float castor3d::shader::Utils::lineariseDepth ( sdw::Float const & depth,
sdw::Float const & nearPlane,
sdw::Float const & farPlane ) const

◆ negateTopDownToBottomUp() [1/3]

C3D_API sdw::Vec2 castor3d::shader::Utils::negateTopDownToBottomUp ( sdw::Vec2 const texCoord)

◆ negateTopDownToBottomUp() [2/3]

C3D_API sdw::Vec3 castor3d::shader::Utils::negateTopDownToBottomUp ( sdw::Vec3 const texCoord)

◆ negateTopDownToBottomUp() [3/3]

C3D_API sdw::Vec4 castor3d::shader::Utils::negateTopDownToBottomUp ( sdw::Vec4 const texCoord)

◆ powder() [1/2]

C3D_API sdw::Float castor3d::shader::Utils::powder ( sdw::Float const d)

◆ powder() [2/2]

C3D_API sdw::Float castor3d::shader::Utils::powder ( sdw::Float const d,
sdw::Float const cosTheta )

◆ reconstructCSZ()

C3D_API sdw::RetFloat castor3d::shader::Utils::reconstructCSZ ( sdw::Float const & depth,
sdw::Vec3 const clipInfo )

◆ reconstructNormal() [1/2]

static C3D_API sdw::Vec3 castor3d::shader::Utils::reconstructNormal ( sdw::Float const & normalX,
sdw::Float const & normalY )
static

◆ reconstructNormal() [2/2]

static C3D_API sdw::Vec3 castor3d::shader::Utils::reconstructNormal ( sdw::Vec2 const & normal)
static

◆ remap()

C3D_API sdw::Float castor3d::shader::Utils::remap ( sdw::Float const originalValue,
sdw::Float const originalMin,
sdw::Float const originalMax,
sdw::Float const newMin,
sdw::Float const newMax )

◆ removeGamma()

C3D_API sdw::Vec3 castor3d::shader::Utils::removeGamma ( sdw::Float const gamma,
sdw::Vec3 const sRGB )

◆ rescaleDepth()

C3D_API sdw::RetFloat castor3d::shader::Utils::rescaleDepth ( sdw::Float const & depth,
sdw::Float const & nearPlane,
sdw::Float const & farPlane )

◆ sampleMap() [1/5]

C3D_API sdw::Vec4 castor3d::shader::Utils::sampleMap ( sdw::CombinedImage2DRgba32 const map,
DerivTex const texCoords )

◆ sampleMap() [2/5]

C3D_API sdw::Vec4 castor3d::shader::Utils::sampleMap ( sdw::CombinedImage2DRgba32 const map,
sdw::Vec2 const texCoords )

◆ sampleMap() [3/5]

C3D_API sdw::Vec4 castor3d::shader::Utils::sampleMap ( sdw::CombinedImage2DRgba32 const map,
sdw::Vec2 const texCoords,
sdw::Float const lod )

◆ sampleMap() [4/5]

C3D_API sdw::Vec4 castor3d::shader::Utils::sampleMap ( sdw::CombinedImage2DRgba32 const map,
sdw::Vec3 const texCoords )

◆ sampleMap() [5/5]

C3D_API sdw::Vec4 castor3d::shader::Utils::sampleMap ( sdw::CombinedImage2DRgba32 const map,
sdw::Vec3 const texCoords,
sdw::Float const lod )

◆ saturate() [1/2]

C3D_API sdw::Float castor3d::shader::Utils::saturate ( sdw::Float const v)

◆ saturate() [2/2]

C3D_API sdw::Vec3 castor3d::shader::Utils::saturate ( sdw::Vec3 const v)

◆ swap()

C3D_API void castor3d::shader::Utils::swap ( sdw::Float const A,
sdw::Float const & B )

◆ threshold()

C3D_API sdw::Float castor3d::shader::Utils::threshold ( sdw::Float const v,
sdw::Float const t )

◆ topDownToBottomUp() [1/3]

C3D_API sdw::Vec2 castor3d::shader::Utils::topDownToBottomUp ( sdw::Vec2 const texCoord)

◆ topDownToBottomUp() [2/3]

C3D_API sdw::Vec3 castor3d::shader::Utils::topDownToBottomUp ( sdw::Vec3 const texCoord)

◆ topDownToBottomUp() [3/3]

C3D_API sdw::Vec4 castor3d::shader::Utils::topDownToBottomUp ( sdw::Vec4 const texCoord)

◆ transformUV()

C3D_API sdw::RetVec2 castor3d::shader::Utils::transformUV ( TextureConfigData const & config,
TextureTransformData const & anim,
sdw::Vec2 const uv )

◆ transformUVW()

C3D_API sdw::RetVec3 castor3d::shader::Utils::transformUVW ( TextureConfigData const & config,
TextureTransformData const & anim,
sdw::Vec3 const uv )

◆ unflatten()

C3D_API sdw::RetUVec3 castor3d::shader::Utils::unflatten ( sdw::UInt const & p,
sdw::UVec3 const & dim )

Flattened array index to 3D array index.


The documentation for this class was generated from the following file: