Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
castor3d::SceneBackground Class Referenceabstract

#include <Background.hpp>

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

Public Member Functions

C3D_API SceneBackground (Engine &engine, Scene &scene, castor::String const &name, castor::String type, bool hasIBLSupport)
 Constructor.
 
virtual C3D_API ~SceneBackground ()
 Destructor.
 
C3D_API bool initialise (RenderDevice const &device)
 Initialisation function.
 
C3D_API void cleanup ()
 Cleanup function.
 
C3D_API void update (CpuUpdater &updater) const
 Updates the background, CPU side.
 
C3D_API void update (GpuUpdater &updater) const
 Updates the background, GPU side.
 
C3D_API void upload (UploadData &uploader)
 Uploads image data to the texture buffer.
 
C3D_API void notifyChanged ()
 Notifies a change to apply on GPU for the background.
 
virtual C3D_API void accept (BackgroundVisitor &visitor)=0
 Visitor acceptance function.
 
virtual C3D_API void accept (ConfigurationVisitorBase &visitor)=0
 Visitor acceptance function.
 
virtual C3D_API crg::FramePass & createBackgroundPass (crg::FramePassGroup &graph, RenderDevice const &device, ProgressBar *progress, VkExtent2D const &size, crg::ImageViewIdArray const &colour, crg::ImageViewIdArray const &depth, crg::ImageViewId const *depthObj, UniformBufferOffsetT< ModelBufferConfiguration > const &modelUbo, CameraUbo const &cameraUbo, HdrConfigUbo const &hdrConfigUbo, SceneUbo const &sceneUbo, bool clearColour, bool clearDepth, bool forceVisible, BackgroundPassBase *&backgroundPass)
 Creates the background render pass.
 
C3D_API void addPassBindings (crg::FramePass &pass, crg::ImageViewIdArray const &targetImage, uint32_t &index) const
 Adds the background specific bindings to a frame pass.
 
C3D_API void addBindings (ashes::VkDescriptorSetLayoutBindingArray &bindings, VkShaderStageFlags shaderStages, uint32_t &index) const
 Adds the background specific bindings.
 
C3D_API void addDescriptors (ashes::WriteDescriptorSetArray &descriptorWrites, crg::ImageViewIdArray const &targetImage, uint32_t &index) const
 Adds the background specific descriptors.
 
virtual C3D_API castor::String const & getModelName () const
 
C3D_API BackgroundModelID getModelID () const
 
virtual C3D_API bool write (castor::String const &tabs, castor::Path const &folder, castor::StringStream &stream) const =0
 Writes the background to a text stream.
 
void setVisible (bool v) noexcept
 
virtual bool isDepthSampled () const noexcept
 
virtual bool hasScattering () const noexcept
 
ScenegetScene () const noexcept
 
castor::String const & getType () const noexcept
 
TextureLayoutgetTexture () const noexcept
 
ashes::Image const & getImage () const
 
bool isHdr () const noexcept
 
bool isSRGB () const noexcept
 
bool hasIbl () const noexcept
 
bool isInitialised () const noexcept
 
bool isVisible () const noexcept
 
IblTextures const & getIbl () const noexcept
 
Sampler const & getSampler () const noexcept
 
uint32_t const & getPassIndex (bool forceVisible) const noexcept
 
- Public Member Functions inherited from castor::OwnedBy< Engine >
Engine * getOwner () const
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Public Attributes

OnBackgroundChanged onChanged
 

Static Public Attributes

static uint32_t constexpr VisiblePassIndex = 0u
 
static uint32_t constexpr HiddenPassIndex = 1u
 

Static Protected Member Functions

static C3D_API castor::PxBufferBaseUPtr adaptBuffer (castor::PxBufferBase const &buffer, castor::String const &name, bool generateMips)
 
static C3D_API castor::ImageUPtr loadImage (Engine &engine, castor::String const &name, castor::Path const &folder, castor::Path const &relative, bool generateMips)
 

Protected Attributes

Scenem_scene
 
castor::String m_type
 
std::atomic_bool m_initialised { false }
 
bool m_hdr { true }
 
bool m_srgb { false }
 
Texture m_textureId
 
TextureLayoutUPtr m_texture
 
SamplerObs m_sampler {}
 
castor::RawUniquePtr< IblTexturesm_ibl
 
bool m_hasIBLSupport
 
bool m_visible { true }
 
uint32_t m_passIndex { 0u }
 
bool m_needsUpload {}
 
- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ SceneBackground()

C3D_API castor3d::SceneBackground::SceneBackground ( Engine & engine,
Scene & scene,
castor::String const & name,
castor::String type,
bool hasIBLSupport )
explicit

Constructor.

Parameters
engineThe engine.
sceneThe parent scene.
nameThe background name.
typeThe background type.
hasIBLSupportTells if the background supports IBL.

◆ ~SceneBackground()

virtual C3D_API castor3d::SceneBackground::~SceneBackground ( )
virtual

Destructor.

Member Function Documentation

◆ accept() [1/2]

virtual C3D_API void castor3d::SceneBackground::accept ( BackgroundVisitor & visitor)
pure virtual

Visitor acceptance function.

Parameters
visitorThe visitor.

Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.

◆ accept() [2/2]

virtual C3D_API void castor3d::SceneBackground::accept ( ConfigurationVisitorBase & visitor)
pure virtual

Visitor acceptance function.

Parameters
visitorThe visitor.

Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.

◆ adaptBuffer()

static C3D_API castor::PxBufferBaseUPtr castor3d::SceneBackground::adaptBuffer ( castor::PxBufferBase const & buffer,
castor::String const & name,
bool generateMips )
staticprotected

◆ addBindings()

C3D_API void castor3d::SceneBackground::addBindings ( ashes::VkDescriptorSetLayoutBindingArray & bindings,
VkShaderStageFlags shaderStages,
uint32_t & index ) const

Adds the background specific bindings.

Parameters
bindingsReceives the bindings.
shaderStagesThe impacted shader stages.
indexThe bindings start index.

◆ addDescriptors()

C3D_API void castor3d::SceneBackground::addDescriptors ( ashes::WriteDescriptorSetArray & descriptorWrites,
crg::ImageViewIdArray const & targetImage,
uint32_t & index ) const

Adds the background specific descriptors.

Parameters
descriptorWritesReceives the descriptors.
targetImageThe image this pass renders to.
indexThe descriptors start index.

◆ addPassBindings()

C3D_API void castor3d::SceneBackground::addPassBindings ( crg::FramePass & pass,
crg::ImageViewIdArray const & targetImage,
uint32_t & index ) const

Adds the background specific bindings to a frame pass.

Parameters
passReceives the bindings.
targetImageThe image this pass renders to.
indexThe bindings start index.

◆ cleanup()

C3D_API void castor3d::SceneBackground::cleanup ( )

Cleanup function.

◆ createBackgroundPass()

virtual C3D_API crg::FramePass & castor3d::SceneBackground::createBackgroundPass ( crg::FramePassGroup & graph,
RenderDevice const & device,
ProgressBar * progress,
VkExtent2D const & size,
crg::ImageViewIdArray const & colour,
crg::ImageViewIdArray const & depth,
crg::ImageViewId const * depthObj,
UniformBufferOffsetT< ModelBufferConfiguration > const & modelUbo,
CameraUbo const & cameraUbo,
HdrConfigUbo const & hdrConfigUbo,
SceneUbo const & sceneUbo,
bool clearColour,
bool clearDepth,
bool forceVisible,
BackgroundPassBase *& backgroundPass )
virtual

Creates the background render pass.

Parameters
graphThe runnable graph.
deviceThe GPU device.
progressThe optional progress bar.
sizeThe render area dimensions.
colourThe colour result.
depthThe optional depth image.
depthObjThe optional depths and objects image.
modelUboThe model UBO.
cameraUboThe matrix UBO.
hdrConfigUboThe HDR configuration UBO.
sceneUboThe scene UBO.
clearColourtrue to clear the colour result.
clearDepthtrue to clear the depth result.
forceVisibletrue to force display of background.
[out]backgroundPassReceives the background pass.

◆ getIbl()

IblTextures const & castor3d::SceneBackground::getIbl ( ) const
inlinenoexcept

References CU_Require, and m_ibl.

◆ getImage()

ashes::Image const & castor3d::SceneBackground::getImage ( ) const
inline

References CU_Require, and m_texture.

◆ getModelID()

C3D_API BackgroundModelID castor3d::SceneBackground::getModelID ( ) const

◆ getModelName()

virtual C3D_API castor::String const & castor3d::SceneBackground::getModelName ( ) const
virtual
Returns
The background model name.

Reimplemented in castor3d::ImageBackground.

◆ getPassIndex()

uint32_t const & castor3d::SceneBackground::getPassIndex ( bool forceVisible) const
inlinenoexcept

References m_passIndex, and VisiblePassIndex.

◆ getSampler()

Sampler const & castor3d::SceneBackground::getSampler ( ) const
inlinenoexcept

References CU_Require, and m_sampler.

◆ getScene()

Scene & castor3d::SceneBackground::getScene ( ) const
inlinenoexcept

References m_scene.

◆ getTexture()

TextureLayout & castor3d::SceneBackground::getTexture ( ) const
inlinenoexcept

References CU_Require, and m_texture.

◆ getType()

castor::String const & castor3d::SceneBackground::getType ( ) const
inlinenoexcept

References m_type.

◆ hasIbl()

bool castor3d::SceneBackground::hasIbl ( ) const
inlinenoexcept

References m_ibl.

◆ hasScattering()

virtual bool castor3d::SceneBackground::hasScattering ( ) const
inlinevirtualnoexcept

◆ initialise()

C3D_API bool castor3d::SceneBackground::initialise ( RenderDevice const & device)

Initialisation function.

Parameters
[in]deviceThe current device.
Returns
true if ok.

◆ isDepthSampled()

virtual bool castor3d::SceneBackground::isDepthSampled ( ) const
inlinevirtualnoexcept

name Getters.

◆ isHdr()

bool castor3d::SceneBackground::isHdr ( ) const
inlinenoexcept

References m_hdr.

◆ isInitialised()

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

References m_initialised.

◆ isSRGB()

bool castor3d::SceneBackground::isSRGB ( ) const
inlinenoexcept

References m_srgb.

◆ isVisible()

bool castor3d::SceneBackground::isVisible ( ) const
inlinenoexcept

References m_visible.

◆ loadImage()

static C3D_API castor::ImageUPtr castor3d::SceneBackground::loadImage ( Engine & engine,
castor::String const & name,
castor::Path const & folder,
castor::Path const & relative,
bool generateMips )
staticprotected

◆ notifyChanged()

C3D_API void castor3d::SceneBackground::notifyChanged ( )

Notifies a change to apply on GPU for the background.

◆ setVisible()

void castor3d::SceneBackground::setVisible ( bool v)
inlinenoexcept

name Mutators.

References HiddenPassIndex, m_passIndex, m_visible, and VisiblePassIndex.

◆ update() [1/2]

C3D_API void castor3d::SceneBackground::update ( CpuUpdater & updater) const

Updates the background, CPU side.

Parameters
[in]updaterThe update data.

◆ update() [2/2]

C3D_API void castor3d::SceneBackground::update ( GpuUpdater & updater) const

Updates the background, GPU side.

Parameters
[in]updaterThe update data.

◆ upload()

C3D_API void castor3d::SceneBackground::upload ( UploadData & uploader)

Uploads image data to the texture buffer.

◆ write()

virtual C3D_API bool castor3d::SceneBackground::write ( castor::String const & tabs,
castor::Path const & folder,
castor::StringStream & stream ) const
pure virtual

Writes the background to a text stream.

Parameters
tabsThe current indentation.
folderThe working folder.
streamThe text stream.

Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.

Member Data Documentation

◆ HiddenPassIndex

uint32_t constexpr castor3d::SceneBackground::HiddenPassIndex = 1u
staticconstexpr

Referenced by setVisible().

◆ m_hasIBLSupport

bool castor3d::SceneBackground::m_hasIBLSupport
protected

◆ m_hdr

bool castor3d::SceneBackground::m_hdr { true }
protected

Referenced by isHdr().

◆ m_ibl

castor::RawUniquePtr< IblTextures > castor3d::SceneBackground::m_ibl
protected

Referenced by getIbl(), and hasIbl().

◆ m_initialised

std::atomic_bool castor3d::SceneBackground::m_initialised { false }
protected

Referenced by isInitialised().

◆ m_needsUpload

bool castor3d::SceneBackground::m_needsUpload {}
protected

◆ m_passIndex

uint32_t castor3d::SceneBackground::m_passIndex { 0u }
protected

Referenced by getPassIndex(), and setVisible().

◆ m_sampler

SamplerObs castor3d::SceneBackground::m_sampler {}
protected

Referenced by getSampler().

◆ m_scene

Scene& castor3d::SceneBackground::m_scene
protected

Referenced by getScene().

◆ m_srgb

bool castor3d::SceneBackground::m_srgb { false }
protected

Referenced by isSRGB().

◆ m_texture

TextureLayoutUPtr castor3d::SceneBackground::m_texture
protected

Referenced by getImage(), and getTexture().

◆ m_textureId

Texture castor3d::SceneBackground::m_textureId
protected

◆ m_type

castor::String castor3d::SceneBackground::m_type
protected

Referenced by getType().

◆ m_visible

bool castor3d::SceneBackground::m_visible { true }
protected

Referenced by isVisible(), and setVisible().

◆ onChanged

OnBackgroundChanged castor3d::SceneBackground::onChanged

◆ VisiblePassIndex

uint32_t constexpr castor3d::SceneBackground::VisiblePassIndex = 0u
staticconstexpr

Referenced by getPassIndex(), and setVisible().


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