cgv
Loading...
Searching...
No Matches
surfel_renderer.h
1#pragma once
2
3#include "surface_renderer.h"
4
5#include "gl/lib_begin.h"
6
7namespace cgv {
8 namespace render {
9 class CGV_API surfel_renderer;
10
12
15 extern CGV_API surfel_renderer& ref_surfel_renderer(context& ctx, int ref_count_change = 0);
16
19 {
20 /*@name surfel rendering attributes*/
22
25
26 /*@name point rendering attributes*/
28
35
36 /*@name global point rendering options*/
38
54 };
55
57 class CGV_API surfel_renderer : public surface_renderer
58 {
59 protected:
60 bool has_point_sizes;
61 bool has_group_point_sizes;
62 bool has_indexed_colors;
63 float reference_point_size;
64 float y_view_angle;
66 render_style* create_render_style() const;
68 bool build_shader_program(context& ctx, shader_program& prog, const shader_define_map& defines);
69 public:
73 void enable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
75 void disable_attribute_array_manager(const context& ctx, attribute_array_manager& aam);
77 void set_reference_point_size(float _reference_point_size);
79 void set_y_view_angle(float y_view_angle);
81 template <typename T = float>
82 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); }
84 void remove_point_size_array(const context& ctx);
86 template <typename T = unsigned, typename C = cgv::media::color<float, cgv::media::RGB, cgv::media::OPACITY> >
87 void set_indexed_color_array(const context& ctx, const std::vector<T>& color_indices, const std::vector<C>& palette) {
88 has_indexed_colors = true;
89 set_attribute_array(ctx, "color_index", color_indices);
90 ref_prog().set_uniform_array(ctx, "palette", palette);
91 }
93 template <typename T = unsigned, typename C = cgv::media::color<float, cgv::media::RGB, cgv::media::OPACITY> >
94 void set_indexed_color_array(const context& ctx, T* color_index_ptr, size_t nr_elements, const std::vector<C>& palette, unsigned stride = 0) {
95 has_indexed_colors = true;
96 set_attribute_array(ctx, "color_index", color_index_ptr, nr_elements, stride);
97 ref_prog().set_uniform_array(ctx, "palette", palette);
98 }
100 void remove_indexed_color_array(const context& ctx);
102 template <typename T = float>
103 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); }
105 bool validate_attributes(const context& ctx) const;
107 bool enable(context& ctx);
109 bool disable(context& ctx);
111 void draw(context& ctx, size_t start, size_t count,
112 bool use_strips = false, bool use_adjacency = false, uint32_t strip_restart_index = -1);
113 };
115 {
116 bool self_reflect(cgv::reflect::reflection_handler& rh);
117 };
119 }
120}
121
122#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
a shader program combines several shader code fragments to a complete definition of the shading pipel...
base classes for renderers that support surface rendering
renderer that supports point splatting
std::map< std::string, std::string > shader_define_map
typedef for shader define map data structure
Definition shader_code.h:52
surfel_renderer & ref_surfel_renderer(context &ctx, int ref_count_change)
reference to a singleton surfel 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 ...
base class for all render styles
Definition renderer.h:16
float percentual_halo_width
set to 0 in constructor
float point_size
default value assigned to point size attribute in enable method of point renderer,...
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 surface_offset
position offset in normal direction to prevent z-figthing if surfels are placed directly on flat surf...
bool use_group_point_size
whether to use the
bool orient_splats
set to true in constructor
float halo_width_in_pixel
set to 0 in constructor
float blend_width_in_pixel
set to 1 in constructor
bool blend_points
set to false in constructor
rgba halo_color
color of halo with opacity channel
float halo_color_strength
strength in [0,1] of halo color with respect to color of primitive