Overload  1.1
Game engine with editor
Public Member Functions | Static Public Member Functions | List of all members
OvRendering::Buffers::UniformBuffer Class Reference

#include <UniformBuffer.h>

Public Member Functions

 UniformBuffer (size_t p_size, uint32_t p_bindingPoint=0, uint32_t p_offset=0, EAccessSpecifier p_accessSpecifier=EAccessSpecifier::DYNAMIC_DRAW)
 
 ~UniformBuffer ()
 
void Bind ()
 
void Unbind ()
 
template<typename T >
void SetSubData (const T &p_data, size_t p_offset)
 
template<typename T >
void SetSubData (const T &p_data, std::reference_wrapper< size_t > p_offsetInOut)
 
uint32_t GetID () const
 

Static Public Member Functions

static void BindBlockToShader (OvRendering::Resources::Shader &p_shader, uint32_t p_uniformBlockLocation, uint32_t p_bindingPoint=0)
 
static void BindBlockToShader (OvRendering::Resources::Shader &p_shader, const std::string &p_name, uint32_t p_bindingPoint=0)
 
static uint32_t GetBlockLocation (OvRendering::Resources::Shader &p_shader, const std::string &p_name)
 

Detailed Description

Wraps OpenGL UBO

Constructor & Destructor Documentation

◆ UniformBuffer()

OvRendering::Buffers::UniformBuffer::UniformBuffer ( size_t  p_size,
uint32_t  p_bindingPoint = 0,
uint32_t  p_offset = 0,
EAccessSpecifier  p_accessSpecifier = EAccessSpecifier::DYNAMIC_DRAW 
)

Create a UniformBuffer

Parameters
p_size(Specify the size in bytes of the UBO data)
p_bindingPoint(Specify the binding point on which the uniform buffer should be binded) @parma p_offset (The offset of the UBO, sizeof previouses UBO if the binding point is != 0)
p_accessSpecifier@project: Overload
Author
: Overload Tech. @restrictions: This software may not be resold, redistributed or otherwise conveyed to a third party.

◆ ~UniformBuffer()

OvRendering::Buffers::UniformBuffer::~UniformBuffer ( )

Destructor of the UniformBuffer

Member Function Documentation

◆ Bind()

void OvRendering::Buffers::UniformBuffer::Bind ( )

Bind the UBO

◆ BindBlockToShader() [1/2]

void OvRendering::Buffers::UniformBuffer::BindBlockToShader ( OvRendering::Resources::Shader p_shader,
const std::string &  p_name,
uint32_t  p_bindingPoint = 0 
)
static

Bind a block identified by the given name to the given shader

Parameters
p_shader
p_name
p_bindingPoint

◆ BindBlockToShader() [2/2]

void OvRendering::Buffers::UniformBuffer::BindBlockToShader ( OvRendering::Resources::Shader p_shader,
uint32_t  p_uniformBlockLocation,
uint32_t  p_bindingPoint = 0 
)
static

Bind a block identified by the given ID to given shader

Parameters
p_shader
p_uniformBlockLocation
p_bindingPoint

◆ GetBlockLocation()

uint32_t OvRendering::Buffers::UniformBuffer::GetBlockLocation ( OvRendering::Resources::Shader p_shader,
const std::string &  p_name 
)
static

Return the location of the block (ID)

Parameters
p_shader
p_name

◆ GetID()

GLuint OvRendering::Buffers::UniformBuffer::GetID ( ) const

Return the ID of the UBO

◆ SetSubData() [1/2]

template<typename T >
void OvRendering::Buffers::UniformBuffer::SetSubData ( const T &  p_data,
size_t  p_offset 
)
inline

Set the data in the UBO located at p_offset to p_data

Parameters
p_data
p_offset

◆ SetSubData() [2/2]

template<typename T >
void OvRendering::Buffers::UniformBuffer::SetSubData ( const T &  p_data,
std::reference_wrapper< size_t >  p_offsetInOut 
)
inline

Set the data in the UBO located at p_offset to p_data

Parameters
p_data
p_offsetInOut(Will keep track of the current stride of the data layout)

◆ Unbind()

void OvRendering::Buffers::UniformBuffer::Unbind ( )

Unbind the UBO


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