Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LineNode.cc
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 
51 
52 
53 //=============================================================================
54 //
55 // CLASS LineNode - IMPLEMENTATION
56 //
57 //=============================================================================
58 
59 //== INCLUDES =================================================================
60 #include <ACG/GL/acg_glew.hh>
61 #include "LineNode.hh"
62 #include <ACG/GL/IRenderer.hh>
63 
64 //== NAMESPACES ===============================================================
65 
66 namespace ACG {
67 namespace SceneGraph {
68 
69 //== IMPLEMENTATION ==========================================================
70 
72  BaseNode* _parent,
73  std::string _name ) :
74  MaterialNode(_parent, _name, MaterialNode::BaseColor | MaterialNode::LineWidth),
75  picking_line_width_(std::numeric_limits<float>::infinity()),
76  line_mode_(_mode),
77  draw_always_on_top (false),
78  prev_depth_(GL_LESS),
79  vbo_(0),
80  updateVBO_(true),
81  lineNodeName_("")
82 {
84 }
85 
86 //----------------------------------------------------------------------------
87 
89  if (vbo_)
90  glDeleteBuffersARB(1, &vbo_);
91 
92 }
93 
94 //----------------------------------------------------------------------------
95 
97 {
98  // Set the new line mode
99  line_mode_ = _mode;
100 
101  // Force an update of the vbo
102  updateVBO_ = true;
103 }
104 
105 //----------------------------------------------------------------------------
106 
108 {
109  clear_points();
110  clear_colors();
111 }
112 
113 //----------------------------------------------------------------------------
114 
116 {
117  points_.clear();
118 
119  // Force an update of the vbo
120  updateVBO_ = true;
121 }
122 
123 //----------------------------------------------------------------------------
124 
126 {
127  colors_.clear();
128  colors4f_.clear();
129 
130  // Force an update of the vbo
131  updateVBO_ = true;
132 }
133 
134 //----------------------------------------------------------------------------
135 
136 void LineNode::set_color(const Vec4f& _c)
137 {
138  clear_colors();
139  add_color(ACG::Vec3uc((char) (((int) _c[0]) * 255),
140  (char) (((int) _c[1]) * 255),
141  (char) (((int) _c[2]) * 255)));
143 }
144 
145 //----------------------------------------------------------------------------
146 
147 void LineNode::add_point(const Vec3d& _v)
148 {
149  points_.push_back(_v);
150 
151  // Force an update of the vbo
152  updateVBO_ = true;
153 }
154 
155 //----------------------------------------------------------------------------
156 
157 void LineNode::add_line(const Vec3d& _v0, const Vec3d& _v1)
158 {
159  add_point(_v0);
160  add_point(_v1);
161 
162  // Force an update of the vbo
163  updateVBO_ = true;
164 }
165 
166 //----------------------------------------------------------------------------
167 
169 {
170  colors_.push_back(_c);
171 
172  // Force an update of the vbo
173  updateVBO_ = true;
174 }
175 
176 //----------------------------------------------------------------------------
177 
179 {
180  colors4f_.push_back(_c);
181 
182  // Force an update of the vbo
183  updateVBO_ = true;
184 }
185 
186 //----------------------------------------------------------------------------
187 
188 void
190 boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
191 {
192  ConstPointIter p_it=points_.begin(), p_end=points_.end();
193  for (; p_it!=p_end; ++p_it)
194  {
195  _bbMax.maximize(*p_it);
196  _bbMin.minimize(*p_it);
197  }
198 }
199 
200 
201 //----------------------------------------------------------------------------
202 
203 
207 {
208  return DrawModes::WIREFRAME;
209 }
210 
211 
212 //----------------------------------------------------------------------------
213 
214 void
216 enter(GLState& _state , const DrawModes::DrawMode& _drawMode)
217 {
218  MaterialNode::enter(_state, _drawMode);
219 
220  if (alwaysOnTop()) {
221  //store current depth comparison function (needed for lasso selection)
222  prev_depth_ = _state.depthFunc();
223 
224  //set depth function and change GLState accordingly
225  _state.set_depthFunc(GL_ALWAYS);
226  }
227 }
228 
229 //----------------------------------------------------------------------------
230 
231 void
233 draw(GLState& _state , const DrawModes::DrawMode& _drawMode)
234 {
235  if (_drawMode & DrawModes::WIREFRAME)
236  {
237  ACG::GLState::disable(GL_LIGHTING);
238 
239 
240  // if (line_mode_ == LineSegmentsMode)
241  // glBegin(GL_LINES);
242  // else
243  // glBegin(GL_LINE_STRIP);
244 
245 
246  if (line_mode_ == LineSegmentsMode)
247  {
248  // first check if (new standard) 4-channel colors are specified
249  if( (points_.size()/2 == colors4f_.size()) )
250  {
251  // enable blending of lines
252  GLboolean blendb;
253  glGetBooleanv( GL_BLEND, &blendb);
254  glEnable(GL_BLEND);
255  // blend ontop of prev. drawn mesh
256  GLboolean depthmaskb;
257  glGetBooleanv( GL_DEPTH_WRITEMASK, &depthmaskb);
258  glDepthMask(GL_FALSE);
259 
260  glBegin(GL_LINES);
261 
262  ConstPointIter p_it=points_.begin(), p_end=points_.end();
263  ConstColor4fIter c_it=colors4f_.begin();
264 
265  Color4f c(1.0f,1.0f,1.0f,1.0f);
266  if(c_it != colors4f_.end()) {
267  c = *c_it;
268  }
269 
270  int cnt = 0;
271  for (; p_it!=p_end; ++p_it)
272  {
273  if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors4f_.end()) {
274  ++c_it;
275  c = *c_it;
276  }
277 
278  glColor(c);
279  glVertex(*p_it);
280 
281  ++cnt;
282  }
283 
284  glEnd();
285 
286  // disable blending of lines
287  if( blendb == GL_FALSE )
288  glDisable(GL_BLEND);
289 
290  // enable depth mask
291  if( depthmaskb == GL_TRUE )
292  glDepthMask(GL_TRUE);
293 
294  }
295  else if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors_.size()) )
296  {
297  glBegin(GL_LINES);
298  ConstPointIter p_it=points_.begin(), p_end=points_.end();
299  ConstColorIter c_it=colors_.begin();
300 
301  Color c((char)255, (char)255, (char)255);
302  if(c_it != colors_.end()) {
303  c = *c_it;
304  }
305 
306  int cnt = 0;
307  for (; p_it!=p_end; ++p_it)
308  {
309  if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors_.end()) {
310  ++c_it;
311  c = *c_it;
312  }
313 
314  glColor(c);
315  glVertex(*p_it);
316 
317  ++cnt;
318  }
319  glEnd();
320  }
321  else
322  {
323  glBegin(GL_LINES);
324 
325  ConstPointIter p_it=points_.begin(), p_end=points_.end();
326 
327  for (; p_it!=p_end; ++p_it)
328  {
329  glVertex(*p_it);
330  }
331 
332  glEnd();
333  }
334  }
335  else
336  {
337  _state.set_color(_state.base_color());
338  glBegin(GL_LINE_STRIP);
339  ConstPointIter p_it=points_.begin(), p_end=points_.end();
340  for (; p_it!=p_end; ++p_it)
341  glVertex(*p_it);
342  glEnd();
343  }
344 
345  //glEnd();
346  }
347 }
348 
349 //----------------------------------------------------------------------------
350 
351 void
353 leave(GLState& _state , const DrawModes::DrawMode& _drawMode)
354 {
355  if (alwaysOnTop()) {
356  //restore depth function and change GLState accordingly
357  _state.set_depthFunc(prev_depth_);
358  }
359 
360  MaterialNode::leave(_state, _drawMode);
361 }
362 
363 //----------------------------------------------------------------------------
364 
365 void LineNode::pick(GLState& _state , PickTarget _target)
366 {
367  if (n_points() == 0)
368  return;
369 
370  // Bind the vertex array
371  ACG::GLState::bindBuffer(GL_ARRAY_BUFFER_ARB, 0);
372  ACG::GLState::vertexPointer( &(points_)[0] );
373  ACG::GLState::enableClientState(GL_VERTEX_ARRAY);
374 
375  const unsigned int n_edges = n_points() - 1;
376 
377  switch (_target)
378  {
379  case PICK_EDGE:
380  {
381  _state.pick_set_maximum (n_edges);
382  pick_edges(_state, 0);
383  break;
384  }
385 
386  case PICK_ANYTHING:
387  {
388  _state.pick_set_maximum (n_edges);
389  pick_edges(_state, 0);
390  break;
391  }
392 
393  default:
394  break;
395  }
396 
397  //Disable the vertex array
398  ACG::GLState::disableClientState(GL_VERTEX_ARRAY);
399 }
400 
401 //----------------------------------------------------------------------------
402 
403 void LineNode::pick_edges(GLState& _state, unsigned int _offset)
404 {
405  // Check if we have any edges to draw (% 0 causes division by zero on windows)
406  if (n_points() < 2)
407  return;
408 
409  const float line_width_old = _state.line_width();
411  _state.pick_set_name (0);
412 
413  glDepthRange(0.0, 0.99);
414 
415  if (line_mode_ == PolygonMode)
416  {
417  const unsigned int n_edges = n_points() - 1;
418  for (unsigned int i = 0; i < n_edges; ++i)
419  {
420  _state.pick_set_name(i + _offset);
421  glBegin(GL_LINES);
422  glArrayElement(i);
423  glArrayElement(i + 1);
424  glEnd();
425  }
426  }
427  else if (line_mode_ == LineSegmentsMode)
428  {
429  const unsigned int n_edges = n_points() / 2;
430  for (unsigned int i = 0; i < n_edges; ++i)
431  {
432  _state.pick_set_name(i + _offset);
433  glBegin(GL_LINES);
434  glArrayElement(2*i);
435  glArrayElement(2*i + 1);
436  glEnd();
437  }
438  }
439 
440  glDepthRange(0.0, 1.0);
441 
442  _state.set_line_width(line_width_old);
443 }
444 
445 //----------------------------------------------------------------------------
446 
448 {
449  if (!updateVBO_)
450  return;
451 
452  // create vbo if it does not exist
453  if (!vbo_)
454  glGenBuffersARB(1, &vbo_);
455 
456  vertexDecl_.clear();
457  vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION);
458 
459  //3 coordinates per vertex
460  std::vector<float> vboData(3*points_.size(),0.f);
461 
462  if (line_mode_ == LineSegmentsMode)
463  {
464  if( (points_.size()/2 == colors4f_.size()) )
465  {
466  // === One color entry per line segment (alpha channel available ) ===
467  vertexDecl_.addElement(GL_FLOAT, 4, VERTEX_USAGE_COLOR);
468  vboData.resize(vboData.size() + 4 * points_.size());
469  float* vboPtr = &vboData[0];
470 
471  ConstPointIter p_it=points_.begin(), p_end=points_.end();
472  ConstColor4fIter c_it=colors4f_.begin();
473 
474  Color4f c(1.0f,1.0f,1.0f,1.0f);
475  if(c_it != colors4f_.end()) {
476  c = *c_it;
477  }
478 
479  int cnt = 0;
480  for (; p_it!=p_end; ++p_it)
481  {
482  if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors4f_.end()) {
483  ++c_it;
484  c = *c_it;
485  }
486  //add position information
487  *(vboPtr++) = (*p_it)[0];
488  *(vboPtr++) = (*p_it)[1];
489  *(vboPtr++) = (*p_it)[2];
490 
491  //add color information
492  *(vboPtr++) = c[0];
493  *(vboPtr++) = c[1];
494  *(vboPtr++) = c[2];
495  *(vboPtr++) = c[3];
496 
497  ++cnt;
498  }
499 
500  //====================
501  } else if ( points_.size()/2 == colors_.size() )
502  {
503  //=== One color entry per line segment (no alpha channel available and uchars as colors) ===
504  vertexDecl_.addElement(GL_FLOAT, 4, VERTEX_USAGE_COLOR);
505  //add 4 colors for each vertex
506  vboData.resize(vboData.size() + 4 * points_.size());
507  float* vboPtr = &vboData[0];
508 
509  ConstPointIter p_it=points_.begin(), p_end=points_.end();
510  ConstColorIter c_it=colors_.begin();
511 
512  Color c((char)255, (char)255, (char)255);
513  if(c_it != colors_.end()) {
514  c = *c_it;
515  }
516 
517  int cnt = 0;
518  for (; p_it!=p_end; ++p_it)
519  {
520  if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors_.end()) {
521  ++c_it;
522  c = *c_it;
523  }
524 
525  //add position information
526  *(vboPtr++) = (*p_it)[0];
527  *(vboPtr++) = (*p_it)[1];
528  *(vboPtr++) = (*p_it)[2];
529 
530  //add color information
531  *(vboPtr++) = c[0]/255.f;
532  *(vboPtr++) = c[1]/255.f;
533  *(vboPtr++) = c[2]/255.f;
534  *(vboPtr++) = 1.f;
535 
536  ++cnt;
537  }
538 
539  //===========
540  } else
541  {
542  //=== No colors. Just draw the segments ===
543  ConstPointIter p_it=points_.begin(), p_end=points_.end();
544  float* vboPtr = &vboData[0];
545 
546  for (; p_it!=p_end; ++p_it)
547  {
548  *(vboPtr++) = (*p_it)[0];
549  *(vboPtr++) = (*p_it)[1];
550  *(vboPtr++) = (*p_it)[2];
551  }
552  //===========
553  }
554 
555 
556  }
557  else
558  {
559  // === No colors (Use material) and one continuous line ===
560  // Pointer to it for easier copy operation
561  float* pPoints = &vboData[0];
562 
563  // Copy from internal storage to vbo in memory
564  for (unsigned int i = 0 ; i < points_.size(); ++i) {
565  for ( unsigned int j = 0 ; j < 3 ; ++j) {
566  *(pPoints++) = points_[i][j];
567  }
568  }
569  }
570 
571  glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_);
572  glBufferDataARB(GL_ARRAY_BUFFER_ARB, vboData.size()*sizeof(float) , &vboData[0] , GL_STATIC_DRAW_ARB);
573 
574  // Update done.
575  updateVBO_ = false;
576 
577 }
578 
579 void
581 getRenderObjects(IRenderer* _renderer, GLState& _state , const DrawModes::DrawMode& _drawMode , const ACG::SceneGraph::Material* _mat) {
582 
583  if (points_.empty())
584  return;
585 
586  // init base render object
587 
588  RenderObject ro;
589  ro.initFromState(&_state);
590  ro.setMaterial(_mat);
591 
592  lineNodeName_ = std::string("LineNode: ")+name();
593  ro.debugName = lineNodeName_.c_str();
594 
595  // draw after scene-meshes
596  if (draw_always_on_top)
597  {
598  ro.priority = 1;
599  ro.depthTest = false;
600  ro.depthWrite = false;
601  }
602  else
603  {
604  ro.depthTest = true;
605  ro.depthWrite = true;
606  }
607 
608  //set blending
609  if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors4f_.size()))
610  {
611  ro.blending = true;
612  ro.blendSrc = GL_SRC_ALPHA;
613  ro.blendDest = GL_ONE_MINUS_SRC_ALPHA;
614  }
615 
616  // simulate line width via quad extrusion in geometry shader
617  QString geomTemplate = ShaderProgGenerator::getShaderDir();
618  geomTemplate += "Wireframe/geom_line2quad.tpl";
619 
620  ro.shaderDesc.geometryTemplateFile = geomTemplate;
621 
622  ro.setUniform("screenSize", Vec2f((float)_state.viewport_width(), (float)_state.viewport_height()));
623  ro.setUniform("lineWidth", _state.line_width());
624 
625  createVBO();
626  ro.vertexBuffer = vbo_;
627  // vertexDecl is defined in createVBO
628  ro.vertexDecl = &vertexDecl_;
629 
630  //besides of the position, colors are saved so we can show them
631  if (vertexDecl_.getNumElements() > 1)
632  ro.shaderDesc.vertexColors = true;
633 
634 
635  if (line_mode_ == LineSegmentsMode)
636  ro.glDrawArrays(GL_LINES, 0, int( points_.size() ));
637  else
638  ro.glDrawArrays(GL_LINE_STRIP, 0, int(points_.size()) );
639 
640  _renderer->addRenderObject(&ro);
641 
642 }
643 
644 //=============================================================================
645 } // namespace SceneGraph
646 } // namespace ACG
647 //=============================================================================
VectorT< float, 2 > Vec2f
Definition: VectorT.hh:108
ShaderGenDesc shaderDesc
Drawmode and other shader params.
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
void add_point(const Vec3d &_v)
add point (for LineMode == PolygonMode)
Definition: LineNode.cc:147
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
std::string name() const
Returns: name of node (needs not be unique)
Definition: MeshNode2T.cc:391
void pick_set_name(unsigned int _idx)
sets the current name/color (like glLoadName(_idx))
Definition: GLState.cc:1057
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
void clear_points()
clear points/lines
Definition: LineNode.cc:115
static void disable(GLenum _cap)
replaces glDisable, but supports locking
void leave(GLState &_state, const DrawModes::DrawMode &_drawMode)
reset depth function to what it was before enter()
Definition: LineNode.cc:353
bool pick_set_maximum(unsigned int _idx)
Set the maximal number of primitives/components of your object.
Definition: GLState.cc:1047
pick any of the prior targets (should be implemented for all nodes)
Definition: BaseNode.hh:110
Interface class between scenegraph and renderer.
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
void set_depthFunc(const GLenum &_depth_func)
Call glDepthFunc() to actually change the depth comparison function, and store the new value in this ...
Definition: GLState.cc:944
void pick(GLState &_state, PickTarget _target)
Draw the line using the GL picking name stack.
Definition: LineNode.cc:365
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
void setUniform(const char *_name, GLint _value)
set values for int uniforms
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
Definition: RenderObject.cc:69
void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const ACG::SceneGraph::Material *_mat)
Add the objects to the given renderer.
Definition: LineNode.cc:581
void addElement(const VertexElement *_pElement)
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
Definition: gl.hh:146
size_t n_points() const
number of points
Definition: LineNode.hh:185
void enter(GLState &_state, const DrawModes::DrawMode &_drawMode)
set depth function (needed for lasso selection so that the line can be draw in pseudo-2D) ...
Definition: LineNode.cc:216
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
Definition: MeshNode2T.cc:406
picks edges (may not be implemented for all nodes)
Definition: BaseNode.hh:106
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
LineNode(LineMode _mode, BaseNode *_parent=0, std::string _name="<LineNode>")
default constructor
Definition: LineNode.cc:71
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
int viewport_width() const
get viewport width
Definition: GLState.hh:825
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
~LineNode()
destructor
Definition: LineNode.cc:88
void set_color(const Vec4f &_col)
set color
Definition: GLState.cc:689
float line_width() const
get line width
Definition: GLState.hh:978
void createVBO()
creates the vbo only if update was requested
Definition: LineNode.cc:447
void clear()
clear points/lines and colors
Definition: LineNode.cc:107
void leave(GLState &_state, const DrawModes::DrawMode &_drawmode)
restores original GL-color and GL-material
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
Definition: IRenderer.cc:105
float picking_line_width() const
get line width used by the picking renderer. Defaults to line_width().
Definition: LineNode.hh:179
void clear_colors()
clear colors
Definition: LineNode.cc:125
DrawModes::DrawMode availableDrawModes() const
return available draw modes
Definition: LineNode.cc:206
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
DrawMode WIREFRAME
draw wireframe
Definition: DrawModes.cc:84
bool & alwaysOnTop()
get and set always on top
Definition: LineNode.hh:202
void set_line_width(float _f)
set line width
Definition: GLState.cc:789
void enter(GLState &_state, const DrawModes::DrawMode &_drawmode)
set current GL-color and GL-material
STL namespace.
void set_color(const Vec4f &_c)
Override material node's set color function in order to locally add color.
Definition: LineNode.cc:136
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
Definition: GLState.cc:937
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
Definition: LineNode.cc:157
int priority
Priority to allow sorting of objects.
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode)
draw lines and normals
Definition: LineNode.cc:233
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
update bounding box
Definition: LineNode.cc:190
void set_line_mode(LineMode _mode)
set line mode (see LineNode::LineMode)
Definition: LineNode.cc:96
const Vec4f & base_color() const
get base color (used when lighting is off)
Definition: GLState.hh:929
void glVertex(const Vec2i &_v)
Wrapper: glVertex for Vec2i.
Definition: gl.hh:97
LineMode
Line mode: draw line segments (every 2 points) or ONE polyline.
Definition: LineNode.hh:108
static QString getShaderDir()
int viewport_height() const
get viewport height
Definition: GLState.hh:827
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
Definition: LineNode.cc:168