Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Lumina::Pipeline::Object::Attribute Class Reference

Attribute instance holding shared OpenGL resources. More...

#include <spk_pipeline.hpp>

Collaboration diagram for spk::Lumina::Pipeline::Object::Attribute:
Collaboration graph

Public Types

enum class  Kind { None , UBO , SSBO , Sampler }
 Enumerates supported attribute resource types.

Public Member Functions

 Attribute ()=default
 Builds an empty attribute with no bound resource.
 Attribute (const Attribute &p_other)=default
 Copies an attribute and its resource handle.
 Attribute (Attribute &&p_other) noexcept=default
 Moves an attribute and its resource handle.
Attributeoperator= (const Attribute &p_other)=default
 Copies an attribute and its resource handle.
Attributeoperator= (Attribute &&p_other) noexcept=default
 Moves an attribute and its resource handle.
Kind kind () const noexcept
 Returns the attribute resource kind.
GLuint bindingPoint () const noexcept
 Returns the binding point associated with this attribute.
std::size_t size () const noexcept
 Returns the attribute resource size in bytes.
GLint uniformLocation () const noexcept
 Returns the uniform location for sampler attributes.
void setUBO (GLuint p_bindingPoint, std::size_t p_size, spk::OpenGL::BufferObject::Usage p_usage)
 Configures the attribute as a UBO resource.
void setSSBO (GLuint p_bindingPoint, std::size_t p_size, spk::OpenGL::BufferObject::Usage p_usage)
 Configures the attribute as an SSBO resource.
void setSampler (GLint p_uniformLocation, GLuint p_textureUnitIndex)
 Configures the attribute as a sampler resource.
void activate ()
 Activates the underlying resource for rendering.
void deactivate ()
 Deactivates the underlying resource after rendering.
spk::OpenGL::UBOubo ()
 Returns the attribute as a UBO resource.
const spk::OpenGL::UBOubo () const
 Returns the attribute as a UBO resource.
spk::OpenGL::SSBOssbo ()
 Returns the attribute as an SSBO resource.
const spk::OpenGL::SSBOssbo () const
 Returns the attribute as an SSBO resource.
spk::OpenGL::SamplerObjectsampler ()
 Returns the attribute as a sampler resource.
const spk::OpenGL::SamplerObjectsampler () const
 Returns the attribute as a sampler resource.
template<typename TResourceType>
TResourceType & as ()
 Returns the attribute as the requested resource type.
template<typename TResourceType>
const TResourceType & as () const
 Returns the attribute as the requested resource type.

Detailed Description

Attribute instance holding shared OpenGL resources.

Constructor & Destructor Documentation

◆ Attribute() [1/2]

spk::Lumina::Pipeline::Object::Attribute::Attribute ( const Attribute & p_other)
default

Copies an attribute and its resource handle.

Parameters
p_otherAttribute to copy.
Here is the call graph for this function:

◆ Attribute() [2/2]

spk::Lumina::Pipeline::Object::Attribute::Attribute ( Attribute && p_other)
defaultnoexcept

Moves an attribute and its resource handle.

Parameters
p_otherAttribute to move.
Here is the call graph for this function:

Member Function Documentation

◆ as() [1/2]

template<typename TResourceType>
TResourceType & spk::Lumina::Pipeline::Object::Attribute::as ( )
inline

Returns the attribute as the requested resource type.

Template Parameters
TResourceTypeResource type (UBO, SSBO, or SamplerObject).
Returns
Mutable resource reference.
Here is the caller graph for this function:

◆ as() [2/2]

template<typename TResourceType>
const TResourceType & spk::Lumina::Pipeline::Object::Attribute::as ( ) const
inline

Returns the attribute as the requested resource type.

Template Parameters
TResourceTypeResource type (UBO, SSBO, or SamplerObject).
Returns
Const resource reference.

◆ bindingPoint()

GLuint spk::Lumina::Pipeline::Object::Attribute::bindingPoint ( ) const
inlinenoexcept

Returns the binding point associated with this attribute.

Returns
Binding point index.

◆ kind()

Kind spk::Lumina::Pipeline::Object::Attribute::kind ( ) const
inlinenoexcept

Returns the attribute resource kind.

Returns
Attribute kind.

◆ operator=() [1/2]

Attribute & spk::Lumina::Pipeline::Object::Attribute::operator= ( Attribute && p_other)
defaultnoexcept

Moves an attribute and its resource handle.

Parameters
p_otherAttribute to move.
Returns
Reference to this attribute.
Here is the call graph for this function:

◆ operator=() [2/2]

Attribute & spk::Lumina::Pipeline::Object::Attribute::operator= ( const Attribute & p_other)
default

Copies an attribute and its resource handle.

Parameters
p_otherAttribute to copy.
Returns
Reference to this attribute.
Here is the call graph for this function:

◆ sampler() [1/2]

spk::OpenGL::SamplerObject & spk::Lumina::Pipeline::Object::Attribute::sampler ( )
inline

Returns the attribute as a sampler resource.

Returns
Mutable sampler reference.

◆ sampler() [2/2]

const spk::OpenGL::SamplerObject & spk::Lumina::Pipeline::Object::Attribute::sampler ( ) const
inline

Returns the attribute as a sampler resource.

Returns
Const sampler reference.

◆ setSampler()

void spk::Lumina::Pipeline::Object::Attribute::setSampler ( GLint p_uniformLocation,
GLuint p_textureUnitIndex )
inline

Configures the attribute as a sampler resource.

Parameters
p_uniformLocationUniform location for the sampler.
p_textureUnitIndexTexture unit index to bind.

◆ setSSBO()

void spk::Lumina::Pipeline::Object::Attribute::setSSBO ( GLuint p_bindingPoint,
std::size_t p_size,
spk::OpenGL::BufferObject::Usage p_usage )
inline

Configures the attribute as an SSBO resource.

Parameters
p_bindingPointBinding point for the SSBO.
p_sizeBuffer size in bytes.
p_usageBuffer usage hint.

◆ setUBO()

void spk::Lumina::Pipeline::Object::Attribute::setUBO ( GLuint p_bindingPoint,
std::size_t p_size,
spk::OpenGL::BufferObject::Usage p_usage )
inline

Configures the attribute as a UBO resource.

Parameters
p_bindingPointBinding point for the UBO.
p_sizeBuffer size in bytes.
p_usageBuffer usage hint.

◆ size()

std::size_t spk::Lumina::Pipeline::Object::Attribute::size ( ) const
inlinenoexcept

Returns the attribute resource size in bytes.

Returns
Size in bytes.

◆ ssbo() [1/2]

spk::OpenGL::SSBO & spk::Lumina::Pipeline::Object::Attribute::ssbo ( )
inline

Returns the attribute as an SSBO resource.

Returns
Mutable SSBO reference.

◆ ssbo() [2/2]

const spk::OpenGL::SSBO & spk::Lumina::Pipeline::Object::Attribute::ssbo ( ) const
inline

Returns the attribute as an SSBO resource.

Returns
Const SSBO reference.

◆ ubo() [1/2]

spk::OpenGL::UBO & spk::Lumina::Pipeline::Object::Attribute::ubo ( )
inline

Returns the attribute as a UBO resource.

Returns
Mutable UBO reference.

◆ ubo() [2/2]

const spk::OpenGL::UBO & spk::Lumina::Pipeline::Object::Attribute::ubo ( ) const
inline

Returns the attribute as a UBO resource.

Returns
Const UBO reference.

◆ uniformLocation()

GLint spk::Lumina::Pipeline::Object::Attribute::uniformLocation ( ) const
inlinenoexcept

Returns the uniform location for sampler attributes.

Returns
Uniform location.

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