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

renderer that supports raycasting of cones More...

#include <cone_renderer.h>

Inheritance diagram for cgv::render::cone_renderer:
cgv::render::surface_renderer cgv::render::group_renderer cgv::render::renderer

Public Member Functions

 cone_renderer ()
 initializes member variables
 
void enable_attribute_array_manager (const context &ctx, attribute_array_manager &aam)
 call this before setting attribute arrays to manage attribute array in given manager
 
void disable_attribute_array_manager (const context &ctx, attribute_array_manager &aam)
 call this after last render/draw call to ensure that no other users of renderer change attribute arrays of given manager
 
bool set_albedo_texture (texture *tex)
 
bool set_density_texture (texture *tex)
 
bool enable (context &ctx)
 enables renderer
 
template<typename T = float>
void set_radius_array (const context &ctx, const std::vector< T > &radii)
 
template<typename T = float>
void set_radius_array (const context &ctx, const T *radii, size_t nr_elements, unsigned stride_in_bytes=0)
 
void remove_radius_array (const context &ctx)
 remove the radius attribute
 
template<typename T = float>
void set_sphere_array (const context &ctx, const std::vector< cgv::math::fvec< T, 4 > > &spheres)
 use this function if you store spheres in vec4 with the 4th component the radius
 
bool validate_attributes (const context &ctx) const
 call to validate, whether essential position attribute is defined
 
bool disable (context &ctx)
 disable renderer
 
void draw (context &ctx, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1)
 convenience function to render with default settings
 
virtual void clear (const context &ctx)
 the clear function destructs the shader program and resets the texture pointers
 
- Public Member Functions inherited from cgv::render::surface_renderer
void enable_attribute_array_manager (const context &ctx, attribute_array_manager &aam)
 call this before setting attribute arrays to manage attribute array in given manager
 
void disable_attribute_array_manager (const context &ctx, attribute_array_manager &aam)
 call this after last render/draw call to ensure that no other users of renderer change attribute arrays of given manager
 
bool enable (context &ctx)
 overload to activate group style
 
bool disable (context &ctx)
 disable renderer
 
template<typename T >
void set_normal (const context &ctx, const cgv::math::fvec< T, 3 > &normal)
 specify a single normal for all lines
 
template<typename T >
void set_normal_array (const context &ctx, const std::vector< T > &normals)
 templated method to set the normal attribute array from a vector of normals of type T, which should have 3 components
 
template<typename T >
void set_normal_array (const context &ctx, const T *normals, size_t nr_elements, unsigned stride_in_bytes=0)
 templated method to set the normal attribute from an array of normals of type T, which should have 3 components
 
void set_normal_array (const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 method to set the normal attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
template<typename T >
void set_normal_array (const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the normal attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
void remove_normal_array (const context &ctx)
 remove the normal attribute
 
template<typename T >
void set_texcoord (const context &ctx, const T &texcoord)
 templated method to set the texcoord attribute without array
 
template<typename T >
void set_texcoord_array (const context &ctx, const std::vector< T > &texcoords)
 templated method to set the texcoord attribute array from a vector of texcoords of type T
 
template<typename T >
void set_texcoord_array (const context &ctx, const T *texcoords, size_t nr_elements, unsigned stride_in_bytes=0)
 templated method to set the texcoord attribute from an array of texcoords of type T
 
void set_texcoord_array (const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the texcoord attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
template<typename T >
void set_texcoord_array (const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the texcoord attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
void remove_texcoord_array (const context &ctx)
 remove the texcoord attribute
 
- Public Member Functions inherited from cgv::render::group_renderer
bool validate_attributes (const context &ctx) const
 check additionally the group attributes
 
void set_group_index_array (const context &ctx, const std::vector< unsigned > &group_indices)
 method to set the group index attribute
 
void set_group_index_array (const context &ctx, const unsigned *group_indices, size_t nr_elements)
 method to set the group index attribute
 
void set_group_index_array (const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 method to set the group index attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
template<typename T >
void set_group_index_array (const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the group index color attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
void remove_group_index_array (const context &ctx)
 remove the group index attribute
 
template<typename T >
void set_group_colors (const context &ctx, const std::vector< T > &colors)
 template method to set the group colors from a vector of colors of type T
 
template<typename T >
void set_group_colors (const context &ctx, const T *colors, size_t nr_elements)
 template method to set the group colors from a vector of colors of type T
 
template<typename T >
void set_group_translations (const context &ctx, const std::vector< T > &group_translations)
 template method to set the group translations from a vector of vectors of type T, which should have 3 components
 
template<typename T >
void set_group_translations (const context &ctx, const T *group_translations, size_t nr_elements)
 template method to set the group translations from a vector of vectors of type T, which should have 3 components
 
template<typename T >
void set_group_rotations (const context &ctx, const std::vector< T > &group_rotations)
 template method to set the group rotation from a vector of quaternions of type T, which should have 4 components
 
template<typename T >
void set_group_rotations (const context &ctx, const T *group_rotations, size_t nr_elements)
 template method to set the group rotation from a vector of quaternions of type T, which should have 4 components
 
- Public Member Functions inherited from cgv::render::renderer
shader_define_mapref_defines ()
 access to shader define map to update defines not handled by render style
 
shader_programref_prog ()
 derived renderer classes have access to shader program
 
void set_prog (shader_program &one_shot_prog)
 set external shader program up to next call to disable() or render()
 
void draw_impl (context &ctx, PrimitiveType pt, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1)
 default implementation of draw method with support for indexed rendering and different primitive types
 
void draw_impl_instanced (context &ctx, PrimitiveType type, size_t start, size_t count, size_t instance_count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1)
 default implementation of instanced draw method with support for indexed rendering and different primitive types
 
 renderer ()
 construct and init attribute tracking flags
 
virtual ~renderer ()
 destructor deletes default renderer style
 
void manage_singleton (context &ctx, const std::string &renderer_name, int &ref_count, int ref_count_change)
 used by derived classes to manage singletons
 
virtual void set_attribute_array_manager (const context &ctx, attribute_array_manager *_aam_ptr=0)
 this function is deprecated, please use enable_attribute_array_manager() and disable_attribute_manager() instead
 
void set_render_style (const render_style &rs)
 reference given render style
 
bool build_program (context &ctx, shader_program &prog, const render_style &rs)
 build shader program for specific render style
 
virtual bool init (context &ctx)
 call init() once before using renderer
 
template<typename T >
void set_position (const context &ctx, const T &position)
 templated method to set the position attribute from a single position of type T
 
template<typename T >
void set_position_array (const context &ctx, const std::vector< T > &positions)
 templated method to set the position attribute from a vector of positions of type T
 
template<typename T >
void set_position_array (const context &ctx, const T *positions, size_t nr_elements, unsigned stride_in_bytes=0)
 templated method to set the position attribute from a vector of positions of type T
 
void set_position_array (const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes)
 method to set the position attribute from a vertex buffer object
 
template<typename T >
void set_position_array (const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the position attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
void remove_position_array (const context &ctx)
 remove the position attribute
 
template<typename T >
void set_color (const context &ctx, const T &color)
 templated method to set the color attribute from a single color of type T
 
template<typename T >
void set_color_array (const context &ctx, const std::vector< T > &colors)
 template method to set the color attribute from a vector of colors of type T
 
template<typename T >
void set_color_array (const context &ctx, const T *colors, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the color attribute from a vector of colors of type T
 
void set_color_array (const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 method to set the color attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
template<typename T >
void set_color_array (const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
 template method to set the color attribute from a vertex buffer object, the element type must be given as explicit template parameter
 
void remove_color_array (const context &ctx)
 remove the color attribute
 
template<typename T >
bool set_indices (const context &ctx, const std::vector< T > &indices, bool keep_on_cpu=false)
 Set the indices for indexed rendering from a vector.
 
template<typename T >
bool set_indices (const context &ctx, const T *indices, size_t nr_indices, bool keep_on_cpu=false)
 Set the indices for indexed rendering from an array given as a pointer.
 
template<typename T >
bool set_indices (const context &ctx, const vertex_buffer &vbo, size_t count)
 Set the indices for indexed rendering from a GPU buffer.
 
bool has_indices () const
 return whether indices have been defined
 
void remove_indices (const context &ctx)
 remove previously set indices
 
const vertex_bufferget_vertex_buffer_ptr (const context &ctx, const attribute_array_manager &aam, const std::string &attr_name)
 
const vertex_bufferget_index_buffer_ptr (const attribute_array_manager &aam)
 
bool validate_and_enable (context &ctx)
 validate attributes and if successful, enable renderer
 
virtual bool render (context &ctx, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1)
 Convenience function that draws vertex or indexed element with this renderer.
 

Protected Member Functions

render_stylecreate_render_style () const
 overload to allow instantiation of cone_renderer
 
void update_defines (shader_define_map &defines)
 update shader defines based on render style
 
bool build_shader_program (context &ctx, shader_program &prog, const shader_define_map &defines)
 build cone program
 
- Protected Member Functions inherited from cgv::render::renderer
bool has_aam () const
 check for attribute array manager
 
bool has_attribute (const context &ctx, const std::string &name)
 check for attribute
 
const render_styleget_style_ptr () const
 access to render style
 
bool attributes_persist () const
 return whether attributes persist after a call to disable
 
template<typename T >
const T & get_style () const
 access to style
 
int get_prog_attribute_location (const context &ctx, const std::string &name, bool error_check=true)
 
template<typename T >
bool set_attribute_array (const context &ctx, const std::string &name, const T &array)
 
template<typename T >
bool set_attribute_array (const context &ctx, const std::string &name, const T *array_ptr, size_t nr_elements, unsigned stride)
 
bool set_attribute_array (const context &ctx, const std::string &name, 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, const std::string &name, const C *array_ptr, size_t nr_elements, const T &elem)
 in case that several attributes are stored interleaved, call this function for the first and ref_composed_attribute_array() for all others
 
template<typename C , typename T >
bool ref_composed_attribute_array (const context &ctx, const std::string &name, const std::string &name_ref, const C *array_ptr, size_t nr_elements, const T &elem)
 in case that several attributes are stored interleaved, call set_composed_attribute_array() for the first and this function for all others
 
bool remove_attribute_array (const context &ctx, const std::string &name)
 

Protected Attributes

bool has_radii
 
shader_define_map shader_defines
 the shader defines used to build the shader, used to comapre against new defines to determine if the shader needs to be rebuilt
 
texturealbedo_texture
 
texturedensity_texture
 
- Protected Attributes inherited from cgv::render::surface_renderer
bool has_normals
 
bool has_texcoords
 
bool cull_per_primitive
 
- Protected Attributes inherited from cgv::render::group_renderer
bool has_group_indices
 
bool has_group_colors
 
bool has_group_translations
 
bool has_group_rotations
 
- Protected Attributes inherited from cgv::render::renderer
bool has_colors
 track whether color attribute is defined
 
bool has_positions
 track whether position attribute is defined
 

Detailed Description

renderer that supports raycasting of cones

Definition at line 61 of file cone_renderer.h.

Constructor & Destructor Documentation

◆ cone_renderer()

cgv::render::cone_renderer::cone_renderer ( )

initializes member variables

Definition at line 54 of file cone_renderer.cxx.

References shader_defines.

Member Function Documentation

◆ build_shader_program()

bool cgv::render::cone_renderer::build_shader_program ( context ctx,
shader_program prog,
const shader_define_map defines 
)
protectedvirtual

build cone program

Reimplemented from cgv::render::renderer.

Definition at line 96 of file cone_renderer.cxx.

References cgv::render::shader_program::build_program().

◆ clear()

void cgv::render::cone_renderer::clear ( const context ctx)
virtual

the clear function destructs the shader program and resets the texture pointers

Reimplemented from cgv::render::renderer.

Definition at line 182 of file cone_renderer.cxx.

References cgv::render::renderer::clear().

Referenced by cgv::app::transformation_gizmo::clear().

◆ create_render_style()

render_style * cgv::render::cone_renderer::create_render_style ( ) const
protectedvirtual

overload to allow instantiation of cone_renderer

Implements cgv::render::renderer.

Definition at line 15 of file cone_renderer.cxx.

◆ disable()

bool cgv::render::cone_renderer::disable ( context ctx)
virtual

◆ disable_attribute_array_manager()

void cgv::render::cone_renderer::disable_attribute_array_manager ( const context ctx,
attribute_array_manager aam 
)
virtual

call this after last render/draw call to ensure that no other users of renderer change attribute arrays of given manager

Reimplemented from cgv::render::renderer.

Definition at line 70 of file cone_renderer.cxx.

References cgv::render::surface_renderer::disable_attribute_array_manager().

◆ draw()

void cgv::render::cone_renderer::draw ( context ctx,
size_t  start,
size_t  count,
bool  use_strips = false,
bool  use_adjacency = false,
uint32_t  strip_restart_index = -1 
)
virtual

convenience function to render with default settings

Reimplemented from cgv::render::renderer.

Definition at line 177 of file cone_renderer.cxx.

References cgv::render::renderer::draw_impl().

◆ enable()

◆ enable_attribute_array_manager()

void cgv::render::cone_renderer::enable_attribute_array_manager ( const context ctx,
attribute_array_manager aam 
)
virtual

call this before setting attribute arrays to manage attribute array in given manager

Reimplemented from cgv::render::renderer.

Definition at line 63 of file cone_renderer.cxx.

References cgv::render::surface_renderer::enable_attribute_array_manager(), and cgv::render::renderer::has_attribute().

◆ remove_radius_array()

void cgv::render::cone_renderer::remove_radius_array ( const context ctx)

remove the radius attribute

Definition at line 75 of file cone_renderer.cxx.

◆ set_albedo_texture()

bool cgv::render::cone_renderer::set_albedo_texture ( texture tex)

Definition at line 100 of file cone_renderer.cxx.

◆ set_density_texture()

bool cgv::render::cone_renderer::set_density_texture ( texture tex)

Definition at line 107 of file cone_renderer.cxx.

◆ set_radius_array() [1/2]

template<typename T = float>
void cgv::render::cone_renderer::set_radius_array ( const context ctx,
const std::vector< T > &  radii 
)
inline

Definition at line 91 of file cone_renderer.h.

◆ set_radius_array() [2/2]

template<typename T = float>
void cgv::render::cone_renderer::set_radius_array ( const context ctx,
const T *  radii,
size_t  nr_elements,
unsigned  stride_in_bytes = 0 
)
inline

Definition at line 94 of file cone_renderer.h.

◆ set_sphere_array()

template<typename T = float>
void cgv::render::cone_renderer::set_sphere_array ( const context ctx,
const std::vector< cgv::math::fvec< T, 4 > > &  spheres 
)
inline

use this function if you store spheres in vec4 with the 4th component the radius

Definition at line 99 of file cone_renderer.h.

◆ update_defines()

void cgv::render::cone_renderer::update_defines ( shader_define_map defines)
protectedvirtual

update shader defines based on render style

Reimplemented from cgv::render::renderer.

Definition at line 85 of file cone_renderer.cxx.

◆ validate_attributes()

bool cgv::render::cone_renderer::validate_attributes ( const context ctx) const
virtual

call to validate, whether essential position attribute is defined

Reimplemented from cgv::render::renderer.

Definition at line 79 of file cone_renderer.cxx.

References cgv::render::group_renderer::validate_attributes().

Member Data Documentation

◆ albedo_texture

texture* cgv::render::cone_renderer::albedo_texture
protected

Definition at line 74 of file cone_renderer.h.

◆ density_texture

texture* cgv::render::cone_renderer::density_texture
protected

Definition at line 75 of file cone_renderer.h.

◆ has_radii

bool cgv::render::cone_renderer::has_radii
protected

Definition at line 64 of file cone_renderer.h.

◆ shader_defines

shader_define_map cgv::render::cone_renderer::shader_defines
protected

the shader defines used to build the shader, used to comapre against new defines to determine if the shader needs to be rebuilt

Definition at line 66 of file cone_renderer.h.

Referenced by cone_renderer().


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