Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
castor3d::Pass Class Reference

#include <Pass.hpp>

Inheritance diagram for castor3d::Pass:
Inheritance graph
[legend]
Collaboration diagram for castor3d::Pass:
Collaboration graph
[legend]

Public Types

using UnitArray = castor::Vector< TextureUnitRPtr >
 
using PassTextureSource = castor::Pair< TextureSourceInfo, PassTextureConfig >
 
using TextureSourceArray = castor::Vector< PassTextureSource >
 
using UnitDataSources = castor::Map< TextureUnitDataRPtr, castor::Vector< TextureSourceInfo > >
 

Public Member Functions

C3D_API Pass (Material &parent, LightingModelID lightingModelId)
 Constructor.
 
C3D_API Pass (Material &parent, Pass const &rhs)
 Copy constructor.
 
C3D_API ~Pass () noexcept
 Destructor.
 
C3D_API void initialise ()
 Initialises the pass and all it's dependencies.
 
C3D_API void cleanup ()
 Cleans up the pass and all it's dependencies.
 
C3D_API void update ()
 Updates the render pass, CPU wise.
 
C3D_API TextureUnitRPtr getTextureUnit (uint32_t index) const
 Retrieves the TextureUnit at the given index.
 
C3D_API void registerTexture (TextureSourceInfo sourceInfo, PassTextureConfig configuration)
 Adds a texture.
 
C3D_API void registerTexture (TextureSourceInfo sourceInfo, PassTextureConfig configuration, TextureAnimationUPtr animation)
 Adds an animated texture.
 
C3D_API void unregisterTexture (TextureSourceInfo const &sourceInfo) noexcept
 Removes a texture unit.
 
C3D_API void resetTexture (TextureSourceInfo const &srcSourceInfo, TextureSourceInfo dstSourceInfo)
 Replaces a texture source.
 
C3D_API void updateConfig (TextureSourceInfo const &sourceInfo, TextureConfiguration configuration)
 Updates the configuration for a texture.
 
C3D_API void prepareTextures ()
 Reduces the textures.
 
C3D_API void setColour (castor::HdrRgbColour const &value)
 Sets the basic pass colour.
 
C3D_API castor::HdrRgbColour const & getColour () const
 
C3D_API PassComponentCombine getPassFlags () const noexcept
 
C3D_API void accept (ConfigurationVisitorBase &vis)
 ConfigurationVisitorBase acceptance function.
 
C3D_API void fillBuffer (PassBuffer &buffer) const
 Fills the pass buffer with this pass data.
 
C3D_API bool writeText (castor::String const &tabs, castor::Path const &folder, castor::String const &subfolder, castor::StringStream &file) const
 Writes the component content to text.
 
C3D_API void fillConfig (TextureConfiguration &config, ConfigurationVisitorBase &vis)
 ConfigurationVisitorBase acceptance function, for a specific texture configuration.
 

Components handling.

C3D_API void addComponent (PassComponentUPtr component)
 
C3D_API bool hasComponent (castor::String const &name) const noexcept
 
C3D_API PassComponentgetComponent (castor::String const &name) const
 
C3D_API castor::Vector< PassComponentUPtr > removeComponent (castor::String const &name)
 
C3D_API shader::PassMaterialShadergetMaterialShader (castor::String const &componentType) const
 
C3D_API PassComponentID getComponentId (castor::String const &componentType) const
 
C3D_API PassComponentPlugin const & getComponentPlugin (PassComponentID componentId) const
 
C3D_API PassComponentCombineID getComponentCombineID () const
 
C3D_API TextureCombineID getTextureCombineID () const
 
uint32_t getHash () const noexcept
 
PassComponentPlugin const & getComponentPlugin (castor::String const &componentType) const
 
template<typename ComponentT >
PassComponentPlugin const & getComponentPlugin () const
 
template<typename ComponentT >
void removeComponent ()
 
template<typename ComponentT , typename ... ParamsT>
ComponentT * createComponent (ParamsT &&... params)
 
template<typename ComponentT >
bool hasComponent () const noexcept
 
template<typename ComponentT >
ComponentT * getComponent () const noexcept
 
PassComponentMap const & getComponents () const
 
C3D_API bool needsAlphaProcessing () const
 
C3D_API bool hasAlphaBlending () const
 
C3D_API bool hasOnlyAlphaBlending () const
 
C3D_API bool hasAlphaTest () const
 
C3D_API bool hasBlendAlphaTest () const
 
C3D_API BlendMode getAlphaBlendMode () const
 
C3D_API BlendMode getColourBlendMode () const
 
C3D_API VkCompareOp getAlphaFunc () const
 
C3D_API VkCompareOp getBlendAlphaFunc () const
 
C3D_API bool hasEnvironmentMapping () const
 
C3D_API bool hasSubsurfaceScattering () const
 
C3D_API bool isTwoSided () const
 
C3D_API UnitArray getTextureUnits () const
 
C3D_API uint32_t getTextureUnitsCount () const
 
C3D_API TextureCombine getTexturesMask () const noexcept
 
C3D_API bool hasLighting () const
 
C3D_API PassComponentRegistergetPassComponentsRegister () const
 
C3D_API castor::String getTextureFlagsName (PassComponentTextureFlag flags) const
 
C3D_API LightingModelID getLightingModelId () const
 
bool isInitialised () const noexcept
 
bool isInitialising () const noexcept
 
bool hasAutomaticShader () const noexcept
 
uint32_t getId () const noexcept
 
bool isImplicit () const noexcept
 
RenderPassRegisterInfogetRenderPassInfo () const noexcept
 
uint32_t getIndex () const noexcept
 
uint32_t getMaxTexCoordSet () const noexcept
 
PassComponentTextureFlag getColourMapFlags () const noexcept
 
PassComponentTextureFlag getOpacityMapFlags () const noexcept
 
PassComponentTextureFlag getNormalMapFlags () const noexcept
 
PassComponentTextureFlag getHeightMapFlags () const noexcept
 
PassComponentTextureFlag getOcclusionMapFlags () const noexcept
 
PassComponentTextureFlag getReflRefrFlags () const noexcept
 
auto begin () const noexcept
 
auto begin () noexcept
 
auto end () const noexcept
 
auto end () noexcept
 
C3D_API void enableLighting (bool value) const
 
C3D_API void enablePicking (bool value) const
 
void setId (uint32_t value) noexcept
 
void setImplicit (bool value=true) noexcept
 
void setColour (castor::RgbColour const &v, float gamma=2.2f)
 
void setColour (castor::Coords3f const &v)
 
void setColour (castor::Point3f const &v)
 
void reset () const noexcept
 
- Public Member Functions inherited from castor::OwnedBy< Material >
Material * getOwner () const
 

Static Public Member Functions

static C3D_API void addParsers (castor::AttributeParsers &result, castor::UInt32StrMap const &textureChannels)
 
static C3D_API float computeRoughnessFromGlossiness (float glossiness)
 
static C3D_API float computeGlossinessFromRoughness (float roughness)
 
static C3D_API float computeGlossinessFromShininess (float shininess)
 
static C3D_API float computeShininessFromGlossiness (float glossiness)
 
static float computeRoughnessFromShininess (float const &shininess)
 
static float computeShininessFromRoughness (float const &roughness)
 

Public Attributes

OnPassChanged onChanged
 

Protected Attributes

std::atomic_bool m_dirty { true }
 

Friends

struct PassComponent
 

Additional Inherited Members

- Protected Member Functions inherited from castor::OwnedBy< Material >
 OwnedBy (Material &owner)
 Constructor.
 

Member Typedef Documentation

◆ PassTextureSource

◆ TextureSourceArray

◆ UnitArray

using castor3d::Pass::UnitArray = castor::Vector< TextureUnitRPtr >

◆ UnitDataSources

Constructor & Destructor Documentation

◆ Pass() [1/2]

C3D_API castor3d::Pass::Pass ( Material & parent,
LightingModelID lightingModelId )

Constructor.

Parameters
[in]parentThe parent material.
[in]lightingModelIdThe material's lighting model ID.

◆ Pass() [2/2]

C3D_API castor3d::Pass::Pass ( Material & parent,
Pass const & rhs )

Copy constructor.

Parameters
[in]parentThe parent material.
[in]rhsThe pass top copy.

◆ ~Pass()

C3D_API castor3d::Pass::~Pass ( )
noexcept

Destructor.

Member Function Documentation

◆ accept()

C3D_API void castor3d::Pass::accept ( ConfigurationVisitorBase & vis)

ConfigurationVisitorBase acceptance function.

Parameters
visThe ... visitor.

◆ addComponent()

C3D_API void castor3d::Pass::addComponent ( PassComponentUPtr component)

Referenced by createComponent().

Here is the caller graph for this function:

◆ addParsers()

static C3D_API void castor3d::Pass::addParsers ( castor::AttributeParsers & result,
castor::UInt32StrMap const & textureChannels )
static

◆ begin() [1/2]

auto castor3d::Pass::begin ( ) const
inlinenoexcept

name Textures iteration.

◆ begin() [2/2]

auto castor3d::Pass::begin ( )
inlinenoexcept

◆ cleanup()

C3D_API void castor3d::Pass::cleanup ( )

Cleans up the pass and all it's dependencies.

◆ computeGlossinessFromRoughness()

static C3D_API float castor3d::Pass::computeGlossinessFromRoughness ( float roughness)
static

Referenced by computeShininessFromRoughness().

Here is the caller graph for this function:

◆ computeGlossinessFromShininess()

static C3D_API float castor3d::Pass::computeGlossinessFromShininess ( float shininess)
static

Referenced by computeRoughnessFromShininess().

Here is the caller graph for this function:

◆ computeRoughnessFromGlossiness()

static C3D_API float castor3d::Pass::computeRoughnessFromGlossiness ( float glossiness)
static

Referenced by computeRoughnessFromShininess().

Here is the caller graph for this function:

◆ computeRoughnessFromShininess()

static float castor3d::Pass::computeRoughnessFromShininess ( float const & shininess)
inlinestatic

References computeGlossinessFromShininess(), and computeRoughnessFromGlossiness().

Here is the call graph for this function:

◆ computeShininessFromGlossiness()

static C3D_API float castor3d::Pass::computeShininessFromGlossiness ( float glossiness)
static

Referenced by computeShininessFromRoughness().

Here is the caller graph for this function:

◆ computeShininessFromRoughness()

static float castor3d::Pass::computeShininessFromRoughness ( float const & roughness)
inlinestatic

References computeGlossinessFromRoughness(), and computeShininessFromGlossiness().

Here is the call graph for this function:

◆ createComponent()

template<typename ComponentT , typename ... ParamsT>
ComponentT * castor3d::Pass::createComponent ( ParamsT &&... params)
inline

References addComponent().

Here is the call graph for this function:

◆ enableLighting()

C3D_API void castor3d::Pass::enableLighting ( bool value) const

name Mutators.

◆ enablePicking()

C3D_API void castor3d::Pass::enablePicking ( bool value) const

◆ end() [1/2]

auto castor3d::Pass::end ( ) const
inlinenoexcept

◆ end() [2/2]

auto castor3d::Pass::end ( )
inlinenoexcept

◆ fillBuffer()

C3D_API void castor3d::Pass::fillBuffer ( PassBuffer & buffer) const

Fills the pass buffer with this pass data.

Parameters
[in,out]bufferThe pass buffer.

◆ fillConfig()

C3D_API void castor3d::Pass::fillConfig ( TextureConfiguration & config,
ConfigurationVisitorBase & vis )

ConfigurationVisitorBase acceptance function, for a specific texture configuration.

Parameters
configThe texture configuration.
visThe ... visitor.

◆ getAlphaBlendMode()

C3D_API BlendMode castor3d::Pass::getAlphaBlendMode ( ) const

◆ getAlphaFunc()

C3D_API VkCompareOp castor3d::Pass::getAlphaFunc ( ) const

◆ getBlendAlphaFunc()

C3D_API VkCompareOp castor3d::Pass::getBlendAlphaFunc ( ) const

◆ getColour()

C3D_API castor::HdrRgbColour const & castor3d::Pass::getColour ( ) const
Returns
The basic pass colour.

◆ getColourBlendMode()

C3D_API BlendMode castor3d::Pass::getColourBlendMode ( ) const

◆ getColourMapFlags()

PassComponentTextureFlag castor3d::Pass::getColourMapFlags ( ) const
inlinenoexcept

◆ getComponent() [1/2]

template<typename ComponentT >
ComponentT * castor3d::Pass::getComponent ( ) const
inlinenoexcept

References getComponent().

Referenced by getComponent().

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

◆ getComponent() [2/2]

C3D_API PassComponent * castor3d::Pass::getComponent ( castor::String const & name) const

◆ getComponentCombineID()

C3D_API PassComponentCombineID castor3d::Pass::getComponentCombineID ( ) const

Referenced by getHash().

Here is the caller graph for this function:

◆ getComponentId()

C3D_API PassComponentID castor3d::Pass::getComponentId ( castor::String const & componentType) const

Referenced by getComponentPlugin(), and getComponentPlugin().

Here is the caller graph for this function:

◆ getComponentPlugin() [1/3]

template<typename ComponentT >
PassComponentPlugin const & castor3d::Pass::getComponentPlugin ( ) const
inline

References getComponentId(), and getComponentPlugin().

Referenced by getComponentPlugin(), and getComponentPlugin().

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

◆ getComponentPlugin() [2/3]

PassComponentPlugin const & castor3d::Pass::getComponentPlugin ( castor::String const & componentType) const
inline

References getComponentId(), and getComponentPlugin().

Here is the call graph for this function:

◆ getComponentPlugin() [3/3]

C3D_API PassComponentPlugin const & castor3d::Pass::getComponentPlugin ( PassComponentID componentId) const

◆ getComponents()

PassComponentMap const & castor3d::Pass::getComponents ( ) const
inline

◆ getHash()

uint32_t castor3d::Pass::getHash ( ) const
inlinenoexcept

References getComponentCombineID(), and getTextureCombineID().

Here is the call graph for this function:

◆ getHeightMapFlags()

PassComponentTextureFlag castor3d::Pass::getHeightMapFlags ( ) const
inlinenoexcept

◆ getId()

uint32_t castor3d::Pass::getId ( ) const
inlinenoexcept

◆ getIndex()

uint32_t castor3d::Pass::getIndex ( ) const
inlinenoexcept

◆ getLightingModelId()

C3D_API LightingModelID castor3d::Pass::getLightingModelId ( ) const

◆ getMaterialShader()

C3D_API shader::PassMaterialShader * castor3d::Pass::getMaterialShader ( castor::String const & componentType) const

◆ getMaxTexCoordSet()

uint32_t castor3d::Pass::getMaxTexCoordSet ( ) const
inlinenoexcept

◆ getNormalMapFlags()

PassComponentTextureFlag castor3d::Pass::getNormalMapFlags ( ) const
inlinenoexcept

◆ getOcclusionMapFlags()

PassComponentTextureFlag castor3d::Pass::getOcclusionMapFlags ( ) const
inlinenoexcept

◆ getOpacityMapFlags()

PassComponentTextureFlag castor3d::Pass::getOpacityMapFlags ( ) const
inlinenoexcept

◆ getPassComponentsRegister()

C3D_API PassComponentRegister & castor3d::Pass::getPassComponentsRegister ( ) const

◆ getPassFlags()

C3D_API PassComponentCombine castor3d::Pass::getPassFlags ( ) const
noexcept
Returns
The pass flags combination.

◆ getReflRefrFlags()

PassComponentTextureFlag castor3d::Pass::getReflRefrFlags ( ) const
inlinenoexcept

◆ getRenderPassInfo()

RenderPassRegisterInfo * castor3d::Pass::getRenderPassInfo ( ) const
inlinenoexcept

◆ getTextureCombineID()

C3D_API TextureCombineID castor3d::Pass::getTextureCombineID ( ) const

Referenced by getHash().

Here is the caller graph for this function:

◆ getTextureFlagsName()

C3D_API castor::String castor3d::Pass::getTextureFlagsName ( PassComponentTextureFlag flags) const

◆ getTexturesMask()

C3D_API TextureCombine castor3d::Pass::getTexturesMask ( ) const
noexcept

◆ getTextureUnit()

C3D_API TextureUnitRPtr castor3d::Pass::getTextureUnit ( uint32_t index) const

Retrieves the TextureUnit at the given index.

Parameters
[in]indexThe index of the TextureUnit to retrieve.
Returns
nullptr if index was out of bounds.

◆ getTextureUnits()

C3D_API UnitArray castor3d::Pass::getTextureUnits ( ) const

◆ getTextureUnitsCount()

C3D_API uint32_t castor3d::Pass::getTextureUnitsCount ( ) const

◆ hasAlphaBlending()

C3D_API bool castor3d::Pass::hasAlphaBlending ( ) const

◆ hasAlphaTest()

C3D_API bool castor3d::Pass::hasAlphaTest ( ) const

◆ hasAutomaticShader()

bool castor3d::Pass::hasAutomaticShader ( ) const
inlinenoexcept

◆ hasBlendAlphaTest()

C3D_API bool castor3d::Pass::hasBlendAlphaTest ( ) const

◆ hasComponent() [1/2]

template<typename ComponentT >
bool castor3d::Pass::hasComponent ( ) const
inlinenoexcept

References hasComponent().

Referenced by hasComponent().

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

◆ hasComponent() [2/2]

C3D_API bool castor3d::Pass::hasComponent ( castor::String const & name) const
noexcept

◆ hasEnvironmentMapping()

C3D_API bool castor3d::Pass::hasEnvironmentMapping ( ) const

◆ hasLighting()

C3D_API bool castor3d::Pass::hasLighting ( ) const

◆ hasOnlyAlphaBlending()

C3D_API bool castor3d::Pass::hasOnlyAlphaBlending ( ) const

◆ hasSubsurfaceScattering()

C3D_API bool castor3d::Pass::hasSubsurfaceScattering ( ) const

◆ initialise()

C3D_API void castor3d::Pass::initialise ( )

Initialises the pass and all it's dependencies.

◆ isImplicit()

bool castor3d::Pass::isImplicit ( ) const
inlinenoexcept

◆ isInitialised()

bool castor3d::Pass::isInitialised ( ) const
inlinenoexcept

◆ isInitialising()

bool castor3d::Pass::isInitialising ( ) const
inlinenoexcept

◆ isTwoSided()

C3D_API bool castor3d::Pass::isTwoSided ( ) const

◆ needsAlphaProcessing()

C3D_API bool castor3d::Pass::needsAlphaProcessing ( ) const

name Getters.

◆ prepareTextures()

C3D_API void castor3d::Pass::prepareTextures ( )

Reduces the textures.

◆ registerTexture() [1/2]

C3D_API void castor3d::Pass::registerTexture ( TextureSourceInfo sourceInfo,
PassTextureConfig configuration )

Adds a texture.

Parameters
[in]sourceInfoThe texture source.
[in]configurationThe texture configuration.

◆ registerTexture() [2/2]

C3D_API void castor3d::Pass::registerTexture ( TextureSourceInfo sourceInfo,
PassTextureConfig configuration,
TextureAnimationUPtr animation )

Adds an animated texture.

Parameters
[in]sourceInfoThe texture source.
[in]configurationThe texture configuration.
[in]animationThe texture animation.

◆ removeComponent() [1/2]

template<typename ComponentT >
void castor3d::Pass::removeComponent ( )
inline

References removeComponent().

Referenced by removeComponent().

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

◆ removeComponent() [2/2]

C3D_API castor::Vector< PassComponentUPtr > castor3d::Pass::removeComponent ( castor::String const & name)

◆ reset()

void castor3d::Pass::reset ( ) const
inlinenoexcept

References m_dirty.

◆ resetTexture()

C3D_API void castor3d::Pass::resetTexture ( TextureSourceInfo const & srcSourceInfo,
TextureSourceInfo dstSourceInfo )

Replaces a texture source.

Parameters
[in]srcSourceInfoThe original texture source.
[in]dstSourceInfoThe replacement texture source.

◆ setColour() [1/4]

void castor3d::Pass::setColour ( castor::Coords3f const & v)
inline

References setColour().

Here is the call graph for this function:

◆ setColour() [2/4]

C3D_API void castor3d::Pass::setColour ( castor::HdrRgbColour const & value)

Sets the basic pass colour.

Parameters
[in]valueThe new value.

Referenced by setColour(), setColour(), and setColour().

Here is the caller graph for this function:

◆ setColour() [3/4]

void castor3d::Pass::setColour ( castor::Point3f const & v)
inline

References setColour().

Here is the call graph for this function:

◆ setColour() [4/4]

void castor3d::Pass::setColour ( castor::RgbColour const & v,
float gamma = 2.2f )
inline

References setColour().

Here is the call graph for this function:

◆ setId()

void castor3d::Pass::setId ( uint32_t value)
inlinenoexcept

◆ setImplicit()

void castor3d::Pass::setImplicit ( bool value = true)
inlinenoexcept

◆ unregisterTexture()

C3D_API void castor3d::Pass::unregisterTexture ( TextureSourceInfo const & sourceInfo)
noexcept

Removes a texture unit.

Parameters
[in]sourceInfoThe texture source.

◆ update()

C3D_API void castor3d::Pass::update ( )

Updates the render pass, CPU wise.

◆ updateConfig()

C3D_API void castor3d::Pass::updateConfig ( TextureSourceInfo const & sourceInfo,
TextureConfiguration configuration )

Updates the configuration for a texture.

Parameters
[in]sourceInfoThe texture source.
[in]configurationThe new texture configuration.

◆ writeText()

C3D_API bool castor3d::Pass::writeText ( castor::String const & tabs,
castor::Path const & folder,
castor::String const & subfolder,
castor::StringStream & file ) const

Writes the component content to text.

Parameters
[in]tabsThe current tabulation level.
[in]folderThe resources folder.
[in]subfolderThe resources subfolder.
[in,out]fileThe output file.

Friends And Related Symbol Documentation

◆ PassComponent

friend struct PassComponent
friend

Member Data Documentation

◆ m_dirty

std::atomic_bool castor3d::Pass::m_dirty { true }
mutableprotected

Referenced by reset().

◆ onChanged

OnPassChanged castor3d::Pass::onChanged

name Signals.


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