cgv
Loading...
Searching...
No Matches
cgv::render::attribute_array_manager Class Reference

attribute array manager used to upload arrays to gpu More...

#include <attribute_array_manager.h>

Public Member Functions

template<typename T>
bool set_indices (const context &ctx, const T &array)
template<typename T>
bool set_indices (const context &ctx, const T *array, size_t count)
bool has_index_buffer () const
 whether aam contains an index buffer
void remove_indices (const context &ctx)
template<typename T>
bool set_attribute_array (const context &ctx, int loc, const T &array)
template<typename T>
bool set_attribute_array (const context &ctx, int loc, const T *array_ptr, size_t nr_elements, unsigned stride)
bool set_attribute_array (const context &ctx, int loc, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes)
template<typename C, typename T>
bool set_composed_attribute_array (const context &ctx, int loc, const C *array_ptr, size_t nr_elements, const T &elem)
template<typename C, typename T>
bool ref_composed_attribute_array (const context &ctx, int loc, int loc_ref, const C *array_ptr, size_t nr_elements, const T &elem)
void remove_attribute_array (const context &ctx, int loc)
 attribute_array_manager (VertexBufferUsage _default_usage=VBU_STREAM_DRAW)
 default initialization
 ~attribute_array_manager ()
 destructor calls destruct
bool has_attribute (const context &ctx, int loc) const
 check whether the given attribute is available
const vertex_buffer * get_buffer_ptr (int loc) const
 returns the pointer to the vertex buffer as managed by this attribute array manager if specified and nullptr otherwise
bool is_created () const
bool init (context &ctx)
bool enable (context &ctx)
bool disable (context &ctx)
void destruct (const context &ctx)

Protected Attributes

VertexBufferUsage default_usage
 store default buffer usage
attribute_array_binding aab
 attribue array binding used to store array pointers
std::map< int, vertex_buffer * > vbos
 store vertex buffers generated per attribute location

Friends

class renderer
 give renderer access to protected members

Detailed Description

attribute array manager used to upload arrays to gpu

Definition at line 14 of file attribute_array_manager.h.

Constructor & Destructor Documentation

◆ attribute_array_manager()

cgv::render::attribute_array_manager::attribute_array_manager ( VertexBufferUsage _default_usage = VBU_STREAM_DRAW)

default initialization

Definition at line 6 of file attribute_array_manager.cxx.

References default_usage.

◆ ~attribute_array_manager()

cgv::render::attribute_array_manager::~attribute_array_manager ( )

destructor calls destruct

Definition at line 12 of file attribute_array_manager.cxx.

References aab.

Member Function Documentation

◆ destruct()

void cgv::render::attribute_array_manager::destruct ( const context & ctx)

Definition at line 57 of file attribute_array_manager.cxx.

◆ disable()

bool cgv::render::attribute_array_manager::disable ( context & ctx)

Definition at line 53 of file attribute_array_manager.cxx.

◆ enable()

bool cgv::render::attribute_array_manager::enable ( context & ctx)

Definition at line 50 of file attribute_array_manager.cxx.

◆ get_buffer_ptr()

const vertex_buffer * cgv::render::attribute_array_manager::get_buffer_ptr ( int loc) const
inline

returns the pointer to the vertex buffer as managed by this attribute array manager if specified and nullptr otherwise

Definition at line 156 of file attribute_array_manager.h.

References vbos.

Referenced by cgv::render::renderer::get_index_buffer_ptr(), and cgv::render::renderer::get_vertex_buffer_ptr().

◆ has_attribute()

bool cgv::render::attribute_array_manager::has_attribute ( const context & ctx,
int loc ) const

check whether the given attribute is available

Definition at line 9 of file attribute_array_manager.cxx.

References aab.

◆ has_index_buffer()

bool cgv::render::attribute_array_manager::has_index_buffer ( ) const

whether aam contains an index buffer

Definition at line 20 of file attribute_array_manager.cxx.

References vbos.

◆ init()

bool cgv::render::attribute_array_manager::init ( context & ctx)

Definition at line 47 of file attribute_array_manager.cxx.

◆ is_created()

bool cgv::render::attribute_array_manager::is_created ( ) const

Definition at line 44 of file attribute_array_manager.cxx.

◆ ref_composed_attribute_array()

template<typename C, typename T>
bool cgv::render::attribute_array_manager::ref_composed_attribute_array ( const context & ctx,
int loc,
int loc_ref,
const C * array_ptr,
size_t nr_elements,
const T & elem )
inline

Definition at line 137 of file attribute_array_manager.h.

◆ remove_attribute_array()

void cgv::render::attribute_array_manager::remove_attribute_array ( const context & ctx,
int loc )

Definition at line 35 of file attribute_array_manager.cxx.

◆ remove_indices()

void cgv::render::attribute_array_manager::remove_indices ( const context & ctx)

Definition at line 27 of file attribute_array_manager.cxx.

◆ set_attribute_array() [1/3]

template<typename T>
bool cgv::render::attribute_array_manager::set_attribute_array ( const context & ctx,
int loc,
const T & array )
inline

Definition at line 71 of file attribute_array_manager.h.

◆ set_attribute_array() [2/3]

template<typename T>
bool cgv::render::attribute_array_manager::set_attribute_array ( const context & ctx,
int loc,
const T * array_ptr,
size_t nr_elements,
unsigned stride )
inline

Definition at line 91 of file attribute_array_manager.h.

◆ set_attribute_array() [3/3]

bool cgv::render::attribute_array_manager::set_attribute_array ( const context & ctx,
int loc,
type_descriptor element_type,
const vertex_buffer & vbo,
size_t offset_in_bytes,
size_t nr_elements,
unsigned stride_in_bytes )

Definition at line 16 of file attribute_array_manager.cxx.

◆ set_composed_attribute_array()

template<typename C, typename T>
bool cgv::render::attribute_array_manager::set_composed_attribute_array ( const context & ctx,
int loc,
const C * array_ptr,
size_t nr_elements,
const T & elem )
inline

Definition at line 114 of file attribute_array_manager.h.

◆ set_indices() [1/2]

template<typename T>
bool cgv::render::attribute_array_manager::set_indices ( const context & ctx,
const T & array )
inline

Definition at line 27 of file attribute_array_manager.h.

◆ set_indices() [2/2]

template<typename T>
bool cgv::render::attribute_array_manager::set_indices ( const context & ctx,
const T * array,
size_t count )
inline

Definition at line 47 of file attribute_array_manager.h.

◆ renderer

friend class renderer
friend

give renderer access to protected members

Definition at line 23 of file attribute_array_manager.h.

References renderer, and vbos.

Referenced by renderer.

Member Data Documentation

◆ aab

attribute_array_binding cgv::render::attribute_array_manager::aab
protected

attribue array binding used to store array pointers

Definition at line 19 of file attribute_array_manager.h.

Referenced by has_attribute(), and ~attribute_array_manager().

◆ default_usage

VertexBufferUsage cgv::render::attribute_array_manager::default_usage
protected

store default buffer usage

Definition at line 17 of file attribute_array_manager.h.

Referenced by attribute_array_manager().

◆ vbos

std::map<int, vertex_buffer*> cgv::render::attribute_array_manager::vbos
protected

store vertex buffers generated per attribute location

Definition at line 21 of file attribute_array_manager.h.

Referenced by get_buffer_ptr(), has_index_buffer(), and renderer.


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