3#include "surface_renderer.h"
5#include "gl/lib_begin.h"
33 bool has_sizes =
false;
34 bool has_orientations =
false;
47 template <
typename T =
float>
48 void set_size(
const context& ctx,
const T& size) {
50 ref_prog().set_attribute(ctx, ref_prog().get_attribute_location(ctx,
"size"), size);
53 template <
typename T =
float>
54 void set_size_array(
const context& ctx,
const std::vector<T>& sizes) {
56 set_attribute_array(ctx,
"size", sizes);
60 void set_size_array(
const context& ctx,
const T* sizes,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
62 set_attribute_array(ctx,
"size", sizes, nr_elements, stride_in_bytes);
65 void remove_size_array(
const context& ctx);
67 template <
typename T =
float>
68 void set_orientation(
const context& ctx,
const cgv::math::quaternion<T>& orientation) {
69 has_orientations =
true;
70 ref_prog().set_attribute(ctx, ref_prog().get_attribute_location(ctx,
"orientation"), orientation);
73 template <
typename T =
float>
75 has_orientations =
true;
76 set_attribute_array(ctx,
"orientation", orientations);
80 void set_orientation_array(
const context& ctx,
const T* orientations,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
81 has_orientations =
true;
82 set_attribute_array(ctx,
"orientation", orientations, nr_elements, stride_in_bytes);
85 void remove_orientation_array(
const context& ctx);
87 bool validate_attributes(
const context& ctx)
const override;
89 bool enable(context& ctx)
override;
91 bool disable(context& ctx)
override;
93 void draw(context& ctx,
size_t start,
size_t count,
94 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
106#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 splatting of ellipsoids
void set_orientation_array(const context &ctx, const std::vector< cgv::math::quaternion< T > > &orientations)
use this function if you store spheres in vec4 with the 4th component the radius
render_style * create_render_style() const override
create and return the default render style
std::string get_default_prog_name() const override
return the default shader program name
base classes for renderers that support surface rendering
namespace for api independent GPU programming
ellipsoid_renderer & ref_ellipsoid_renderer(context &ctx, int ref_count_change)
reference to a singleton ellipsoid renderer that can be shared among drawables
this header is dependency free
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 for ellipsoid rendere
cgv::vec3 size
default value assigned to size attribute in enable method of ellipsoid renderer, set to 1 in construc...
float size_scale
multiplied to the ellipsoid sizes, initialized to 1
base class for all render styles