53 #define ACG_MESHNODE_C 55 #include <ACG/Geometry/GPUCacheOptimizer.hh> 56 #include <ACG/GL/DrawMesh.hh> 57 #include <ACG/GL/GLError.hh> 58 #include <ACG/GL/GLState.hh> 70 #include "MeshNode2T.hh" 76 const std::string& _name ):
83 updateVertexPicking_(true),
84 vertexPickingBaseIndex_(0),
85 updateEdgePicking_(true),
86 edgePickingBaseIndex_(0),
87 updateFacePicking_(true),
88 facePickingBaseIndex_(0),
89 updateAnyPicking_(true),
90 anyPickingBaseIndex_(0),
91 perFaceTextureIndexAvailable_(false),
93 draw_with_offset_(false)
101 MeshNodeBase::supplyDrawMesh(drawMesh_);
124 if (mesh_.has_vertex_normals())
131 if (mesh_.has_face_normals())
134 if (mesh_.has_halfedge_normals())
137 if (mesh_.has_vertex_colors())
142 if (mesh_.has_vertex_normals())
146 if(mesh_.has_edge_colors())
151 if(mesh_.has_halfedge_colors())
156 bool enableTexturedFaces = drawMesh_->perFaceTextureCoordinateAvailable() != 0;
158 if (mesh_.has_face_colors()) {
161 if( mesh_.has_face_normals() )
164 if (mesh().has_vertex_normals()) {
167 if (enableTexturedFaces)
172 if ( mesh_.has_vertex_texcoords2D() ) {
175 if (mesh_.has_vertex_normals())
179 if ( enableTexturedFaces ) {
182 if (mesh_.has_face_normals())
224 glPushAttrib(GL_ENABLE_BIT);
226 GLenum prev_depth_offset = _state.
depthFunc();
227 if(draw_with_offset_)
230 glPolygonOffset(-1.0f, -10.0f);
250 if ( _drawMode & DrawModes::POINTS_SHADED ) {
256 if ( enableColors_ && (_drawMode & DrawModes::POINTS_COLORED) )
258 drawMesh_->usePerVertexColors();
261 if ( enableNormals_ && (_drawMode & DrawModes::POINTS_SHADED ) )
267 drawMesh_->disableColors();
292 drawMesh_->disableColors();
307 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
310 drawMesh_->disableColors();
313 clear_color[3] = 1.0;
331 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
337 enable_arrays( PER_EDGE_VERTEX_ARRAY | PER_EDGE_COLOR_ARRAY );
347 enable_arrays( PER_HALFEDGE_VERTEX_ARRAY);
355 enable_arrays( PER_HALFEDGE_VERTEX_ARRAY | PER_HALFEDGE_COLOR_ARRAY );
367 drawMesh_->usePerVertexColors();
378 if ( enableNormals_ ) {
384 drawMesh_->usePerVertexColors();
396 drawMesh_->setFlatShading();
397 drawMesh_->disableColors();
409 drawMesh_->usePerVertexNormals();
410 drawMesh_->setSmoothShading();
411 drawMesh_->disableColors();
433 drawMesh_->usePerVertexNormals();
434 drawMesh_->setSmoothShading();
435 drawMesh_->disableColors();
456 drawMesh_->usePerFaceColors();
471 drawMesh_->disableColors();
472 drawMesh_->setSmoothShading();
473 drawMesh_->usePerHalfedgeNormals();
489 drawMesh_->setFlatShading();
490 drawMesh_->usePerFaceColors();
507 drawMesh_->setSmoothShading();
508 drawMesh_->usePerVertexNormals();
509 drawMesh_->usePerFaceColors();
512 drawMesh_->draw(textureMap_,
true);
534 drawMesh_->setSmoothShading();
535 drawMesh_->usePerVertexNormals();
536 drawMesh_->usePerFaceColors();
537 drawMesh_->usePerHalfedgeTexcoords();
539 drawMesh_->draw(textureMap_,
true);
554 drawMesh_->disableColors();
555 drawMesh_->usePerVertexTexcoords();
559 GLint prevTexEnvMode = 0;
560 glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &prevTexEnvMode);
561 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
567 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, prevTexEnvMode);
577 drawMesh_->disableColors();
578 drawMesh_->usePerVertexTexcoords();
582 GLint prevTexEnvMode = 0;
583 glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &prevTexEnvMode);
584 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
590 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, prevTexEnvMode);
601 drawMesh_->setSmoothShading();
602 drawMesh_->disableColors();
603 drawMesh_->usePerVertexTexcoords();
622 drawMesh_->disableColors();
623 drawMesh_->usePerHalfedgeTexcoords();
625 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
645 drawMesh_->setFlatShading();
646 drawMesh_->disableColors();
647 drawMesh_->usePerHalfedgeTexcoords();
660 if(draw_with_offset_)
669 template <
class Mesh>
674 ro.debugName =
"MeshNode";
678 for (
unsigned int i = 0; i < _drawMode.
getNumLayers(); ++i)
687 ro.depthWrite =
true;
689 ro.setMaterial(_mat);
704 switch (props->colorSource())
710 drawMesh_->disableColors();
716 if (props->primitive() == DrawModes::PRIMITIVE_POLYGON)
718 switch (props->normalSource())
726 drawMesh_->setFlatShading();
728 drawMesh_->setSmoothShading();
734 switch (props->texcoordSource())
755 switch (props->lightStage())
778 if (props->primitive() == DrawModes::PRIMITIVE_WIREFRAME)
780 ro.debugName =
"MeshNode.Wireframe";
783 drawMesh_->disableColors();
787 ro.emissive = ro.specular;
789 ro.emissive = OpenMesh::color_cast<ACG::Vec3f>(_state.
overlay_color());
797 applyRenderObjectSettings(props->primitive(), &ro);
798 add_line_RenderObjects(_renderer, &ro);
801 if (props->primitive() == DrawModes::PRIMITIVE_HIDDENLINE)
804 drawMesh_->disableColors();
808 ro.emissive = ro.specular;
810 ro.emissive = OpenMesh::color_cast<ACG::Vec3f>(_state.
overlay_color());
814 if ( (polyLayer >
int(i) || polyLayer < 0) && ( mesh_.n_faces() != 0 ))
818 applyRenderObjectSettings(DrawModes::PRIMITIVE_POLYGON, &ro);
821 ro.glColorMask(0,0,0,0);
823 ro.debugName =
"MeshNode.HiddenLine.faces";
824 add_face_RenderObjects(_renderer, &ro);
830 ro.glColorMask(1,1,1,1);
835 applyRenderObjectSettings(DrawModes::PRIMITIVE_HIDDENLINE, &ro);
837 ro.debugName =
"MeshNode.HiddenLine.lines";
838 add_line_RenderObjects(_renderer, &ro);
841 if (props->
colored() && props->primitive() == DrawModes::PRIMITIVE_EDGE)
847 drawMesh_->updateEdgeHalfedgeVertexDeclarations();
848 ro.
vertexDecl = drawMesh_->getEdgeColoredVertexDeclaration();
849 ro.glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
852 ro.emissive = ro.specular;
857 applyRenderObjectSettings(props->primitive(), &ro);
858 ro.debugName =
"MeshNode.Edges";
865 if (props->primitive() == DrawModes::PRIMITIVE_HALFEDGE)
870 drawMesh_->updateEdgeHalfedgeVertexDeclarations();
871 halfedgeDecl.clear();
876 ro.emissive = ro.specular;
879 ro.glDrawArrays(GL_LINES, 0,
int(mesh_.n_halfedges() * 2));
881 ro.debugName =
"MeshNode.HalfEdges";
891 switch (props->primitive())
893 case DrawModes::PRIMITIVE_POINT:
895 if (ro.
shaderDesc.shadeMode == SG_SHADE_UNLIT)
899 ro.emissive = ro.specular;
907 applyRenderObjectSettings(props->primitive(), &ro);
908 ro.debugName =
"MeshNode.Points";
909 add_point_RenderObjects(_renderer, &ro);
911 case DrawModes::PRIMITIVE_EDGE:
914 ro.emissive = ro.specular;
919 applyRenderObjectSettings(props->primitive(), &ro);
920 ro.debugName =
"MeshNode.Edges";
921 add_line_RenderObjects(_renderer, &ro);
923 case DrawModes::PRIMITIVE_POLYGON:
925 applyRenderObjectSettings(props->primitive(), &ro);
927 if (!ro.
shaderDesc.vertexTemplateFile.isEmpty())
928 drawMesh_->scanVertexShaderForInput(ro.
shaderDesc.vertexTemplateFile.toStdString());
934 ro.debugName =
"MeshNode.Faces";
935 add_face_RenderObjects(_renderer, &ro, useNonIndexed);
950 drawMesh_->addPointRenderObjects(_renderer, _baseObj);
957 drawMesh_->drawVertices();
965 if ((enabled_arrays_ & PER_EDGE_COLOR_ARRAY) && (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY))
968 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
971 drawMesh_->drawLines();
979 if ((enabled_arrays_ & PER_EDGE_COLOR_ARRAY) && (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY))
982 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
985 drawMesh_->addLineRenderObjects(_renderer, _baseObj);
993 if ( enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY )
994 glDrawArrays(GL_LINES, 0,
int(mesh_.n_halfedges() * 2));
997 std::cerr <<
"Unable to Draw! halfedge array configuration is invalid!!" << std::endl;
1000 template<
class Mesh>
1004 drawMesh_->draw(textureMap_);
1007 template<
class Mesh>
1011 drawMesh_->addTriRenderObjects(_renderer, _baseObj, textureMap_, _nonindexed);
1014 template<
class Mesh>
1028 if (_arrays & PER_EDGE_VERTEX_ARRAY) {
1031 if (!(enabled_arrays_ & PER_EDGE_VERTEX_ARRAY)) {
1032 enabled_arrays_ |= PER_EDGE_VERTEX_ARRAY;
1041 }
else if (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY) {
1043 enabled_arrays_ &= ~PER_EDGE_VERTEX_ARRAY;
1052 if ( mesh_.has_edge_colors() && ( _arrays & PER_EDGE_COLOR_ARRAY) ) {
1055 if (!(enabled_arrays_ & PER_EDGE_COLOR_ARRAY)) {
1056 enabled_arrays_ |= PER_EDGE_COLOR_ARRAY;
1065 }
else if (enabled_arrays_ & PER_EDGE_COLOR_ARRAY) {
1067 enabled_arrays_ &= ~PER_EDGE_COLOR_ARRAY;
1077 if (_arrays & PER_HALFEDGE_VERTEX_ARRAY) {
1080 if (!(enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY)) {
1081 enabled_arrays_ |= PER_HALFEDGE_VERTEX_ARRAY;
1090 }
else if (enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY) {
1092 enabled_arrays_ &= ~PER_HALFEDGE_VERTEX_ARRAY;
1101 if ( mesh_.has_halfedge_colors() && ( _arrays & PER_HALFEDGE_COLOR_ARRAY) ) {
1104 if (!(enabled_arrays_ & PER_HALFEDGE_COLOR_ARRAY)) {
1105 enabled_arrays_ |= PER_HALFEDGE_COLOR_ARRAY;
1114 }
else if (enabled_arrays_ & PER_HALFEDGE_COLOR_ARRAY) {
1116 enabled_arrays_ &= ~PER_HALFEDGE_COLOR_ARRAY;
1126 template<
class Mesh>
1135 pick_vertices(_state);
1140 pick_vertices(_state,
true);
1163 pick_edges(_state,
true);
1173 template<
class Mesh>
1180 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_vertices()))) {
1181 omerr() <<
"MeshNode::pick_vertices: color range too small, " <<
"picking failed\n";
1185 if ( mesh_.n_vertices() == 0 ) {
1186 std::cerr <<
"pick_vertices: No vertices in Mesh!" << std::endl;
1190 if (_front && ( mesh_.n_faces() != 0 ) ) {
1194 clear_color[3] = 1.0;
1196 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1203 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1207 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1213 int pickImplementationMethod = 0;
1217 if (drawMesh_->supportsPickingVertices_opt())
1222 if ( updateVertexPicking_ || _state.
pick_current_index () != vertexPickingBaseIndex_) {
1223 if (pickImplementationMethod == 0)
1224 drawMesh_->updatePickingVertices(_state);
1226 drawMesh_->updatePickingVertices_opt(_state);
1228 updateVertexPicking_ =
false;
1231 if (mesh_.n_vertices()) {
1233 if (pickImplementationMethod == 0) {
1244 glDrawArrays(GL_POINTS, 0,
int(mesh_.n_vertices()));
1252 else if (pickImplementationMethod == 1){
1255 drawMesh_->drawPickingVertices_opt(_state.
projection() * _state.
modelview(), vertexPickingBaseIndex_);
1261 std::cerr <<
"pick_vertices: No vertices in Mesh!" << std::endl;
1265 std::cerr <<
"No fallback pick_vertices!" << std::endl;
1272 template<
class Mesh>
1279 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_edges()))) {
1280 omerr() <<
"MeshNode::pick_edges: color range too small, " <<
"picking failed\n";
1284 if ( mesh_.n_vertices() == 0 ) {
1285 std::cerr <<
"pick_edges: No vertices in Mesh!" << std::endl;
1289 if ( _front && ( mesh_.n_faces() != 0 ) ) {
1293 clear_color[3] = 1.0;
1295 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1302 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1306 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1317 int pickImplementationMethod = 0;
1320 if (drawMesh_->supportsPickingEdges_opt())
1324 if (pickImplementationMethod == 0)
1325 drawMesh_->updatePickingEdges(_state);
1327 drawMesh_->updatePickingEdges_opt(_state);
1329 updateEdgePicking_ =
false;
1332 if ( mesh_.n_edges() != 0 && drawMesh_) {
1334 if (pickImplementationMethod == 0){
1344 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
1352 else if (pickImplementationMethod == 1){
1354 drawMesh_->drawPickingEdges_opt(_state.
projection() * _state.
modelview(), edgePickingBaseIndex_);
1361 std::cerr <<
"No fallback pick_edges!" << std::endl;
1368 template<
class Mesh>
1374 if ( mesh_.n_vertices() == 0 ) {
1375 std::cerr <<
"pick_faces: No vertices in Mesh!" << std::endl;
1379 if ( mesh_.n_faces() > 0 ) {
1380 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_faces()))) {
1381 omerr() <<
"MeshNode::pick_faces: color range too small, " <<
"picking failed\n";
1386 omerr() <<
"Strange pickSetMAximum failed for index 1 in MeshNode\n";
1394 int pickImplementationMethod = 0;
1398 if (drawMesh_->supportsPickingFaces_opt())
1405 if (pickImplementationMethod == 0) {
1409 drawMesh_->updatePickingFaces(_state);
1411 updateFacePicking_ =
false;
1414 if ( mesh_.n_faces() != 0 ) {
1425 glDrawArrays(GL_TRIANGLES, 0,
int(3 * drawMesh_->getNumTris()));
1436 else if (pickImplementationMethod == 1) {
1441 drawMesh_->updatePickingFaces_opt(_state);
1443 updateFacePicking_ =
false;
1446 if ( mesh_.n_faces() != 0 ) {
1448 drawMesh_->drawPickingFaces_opt(_state.
projection() * _state.
modelview(), facePickingBaseIndex_);
1462 std::cerr <<
"Unknown picking method in pick_faces!" << std::endl;
1466 std::cerr <<
"No fallback pick_faces!" << std::endl;
1470 template<
class Mesh>
1476 size_t numElements = mesh_.n_faces() + mesh_.n_edges() + mesh_.n_vertices();
1478 if ( mesh_.n_vertices() == 0 ) {
1479 std::cerr <<
"pick_any: No vertices in Mesh!" << std::endl;
1484 if (numElements == 0) {
1485 std::cerr <<
"pick_any: Number of elements : 0 " << std::endl;
1491 omerr() <<
"MeshNode::pick_any: color range too small, " <<
"picking failed\n";
1500 int pickImplementationMethod = 0;
1503 if (drawMesh_->supportsPickingAny_opt())
1508 if (pickImplementationMethod == 0)
1509 drawMesh_->updatePickingAny(_state);
1511 drawMesh_->updatePickingAny_opt(_state);
1513 updateAnyPicking_ =
false;
1516 if (pickImplementationMethod == 0){
1527 if ( mesh_.n_faces() != 0 && drawMesh_) {
1532 glDrawArrays(GL_TRIANGLES, 0,
int(3 * drawMesh_->getNumTris()));
1538 if ( mesh_.n_edges() != 0 && drawMesh_) {
1543 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
1552 glDrawArrays(GL_POINTS, 0,
int(mesh_.n_vertices()));
1561 drawMesh_->drawPickingAny_opt(_state.
projection() * _state.
modelview(), anyPickingBaseIndex_);
1565 std::cerr <<
"No fallback pick_any!" << std::endl;
1573 template<
class Mesh>
1583 updateVertexPicking_ =
true;
1584 updateEdgePicking_ =
true;
1585 updateFacePicking_ =
true;
1586 updateAnyPicking_ =
true;
1589 drawMesh_->invalidatePerEdgeBuffers();
1592 drawMesh_->invalidatePerHalfedgeBuffers();
1594 drawMesh_->updateGeometry();
1596 drawMesh_->invalidateFullVBO();
1599 bbMin_ =
Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
1600 bbMax_ =
Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
1601 typename Mesh::ConstVertexIter v_it(mesh_.vertices_begin()), v_end(mesh_.vertices_end());
1603 for (; v_it!=v_end; ++v_it)
1605 bbMin_.minimize(mesh_.point(*v_it));
1606 bbMax_.maximize(mesh_.point(*v_it));
1610 template<
class Mesh>
1615 drawMesh_->invalidatePerEdgeBuffers();
1616 drawMesh_->invalidatePerHalfedgeBuffers();
1619 drawMesh_->updateTopology();
1625 template<
class Mesh>
1629 drawMesh_->updateTextures();
1631 updateVertexPicking_ =
true;
1632 updateFacePicking_ =
true;
1633 updateAnyPicking_ =
true;
1638 template<
class Mesh>
1643 drawMesh_->invalidatePerEdgeBuffers();
1644 drawMesh_->invalidatePerHalfedgeBuffers();
1649 drawMesh_->updateFull();
1652 template<
class Mesh>
1657 drawMesh_->setTextureIndexPropertyName(_indexPropertyName);
1658 perFaceTextureIndexAvailable_ = drawMesh_->perFaceTextureIndexAvailable() != 0;
1661 template<
class Mesh>
1666 return drawMesh_->getTextureIndexPropertyName();
1669 template<
class Mesh>
1673 drawMesh_->setPerFaceTextureCoordinatePropertyName(_halfedgeTextcoordPropertyName);
1679 template<
class Mesh>
1683 unsigned int res = 0;
1686 res += drawMesh_->getMemoryUsage();
1692 template<
class Mesh>
static GLuint getBoundTextureBuffer()
get bound texture
void pick(GLState &_state, PickTarget _target) override
Draws the object in picking mode.
DrawMode SOLID_2DTEXTURED_FACE
draw per halfedge textured faces
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
int getLayerIndexByPrimitive(DrawModePrimitive _type) const
search for layer with specified primitive
void pointSize(float _sz)
set point size (default: 1.0)
picks edges (may not be implemented for all nodes)
float line_width() const
get line width
size_t pick_current_index() const
Returns the current color picking index (can be used for caching)
picks faces (should be implemented for all nodes)
bool flatShaded() const
Is flat shading used (Normals per face)?
bool isAtomic() const
Check if this is an atomic draw Mode.
void pick_vertices(GLState &_state, bool _front=false)
Renders picking for vertices _front: Only render front vertices (not occluded by geometry) ...
DrawMode SOLID_ENV_MAPPED
draw environment mapped
VectorT< float, 2 > Vec2f
bool lighting() const
Is lighting enabled?
Namespace providing different geometric functions concerning angles.
void set_color(const Vec4f &_col)
set color
picks only visible front verices (may not be implemented for all nodes)
int viewport_height() const
get viewport height
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode) override
Draws the object.
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
void add_point_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj)
Draws the object.
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
DrawMode SOLID_SMOOTH_SHADED_FEATURES
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax) override
Current bounding box.
ShaderGenDesc shaderDesc
Drawmode and other shader params.
DrawMode SOLID_FACES_COLORED_2DTEXTURED_FACE_SMOOTH_SHADED
draw per halfedge texture faces modulated with face colors with smooth shading
void pick_any(GLState &_state)
Renders picking for all primitives.
void clearTextures()
disables texture support and removes all texture types
DrawMode SOLID_2DTEXTURED_FACE_SHADED
draw per halfedge textured faces
QString vertexColorsInterpolator
interpolation qualifier for input vertex colors: "flat", "smooth", "noperspective" ...
static GLenum getBoundTextureTarget()
get bound texture target
DrawMode HIDDENLINE
draw hidden line (2 rendering passes needed)
void update_geometry()
the geometry of the mesh has changed
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
void add_face_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj, bool _nonindexed=false)
Draws the object.
void add_line_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj)
Draws the object.
void setHalfedgeTextcoordPropertyName(std::string _halfedgeTextcoordPropertyName)
Set the name of the per face texture coordinate property.
DrawMode SOLID_SMOOTH_SHADED
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
void update_textures()
force an texture update
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
void setupLineRendering(float _lineWidth, const Vec2f &_screenSize)
Setup rendering of thick lines.
bool colored() const
Are colors used?
bool ACGDLLEXPORT openGLVersionTest(const int _major, const int _minor)
void setIndexPropertyName(std::string _indexPropertyName)
set the name of the property used for texture index specification
ACG::SceneGraph::DrawModes::DrawMode availableDrawModes() const override
return available draw modes
void draw_halfedges()
draws all halfedges of the mesh
Vec2f depthRange
glDepthRange: (znear, zmax)
unsigned int getMemoryUsage()
measures the size in bytes of allocated memory
DrawMode SOLID_POINTS_COLORED_SHADED
draw faces, but use Gouraud shading to interpolate vertex colors
DrawMode HALFEDGES
draw halfedges
DrawMode SOLID_PHONG_SHADED
draw phong shaded faces
static void colorPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glColorPointer, supports locking
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
bool pick_set_maximum(size_t _idx)
Set the maximal number of primitives/components of your object.
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
void setupPointRendering(float _pointSize, const Vec2f &_screenSize)
Setup rendering of circle points.
void set_base_color(const Vec4f &_col)
set base color (used when lighting is off)
pick any of the prior targets (should be implemented for all nodes)
const Vec4f & base_color() const
get base color (used when lighting is off)
const Vec4f & clear_color() const
get background color
QString vertexNormalInterpolator
interpolation qualifier for vertex shader normal outputs: "flat", "smooth", "noperspective" ...
DrawMode SOLID_TEXTURED
draw textured faces
DrawMode SOLID_FACES_COLORED_FLAT_SHADED
draw flat shaded and colored faces (requires face normals and colors)
picks verices (may not be implemented for all nodes)
void update_topology()
the topology of the mesh has changed
GLuint indexBuffer
Use vertex array object.
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
picks only visible front edges (may not be implemented for all nodes)
const Vec4f & color()
set color
const Vec4f & specular_color() const
get specular color
bool twosided_lighting()
get whether transparenet or solid objects should be drawn
void update_color()
the colors of the mesh have changed
int viewport_width() const
get viewport width
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
const GLMatrixd & modelview() const
get modelview matrix
DrawMode NONE
not a valid draw mode
DrawMode POINTS
draw unlighted points using the default base color
DrawModeProperties stores a set of properties that defines, how to render an object.
const Vec4f & overlay_color() const
Get overlay color.
virtual ~MeshNodeT()
Destructor.
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
const std::string & indexPropertyName() const
Get current texture index property name.
void draw_lines()
draws all edges of the mesh
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
void addTextureType(GLenum _type, bool _shadow, size_t _stage)
adds a texture type to the shader and enables texturing.
int priority
Priority to allow sorting of objects.
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
void pick_faces(GLState &_state)
Renders picking for faces _front: Only render front faces (not occluded by geometry) ...
void pick_edges(GLState &_state, bool _front=false)
Renders picking for edges _front: Only render front edges (not occluded by geometry) ...
DrawMode WIREFRAME
draw wireframe
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
DrawMode POINTS_COLORED
draw colored, but not lighted points (requires point colors)
MeshNodeT(Mesh &_mesh, BaseNode *_parent=0, const std::string &_name="<MeshNode>")
Default constructor.
static void enable(GLenum _cap, bool _warnRemoved=true)
replaces glEnable, but supports locking
DrawMode EDGES_COLORED
draw edges with colors (without shading)
DrawMeshT< Mesh > * getDrawMesh()
Get DrawMesh instance.
bool color_picking() const
Is color picking active?
static void depthRange(GLclampd _zNear, GLclampd _zFar)
replaces glDepthRange, supports locking
DrawMode SOLID_TEXTURED_SHADED
draw smooth shaded textured faces
void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat) override
Draws the object deferred.
const DrawModeProperties * getLayer(unsigned int _i) const
returns the property set at layer i
DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED
draw smooth shaded and colored faces (requires vertex normals and face colors)
DrawMode POINTS_SHADED
draw shaded points (requires point normals)
Interface class between scenegraph and renderer.
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
const GLMatrixd & projection() const
get projection matrix
size_t getNumLayers() const
returns the layer count
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
void draw_vertices()
draws all vertices of the mesh
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
VectorT< double, 3 > Vec3d
void enable_arrays(unsigned int _arrays)
enable/disable vertex arrays according to the bits in _arrays
void draw_faces()
draws all faces of the mesh