libigl v2.5.0
Loading...
Searching...
No Matches
MeshGL.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_OPENGL_MESHGL_H
9#define IGL_OPENGL_MESHGL_H
10
11
12#include "../igl_inline.h"
13#include <Eigen/Core>
14#include <cstdint>
15
16namespace igl
17{
18namespace opengl
19{
20
23class MeshGL
24{
25public:
26 typedef unsigned int GLuint;
27 typedef unsigned int GLint;
28
32 {
33 DIRTY_NONE = 0x0000,
35 DIRTY_UV = 0x0002,
36 DIRTY_NORMAL = 0x0004,
37 DIRTY_AMBIENT = 0x0008,
38 DIRTY_DIFFUSE = 0x0010,
40 DIRTY_TEXTURE = 0x0040,
41 DIRTY_FACE = 0x0080,
42 DIRTY_MESH = 0x00FF,
48 DIRTY_ALL = 0xFFFF
49 };
50
51 bool is_initialized = false;
59
72
77
90
91 // Temporary copy of the content of each VBO
92 typedef Eigen::Matrix<float,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor> RowMatrixXf;
103
104 // Text Rendering
124
125 int tex_u;
126 int tex_v;
129 Eigen::Matrix<char,Eigen::Dynamic,1> tex;
130
131 Eigen::Matrix<unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> F_vbo;
132 Eigen::Matrix<unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> lines_F_vbo;
133 Eigen::Matrix<unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> points_F_vbo;
134
136 uint32_t dirty;
137
139
142
145
148
151
155 IGL_INLINE void draw_mesh(bool solid);
156
159
162
165
168
172 IGL_INLINE void bind_labels(const TextGL& labels);
174 IGL_INLINE void draw_labels(const TextGL& labels);
175
178
179};
180
181}
182}
183
184#ifndef IGL_STATIC_LIBRARY
185# include "MeshGL.cpp"
186#endif
187
188#endif
Coverts mesh data inside a igl::ViewerData class in an OpenGL compatible format The class includes a ...
Definition MeshGL.h:24
unsigned int GLuint
Definition MeshGL.h:26
void draw_mesh(bool solid)
Draw the currently buffered mesh (either solid or wireframe)
GLuint vbo_tex
Texture.
Definition MeshGL.h:76
RowMatrixXf V_normals_vbo
Definition MeshGL.h:94
void draw_overlay_lines()
Draw the currently buffered line overlay.
GLuint vbo_lines_F
Indices of the line overlay.
Definition MeshGL.h:79
TextGL vertex_labels
Definition MeshGL.h:120
Eigen::Matrix< unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > F_vbo
Definition MeshGL.h:131
GLuint vbo_V_uv
UV coordinates for the current mesh (#V x 2)
Definition MeshGL.h:63
void bind_overlay_lines()
Bind the underlying OpenGL buffer objects for subsequent line overlay draw calls.
RowMatrixXf lines_V_colors_vbo
Definition MeshGL.h:100
GLuint vbo_V_normals
Vertices of the current mesh (#V x 3)
Definition MeshGL.h:65
uint32_t dirty
Marks dirty buffers that need to be uploaded to OpenGL.
Definition MeshGL.h:136
void init_text_rendering()
Text Binding and Draw functions.
Eigen::Matrix< char, Eigen::Dynamic, 1 > tex
Definition MeshGL.h:129
RowMatrixXf V_uv_vbo
Definition MeshGL.h:98
RowMatrixXf V_diffuse_vbo
Definition MeshGL.h:96
GLuint vbo_points_V_colors
Color values of the point overlay.
Definition MeshGL.h:89
void bind_overlay_points()
Bind the underlying OpenGL buffer objects for subsequent point overlay draw calls.
int tex_v
Definition MeshGL.h:126
GLuint vao_mesh
Definition MeshGL.h:52
GLuint vao_overlay_points
Definition MeshGL.h:54
GLuint vbo_V
Vertices of the current mesh (#V x 3)
Definition MeshGL.h:61
GLuint vbo_lines_V_colors
Color values of the line overlay.
Definition MeshGL.h:83
Eigen::Matrix< unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > lines_F_vbo
Definition MeshGL.h:132
void init_buffers()
Create a new set of OpenGL buffer objects.
void init()
Initialize shaders and buffers.
GLuint shader_overlay_points
Definition MeshGL.h:57
GLuint vbo_lines_V
Vertices of the line overlay.
Definition MeshGL.h:81
GLuint font_atlas
Definition MeshGL.h:123
void draw_labels(const TextGL &labels)
Draw the currently buffered text.
RowMatrixXf V_ambient_vbo
Definition MeshGL.h:95
GLuint vbo_V_specular
Specular material (#V x 3)
Definition MeshGL.h:71
DirtyFlags
Bitmask flags for keeping track of what needs to be (re)-uploaded to the GPU.
Definition MeshGL.h:32
@ DIRTY_FACE
Definition MeshGL.h:41
@ DIRTY_NORMAL
Definition MeshGL.h:36
@ DIRTY_UV
Definition MeshGL.h:35
@ DIRTY_POSITION
Definition MeshGL.h:34
@ DIRTY_ALL
Definition MeshGL.h:48
@ DIRTY_SPECULAR
Definition MeshGL.h:39
@ DIRTY_MESH
Definition MeshGL.h:42
@ DIRTY_AMBIENT
Definition MeshGL.h:37
@ DIRTY_NONE
Definition MeshGL.h:33
@ DIRTY_FACE_LABELS
Definition MeshGL.h:46
@ DIRTY_TEXTURE
Definition MeshGL.h:40
@ DIRTY_OVERLAY_LINES
Definition MeshGL.h:43
@ DIRTY_VERTEX_LABELS
Definition MeshGL.h:45
@ DIRTY_DIFFUSE
Definition MeshGL.h:38
@ DIRTY_CUSTOM_LABELS
Definition MeshGL.h:47
@ DIRTY_OVERLAY_POINTS
Definition MeshGL.h:44
Eigen::Matrix< unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > points_F_vbo
Definition MeshGL.h:133
RowMatrixXf points_V_vbo
Definition MeshGL.h:101
GLuint shader_overlay_lines
Definition MeshGL.h:56
RowMatrixXf lines_V_vbo
Definition MeshGL.h:99
GLuint vbo_F
Faces of the mesh (#F x 3)
Definition MeshGL.h:74
void draw_overlay_points()
Draw the currently buffered point overlay.
void free_buffers()
Release the OpenGL buffer objects.
TextGL custom_labels
Definition MeshGL.h:122
void bind_labels(const TextGL &labels)
Bind the underlying OpenGL buffer objects for subsequent text draw calls.
RowMatrixXf V_vbo
Definition MeshGL.h:93
GLuint vbo_V_ambient
Ambient material (#V x 3)
Definition MeshGL.h:67
TextGL face_labels
Definition MeshGL.h:121
GLint tex_filter
Definition MeshGL.h:127
GLuint vbo_points_V
Vertices of the point overlay.
Definition MeshGL.h:87
GLuint vao_overlay_lines
Definition MeshGL.h:53
GLuint vbo_V_diffuse
Diffuse material (#V x 3)
Definition MeshGL.h:69
GLuint vbo_points_F
Indices of the point overlay.
Definition MeshGL.h:85
GLuint shader_text
Definition MeshGL.h:58
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > RowMatrixXf
Definition MeshGL.h:92
void bind_mesh()
Bind the underlying OpenGL buffer objects for subsequent mesh draw calls.
void free()
Release all resources.
bool is_initialized
Definition MeshGL.h:51
GLuint shader_mesh
Definition MeshGL.h:55
RowMatrixXf V_specular_vbo
Definition MeshGL.h:97
int tex_u
Definition MeshGL.h:125
GLint tex_wrap
Definition MeshGL.h:128
RowMatrixXf points_V_colors_vbo
Definition MeshGL.h:102
unsigned int GLint
Definition MeshGL.h:27
#define IGL_INLINE
Definition igl_inline.h:15
Definition AABB.h:17
Definition MeshGL.h:106
Eigen::Matrix< unsigned, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > label_indices_vbo
Definition MeshGL.h:116
RowMatrixXf label_pos_vbo
Definition MeshGL.h:113
GLuint vao_labels
Definition MeshGL.h:108
GLuint vbo_labels_pos
Definition MeshGL.h:109
GLuint vbo_labels_indices
Definition MeshGL.h:112
GLuint vbo_labels_characters
Definition MeshGL.h:110
RowMatrixXf label_char_vbo
Definition MeshGL.h:114
GLuint vbo_labels_offset
Definition MeshGL.h:111
RowMatrixXf label_offset_vbo
Definition MeshGL.h:115
uint32_t dirty_flag
Definition MeshGL.h:107