The drawable for rendering a set of triangles, e.g., the surface of a triangular mesh.
More...
|
| TrianglesDrawable (const std::string &name="", Model *model=nullptr) |
|
Type | type () const override |
| Returns the type of the drawable. More...
|
|
bool | smooth_shading () const |
|
void | set_smooth_shading (bool b) |
|
float | opacity () const |
| Query the opacity of the drawable, in the range [0.0, 1.0]. More...
|
|
void | set_opacity (float opacity) |
| Set the opacity of the drawable. More...
|
|
void | draw (const Camera *camera) const override |
| The draw method. More...
|
|
| Drawable (const std::string &name="unknown", Model *model=nullptr) |
|
virtual Type | type () const =0 |
| Returns the type of the drawable. More...
|
|
const std::string & | name () const |
|
void | set_name (const std::string &n) |
|
Model * | model () |
| the model to which the drawable is attached to (can be NULL).
|
|
const Model * | model () const |
|
void | set_model (Model *m) |
|
const Box3 & | bounding_box () const |
|
State & | state () |
|
const State & | state () const |
|
void | set_state (const State &s) |
|
void | buffer_stats (std::ostream &output) const |
| print statistics (e.g., num vertices, memory usage) of the buffers to an output stream (e.g., std::cout).
|
|
std::size_t | num_vertices () const |
|
VertexArrayObject * | vao () |
| Returns the vertex array object of this drawable.
|
|
const VertexArrayObject * | vao () const |
| Returns the vertex array object of this drawable.
|
|
unsigned int | vertex_buffer () const |
|
unsigned int | color_buffer () const |
|
unsigned int | normal_buffer () const |
|
unsigned int | texcoord_buffer () const |
|
unsigned int | element_buffer () const |
|
void | update_vertex_buffer (const std::vector< vec3 > &vertices, bool dynamic=false) |
| Creates/Updates a single buffer. More...
|
|
void | update_color_buffer (const std::vector< vec3 > &colors, bool dynamic=false) |
|
void | update_normal_buffer (const std::vector< vec3 > &normals, bool dynamic=false) |
|
void | update_texcoord_buffer (const std::vector< vec2 > &texcoords, bool dynamic=false) |
|
void | update_element_buffer (const std::vector< unsigned int > &elements) |
|
void | update_element_buffer (const std::vector< std::vector< unsigned int > > &elements) |
| Updates the element buffer. More...
|
|
void | disable_element_buffer () |
| Disables the use of the element buffer. More...
|
|
void | gl_draw () const |
|
void | update () |
| Requests an update of the OpenGL buffers. More...
|
|
void | set_update_func (const std::function< void(Model *, Drawable *)> &func) |
| Setups how a drawable updates its rendering buffers. More...
|
|
Manipulator * | manipulator () |
| Gets the manipulator attached to this drawable. More...
|
|
const Manipulator * | manipulator () const |
| Gets the manipulator attached to this drawable. More...
|
|
void | set_manipulator (Manipulator *manip) |
| Attaches a manipulator to this model. More...
|
|
mat4 | manipulated_matrix () const |
| Returns the manipulation matrix.
|
|
| 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 |
|
The drawable for rendering a set of triangles, e.g., the surface of a triangular mesh.
- See also
- LinesDrawable, PointsDrawable
- Note
- TrianglesDrawable supports triangles only. Visualizing general polygons typically requires tessellating the faces into a set of triangles (using Tessellator or any other methods). Vertex coordinates and properties (e.g., color, normal) must be provided as consecutive triplets in an array to be transferred to GPU. See Drawable::update_vertex_buffer().
- Examples
- Tutorial_204_Viewer_Qt, Tutorial_301_Drawables, Tutorial_311_Animation, Tutorial_501_AmbientOcclusion, and Tutorial_504_Transparency.