3#include "surface_renderer.h"
5#include "gl/lib_begin.h"
9 class CGV_API spline_tube_renderer;
20 float radius_scale = 1.0f;
30 bool has_radii =
false;
32 bool has_tangents =
false;
47 template <
typename T =
float>
48 void set_radius_array(
const context& ctx,
const std::vector<T>& radii) { has_radii =
true; set_attribute_array(ctx,
"radius", radii); }
50 template <
typename T =
float>
51 void set_radius_array(
const context& ctx,
const T* radii,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_radii =
true; set_attribute_array(ctx,
"radius", radii, nr_elements, stride_in_bytes); }
53 void remove_radius_array(
const context& ctx);
55 template <
typename T =
float>
56 void set_tangent_array(
const context& ctx,
const std::vector<T>& tangents) { has_tangents =
true; set_attribute_array(ctx,
"tangent", tangents); }
58 template <
typename T =
float>
59 void set_tangent_array(
const context& ctx,
const T* tangents,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_tangents =
true; set_attribute_array(ctx,
"tangent", tangents, nr_elements, stride_in_bytes); }
61 void remove_tangent_array(
const context& ctx);
63 template <
typename T =
float>
65 set_composed_attribute_array(ctx,
"position", spheres.data(), spheres.size(),
reinterpret_cast<const cgv::math::fvec<T, 3>&
>(spheres.front()));
66 ref_composed_attribute_array(ctx,
"radius",
"position", &spheres.front(), spheres.size(), spheres[0][3]);
71 template <
typename T =
float>
73 set_composed_attribute_array(ctx,
"position", spheres, nr_elements,
reinterpret_cast<const cgv::math::fvec<T, 3>&
>(*spheres));
74 ref_composed_attribute_array(ctx,
"radius",
"position", spheres, nr_elements, (*spheres)[3]);
79 bool validate_attributes(
const context& ctx)
const override;
81 bool enable(
context& ctx)
override;
83 bool disable(
context& ctx)
override;
85 void draw(
context& ctx,
size_t start,
size_t count,
86 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
97#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.
renderer that supports point splatting
render_style * create_render_style() const override
create and return the default render style
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
void set_eye_pos(vec3 ep)
set the eye position needed for rendering
std::string get_default_prog_name() const override
return the default shader program name
void set_sphere_array(const context &ctx, const cgv::math::fvec< T, 4 > *spheres, size_t nr_elements)
use this function if you store spheres in vec4 with the 4th component the radius
base classes for renderers that support surface rendering
spline_tube_renderer & ref_spline_tube_renderer(context &ctx, int ref_count_change)
reference to a singleton spline tube renderer that is shared among drawables
this header is dependency free
this reflection traits implementation is used for external self_reflect implementations of instances ...
base class for all render styles