Kanzi  3.9.6
Kanzi Engine API
kanzi::Framebuffer Class Reference

Framebuffer attachment state. More...

#include <kanzi/core.ui/graphics2d/framebuffer.hpp>

Inheritance diagram for kanzi::Framebuffer:
[legend]

Classes

struct  AttachmentPoint
 AttachmentPoint. More...
 

Public Member Functions

void clear ()
 Clear internal state. More...
 
 Framebuffer (Domain *domain, string_view name="")
 Constructor. More...
 
AttachmentPointgetColorAttachment (unsigned int index)
 Gets the color attachment by index. More...
 
RenderbufferSharedPtr getDepthStencilRenderbuffer () const
 Gets the current depth texture attachment. More...
 
TextureSharedPtr getDepthTexture () const
 Gets the current depth texture attachment. More...
 
unsigned int getDrawBufferCount () const
 Gets the draw buffer count for binding. More...
 
unsigned int getNativeHandle () const
 Gets the native framebuffer handle. More...
 
bool hasAttachedDepthTarget () const
 Indicates whether a depth target has been bound. More...
 
void recreateFramebuffer (Renderer &renderer)
 Recreates the framebuffer based on existing textures. More...
 
bool update (Renderer &renderer, array< TextureSharedPtr, 4u > &colorTexture, array< RenderbufferSharedPtr, 4u > &colorRenderbuffer, TextureSharedPtr depthTexture, RenderbufferSharedPtr depthStencilRenderbuffer)
 Updates the framebuffer state. More...
 
bool updateColorAttachment (unsigned int index, TextureSharedPtr colorTexture, RenderbufferSharedPtr colorRenderbuffer)
 Updates a color attachment point at index. More...
 
bool updateColorAttachment (unsigned int index, TextureSharedPtr colorTexture)
 Updates a color attachment point at index. More...
 
bool updateColorAttachment (unsigned int index, RenderbufferSharedPtr colorRenderbuffer)
 Updates a color attachment point at index. More...
 
bool updateDepthAttachment (TextureSharedPtr depthTexture)
 Updates depth attachment. More...
 
bool updateDepthStencilAttachment (RenderbufferSharedPtr depthStencilRenderbuffer)
 Updates depth attachment. More...
 
 ~Framebuffer () override=default
 Destructor. More...
 
- Public Member Functions inherited from kanzi::GPUResource
unsigned int getGPUMemoryUsage () const
 
RenderergetRenderer () const
 
void invalidate ()
 Notify resource that graphics context was lost and all GPU resources are invalid. More...
 
bool isDeployed () const
 
 ~GPUResource () override
 
- Public Member Functions inherited from kanzi::Resource
virtual unsigned int getCPUMemoryUsage () const
 Function for getting the memory usage of a resource. More...
 
const string & getName () const
 Gets the resource name. More...
 
const string & getUrl () const
 Gets the resource URL. More...
 
bool isKeepAlive () const
 Tells if the resource has keep alive flag set. More...
 
void reload ()
 
void reloadFromFile (string_view filePath)
 
void reloadFromKzb (KzbFile &kzbFile, ReadOnlyMemoryFile &file, KzbMemoryParser &parser)
 
void setKeepAlive (bool keepAlive)
 Sets the keep alive flag. More...
 
void setUrl (string_view url)
 Sets the resource URL. More...
 
 ~Resource () override
 Destructor. More...
 
- Public Member Functions inherited from kanzi::Object
AppliedStyleEntrySharedPtr applyObjectStyle (kanzi::StyleSharedPtr style)
 Applies a style to an object. More...
 
void applyObjectStyles ()
 Apply all styles for an object node. More...
 
DomaingetDomain () const
 Returns the domain the object belongs to. More...
 
const MetaclassgetDynamicMetaclass () const override
 Returns the metaclass of the dynamic type of the object. More...
 
MainLoopSchedulergetMainLoopScheduler () const
 Returns the MainLoopScheduler instance of the associated Domain. More...
 
detail::MessageDispatcher * getMessageDispatcher () const
 Returns the message dispatcher of the object. More...
 
ResourceManagergetResourceManager () const
 Returns the resource manager of the object. More...
 
ScriptingContextSharedPtr getScriptingContext () const
 Gets the scripting context of the object. More...
 
 Object (Domain *domain)
 
void setScriptingContext (ScriptingContextSharedPtr context)
 Sets the scripting context of the object. More...
 
void unapplyObjectStyle (AppliedStyleEntrySharedPtr appliedStyleEntry)
 
void unapplyObjectStyles ()
 Unapplies and removes all applied styles. More...
 
 ~Object () override
 
- Public Member Functions inherited from kanzi::MetaObject
bool isTypeOf (const Metaclass *objectType) const
 Determines if the type of this object is the given type or derived from it. More...
 
virtual ~MetaObject ()
 
- Public Member Functions inherited from kanzi::PropertyObject
template<typename DataType >
void addPropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void addPropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 
PropertyStorageContainer::iterator beginPropertyStorage ()
 Returns the begin iterator to the internal property storage container. More...
 
PropertyStorageContainer::const_iterator beginPropertyStorage () const
 Returns the begin iterator to the internal property storage container. More...
 
void clearPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
void copyLocalValue (const PropertyObject &other, AbstractPropertyType propertyType)
 Copies local value of single property from another object. More...
 
void copyLocalValues (const PropertyObject &other)
 Copies all local values from another object. More...
 
PropertyStorageContainer::iterator endPropertyStorage ()
 Returns the end iterator to the internal property storage container. More...
 
PropertyStorageContainer::const_iterator endPropertyStorage () const
 Returns the end iterator to the internal property storage container. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractPropertyBase (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalProperty (const PropertyType< DataType > &propertyType) const
 Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value. More...
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getProperty (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property type. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers. More...
 
template<typename DataType >
size_t getPropertyNotificationHandlerCount (const PropertyType< DataType > &propertyType) const
 Gets number of current notification handlers for given property type. More...
 
bool hasBaseValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value, disregarding modifiers. More...
 
bool hasLocalValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a local value set for the property. More...
 
bool hasNonClassValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a value of any precedence higher than class default value set for the property. More...
 
bool hasValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value. More...
 
bool isPropertyFlagSet (AbstractPropertyType propertyType, uint32_t flag) const
 
virtual void onPropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason)
 Virtual function to handle property change notifications. More...
 
 PropertyObject ()
 
void removeKzbProperties (flat_set< AbstractPropertyType > *keepProperties)
 Remove all KZB properties that are not included in a given set. More...
 
void removeKzbProperties ()
 Remove all KZB properties. More...
 
template<typename DataType >
void removeLocalPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
void removeLocalValue (AbstractPropertyType propertyType)
 Removes the local value associated with the property. More...
 
template<typename DataType >
void removePropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void removePropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void removePropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
template<typename DataType >
void setAbstractProperty (AbstractPropertyType abstractPropertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 
template<typename DataType >
void setProperty (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 Sets the local value of a property type. More...
 
void setPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
void validatePropertyModifiers (AbstractPropertyType propertyType)
 
virtual ~PropertyObject ()
 

Static Public Member Functions

static FramebufferSharedPtr create (Domain *domain, string_view name="")
 Creates a framebuffer resource. More...
 
- Static Public Member Functions inherited from kanzi::Object
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info. More...
 
- Static Public Member Functions inherited from kanzi::MetaObject
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info. More...
 

Protected Member Functions

bool attachTarget (Renderer &renderer, const AttachmentPoint &attachmentPoint, Surface::APIAttachment attachment)
 Attaches a single attachment point to output index. More...
 
void attachTarget (Renderer &renderer, const Texture &texture, Surface::APIAttachment attachment)
 Attaches a single texture to output index. More...
 
void attachTarget (Renderer &renderer, const Renderbuffer &renderbuffer, Surface::APIAttachment attachment)
 Attaches a single renderbuffer to output index. More...
 
void invalidateOverride () override
 GPUResource::invalidateOverride() implementation. More...
 
bool isDeployedOverride () const override
 GPUResource::isDeployedOverride() implementation. More...
 
void reloadOverride () override
 Resource::reloadOverride() implementation. More...
 
- Protected Member Functions inherited from kanzi::GPUResource
virtual unsigned int getGPUMemoryUsageOverride () const
 Gets the amount of GPU memory consumed by the resource. More...
 
 GPUResource (Domain *domain, string_view name="")
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::Resource
virtual unsigned int getCPUMemoryUsageOverride () const
 
virtual void reloadFromFileOverride (string_view filePath)
 
virtual void reloadFromKzbOverride (KzbFile &kzbFile, ReadOnlyMemoryFile &file, KzbMemoryParser &parser)
 
 Resource (Domain *domain, string_view name)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::Object
void initialize ()
 
void onCopy (const Object &other)
 
- Protected Member Functions inherited from kanzi::MetaObject
void initialize ()
 
 MetaObject ()
 
- Protected Member Functions inherited from kanzi::PropertyObject
AbstractPropertyTypeDescriptor::ValueSourceEntryacquireLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Acquires a local value source entry that is free for the assignment of a value. More...
 
AbstractPropertyTypeDescriptor::ModifierStorageacquireModifierStorage (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::NotificationStorageacquireNotificationStorage (AbstractPropertyTypeDescriptor &descriptor)
 
PropertyStoragePtr acquirePropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 Internally adds a property value source. More...
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 Internally adds a property value source. More...
 
AbstractPropertyTypeDescriptor::ValueSourceEntryconstructLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
PropertyStoragePtr constructPropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
void copyLocalValue (const AbstractPropertyTypeDescriptor::PropertyStorage &otherPropertyStorage)
 Copy local value from property storage. More...
 
AbstractPropertyTypeDescriptor::ModifierStoragefindModifierStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::NotificationStoragefindNotificationStorage (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::PropertyStoragefindPropertyStorage (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the property storage for given property type descriptor. More...
 
PropertyStoragePtr findPropertyStoragePtr (AbstractPropertyTypeDescriptor &descriptor) const
 Gets property storage intrusive pointer which you can use to hold a reference until the end of the operation. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByNameAndDataType (string_view name, PropertyDataType dataType) const
 Finds a property type descriptor by name and data type. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByQualifiedNameAndDataType (string_view qualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with qualified names. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByUnqualifiedNameAndDataType (string_view unqualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with unqualified names. More...
 
AbstractPropertyTypeDescriptor::ValueSourcegetClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetFinalValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetNonClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetTopValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the top-level value source for a given property descriptor. More...
 
virtual void notifyPropertyHandlers (PropertyStoragePtr &storagePtr, PropertyNotificationReason reason)
 Notifies all property handlers on a property storage. More...
 
void onCopy (const PropertyObject &other)
 
void removeLocalValue (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Removes a local value from the given property storage. More...
 
void removePropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, void *owner)
 Removes a property value source. More...
 
void validatePropertyModifiersAndNotifyHandlers (PropertyStoragePtr &propertyStorage)
 

Protected Attributes

array< AttachmentPoint, 4 > m_colorAttachments
 Array of color attachments. More...
 
RenderbufferSharedPtr m_depthStencilRenderbuffer
 Depth/stencil renderbuffer. More...
 
TextureSharedPtr m_depthTexture
 Depth texture. More...
 
unsigned int m_drawBufferCount
 Number of draw buffers in use after last update. More...
 
GLFramebufferHandle m_handle
 Framebuffer handle used. More...
 
- Protected Attributes inherited from kanzi::Object
AppliedStyleContainer m_appliedStyles
 Listing of applied styles applied to this object. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::GPUResource
enum  MemoryType { GpuOnly, GpuAndRam, RamOnly }
 Memory upload and RAM preservation strategy for GPU resources. More...
 
- Public Types inherited from kanzi::PropertyObject
typedef PropertyStorageContainer::const_iterator PropertyStorageConstIterator
 
typedef vector< PropertyStoragePtrPropertyStorageContainer
 
typedef PropertyStorageContainer::iterator PropertyStorageIterator
 
typedef intrusive_ptr< AbstractPropertyTypeDescriptor::PropertyStoragePropertyStoragePtr
 
typedef PropertyStorageContainer::reverse_iterator PropertyStorageReverseIterator
 
- Protected Types inherited from kanzi::Object
typedef vector< AppliedStyleEntrySharedPtrAppliedStyleContainer
 Applied style container. More...
 

Detailed Description

Framebuffer attachment state.

Handles the attachment state for a framebuffer that combines multiple textures and renderbuffers into one render context.

Inherits GPUresource so it's possible to add the framebuffer constructs into resource manager and have them be invalidated.

Framebuffer class is intended for internal use by other Kanzi subsystems controlling rendering. It can also be used manually:

// Create two individual render target textures.
Texture::CreateInfoNode2DRenderTarget createInfo1(512, 384, GraphicsFormatR8G8B8A8_UNORM);
Texture::CreateInfoNode2DRenderTarget createInfo2(512, 384, GraphicsFormatR8_UNORM);
TextureSharedPtr texture1 = Texture::create(domain, createInfo1, "color target 1");
TextureSharedPtr texture2 = Texture::create(domain, createInfo2, "color target 2");
// Create a framebuffer.
FramebufferSharedPtr framebuffer = Framebuffer::create(domain, "framebuffer");
// Set the textures into the color attachments.
framebuffer->updateColorAttachment(0u, texture1);
framebuffer->updateColorAttachment(1u, texture2);
// Recreate the framebuffer based on the state.
framebuffer->recreateFramebuffer(*renderer);
// Bind framebuffer for rendering.
// Note that since there are two color targets, the color target count must be updated.
renderer->bindFramebuffer(framebuffer->getNativeHandle());
renderer->setColorBufferCount(framebuffer->getDrawBufferCount());
// After rendering, restore the color buffer count to 1 if necessary.
renderer->bindFramebuffer(0u);
renderer->setColorBufferCount(1u);

Constructor & Destructor Documentation

◆ Framebuffer()

kanzi::Framebuffer::Framebuffer ( Domain domain,
string_view  name = "" 
)
explicit

Constructor.

Parameters
domainDomain to use.
nameResource name.

◆ ~Framebuffer()

kanzi::Framebuffer::~Framebuffer ( )
overridedefault

Destructor.

Member Function Documentation

◆ create()

static FramebufferSharedPtr kanzi::Framebuffer::create ( Domain domain,
string_view  name = "" 
)
static

Creates a framebuffer resource.

Parameters
domainDomain to use.
nameResource name.

◆ getDrawBufferCount()

unsigned int kanzi::Framebuffer::getDrawBufferCount ( ) const
inline

Gets the draw buffer count for binding.

Returns
Draw buffer count.
Since
Kanzi 3.9.0

◆ getNativeHandle()

unsigned int kanzi::Framebuffer::getNativeHandle ( ) const
inline

Gets the native framebuffer handle.

Returns
Native handle ID.

◆ getColorAttachment()

AttachmentPoint& kanzi::Framebuffer::getColorAttachment ( unsigned int  index)
inline

Gets the color attachment by index.

Parameters
indexIndex of the color attachment.
Returns
Reference to attachment.
Since
Kanzi 3.9.0

◆ getDepthTexture()

TextureSharedPtr kanzi::Framebuffer::getDepthTexture ( ) const
inline

Gets the current depth texture attachment.

Returns
Depth texture attachment or nullptr.
Since
Kanzi 3.9.0

◆ getDepthStencilRenderbuffer()

RenderbufferSharedPtr kanzi::Framebuffer::getDepthStencilRenderbuffer ( ) const
inline

Gets the current depth texture attachment.

Returns
Depth texture attachment or nullptr.
Since
Kanzi 3.9.0

◆ hasAttachedDepthTarget()

bool kanzi::Framebuffer::hasAttachedDepthTarget ( ) const

Indicates whether a depth target has been bound.

Returns true if a depth texture is attached or a depth renderbuffer exists.

Returns
If a depth target is bound, true, otherwise false.
Since
Kanzi 3.9.0

◆ clear()

void kanzi::Framebuffer::clear ( )

Clear internal state.

After calling this function, the framebuffer does not own any GPU resources.

Since
Kanzi 3.9.0

◆ update()

bool kanzi::Framebuffer::update ( Renderer renderer,
array< TextureSharedPtr, 4u > &  colorTexture,
array< RenderbufferSharedPtr, 4u > &  colorRenderbuffer,
TextureSharedPtr  depthTexture,
RenderbufferSharedPtr  depthStencilRenderbuffer 
)

Updates the framebuffer state.

Recreates the framebuffer when any attachment state changes:

  • If color renderbuffer is specified, it is selected instead of texture.
  • If depth/stencil renderbuffer is specified, it is selected instead of texture.
  • Does not check the size or format. Requires the given textures and renderbuffers to have the correct settings.
    Parameters
    rendererRenderer to use.
    colorTextureArray of color textures-
    colorRenderbufferArray of color renderbuffers.
    depthTextureDepth texture target.
    depthStencilRenderbufferThe depth or stencil renderbuffer.
    Returns
    If the framebuffer was recreated true, otherwise false.
    Since
    Kanzi 3.9.0

◆ updateColorAttachment() [1/3]

bool kanzi::Framebuffer::updateColorAttachment ( unsigned int  index,
TextureSharedPtr  colorTexture,
RenderbufferSharedPtr  colorRenderbuffer 
)
inline

Updates a color attachment point at index.

Called internally from update() if giving all paramters.

Parameters
indexIndex of color attachment.
colorTextureColor texture to attach at attachment point.
colorRenderbufferColor renderbuffer to attach at attachment point.
Returns
True if any of the attached objects were changed.
Since
Kanzi 3.9.0

◆ updateColorAttachment() [2/3]

bool kanzi::Framebuffer::updateColorAttachment ( unsigned int  index,
TextureSharedPtr  colorTexture 
)
inline

Updates a color attachment point at index.

Parameters
indexIndex of color attachment.
colorTextureColor texture to attach at attachment point.
Returns
True if any of the attached objects were changed.
Since
Kanzi 3.9.0

◆ updateColorAttachment() [3/3]

bool kanzi::Framebuffer::updateColorAttachment ( unsigned int  index,
RenderbufferSharedPtr  colorRenderbuffer 
)
inline

Updates a color attachment point at index.

Parameters
indexIndex of color attachment.
colorRenderbufferColor renderbuffer to attach at attachment point.
Returns
True if any of the attached objects were changed.
Since
Kanzi 3.9.0

◆ updateDepthAttachment()

bool kanzi::Framebuffer::updateDepthAttachment ( TextureSharedPtr  depthTexture)
inline

Updates depth attachment.

Called internally from update() if giving all paramters.

Parameters
depthTextureDepth texture to use.
Returns
True if any of the attached objects were changed.
Since
Kanzi 3.9.0

◆ updateDepthStencilAttachment()

bool kanzi::Framebuffer::updateDepthStencilAttachment ( RenderbufferSharedPtr  depthStencilRenderbuffer)
inline

Updates depth attachment.

Called internally from update() if giving all paramters.

Parameters
depthStencilRenderbufferThe depth or stencil renderbuffer.
Returns
True if any of the attached objects were changed.
Since
Kanzi 3.9.0

◆ recreateFramebuffer()

void kanzi::Framebuffer::recreateFramebuffer ( Renderer renderer)

Recreates the framebuffer based on existing textures.

Must be called after updating individual attachments. Calling update() with all parameters will internally call this function.

Parameters
rendererRenderer to use.
Since
Kanzi 3.9.0

◆ attachTarget() [1/3]

bool kanzi::Framebuffer::attachTarget ( Renderer renderer,
const AttachmentPoint attachmentPoint,
Surface::APIAttachment  attachment 
)
protected

Attaches a single attachment point to output index.

Favors renderbuffer.

Parameters
rendererRenderer to use.
attachmentPointAttachment point input (texture or renderbuffer).
attachmentSurface attachment target. Color buffer index or depth buffer.
Returns
If any target was attached true, otherwise false.
Since
Kanzi 3.9.0

◆ attachTarget() [2/3]

void kanzi::Framebuffer::attachTarget ( Renderer renderer,
const Texture texture,
Surface::APIAttachment  attachment 
)
protected

Attaches a single texture to output index.

Parameters
rendererRenderer to use.
textureColor texture to attach.
attachmentSurface attachment target. Color buffer index or depth buffer.
Since
Kanzi 3.9.0

◆ attachTarget() [3/3]

void kanzi::Framebuffer::attachTarget ( Renderer renderer,
const Renderbuffer renderbuffer,
Surface::APIAttachment  attachment 
)
protected

Attaches a single renderbuffer to output index.

Parameters
rendererRenderer to use.
renderbufferAttachment point to attach.
attachmentSurface attachment target. Color buffer index or depth buffer.
Since
Kanzi 3.9.0

◆ isDeployedOverride()

bool kanzi::Framebuffer::isDeployedOverride ( ) const
overrideprotectedvirtual

◆ invalidateOverride()

void kanzi::Framebuffer::invalidateOverride ( )
overrideprotectedvirtual

GPUResource::invalidateOverride() implementation.

Reimplemented from kanzi::GPUResource.

◆ reloadOverride()

void kanzi::Framebuffer::reloadOverride ( )
overrideprotectedvirtual

Resource::reloadOverride() implementation.

Reimplemented from kanzi::Resource.

Member Data Documentation

◆ m_handle

GLFramebufferHandle kanzi::Framebuffer::m_handle
protected

Framebuffer handle used.

◆ m_colorAttachments

array<AttachmentPoint, 4> kanzi::Framebuffer::m_colorAttachments
protected

Array of color attachments.

◆ m_depthTexture

TextureSharedPtr kanzi::Framebuffer::m_depthTexture
protected

Depth texture.

◆ m_depthStencilRenderbuffer

RenderbufferSharedPtr kanzi::Framebuffer::m_depthStencilRenderbuffer
protected

Depth/stencil renderbuffer.

◆ m_drawBufferCount

unsigned int kanzi::Framebuffer::m_drawBufferCount
protected

Number of draw buffers in use after last update.


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