|
cgv
|
renderer that supports point splatting More...
#include <line_renderer.h>
Public Member Functions | |
| bool | enable (context &ctx) override |
| overload to activate group style | |
| bool | disable (context &ctx) override |
| disable renderer | |
| void | enable_attribute_array_manager (const context &ctx, attribute_array_manager &aam) override |
| 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) override |
| call this after last render/draw call to ensure that no other users of renderer change attribute arrays of given manager | |
| bool | init (context &ctx) override |
| call init() once before using 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 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 | remove_normal_array (const context &ctx) |
| remove the normal attribute | |
| template<typename T > | |
| void | set_line_width (const context &ctx, const T &line_width) |
| specify a single line_width for all lines | |
| template<typename T > | |
| void | set_line_width_array (const context &ctx, const std::vector< T > &line_widths) |
| line_width array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box | |
| template<typename T > | |
| void | set_line_width_array (const context &ctx, const T *line_widths, size_t nr_elements, unsigned stride_in_bytes=0) |
| line_width array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box | |
| void | remove_line_width_array (const context &ctx) |
| remove the line width attribute | |
| template<typename T > | |
| void | set_depth_offset (const context &ctx, const T &depth_offset) |
| specify a single depth_offset for all lines | |
| template<typename T > | |
| void | set_depth_offset_array (const context &ctx, const std::vector< T > &depth_offsets) |
| depth_offset array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box | |
| template<typename T > | |
| void | set_depth_offset_array (const context &ctx, const T *depth_offsets, size_t nr_elements, unsigned stride_in_bytes=0) |
| depth_offset array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box | |
| void | remove_depth_offset_array (const context &ctx) |
| remove the depth offset attribute | |
| void | draw (context &ctx, size_t start, size_t count, bool use_strips=false, bool use_adjacency=false, uint32_t strip_restart_index=-1) override |
| convenience function to render with default settings | |
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_compile_options & | ref_shader_options () |
| access to shader program compile options to update settings not handled by render style | |
| shader_program & | ref_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 | |
| 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_buffer * | get_vertex_buffer_ptr (const context &ctx, const attribute_array_manager &aam, const std::string &attr_name) |
| const vertex_buffer * | get_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. | |
| virtual void | clear (const context &ctx) |
| the clear function destructs the shader program | |
Protected Member Functions | |
| std::string | get_default_prog_name () const override |
| return the default shader program name | |
| render_style * | create_render_style () const override |
| create and return the default render style | |
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_style * | get_style_ptr () const |
| access to render style | |
| bool | attributes_persist () const |
| return whether attributes persist after a call to disable | |
| virtual void | update_shader_program_options (shader_compile_options &options) const |
| overload to update the shader program compile options based on the current render style; only called if internal shader program is used | |
| virtual bool | build_shader_program (context &ctx, shader_program &prog, const shader_compile_options &options) const |
| overload to change default behaviour and build a custom shader program based on the passed options | |
| 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_normals = false |
| bool | has_line_widths = false |
| bool | has_depth_offsets = false |
Protected Attributes inherited from cgv::render::group_renderer | |
| bool | has_group_indices = false |
| bool | has_group_colors = false |
| bool | has_group_translations = false |
| bool | has_group_rotations = false |
Protected Attributes inherited from cgv::render::renderer | |
| bool | has_colors = false |
| track whether color attribute is defined | |
| bool | has_positions = false |
| track whether position attribute is defined | |
renderer that supports point splatting
Definition at line 55 of file line_renderer.h.
|
inlineoverrideprotectedvirtual |
create and return the default render style
Implements cgv::render::renderer.
Reimplemented in cgv::render::normal_renderer.
Definition at line 64 of file line_renderer.h.
|
overridevirtual |
disable renderer
Reimplemented from cgv::render::group_renderer.
Definition at line 111 of file line_renderer.cxx.
References cgv::render::renderer::attributes_persist(), cgv::render::line_render_style::blend_lines, cgv::render::group_renderer::disable(), and cgv::render::context::pop_blend_state().
Referenced by cgv::render::box_wire_renderer::disable().
|
overridevirtual |
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::group_renderer.
Definition at line 28 of file line_renderer.cxx.
References cgv::render::group_renderer::disable_attribute_array_manager().
Referenced by cgv::render::box_wire_renderer::disable_attribute_array_manager().
|
overridevirtual |
convenience function to render with default settings
Reimplemented from cgv::render::renderer.
Reimplemented in cgv::render::normal_renderer.
Definition at line 124 of file line_renderer.cxx.
References cgv::render::renderer::draw_impl().
|
overridevirtual |
overload to activate group style
Reimplemented from cgv::render::group_renderer.
Reimplemented in cgv::render::normal_renderer.
Definition at line 67 of file line_renderer.cxx.
References cgv::render::line_render_style::blend_lines, cgv::render::line_render_style::blend_width_in_pixel, cgv::render::line_render_style::default_color, cgv::render::line_render_style::default_depth_offset, cgv::render::line_render_style::default_line_width, cgv::render::line_render_style::default_normal, cgv::render::group_renderer::enable(), cgv::render::context::enable_blending(), cgv::render::context::get_blend_state(), cgv::render::context::get_height(), cgv::render::line_render_style::halo_color, cgv::render::line_render_style::halo_color_strength, cgv::render::line_render_style::halo_width_in_pixel, cgv::render::renderer::has_colors, cgv::render::line_render_style::measure_line_width_in_pixel, cgv::render::line_render_style::percentual_halo_width, cgv::render::context::push_blend_state(), cgv::render::renderer::ref_prog(), cgv::render::line_render_style::reference_line_width, cgv::render::line_render_style::screen_aligned, cgv::render::shader_program::set_attribute(), cgv::render::context::set_blend_func(), cgv::render::context::set_color(), and cgv::render::shader_program::set_uniform().
Referenced by cgv::render::box_wire_renderer::enable(), and cgv::render::normal_renderer::enable().
|
overridevirtual |
call this before setting attribute arrays to manage attribute array in given manager
Reimplemented from cgv::render::group_renderer.
Definition at line 17 of file line_renderer.cxx.
References cgv::render::group_renderer::enable_attribute_array_manager(), and cgv::render::renderer::has_attribute().
Referenced by cgv::render::box_wire_renderer::enable_attribute_array_manager().
|
inlineoverrideprotectedvirtual |
return the default shader program name
Implements cgv::render::renderer.
Reimplemented in cgv::render::normal_renderer.
Definition at line 62 of file line_renderer.h.
|
overridevirtual |
call init() once before using renderer
creates default render style and builds shader program based on defines that can be configured with ref_defines() before calling init(). Reconfiguring defines after init() causes rebuild of shader program in enable() function.
Reimplemented from cgv::render::renderer.
Definition at line 47 of file line_renderer.cxx.
References cgv::render::renderer::init(), cgv::render::renderer::ref_prog(), and cgv::render::shader_program::set_attribute().
| void cgv::render::line_renderer::remove_depth_offset_array | ( | const context & | ctx | ) |
remove the depth offset attribute
Definition at line 43 of file line_renderer.cxx.
| void cgv::render::line_renderer::remove_line_width_array | ( | const context & | ctx | ) |
remove the line width attribute
Definition at line 39 of file line_renderer.cxx.
| void cgv::render::line_renderer::remove_normal_array | ( | const context & | ctx | ) |
remove the normal attribute
Definition at line 35 of file line_renderer.cxx.
|
inline |
specify a single depth_offset for all lines
Definition at line 100 of file line_renderer.h.
|
inline |
depth_offset array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box
Definition at line 103 of file line_renderer.h.
|
inline |
depth_offset array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box
Definition at line 106 of file line_renderer.h.
|
inline |
specify a single line_width for all lines
Definition at line 89 of file line_renderer.h.
|
inline |
line_width array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box
Definition at line 92 of file line_renderer.h.
|
inline |
line_width array specifies box extends in case of position_is_center=true, otherwise the maximum point of each box
Definition at line 95 of file line_renderer.h.
|
inline |
specify a single normal for all lines
Definition at line 78 of file line_renderer.h.
|
inline |
templated method to set the normal attribute from a vector of normals of type T, which should have 3 components
Definition at line 81 of file line_renderer.h.
|
inline |
templated method to set the normal attribute from an array of normals of type T, which should have 3 components
Definition at line 84 of file line_renderer.h.
|
protected |
Definition at line 60 of file line_renderer.h.
|
protected |
Definition at line 59 of file line_renderer.h.
|
protected |
Definition at line 58 of file line_renderer.h.