Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
71 LineNode::LineNode( LineMode _mode,
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 {
83 drawMode(DrawModes::WIREFRAME);
84 }
85
86 //----------------------------------------------------------------------------
87
88 LineNode::~LineNode() {
89 if (vbo_)
90 glDeleteBuffersARB(1, &vbo_);
91
92 }
93
94 //----------------------------------------------------------------------------
95
96 void LineNode::set_line_mode(LineMode _mode)
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
107 void LineNode::clear()
108 {
109 clear_points();
110 clear_colors();
111 }
112
113 //----------------------------------------------------------------------------
114
115 void LineNode::clear_points()
116 {
117 points_.clear();
118
119 // Force an update of the vbo
120 updateVBO_ = true;
121 }
122
123 //----------------------------------------------------------------------------
124
125 void LineNode::clear_colors()
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)));
142 MaterialNode::set_color(_c);
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
168 void LineNode::add_color(const ACG::Vec3uc& _c)
169 {
170 colors_.push_back(_c);
171
172 // Force an update of the vbo
173 updateVBO_ = true;
174 }
175
176 //----------------------------------------------------------------------------
177
178 void LineNode::add_color(const Color4f _c)
179 {
180 colors4f_.push_back(_c);
181
182 // Force an update of the vbo
183 updateVBO_ = true;
184 }
185
186 //----------------------------------------------------------------------------
187
188 void
189 LineNode::
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
204 DrawModes::DrawMode
205 LineNode::
206 availableDrawModes() const
207 {
208 return DrawModes::WIREFRAME;
209 }
210
211
212 //----------------------------------------------------------------------------
213
214 void
215 LineNode::
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
232 LineNode::
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
352 LineNode::
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();
410 _state.set_line_width(picking_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
447 void LineNode::createVBO()
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
580 LineNode::
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 //=============================================================================
ACG::Vec2f
VectorT< float, 2 > Vec2f
Definition: VectorT.hh:108
ACG::RenderObject::shaderDesc
ShaderGenDesc shaderDesc
Drawmode and other shader params.
Definition: RenderObject.hh:232
ACG
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
ACG::SceneGraph::LineNode::add_point
void add_point(const Vec3d &_v)
add point (for LineMode == PolygonMode)
Definition: LineNode.cc:147
ACG::SceneGraph::ACG::GLState::disableClientState
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
ACG::SceneGraph::BaseNode
Definition: BaseNode.hh:135
ACG::SceneGraph::ACG::SceneGraph::BaseNode::name
std::string name() const
Returns: name of node (needs not be unique)
Definition: MeshNode2T.cc:391
ACG::GLState::pick_set_name
void pick_set_name(unsigned int _idx)
sets the current name/color (like glLoadName(_idx))
Definition: GLState.cc:1057
ACG::SceneGraph::PickTarget
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
ACG::SceneGraph::LineNode::clear_points
void clear_points()
clear points/lines
Definition: LineNode.cc:115
ACG::SceneGraph::ACG::GLState::disable
static void disable(GLenum _cap)
replaces glDisable, but supports locking
ACG::SceneGraph::LineNode::leave
void leave(GLState &_state, const DrawModes::DrawMode &_drawMode)
reset depth function to what it was before enter()
Definition: LineNode.cc:353
ACG::GLState::pick_set_maximum
bool pick_set_maximum(unsigned int _idx)
Set the maximal number of primitives/components of your object.
Definition: GLState.cc:1047
ACG::SceneGraph::PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
Definition: BaseNode.hh:110
ACG::RenderObject
Interface class between scenegraph and renderer.
Definition: RenderObject.hh:105
ACG::RenderObject::blendDest
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
Definition: RenderObject.hh:254
ACG::GLState::set_depthFunc
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
ACG::SceneGraph::LineNode::pick
void pick(GLState &_state, PickTarget _target)
Draw the line using the GL picking name stack.
Definition: LineNode.cc:365
ACG::RenderObject::vertexBuffer
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
Definition: RenderObject.hh:169
ACG::RenderObject::setUniform
void setUniform(const char *_name, GLint _value)
set values for int uniforms
Definition: RenderObject.cc:396
ACG::SceneGraph::ACG::VertexDeclaration::clear
void clear()
ACG::RenderObject::initFromState
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
Definition: RenderObject.cc:69
ACG::SceneGraph::LineNode::getRenderObjects
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
ACG::SceneGraph::ACG::VertexDeclaration::addElement
void addElement(const VertexElement *_pElement)
ACG::GLState
Definition: GLState.hh:220
ACG::glColor
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
Definition: gl.hh:146
ACG::SceneGraph::LineNode::n_points
size_t n_points() const
number of points
Definition: LineNode.hh:185
ACG::SceneGraph::LineNode::enter
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
ACG::SceneGraph::ACG::SceneGraph::BaseNode::drawMode
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
Definition: MeshNode2T.cc:406
ACG::SceneGraph::PICK_EDGE
picks edges (may not be implemented for all nodes)
Definition: BaseNode.hh:106
ACG::RenderObject::vertexDecl
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
Definition: RenderObject.hh:215
ACG::IRenderer
Definition: IRenderer.hh:84
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:294
ACG::SceneGraph::LineNode::LineNode
LineNode(LineMode _mode, BaseNode *_parent=0, std::string _name="<LineNode>")
default constructor
Definition: LineNode.cc:71
ACG::SceneGraph::ACG::SceneGraph::Material
Definition: MeshNode2T.cc:85
ACG::SceneGraph::ACG::GLState::bindBuffer
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
ACG::GLState::viewport_width
int viewport_width() const
get viewport width
Definition: GLState.hh:825
ACG::SceneGraph::MaterialNode::set_color
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
Definition: MaterialNode.hh:394
ACG::SceneGraph::LineNode::~LineNode
~LineNode()
destructor
Definition: LineNode.cc:88
ACG::GLState::set_color
void set_color(const Vec4f &_col)
set color
Definition: GLState.cc:689
ACG::GLState::line_width
float line_width() const
get line width
Definition: GLState.hh:978
ACG::SceneGraph::LineNode::createVBO
void createVBO()
creates the vbo only if update was requested
Definition: LineNode.cc:447
ACG::SceneGraph::LineNode::clear
void clear()
clear points/lines and colors
Definition: LineNode.cc:107
ACG::VERTEX_USAGE_COLOR
"inColor"
Definition: VertexDeclaration.hh:74
OpenMesh::VectorT
Definition: Vector11T.hh:83
ACG::VERTEX_USAGE_POSITION
"inPosition"
Definition: VertexDeclaration.hh:71
ACG::SceneGraph::MaterialNode::leave
void leave(GLState &_state, const DrawModes::DrawMode &_drawmode)
restores original GL-color and GL-material
ACG::IRenderer::addRenderObject
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
Definition: IRenderer.cc:105
ACG::SceneGraph::ACG::VertexDeclaration::getNumElements
unsigned int getNumElements() const
ACG::SceneGraph::LineNode::picking_line_width
float picking_line_width() const
get line width used by the picking renderer. Defaults to line_width().
Definition: LineNode.hh:179
ACG::SceneGraph::LineNode::clear_colors
void clear_colors()
clear colors
Definition: LineNode.cc:125
ACG::SceneGraph::LineNode::availableDrawModes
DrawModes::DrawMode availableDrawModes() const
return available draw modes
Definition: LineNode.cc:206
ACG::SceneGraph::ACG::GLState::vertexPointer
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
ACG::SceneGraph::DrawModes::WIREFRAME
DrawMode WIREFRAME
draw wireframe
Definition: DrawModes.cc:84
ACG::SceneGraph::LineNode::alwaysOnTop
bool & alwaysOnTop()
get and set always on top
Definition: LineNode.hh:202
ACG::GLState::set_line_width
void set_line_width(float _f)
set line width
Definition: GLState.cc:789
ACG::SceneGraph::MaterialNode::enter
void enter(GLState &_state, const DrawModes::DrawMode &_drawmode)
set current GL-color and GL-material
std
STL namespace.
ACG::SceneGraph::LineNode::set_color
void set_color(const Vec4f &_c)
Override material node's set color function in order to locally add color.
Definition: LineNode.cc:136
ACG::SceneGraph::ACG::GLState::enableClientState
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
ACG::GLState::depthFunc
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
Definition: GLState.cc:937
ACG::SceneGraph::LineNode::add_line
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
Definition: LineNode.cc:157
ACG::RenderObject::priority
int priority
Priority to allow sorting of objects.
Definition: RenderObject.hh:123
ACG::SceneGraph::LineNode::draw
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode)
draw lines and normals
Definition: LineNode.cc:233
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:321
ACG::SceneGraph::LineNode::boundingBox
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
update bounding box
Definition: LineNode.cc:190
ACG::SceneGraph::LineNode::set_line_mode
void set_line_mode(LineMode _mode)
set line mode (see LineNode::LineMode)
Definition: LineNode.cc:96
ACG::GLState::base_color
const Vec4f & base_color() const
get base color (used when lighting is off)
Definition: GLState.hh:929
ACG::glVertex
void glVertex(const Vec2i &_v)
Wrapper: glVertex for Vec2i.
Definition: gl.hh:97
ACG::SceneGraph::LineNode::LineMode
LineMode
Line mode: draw line segments (every 2 points) or ONE polyline.
Definition: LineNode.hh:108
ACG::ShaderProgGenerator::getShaderDir
static QString getShaderDir()
Definition: ShaderGenerator.cc:2406
ACG::GLState::viewport_height
int viewport_height() const
get viewport height
Definition: GLState.hh:827
ACG::SceneGraph::LineNode::add_color
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
Definition: LineNode.cc:168