59 #define ACG_MESHNODE_C
61 #include <ACG/Geometry/GPUCacheOptimizer.hh>
62 #include <ACG/GL/DrawMesh.hh>
63 #include <ACG/GL/GLError.hh>
69 namespace SceneGraph {
75 #include "MeshNode2T.hh"
88 updateVertexPicking_(true),
89 vertexPickingBaseIndex_(0),
90 updateEdgePicking_(true),
91 edgePickingBaseIndex_(0),
92 updateFacePicking_(true),
93 facePickingBaseIndex_(0),
94 updateAnyPicking_(true),
95 anyPickingBaseIndex_(0),
96 perFaceTextureIndexAvailable_(false),
97 perFaceTextureCoordsAvailable_(false),
99 draw_with_offset_(false)
104 std::cerr <<
"Error! Vertex buffer objects are not supported! The meshNode will not work without them!" << std::endl;
110 MeshNodeBase::supplyDrawMesh(drawMesh_);
133 if (mesh_.has_vertex_normals())
140 if (mesh_.has_face_normals())
143 if (mesh_.has_halfedge_normals())
146 if (mesh_.has_vertex_colors())
151 if (mesh_.has_vertex_normals())
155 if(mesh_.has_edge_colors())
160 if(mesh_.has_halfedge_colors())
165 if (mesh_.has_face_colors()) {
168 if( mesh_.has_face_normals() )
171 if (mesh().has_vertex_normals()) {
174 if (perFaceTextureCoordsAvailable_)
179 if ( mesh_.has_vertex_texcoords2D() ) {
182 if (mesh_.has_vertex_normals())
186 if ( perFaceTextureCoordsAvailable_ ) {
189 if (mesh_.has_face_normals())
200 _bbMin.minimize(bbMin_);
201 _bbMax.maximize(bbMax_);
231 glPushAttrib(GL_ENABLE_BIT);
233 GLenum prev_depth_offset = _state.
depthFunc();
234 if(draw_with_offset_)
237 glPolygonOffset(-1.0f, -10.0f);
257 if ( _drawMode & DrawModes::POINTS_SHADED ) {
263 if ( enableColors_ && (_drawMode & DrawModes::POINTS_COLORED) )
265 drawMesh_->usePerVertexColors();
268 if ( enableNormals_ && (_drawMode & DrawModes::POINTS_SHADED ) )
274 drawMesh_->disableColors();
299 drawMesh_->disableColors();
314 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
317 drawMesh_->disableColors();
320 clear_color[3] = 1.0;
338 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
344 enable_arrays( PER_EDGE_VERTEX_ARRAY | PER_EDGE_COLOR_ARRAY );
354 enable_arrays( PER_HALFEDGE_VERTEX_ARRAY);
362 enable_arrays( PER_HALFEDGE_VERTEX_ARRAY | PER_HALFEDGE_COLOR_ARRAY );
374 drawMesh_->usePerVertexColors();
385 if ( enableNormals_ ) {
391 drawMesh_->usePerVertexColors();
403 drawMesh_->setFlatShading();
404 drawMesh_->disableColors();
416 drawMesh_->usePerVertexNormals();
417 drawMesh_->setSmoothShading();
418 drawMesh_->disableColors();
440 drawMesh_->usePerVertexNormals();
441 drawMesh_->setSmoothShading();
442 drawMesh_->disableColors();
463 drawMesh_->usePerFaceColors();
478 drawMesh_->disableColors();
479 drawMesh_->setSmoothShading();
480 drawMesh_->usePerHalfedgeNormals();
496 drawMesh_->setFlatShading();
497 drawMesh_->usePerFaceColors();
514 drawMesh_->setSmoothShading();
515 drawMesh_->usePerVertexNormals();
516 drawMesh_->usePerFaceColors();
519 drawMesh_->draw(textureMap_,
true);
541 drawMesh_->setSmoothShading();
542 drawMesh_->usePerVertexNormals();
543 drawMesh_->usePerFaceColors();
544 drawMesh_->usePerHalfedgeTexcoords();
546 drawMesh_->draw(textureMap_,
true);
561 drawMesh_->disableColors();
562 drawMesh_->usePerVertexTexcoords();
566 GLint prevTexEnvMode = 0;
567 glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &prevTexEnvMode);
568 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
574 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, prevTexEnvMode);
584 drawMesh_->disableColors();
585 drawMesh_->usePerVertexTexcoords();
589 GLint prevTexEnvMode = 0;
590 glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &prevTexEnvMode);
591 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
597 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, prevTexEnvMode);
608 drawMesh_->setSmoothShading();
609 drawMesh_->disableColors();
610 drawMesh_->usePerVertexTexcoords();
629 drawMesh_->disableColors();
630 drawMesh_->usePerHalfedgeTexcoords();
632 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
652 drawMesh_->setFlatShading();
653 drawMesh_->disableColors();
654 drawMesh_->usePerHalfedgeTexcoords();
667 if(draw_with_offset_)
676 template <
class Mesh>
681 ro.debugName =
"MeshNode";
694 ro.depthWrite =
true;
696 ro.setMaterial(_mat);
711 switch (props->colorSource())
717 drawMesh_->disableColors();
723 if (props->primitive() == DrawModes::PRIMITIVE_POLYGON)
725 switch (props->normalSource())
733 drawMesh_->setFlatShading();
735 drawMesh_->setSmoothShading();
741 switch (props->texcoordSource())
759 switch (props->lightStage())
777 if (props->primitive() == DrawModes::PRIMITIVE_WIREFRAME)
779 ro.debugName =
"MeshNode.Wireframe";
782 drawMesh_->disableColors();
786 ro.emissive = ro.specular;
788 ro.emissive = OpenMesh::color_cast<ACG::Vec3f>(_state.
overlay_color());
796 applyRenderObjectSettings(props->primitive(), &ro);
797 add_line_RenderObjects(_renderer, &ro);
800 if (props->primitive() == DrawModes::PRIMITIVE_HIDDENLINE)
803 drawMesh_->disableColors();
807 ro.emissive = ro.specular;
813 if ( (polyLayer >
int(i) || polyLayer < 0) && ( mesh_.n_faces() != 0 ))
817 applyRenderObjectSettings(DrawModes::PRIMITIVE_POLYGON, &ro);
820 ro.glColorMask(0,0,0,0);
822 ro.debugName =
"MeshNode.HiddenLine.faces";
823 add_face_RenderObjects(_renderer, &ro);
829 ro.glColorMask(1,1,1,1);
834 applyRenderObjectSettings(DrawModes::PRIMITIVE_HIDDENLINE, &ro);
836 ro.debugName =
"MeshNode.HiddenLine.lines";
837 add_line_RenderObjects(_renderer, &ro);
840 if (props->
colored() && props->primitive() == DrawModes::PRIMITIVE_EDGE)
846 drawMesh_->updateEdgeHalfedgeVertexDeclarations();
847 ro.
vertexDecl = drawMesh_->getEdgeColoredVertexDeclaration();
848 ro.glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
851 ro.emissive = ro.specular;
856 applyRenderObjectSettings(props->primitive(), &ro);
857 ro.debugName =
"MeshNode.Edges";
864 if (props->primitive() == DrawModes::PRIMITIVE_HALFEDGE)
869 drawMesh_->updateEdgeHalfedgeVertexDeclarations();
871 ro.
vertexDecl = drawMesh_->getHalfedgeVertexDeclaration();
873 ro.
vertexDecl = drawMesh_->getHalfedgeColoredVertexDeclaration();
876 ro.emissive = ro.specular;
878 ro.glDrawArrays(GL_LINES, 0,
int(mesh_.n_halfedges() * 2));
884 applyRenderObjectSettings(props->primitive(), &ro);
885 ro.debugName =
"MeshNode.HalfEdges";
895 switch (props->primitive())
897 case DrawModes::PRIMITIVE_POINT:
903 ro.emissive = ro.specular;
911 applyRenderObjectSettings(props->primitive(), &ro);
912 ro.debugName =
"MeshNode.Points";
913 add_point_RenderObjects(_renderer, &ro);
915 case DrawModes::PRIMITIVE_EDGE:
918 ro.emissive = ro.specular;
923 applyRenderObjectSettings(props->primitive(), &ro);
924 ro.debugName =
"MeshNode.Edges";
925 add_line_RenderObjects(_renderer, &ro);
927 case DrawModes::PRIMITIVE_POLYGON:
929 applyRenderObjectSettings(props->primitive(), &ro);
931 if (!ro.
shaderDesc.vertexTemplateFile.isEmpty())
932 drawMesh_->scanVertexShaderForInput(ro.
shaderDesc.vertexTemplateFile.toStdString());
938 ro.debugName =
"MeshNode.Faces";
939 add_face_RenderObjects(_renderer, &ro, useNonIndexed);
954 drawMesh_->addPointRenderObjects(_renderer, _baseObj);
961 drawMesh_->drawVertices();
969 if ((enabled_arrays_ & PER_EDGE_COLOR_ARRAY) && (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY))
972 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
975 drawMesh_->drawLines();
983 if ((enabled_arrays_ & PER_EDGE_COLOR_ARRAY) && (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY))
986 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
989 drawMesh_->addLineRenderObjects(_renderer, _baseObj);
997 if ( enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY )
998 glDrawArrays(GL_LINES, 0,
int(mesh_.n_halfedges() * 2));
1001 std::cerr <<
"Unable to Draw! halfedge array configuration is invalid!!" << std::endl;
1004 template<
class Mesh>
1008 drawMesh_->draw(textureMap_);
1011 template<
class Mesh>
1015 drawMesh_->addTriRenderObjects(_renderer, _baseObj, textureMap_, _nonindexed);
1018 template<
class Mesh>
1032 if (_arrays & PER_EDGE_VERTEX_ARRAY) {
1035 if (!(enabled_arrays_ & PER_EDGE_VERTEX_ARRAY)) {
1036 enabled_arrays_ |= PER_EDGE_VERTEX_ARRAY;
1045 }
else if (enabled_arrays_ & PER_EDGE_VERTEX_ARRAY) {
1047 enabled_arrays_ &= ~PER_EDGE_VERTEX_ARRAY;
1056 if ( mesh_.has_edge_colors() && ( _arrays & PER_EDGE_COLOR_ARRAY) ) {
1059 if (!(enabled_arrays_ & PER_EDGE_COLOR_ARRAY)) {
1060 enabled_arrays_ |= PER_EDGE_COLOR_ARRAY;
1069 }
else if (enabled_arrays_ & PER_EDGE_COLOR_ARRAY) {
1071 enabled_arrays_ &= ~PER_EDGE_COLOR_ARRAY;
1081 if (_arrays & PER_HALFEDGE_VERTEX_ARRAY) {
1084 if (!(enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY)) {
1085 enabled_arrays_ |= PER_HALFEDGE_VERTEX_ARRAY;
1094 }
else if (enabled_arrays_ & PER_HALFEDGE_VERTEX_ARRAY) {
1096 enabled_arrays_ &= ~PER_HALFEDGE_VERTEX_ARRAY;
1105 if ( mesh_.has_halfedge_colors() && ( _arrays & PER_HALFEDGE_COLOR_ARRAY) ) {
1108 if (!(enabled_arrays_ & PER_HALFEDGE_COLOR_ARRAY)) {
1109 enabled_arrays_ |= PER_HALFEDGE_COLOR_ARRAY;
1118 }
else if (enabled_arrays_ & PER_HALFEDGE_COLOR_ARRAY) {
1120 enabled_arrays_ &= ~PER_HALFEDGE_COLOR_ARRAY;
1130 template<
class Mesh>
1139 pick_vertices(_state);
1144 pick_vertices(_state,
true);
1167 pick_edges(_state,
true);
1177 template<
class Mesh>
1184 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_vertices()))) {
1185 omerr() <<
"MeshNode::pick_vertices: color range too small, " <<
"picking failed\n";
1189 if ( mesh_.n_vertices() == 0 ) {
1190 std::cerr <<
"pick_vertices: No vertices in Mesh!" << std::endl;
1194 if (_front && ( mesh_.n_faces() != 0 ) ) {
1198 clear_color[3] = 1.0;
1200 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1207 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1211 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1217 int pickImplementationMethod = 0;
1220 if (drawMesh_->supportsPickingVertices_opt())
1221 pickImplementationMethod = 1;
1225 if ( updateVertexPicking_ || _state.
pick_current_index () != vertexPickingBaseIndex_) {
1226 if (pickImplementationMethod == 0)
1227 drawMesh_->updatePickingVertices(_state);
1229 drawMesh_->updatePickingVertices_opt(_state);
1231 updateVertexPicking_ =
false;
1234 if (mesh_.n_vertices()) {
1236 if (pickImplementationMethod == 0) {
1247 glDrawArrays(GL_POINTS, 0,
int(mesh_.n_vertices()));
1255 else if (pickImplementationMethod == 1){
1258 drawMesh_->drawPickingVertices_opt(_state.
projection() * _state.
modelview(), vertexPickingBaseIndex_);
1264 std::cerr <<
"pick_vertices: No vertices in Mesh!" << std::endl;
1268 std::cerr <<
"No fallback pick_vertices!" << std::endl;
1275 template<
class Mesh>
1282 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_edges()))) {
1283 omerr() <<
"MeshNode::pick_edges: color range too small, " <<
"picking failed\n";
1287 if ( mesh_.n_vertices() == 0 ) {
1288 std::cerr <<
"pick_edges: No vertices in Mesh!" << std::endl;
1292 if ( _front && ( mesh_.n_faces() != 0 ) ) {
1296 clear_color[3] = 1.0;
1298 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1305 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1309 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1320 int pickImplementationMethod = 0;
1323 if (drawMesh_->supportsPickingEdges_opt())
1324 pickImplementationMethod = 1;
1327 if (pickImplementationMethod == 0)
1328 drawMesh_->updatePickingEdges(_state);
1330 drawMesh_->updatePickingEdges_opt(_state);
1332 updateEdgePicking_ =
false;
1335 if ( mesh_.n_edges() != 0 && drawMesh_) {
1337 if (pickImplementationMethod == 0){
1347 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
1355 else if (pickImplementationMethod == 1){
1357 drawMesh_->drawPickingEdges_opt(_state.
projection() * _state.
modelview(), edgePickingBaseIndex_);
1364 std::cerr <<
"No fallback pick_edges!" << std::endl;
1371 template<
class Mesh>
1377 if ( mesh_.n_vertices() == 0 ) {
1378 std::cerr <<
"pick_faces: No vertices in Mesh!" << std::endl;
1382 if ( mesh_.n_faces() > 0 ) {
1383 if (!_state.
pick_set_maximum (static_cast<unsigned int>(mesh_.n_faces()))) {
1384 omerr() <<
"MeshNode::pick_faces: color range too small, " <<
"picking failed\n";
1389 omerr() <<
"Strange pickSetMAximum failed for index 1 in MeshNode\n";
1397 int pickImplementationMethod = 0;
1401 if (drawMesh_->supportsPickingFaces_opt())
1402 pickImplementationMethod = 1;
1408 if (pickImplementationMethod == 0) {
1412 drawMesh_->updatePickingFaces(_state);
1414 updateFacePicking_ =
false;
1417 if ( mesh_.n_faces() != 0 ) {
1428 glDrawArrays(GL_TRIANGLES, 0,
int(3 * drawMesh_->getNumTris()));
1439 else if (pickImplementationMethod == 1) {
1444 drawMesh_->updatePickingFaces_opt(_state);
1446 updateFacePicking_ =
false;
1449 if ( mesh_.n_faces() != 0 ) {
1451 drawMesh_->drawPickingFaces_opt(_state.
projection() * _state.
modelview(), facePickingBaseIndex_);
1465 std::cerr <<
"Unknown picking method in pick_faces!" << std::endl;
1469 std::cerr <<
"No fallback pick_faces!" << std::endl;
1473 template<
class Mesh>
1479 size_t numElements = mesh_.n_faces() + mesh_.n_edges() + mesh_.n_vertices();
1481 if ( mesh_.n_vertices() == 0 ) {
1482 std::cerr <<
"pick_any: No vertices in Mesh!" << std::endl;
1487 if (numElements == 0) {
1488 std::cerr <<
"pick_any: Number of elements : 0 " << std::endl;
1494 omerr() <<
"MeshNode::pick_any: color range too small, " <<
"picking failed\n";
1503 int pickImplementationMethod = 0;
1507 if (drawMesh_->supportsPickingAny_opt())
1508 pickImplementationMethod = 1;
1512 if (pickImplementationMethod == 0)
1513 drawMesh_->updatePickingAny(_state);
1515 drawMesh_->updatePickingAny_opt(_state);
1517 updateAnyPicking_ =
false;
1520 if (pickImplementationMethod == 0){
1531 if ( mesh_.n_faces() != 0 && drawMesh_) {
1536 glDrawArrays(GL_TRIANGLES, 0,
int(3 * drawMesh_->getNumTris()));
1542 if ( mesh_.n_edges() != 0 && drawMesh_) {
1547 glDrawArrays(GL_LINES, 0,
int(mesh_.n_edges() * 2));
1556 glDrawArrays(GL_POINTS, 0,
int(mesh_.n_vertices()));
1565 drawMesh_->drawPickingAny_opt(_state.
projection() * _state.
modelview(), anyPickingBaseIndex_);
1569 std::cerr <<
"No fallback pick_any!" << std::endl;
1577 template<
class Mesh>
1587 updateVertexPicking_ =
true;
1588 updateEdgePicking_ =
true;
1589 updateFacePicking_ =
true;
1590 updateAnyPicking_ =
true;
1593 drawMesh_->invalidatePerEdgeBuffers();
1596 drawMesh_->invalidatePerHalfedgeBuffers();
1598 drawMesh_->updateGeometry();
1600 drawMesh_->invalidateFullVBO();
1603 bbMin_ =
Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
1604 bbMax_ =
Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
1605 typename Mesh::ConstVertexIter v_it(mesh_.vertices_begin()), v_end(mesh_.vertices_end());
1607 for (; v_it!=v_end; ++v_it)
1609 bbMin_.minimize(mesh_.point(*v_it));
1610 bbMax_.maximize(mesh_.point(*v_it));
1614 template<
class Mesh>
1619 drawMesh_->invalidatePerEdgeBuffers();
1620 drawMesh_->invalidatePerHalfedgeBuffers();
1623 drawMesh_->updateTopology();
1629 template<
class Mesh>
1633 drawMesh_->updateTextures();
1635 updateVertexPicking_ =
true;
1636 updateFacePicking_ =
true;
1637 updateAnyPicking_ =
true;
1642 template<
class Mesh>
1647 drawMesh_->invalidatePerEdgeBuffers();
1648 drawMesh_->invalidatePerHalfedgeBuffers();
1653 drawMesh_->updateFull();
1656 template<
class Mesh>
1661 drawMesh_->setTextureIndexPropertyName(_indexPropertyName);
1662 perFaceTextureIndexAvailable_ = drawMesh_->perFaceTextureIndexAvailable() != 0;
1665 template<
class Mesh>
1670 return drawMesh_->getTextureIndexPropertyName();
1673 template<
class Mesh>
1678 drawMesh_->setPerFaceTextureCoordinatePropertyName(_halfedgeTextcoordPropertyName);
1679 perFaceTextureCoordsAvailable_ = drawMesh_->perFaceTextureCoordinateAvailable() != 0;
1686 template<
class Mesh>
1690 unsigned int res = 0;
1693 res += drawMesh_->getMemoryUsage();
1699 template<
class Mesh>
DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED
draw smooth shaded and colored faces (requires vertex normals and face colors)
VectorT< float, 2 > Vec2f
static GLuint getBoundTextureBuffer()
get bound texture
const DrawModeProperties * getLayer(unsigned int _i) const
returns the property set at layer i
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
size_t getNumLayers() const
returns the layer count
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode)
Draws the object.
DrawMode EDGES_COLORED
draw edges with colors (without shading)
ShaderGenDesc shaderDesc
Drawmode and other shader params.
Namespace providing different geometric functions concerning angles.
bool lighting() const
Is lighting enabled?
static void enable(GLenum _cap)
replaces glEnable, but supports locking
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
DrawMeshT< Mesh > * getDrawMesh()
Get DrawMesh instance.
DrawMode HIDDENLINE
draw hidden line (2 rendering passes needed)
int viewport_width() const
get viewport width
static void colorPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glColorPointer, supports locking
void pick_any(GLState &_state)
Renders picking for all primitives.
static void disable(GLenum _cap)
replaces glDisable, but supports locking
DrawMode HALFEDGES
draw halfedges
picks faces (should be implemented for all nodes)
pick any of the prior targets (should be implemented for all nodes)
DrawMode SOLID_2DTEXTURED_FACE_SHADED
draw per halfedge textured faces
void update_textures()
force an texture update
void draw_halfedges()
draws all halfedges of the mesh
void update_geometry()
the geometry of the mesh has changed
const GLMatrixd & modelview() const
get modelview matrix
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
float line_width() const
get line width
void setIndexPropertyName(std::string _indexPropertyName)
set the name of the property used for texture index specification
DrawMode SOLID_2DTEXTURED_FACE
draw per halfedge textured faces
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
void add_face_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj, bool _nonindexed=false)
Draws the object.
bool flatShaded() const
Is flat shading used (Normals per face)?
virtual ~MeshNodeT()
Destructor.
int priority
Priority to allow sorting of objects.
void clearTextures()
disables texture support and removes all texture types
int viewport_height() const
get viewport height
bool pick_set_maximum(unsigned int _idx)
Set the maximal number of primitives/components of your object.
const Vec4f & overlay_color() const
Get overlay color.
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
void update_color()
the colors of the mesh have changed
VectorT< double, 3 > Vec3d
static GLenum getBoundTextureTarget()
get bound texture target
DrawMode SOLID_SMOOTH_SHADED
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
const std::string & indexPropertyName() const
Get current texture index property name.
void pick_edges(GLState &_state, bool _front=false)
Renders picking for edges _front: Only render front edges (not occluded by geometry) ...
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
MeshNodeT(Mesh &_mesh, BaseNode *_parent=0, std::string _name="<MeshNode>")
Default constructor.
void enable_arrays(unsigned int _arrays)
enable/disable vertex arrays according to the bits in _arrays
picks verices (may not be implemented for all nodes)
ACG::SceneGraph::DrawModes::DrawMode availableDrawModes() const
return available draw modes
void add_line_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj)
Draws the object.
void update_topology()
the topology of the mesh has changed
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
bool checkExtensionSupported(const std::string &_extension)
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
Current bounding box.
picks edges (may not be implemented for all nodes)
picks only visible front verices (may not be implemented for all nodes)
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
const Vec4f & color()
set color
DrawMode SOLID_ENV_MAPPED
draw environment mapped
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
DrawMode POINTS_COLORED
draw colored, but not lighted points (requires point colors)
void addTextureType(GLenum _type, bool _shadow, size_t _stage)
adds a texture type to the shader and enables texturing.
void add_point_RenderObjects(IRenderer *_renderer, const RenderObject *_baseObj)
Draws the object.
bool isAtomic() const
Check if this is an atomic draw Mode.
void setupPointRendering(float _pointSize, const Vec2f &_screenSize)
Setup rendering of circle points.
void draw_faces()
draws all faces of the mesh
Vec2f depthRange
glDepthRange: (znear, zmax)
int getLayerIndexByPrimitive(DrawModePrimitive _type) const
search for layer with specified primitive
Interface class between scenegraph and renderer.
DrawMode POINTS
draw unlighted points using the default base color
void draw_vertices()
draws all vertices of the mesh
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
void pick_faces(GLState &_state)
Renders picking for faces _front: Only render front faces (not occluded by geometry) ...
void set_color(const Vec4f &_col)
set color
void pointSize(float _sz)
set point size (default: 1.0)
DrawMode SOLID_TEXTURED
draw textured faces
DrawMode POINTS_SHADED
draw shaded points (requires point normals)
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
DrawMode SOLID_PHONG_SHADED
draw phong shaded faces
unsigned int pick_current_index() const
Returns the current color picking index (can be used for caching)
DrawModeProperties stores a set of properties that defines, how to render an object.
DrawMode WIREFRAME
draw wireframe
void pick(GLState &_state, PickTarget _target)
Draws the object in picking mode.
bool colored() const
Are colors used?
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
const Vec4f & base_color() const
get base color (used when lighting is off)
unsigned int getMemoryUsage()
measures the size in bytes of allocated memory
void draw_lines()
draws all edges of the mesh
void pick_vertices(GLState &_state, bool _front=false)
Renders picking for vertices _front: Only render front vertices (not occluded by geometry) ...
void set_base_color(const Vec4f &_col)
set base color (used when lighting is off)
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
void setHalfedgeTextcoordPropertyName(std::string _halfedgeTextcoordPropertyName)
Set the name of the per face texture coordinate property.
void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
Draws the object deferred.
DrawMode SOLID_TEXTURED_SHADED
draw smooth shaded textured faces
void setupLineRendering(float _lineWidth, const Vec2f &_screenSize)
Setup rendering of thick lines.
static void depthRange(GLclampd _zNear, GLclampd _zFar)
replaces glDepthRange, supports locking
const Vec4f & specular_color() const
get specular color
DrawMode SOLID_FACES_COLORED_2DTEXTURED_FACE_SMOOTH_SHADED
draw per halfedge texture faces modulated with face colors with smooth shading
DrawMode SOLID_FACES_COLORED_FLAT_SHADED
draw flat shaded and colored faces (requires face normals and colors)
DrawMode SOLID_POINTS_COLORED_SHADED
draw faces, but use Gouraud shading to interpolate vertex colors
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
DrawMode SOLID_SMOOTH_SHADED_FEATURES
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
picks only visible front edges (may not be implemented for all nodes)
DrawMode NONE
not a valid draw mode
const Vec4f & clear_color() const
get background color
QString vertexColorsInterpolator
interpolation qualifier for input vertex colors: "flat", "smooth", "noperspective" ...
const GLMatrixd & projection() const
get projection matrix
bool color_picking() const
Is color picking active?