Castor3D 0.16.0
Multiplatform 3D engine
|
#include <Background.hpp>
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 |
Scene & | getScene () const noexcept |
castor::String const & | getType () const noexcept |
TextureLayout & | getTexture () 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 | |
Scene & | m_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< IblTextures > | m_ibl |
bool | m_hasIBLSupport |
bool | m_visible { true } |
uint32_t | m_passIndex { 0u } |
bool | m_needsUpload {} |
Protected Attributes inherited from castor::NamedBaseT< T > | |
T | m_name |
Additional Inherited Members | |
Protected Member Functions inherited from castor::OwnedBy< Engine > | |
OwnedBy (Engine &owner) | |
Constructor. | |
|
explicit |
Constructor.
engine | The engine. |
scene | The parent scene. |
name | The background name. |
type | The background type. |
hasIBLSupport | Tells if the background supports IBL. |
|
virtual |
Destructor.
|
pure virtual |
Visitor acceptance function.
visitor | The visitor. |
Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.
|
pure virtual |
Visitor acceptance function.
visitor | The visitor. |
Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.
|
staticprotected |
C3D_API void castor3d::SceneBackground::addBindings | ( | ashes::VkDescriptorSetLayoutBindingArray & | bindings, |
VkShaderStageFlags | shaderStages, | ||
uint32_t & | index ) const |
Adds the background specific bindings.
bindings | Receives the bindings. |
shaderStages | The impacted shader stages. |
index | The bindings start index. |
C3D_API void castor3d::SceneBackground::addDescriptors | ( | ashes::WriteDescriptorSetArray & | descriptorWrites, |
crg::ImageViewIdArray const & | targetImage, | ||
uint32_t & | index ) const |
Adds the background specific descriptors.
descriptorWrites | Receives the descriptors. |
targetImage | The image this pass renders to. |
index | The descriptors start index. |
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.
pass | Receives the bindings. |
targetImage | The image this pass renders to. |
index | The bindings start index. |
C3D_API void castor3d::SceneBackground::cleanup | ( | ) |
Cleanup function.
|
virtual |
Creates the background render pass.
graph | The runnable graph. | |
device | The GPU device. | |
progress | The optional progress bar. | |
size | The render area dimensions. | |
colour | The colour result. | |
depth | The optional depth image. | |
depthObj | The optional depths and objects image. | |
modelUbo | The model UBO. | |
cameraUbo | The matrix UBO. | |
hdrConfigUbo | The HDR configuration UBO. | |
sceneUbo | The scene UBO. | |
clearColour | true to clear the colour result. | |
clearDepth | true to clear the depth result. | |
forceVisible | true to force display of background. | |
[out] | backgroundPass | Receives the background pass. |
|
inlinenoexcept |
References CU_Require, and m_ibl.
|
inline |
References CU_Require, and m_texture.
C3D_API BackgroundModelID castor3d::SceneBackground::getModelID | ( | ) | const |
|
virtual |
Reimplemented in castor3d::ImageBackground.
|
inlinenoexcept |
References m_passIndex, and VisiblePassIndex.
|
inlinenoexcept |
References CU_Require, and m_sampler.
|
inlinenoexcept |
References CU_Require, and m_texture.
|
inlinenoexcept |
References m_type.
|
inlinenoexcept |
References m_ibl.
|
inlinevirtualnoexcept |
C3D_API bool castor3d::SceneBackground::initialise | ( | RenderDevice const & | device | ) |
Initialisation function.
[in] | device | The current device. |
true
if ok.
|
inlinevirtualnoexcept |
name Getters.
|
inlinenoexcept |
References m_hdr.
|
inlinenoexcept |
References m_initialised.
|
inlinenoexcept |
References m_srgb.
|
inlinenoexcept |
References m_visible.
|
staticprotected |
C3D_API void castor3d::SceneBackground::notifyChanged | ( | ) |
Notifies a change to apply on GPU for the background.
|
inlinenoexcept |
name Mutators.
References HiddenPassIndex, m_passIndex, m_visible, and VisiblePassIndex.
C3D_API void castor3d::SceneBackground::update | ( | CpuUpdater & | updater | ) | const |
Updates the background, CPU side.
[in] | updater | The update data. |
C3D_API void castor3d::SceneBackground::update | ( | GpuUpdater & | updater | ) | const |
Updates the background, GPU side.
[in] | updater | The update data. |
C3D_API void castor3d::SceneBackground::upload | ( | UploadData & | uploader | ) |
Uploads image data to the texture buffer.
|
pure virtual |
Writes the background to a text stream.
tabs | The current indentation. |
folder | The working folder. |
stream | The text stream. |
Implemented in castor3d::ColourBackground, castor3d::ImageBackground, and castor3d::SkyboxBackground.
|
staticconstexpr |
Referenced by setVisible().
|
protected |
|
protected |
Referenced by isHdr().
|
protected |
|
protected |
Referenced by isInitialised().
|
protected |
|
protected |
Referenced by getPassIndex(), and setVisible().
|
protected |
Referenced by getSampler().
|
protected |
Referenced by getScene().
|
protected |
Referenced by isSRGB().
|
protected |
Referenced by getImage(), and getTexture().
|
protected |
|
protected |
Referenced by getType().
|
protected |
Referenced by isVisible(), and setVisible().
OnBackgroundChanged castor3d::SceneBackground::onChanged |
|
staticconstexpr |
Referenced by getPassIndex(), and setVisible().