Class representing the rendering state of a drawable.
More...
#include <easy3d/renderer/state.h>
|
enum | Method { UNIFORM_COLOR
, COLOR_PROPERTY
, SCALAR_FIELD
, TEXTURED
} |
|
enum | Location { VERTEX
, FACE
, EDGE
, HALFEDGE
} |
|
|
| State (const State &s) |
|
State & | operator= (const State &rhs) |
| assign rhs to *this . performs a deep copy of all member variables.
|
|
bool | is_visible () const |
|
void | set_visible (bool v) |
|
bool | is_selected () const |
|
void | set_selected (bool b) |
|
|
void | set_uniform_coloring (const vec4 &color) |
|
void | set_property_coloring (Location color_location, const std::string &color_name="") |
|
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) |
|
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) |
|
void | set_coloring (Method method, Location location, const std::string &name) |
|
void | set_coloring_method (Method method) |
|
Method | coloring_method () const |
|
const vec4 & | color () const |
|
void | set_color (const vec4 &c) |
|
Location | property_location () const |
|
const std::string & | property_name () const |
|
bool | lighting () const |
| returns whether lighting is enabled.
|
|
void | set_lighting (bool l) |
| enables/disables lighting.
|
|
bool | lighting_two_sides () const |
| returns whether double-sided lighting is enabled.
|
|
void | set_lighting_two_sides (bool b) |
| enables/disables double-sided lighting.
|
|
bool | distinct_back_color () const |
|
void | set_distinct_back_color (bool b) |
|
const vec4 & | back_color () const |
|
void | set_back_color (const vec4 &c) |
|
const Texture * | texture () const |
|
void | set_texture (Texture *tex) |
|
float | texture_repeat () const |
|
void | set_texture_repeat (float r) |
|
float | texture_fractional_repeat () const |
|
void | set_texture_fractional_repeat (float fr) |
|
bool | is_ssao_enabled () const |
|
void | enable_ssao (bool b) |
|
void | set_ssao_texture (unsigned int tex) |
|
bool | clamp_range () const |
|
void | set_clamp_range (bool b) |
|
float | clamp_lower () const |
|
void | set_clamp_lower (float v) |
|
float | clamp_upper () const |
|
void | set_clamp_upper (float v) |
|
Material & | material () |
|
const Material & | material () const |
|
void | set_material (const Material &m) |
|
bool | plane_clip_discard_primitive () const |
| Controls the behavior for vertex clipping. More...
|
|
void | set_plane_clip_discard_primitive (bool b) |
|
bool | highlight () const |
|
void | set_highlight (bool b) |
|
void | set_highlight_range (const std::pair< int, int > &range) |
|
const std::pair< int, int > & | highlight_range () const |
|
Class representing the rendering state of a drawable.
◆ Location
The location of a coloring property. It is denoted by the type of the geometric primitives on which the property is defined.
◆ Method
A complete description of a color scheme contains the coloring method, and (if not uniform color) the location and name of a property. Available coloring methods:
- UNIFORM_COLOR: uniformly colored;
- COLOR_PROPERTY: using a color property;
- SCALAR_FIELD: using a scalar field;
- TEXTURED: using texture(s). Possible properties for coloring a drawable:
- color properties defined on vertices, faces, or edges. A color property is specified by its name, e.g., "v:color", "f:color", "e:color";
- scalar fields defined on vertices, faces, or edges. A scalar field is specified by its name, e.g., "v:curvature", "v:height", "f:segment_id";
- texture coordinates defined on vertices or halfedges. A texture coordinates property is specified by its name, e.g., "v:texcoord", "h:texcoord".
◆ back_color()
const vec4 & back_color |
( |
| ) |
const |
|
inline |
◆ clamp_lower()
float clamp_lower |
( |
| ) |
const |
|
inline |
Clamp the lower side of the value range of a scalar field. Value is in [0, 1] (i.e., 0% to 100%).
◆ clamp_range()
bool clamp_range |
( |
| ) |
const |
|
inline |
Clamp the value range of a scalar field.
◆ clamp_upper()
float clamp_upper |
( |
| ) |
const |
|
inline |
Clamp the upper side of the value range of a scalar field. Value is in [0, 1] (i.e., 0% to 100%).
◆ color()
const vec4 & color |
( |
| ) |
const |
|
inline |
The color, which is effective only when the coloring method was set to UNIFORM_COLOR. Call set_uniform_coloring() to change this color.
◆ coloring_method()
Method coloring_method |
( |
| ) |
const |
|
inline |
Returns the coloring method being used for rendering.
◆ distinct_back_color()
bool distinct_back_color |
( |
| ) |
const |
|
inline |
returns whether a different color is used for rendering the backside of a drawable.
- Note
- effective only when two-sides lighting is enabled
◆ highlight()
Highlight a subset of primitives of this drawable. Primitives with indices within the range [highlight_id_low_, highlight_id_high_] will be highlighted.
- Parameters
-
range | Specifies the min and max indices of the primitives to be highlighted. Providing [-1, -1] will un-highlight any previously highlighted primitives. |
- Attention
- For non-triangular surface meshes, all polygonal faces are internally triangulated to allow a unified rendering APIs. The range must be given on the triangulated faces! If you have face range, you should convert the face range to triangle range. For each face, its triangles are defined on SurfaceMesh::face_property<std::pair<int, int> >("f:triangle_range").
◆ plane_clip_discard_primitive()
bool plane_clip_discard_primitive |
( |
| ) |
const |
|
inline |
Controls the behavior for vertex clipping.
If plane_clip_discard_primitive() is false
(default value, standard plane clip), the clip distances will be linearly interpolated across the primitive (e.g., line, triangle) and the portion of the primitive with interpolated distances less than 0.0 will be clipped. If plane_clip_discard_primitive() is true
, a primitive will be completely discarded if one of its vertices has a negative clip distance.
◆ property_location()
The location of the color property.
◆ property_name()
const std::string & property_name |
( |
| ) |
const |
|
inline |
The name of the color attribute.
◆ set_back_color()
void set_back_color |
( |
const vec4 & |
c | ) |
|
|
inline |
◆ set_coloring()
void set_coloring |
( |
Method |
method, |
|
|
Location |
location, |
|
|
const std::string & |
name |
|
) |
| |
Sets the coloring. A generic version of the set_[method]_coloring() method.
- Parameters
-
method | The coloring method. |
location | The the location of the coloring property. |
name | The name of the coloring property. |
texture | The texture for the coloring. |
◆ set_coloring_method()
void set_coloring_method |
( |
Method |
method | ) |
|
|
inline |
Sets the coloring method.
It has the same effect as if set_coloring() is called without changing the location (2nd argument) and name (3rd argument) of the coloring property.
- See also
- set_coloring()
- Parameters
-
method | The coloring method. |
◆ set_distinct_back_color()
void set_distinct_back_color |
( |
bool |
b | ) |
|
|
inline |
enables/disables different backside color.
- Note
- effective only when two-sides lighting is enabled
◆ set_property_coloring()
void set_property_coloring |
( |
Location |
color_location, |
|
|
const std::string & |
color_name = "" |
|
) |
| |
◆ set_scalar_coloring()
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.
- Parameters
-
scalar_location | The location of the scalar field. |
scalar_name | The name of the scalar field. |
texture | The pointer to the texture. |
clamp_lower | The percentage of values to be clamped at the lower side of the range. Default is 5%. |
clamp_upper | The percentage of values to be clamped at the upper side of the range. Default is 5%. |
- Examples
- Tutorial_303_ScalarField.
◆ set_texture_coloring()
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.
- Parameters
-
texcoord_location | The location of texture coordinate. |
texcoord_name | The name of the texture coordinate property. |
texture | The pointer to the texture. |
repeat | The repeat factor of the texture. Default value is 1.0. |
repeat_fraction | The fractional repeat factor of the texture. Default value is 0.0. |
◆ set_uniform_coloring()
void set_uniform_coloring |
( |
const vec4 & |
color | ) |
|
◆ texture()
Memory management of textures is the user's responsibility.
◆ texture_fractional_repeat()
float texture_fractional_repeat |
( |
| ) |
const |
|
inline |
Controls the texture repeat at a finer level: 100 fractional repeat == 1 repeat.
◆ texture_repeat()
float texture_repeat |
( |
| ) |
const |
|
inline |
How many times do you want to repeat the texture?
The documentation for this class was generated from the following files:
- /Users/lnan/Documents/Projects/Easy3D/easy3d/renderer/state.h
- /Users/lnan/Documents/Projects/Easy3D/easy3d/renderer/state.cpp