cgv
Loading...
Searching...
No Matches
point_renderer.h
1#pragma once
2
3#include "group_renderer.h"
4
5#include "gl/lib_begin.h"
6
7namespace cgv {
8 namespace render {
9 class CGV_API point_renderer;
10
12
15 extern CGV_API point_renderer& ref_point_renderer(context& ctx, int ref_count_change = 0);
16
18 struct CGV_API point_render_style : public group_render_style
19 {
20 /*@name point rendering attributes*/
22
31
32 /*@name global point rendering options*/
34
50 };
51
53 class CGV_API point_renderer : public group_renderer
54 {
55 protected:
56 bool has_point_sizes;
57 bool has_group_point_sizes;
58 bool has_indexed_colors;
59 bool has_depth_offsets;
60 float reference_point_size;
61 float y_view_angle;
63 render_style* create_render_style() const;
65 bool build_shader_program(context& ctx, shader_program& prog, const shader_define_map& defines);
66 public:
70 void enable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
72 void disable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
74 void set_reference_point_size(float _reference_point_size);
76 void set_y_view_angle(float y_view_angle);
78 template <typename T = float>
79 void set_point_size_array(const context& ctx, const std::vector<T>& point_sizes) { has_point_sizes = true; set_attribute_array(ctx, "point_size", point_sizes); }
81 void remove_point_size_array(const context& ctx);
83 template <typename T = float>
84 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); }
86 void remove_depth_offset_array(const context& ctx);
88 template <typename T = unsigned, typename C = cgv::media::color<float,cgv::media::RGB,cgv::media::OPACITY> >
89 void set_indexed_color_array(const context& ctx, const std::vector<T>& color_indices, const std::vector<C>& palette) {
90 has_indexed_colors = true;
91 set_attribute_array(ctx, "color_index", color_indices);
92 ref_prog().set_uniform_array(ctx, "palette", palette);
93 }
95 void remove_indexed_color_array(const context& ctx);
97 template <typename T = float>
98 void set_group_point_sizes(const context& ctx, const std::vector<T>& group_point_sizes) { has_group_point_sizes = true; ref_prog().set_uniform_array(ctx, "group_point_sizes", group_point_sizes); }
100 bool validate_attributes(const context& ctx) const;
102 bool enable(context& ctx);
104 bool disable(context& ctx);
106 void draw(context& ctx, size_t start, size_t count,
107 bool use_strips = false, bool use_adjacency = false, uint32_t strip_restart_index = -1);
108 };
110 {
111 bool self_reflect(cgv::reflect::reflection_handler& rh);
112 };
114 }
115}
116
117#include <cgv/config/lib_end.h>
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.
Definition context.h:621
abstract renderer class that provides functionality for grouping primitives
renderer that supports point splatting
void set_depth_offset_array(const context &ctx, const std::vector< T > &depth_offsets)
set per point depth offsets
a shader program combines several shader code fragments to a complete definition of the shading pipel...
std::map< std::string, std::string > shader_define_map
typedef for shader define map data structure
Definition shader_code.h:52
point_renderer & ref_point_renderer(context &ctx, int ref_count_change)
reference to a singleton point renderer that can be shared among drawables
the cgv namespace
Definition print.h:11
this reflection traits implementation is used for external self_reflect implementations of instances ...
render style used for group information
float blend_width_in_pixel
set to 1 in constructor
rgba halo_color
color of halo with opacity channel
bool use_group_point_size
whether to use the
float default_depth_offset
default value for depth offset used to support layering
float halo_width_in_pixel
set to 0 in constructor
bool measure_point_size_in_pixel
whether to measure point size in pixels or in world space relative to reference_pixel_size passed to ...
float halo_color_strength
strength in [0,1] of halo color with respect to color of primitive
bool screen_aligned
whether to span point splat in screen aligned coordinate system
float percentual_halo_width
set to 0 in constructor
bool blend_points
set to true in constructor
float point_size
default value assigned to point size attribute in enable method of point renderer,...
base class for all render styles
Definition renderer.h:16