3#include "surface_renderer.h"
5#include "gl/lib_begin.h"
24 bool show_caps =
true;
25 bool rounded_caps =
false;
27 bool enable_texturing =
false;
28 enum TextureBlendMode {
32 TBM_INVERSE_MULTIPLY = 3,
34 } texture_blend_mode = TextureBlendMode::TBM_MIX;
35 float texture_blend_factor = 1.0f;
36 bool texture_tile_from_center =
false;
37 vec2 texture_offset = { 0.0f };
38 vec2 texture_tiling = { 1.0f };
39 bool texture_use_reference_length =
false;
40 float texture_reference_length = 1.0f;
42 bool enable_ambient_occlusion =
false;
43 float ao_offset = 0.04f;
44 float ao_distance = 0.8f;
45 float ao_strength = 1.0f;
47 vec3 tex_offset = { 0.0f };
48 vec3 tex_scaling = { 1.0f };
49 vec3 tex_coord_scaling = { 1.0f };
50 float texel_size = 1.0f;
51 float cone_angle_factor = 1.0f;
52 std::vector<vec3> sample_dirs = std::vector<vec3>(3, { 0.0f, 1.0f, 0.0f });
58 bool has_radii =
false;
66 texture* albedo_texture =
nullptr;
67 texture* density_texture =
nullptr;
74 bool set_albedo_texture(
texture* tex);
75 bool set_density_texture(
texture* tex);
77 bool enable(
context& ctx)
override;
79 template <
typename T =
float>
80 void set_radius_array(
const context& ctx,
const std::vector<T>& radii) { has_radii =
true; set_attribute_array(ctx,
"radius", radii); }
82 template <
typename T =
float>
83 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); }
85 void remove_radius_array(
const context& ctx);
87 template <
typename T =
float>
95 template <
typename T =
float>
103 bool validate_attributes(
const context& ctx)
const override;
105 bool disable(
context& ctx)
override;
107 void draw(
context& ctx,
size_t start,
size_t count,
108 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
110 void clear(
const context& ctx)
override;
121#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
renderer that supports raycasting of cones
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_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
std::string get_default_prog_name() const override
return the default shader program name
render_style * create_render_style() const override
create and return the default render style
base class for all drawables, which is independent of the used rendering API.
bool ref_composed_attribute_array(const context &ctx, const std::string &name, const std::string &name_ref, const C *array_ptr, size_t nr_elements, const T &elem)
in case that several attributes are stored interleaved, call set_composed_attribute_array() for the f...
bool set_composed_attribute_array(const context &ctx, const std::string &name, const C *array_ptr, size_t nr_elements, const T &elem)
in case that several attributes are stored interleaved, call this function for the first and ref_comp...
bool has_positions
track whether position attribute is defined
Stores preprocessor options used for conditionally compiling shader programs.
base classes for renderers that support surface rendering
the texture class encapsulates all functionality independent of the rendering api.
namespace for api independent GPU programming
cone_renderer & ref_cone_renderer(context &ctx, int ref_count_change)
reference to a singleton cone renderer that is shared among drawables
this header is dependency free
cgv::math::fvec< float, 2 > vec2
declare type of 2d single precision floating point vectors
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 ...
float radius
default value assigned to radius attribute in enable method of cone renderer
float radius_scale
multiplied to the cone radii
base class for all render styles