3#include "group_renderer.h"
4#include <cgv/media/color.h>
6#include "gl/lib_begin.h"
58 bool has_normals =
false;
59 bool has_line_widths =
false;
60 bool has_depth_offsets =
false;
67 bool enable(
context& ctx)
override;
69 bool disable(
context& ctx)
override;
75 bool init(
context& ctx)
override;
81 void set_normal_array(
const context& ctx,
const std::vector<T>& normals) { has_normals =
true; set_attribute_array(ctx,
"normal", normals); }
84 void set_normal_array(
const context& ctx,
const T* normals,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_normals =
true; set_attribute_array(ctx,
"normal", normals, nr_elements, stride_in_bytes); }
86 void remove_normal_array(
const context& ctx);
89 void set_line_width(
const context& ctx,
const T& line_width) { has_line_widths =
true;
ref_prog().set_attribute(ctx, get_prog_attribute_location(ctx,
"line_width"), line_width); }
92 void set_line_width_array(
const context& ctx,
const std::vector<T>& line_widths) { has_line_widths =
true; set_attribute_array(ctx,
"line_width", line_widths); }
95 void set_line_width_array(
const context& ctx,
const T* line_widths,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_line_widths =
true; set_attribute_array(ctx,
"line_width", line_widths, nr_elements, stride_in_bytes); }
97 void remove_line_width_array(
const context& ctx);
100 void set_depth_offset(
const context& ctx,
const T& depth_offset) { has_depth_offsets =
true;
ref_prog().set_attribute(ctx, get_prog_attribute_location(ctx,
"depth_offset"), depth_offset); }
102 template <
typename T>
103 void set_depth_offset_array(
const context& ctx,
const std::vector<T>& depth_offsets) { has_depth_offsets =
true; set_attribute_array(ctx,
"depth_offset", depth_offsets); }
105 template <
typename T>
106 void set_depth_offset_array(
const context& ctx,
const T* depth_offsets,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_depth_offsets =
true; set_attribute_array(ctx,
"depth_offset", depth_offsets, nr_elements, stride_in_bytes); }
108 void remove_depth_offset_array(
const context& ctx);
110 void draw(
context& ctx,
size_t start,
size_t count,
111 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
114 extern CGV_API line_renderer& ref_line_renderer(context& ctx,
int ref_count_change = 0);
124#include <cgv/config/lib_end.h>
A vector with zero based index.
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
abstract renderer class that provides functionality for grouping primitives
renderer that supports point splatting
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 po...
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 ...
void set_normal(const context &ctx, const cgv::math::fvec< T, 3 > &normal)
specify a single normal for all lines
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 poin...
std::string get_default_prog_name() const override
return the default shader program name
void set_line_width(const context &ctx, const T &line_width)
specify a single line_width for all lines
void set_depth_offset(const context &ctx, const T &depth_offset)
specify a single depth_offset for all lines
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 ...
render_style * create_render_style() const override
create and return the default render style
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 po...
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 poin...
shader_program & ref_prog()
derived renderer classes have access to shader program
namespace for api independent GPU programming
this header is dependency free
cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
declare rgba color type with 32 bit components
cgv::math::fvec< float, 3 > vec3
declare type of 3d single precision floating point vectors
this reflection traits implementation is used for external self_reflect implementations of instances ...
render style used for group information
rgba halo_color
halo color
float blend_width_in_pixel
blend with in pixels used for line smoothing
float default_depth_offset
default depth offset for case when "depth_offset" attribute is not set
float default_line_width
default line width for case when "line_width" attribute is not set
vec3 default_normal
default normal for case when "normal" attribute is not set
float halo_width_in_pixel
halo width in pixel
bool measure_line_width_in_pixel
whether to measure line width in pixels - otherwise in eye space relative to reference_line_width
float reference_line_width
reference line width multiplied to line width if measure_line_width_in_pixel is false
bool screen_aligned
whether to span line splat in screen aligned coordinate system
float halo_color_strength
parameter in [0,1] to mix line color with halo color
float percentual_halo_width
halo width in percent of line width
rgba default_color
default color for case when "color" attribute is not set
bool blend_lines
whether to enable blending while rendering (needed for smooth edges; true by default)
base class for all render styles