27#ifndef EASY3D_RENDERER_STATE_H
28#define EASY3D_RENDERER_STATE_H
32#include <easy3d/core/types.h>
172 float repeat_fraction = 0.0f);
439 Texture* create_color_texture();
443 Texture* create_scalar_texture();
452 std::string property_name_;
456 bool lighting_two_sides_;
457 bool distinct_back_color_;
463 float texture_repeat_;
465 float texture_fractional_repeat_;
468 unsigned int ssao_texture_;
479 bool plane_clip_discard_primitive_;
483 std::pair<int, int> highlight_range_;
void set_lighting(bool l)
Enables or disables lighting.
Definition state.h:243
void set_texture_fractional_repeat(float fr)
Sets the fractional repeat factor of the texture.
Definition state.h:316
Location property_location() const
Returns the location of the color property.
Definition state.h:224
void set_highlight(bool b)
Sets the highlight state of a subset of primitives of this drawable.
Definition state.h:417
Method
Available coloring methods.
Definition state.h:57
@ TEXTURED
Using texture(s)
Definition state.h:61
@ UNIFORM_COLOR
Uniformly colored.
Definition state.h:58
@ COLOR_PROPERTY
Using a color property.
Definition state.h:59
@ SCALAR_FIELD
Using a scalar field.
Definition state.h:60
void set_scalar_coloring(Location scalar_location, const std::string &scalar_name, const Texture *texture=nullptr, float clamp_lower=0.05f, float clamp_upper=0.05f)
Constructs a scheme for rendering scalar fields.
Definition state.cpp:125
void set_ssao_texture(unsigned int tex)
Sets the SSAO texture.
Definition state.h:332
Method coloring_method() const
Returns the coloring method being used for rendering.
Definition state.h:207
float clamp_lower() const
Returns the percentage of values clamped at the lower side of the range.
Definition state.h:350
bool is_visible() const
Checks if the drawable is visible.
Definition state.h:127
State & operator=(const State &rhs)
Assignment operator.
Definition state.cpp:67
const vec4 & color() const
Returns the color, which is effective only when the coloring method was set to UNIFORM_COLOR.
Definition state.h:213
float clamp_upper() const
Returns the percentage of values clamped at the upper side of the range.
Definition state.h:363
const std::pair< int, int > & highlight_range() const
Returns the range of primitives to be highlighted.
Definition state.h:434
bool distinct_back_color() const
Checks if a different color is used for rendering the backside of a drawable.
Definition state.h:261
void set_uniform_coloring(const vec4 &color)
Constructs a uniform coloring scheme.
Definition state.cpp:92
float texture_repeat() const
Returns the repeat factor of the texture.
Definition state.h:298
bool is_ssao_enabled() const
Checks if SSAO is enabled.
Definition state.h:322
bool highlight() const
Checks if a subset of primitives of this drawable is highlighted.
Definition state.h:412
void set_clamp_lower(float v)
Sets the percentage of values clamped at the lower side of the range.
Definition state.h:356
void set_clamp_upper(float v)
Sets the percentage of values clamped at the upper side of the range.
Definition state.h:369
void set_texture_coloring(Location texcoord_location, const std::string &texcoord_name, const Texture *texture=nullptr, float repeat=1.0f, float repeat_fraction=0.0f)
Constructs a scheme for textured rendering.
Definition state.cpp:107
State()
Default constructor.
Definition state.cpp:42
float texture_fractional_repeat() const
Returns the fractional repeat factor of the texture.
Definition state.h:310
const vec4 & back_color() const
Returns the backside color.
Definition state.h:274
void set_clamp_range(bool b)
Sets the clamping of the value range of a scalar field.
Definition state.h:343
void set_visible(bool v)
Sets the visibility of the drawable.
Definition state.h:132
virtual ~State()=default
Virtual destructor.
void set_back_color(const vec4 &c)
Sets the backside color.
Definition state.h:280
void set_selected(bool b)
Sets the selection state of the drawable.
Definition state.h:143
const std::string & property_name() const
Returns the name of the color attribute.
Definition state.h:230
void set_coloring(Method method, Location location, const std::string &name)
Sets the coloring.
Definition state.cpp:141
bool lighting() const
Checks if lighting is enabled.
Definition state.h:238
bool plane_clip_discard_primitive() const
Controls the behavior for vertex clipping.
Definition state.h:396
void set_color(const vec4 &c)
Sets the color.
Definition state.h:218
void set_property_coloring(Location color_location, const std::string &color_name="")
Constructs a scheme for rendering a drawable with per-element color.
Definition state.cpp:100
void set_highlight_range(const std::pair< int, int > &range)
Sets the range of primitives to be highlighted.
Definition state.h:428
const Texture * texture() const
Returns the texture.
Definition state.h:287
bool lighting_two_sides() const
Checks if double-sided lighting is enabled.
Definition state.h:249
bool clamp_range() const
Checks if the value range of a scalar field is clamped.
Definition state.h:338
Material & material()
Returns the material.
Definition state.h:375
void set_distinct_back_color(bool b)
Enables or disables different backside color.
Definition state.h:267
bool is_selected() const
Checks if the drawable is selected.
Definition state.h:138
void set_material(const Material &m)
Sets the material.
Definition state.h:385
void set_texture(const Texture *tex)
Sets the texture.
Definition state.h:292
void set_coloring_method(Method method)
Sets the coloring method.
Definition state.h:202
const Material & material() const
Returns the material (const version).
Definition state.h:380
void set_texture_repeat(float r)
Sets the repeat factor of the texture.
Definition state.h:303
Location
The location of a coloring property.
Definition state.h:68
@ VERTEX
Property defined on vertices.
Definition state.h:69
@ FACE
Property defined on faces.
Definition state.h:70
@ HALFEDGE
Property defined on halfedges.
Definition state.h:72
@ EDGE
Property defined on edges.
Definition state.h:71
void set_lighting_two_sides(bool b)
Enables or disables double-sided lighting.
Definition state.h:254
void set_plane_clip_discard_primitive(bool b)
Sets the behavior for vertex clipping.
Definition state.h:406
void enable_ssao(bool b)
Enables or disables SSAO.
Definition state.h:327
OpenGL texture.
Definition texture.h:42
Definition collider.cpp:182
Vec< 4, float > vec4
A 4D point/vector of float type.
Definition types.h:46
vec4 specular
Specular color.
Definition state.h:95
float shininess
Specular power.
Definition state.h:96
vec4 ambient
Ambient color.
Definition state.h:93
Material()=default
Default constructor.