58 #define ACG_BSPLINECURVENODET_C 62 #include "BSplineCurveNodeT.hh" 63 #include <ACG/GL/gl.hh> 64 #include <ACG/GL/GLError.hh> 65 #include <ACG/GL/IRenderer.hh> 66 #include <ACG/Utils/VSToolsT.hh> 68 #include <OpenMesh/Core/Utils/vector_cast.hh> 80 template <
class BSplineCurve>
85 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
87 _bbMin.
minimize(bsplineCurve_.get_control_point(i));
88 _bbMax.
maximize(bsplineCurve_.get_control_point(i));
94 template <
class BSplineCurve>
119 template <
class BSplineCurve>
124 glPushAttrib(GL_ENABLE_BIT);
127 if ( bspline_selection_draw_mode_ == CONTROLPOINT
128 && controlPointSelectionTexture_valid_ ==
false)
129 updateControlPointSelectionTexture(_state);
131 if ( bspline_selection_draw_mode_ == KNOTVECTOR
132 && knotVectorSelectionTexture_valid_ ==
false)
133 updateKnotVectorSelectionTexture(_state);
140 if (bspline_draw_mode_ == NORMAL)
144 else if (bspline_draw_mode_ == FANCY)
148 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
154 render( _state,
false, _drawMode);
161 render( _state,
false, _drawMode);
170 template <
class BSplineCurve>
176 if ( bspline_selection_draw_mode_ == CONTROLPOINT
177 && controlPointSelectionTexture_valid_ ==
false)
178 updateControlPointSelectionTexture(_state);
180 if ( bspline_selection_draw_mode_ == KNOTVECTOR
181 && knotVectorSelectionTexture_valid_ ==
false)
182 updateKnotVectorSelectionTexture(_state);
203 if (props->primitive() == DrawModes::PRIMITIVE_POINT)
205 ro.glDrawArrays(GL_POINTS, 0, curveLineVertices_);
208 else if (props->primitive() == DrawModes::PRIMITIVE_WIREFRAME)
210 ro.glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
216 if (render_control_polygon_)
218 updateControlPointBuffer();
219 updateControlPointSelBuffer();
220 updateControlEdgeSelBuffer();
237 if (controlEdgeSelCount_)
239 ro.emissive = highlightColor;
243 ro.glDrawElements(GL_LINES, 2 * controlEdgeSelCount_, GL_UNSIGNED_INT, 0);
248 ro.emissive = polygonColor;
250 ro.glDrawArrays(GL_LINE_STRIP, 0, bsplineCurve_.n_control_points());
256 if (controlPointSelCount_)
258 ro.emissive = highlightColor;
262 ro.glDrawElements(GL_POINTS, controlPointSelCount_, GL_UNSIGNED_INT, 0);
267 ro.emissive = polygonColor;
269 ro.glDrawElements(GL_POINTS, bsplineCurve_.n_control_points(), GL_UNSIGNED_INT, 0);
276 template <
class BSplineCurve>
282 if (render_control_polygon_)
284 if (bspline_draw_mode_ == NORMAL)
285 drawControlPolygon(_drawMode, _state);
286 else if (bspline_draw_mode_ == FANCY)
287 drawFancyControlPolygon(_drawMode, _state);
294 if (bspline_selection_draw_mode_ == NONE)
296 if (bspline_draw_mode_ == NORMAL)
299 drawFancyCurve(_state);
303 if (bspline_selection_draw_mode_ == CONTROLPOINT) {
304 drawTexturedCurve(_state, cp_selection_texture_idx_);
306 else if (bspline_selection_draw_mode_ == KNOTVECTOR) {
307 drawTexturedCurve(_state, knot_selection_texture_idx_);
315 template <
class BSplineCurve>
322 curveLineVBO_.bind();
323 curveLineDecl_.activateFixedFunction();
325 glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
327 curveLineDecl_.deactivateFixedFunction();
328 curveLineVBO_.unbind();
333 template <
class BSplineCurve>
340 double cylinderRadius = _state.
line_width() * 0.2;
342 for (
int i = 0; i < (int)curve_samples_.size() - 1; ++i)
344 Vec3d p = curve_samples_[i].first;
345 Vec3d p_next = curve_samples_[i+1].first;
346 draw_cylinder(p, p_next - p, cylinderRadius, _state);
352 template <
class BSplineCurve>
357 float c1 = _color[0]*1.5;
358 c1 = c1 > 1.0 ? 1.0 : c1;
360 float c2 = _color[1]*1.5;
361 c2 = c2 > 1.0 ? 1.0 : c2;
363 float c3 = _color[2]*1.5;
364 c3 = c3 > 1.0 ? 1.0 : c3;
366 return Vec4f( c1, c2, c3, _color[3]);
371 template <
class BSplineCurve>
376 updateControlPointBuffer();
377 updateControlPointSelBuffer();
378 updateControlEdgeSelBuffer();
383 controlPointVBO_.bind();
384 controlPointDecl_.activateFixedFunction();
390 if( bsplineCurve_.edge_selections_available())
395 glColor(generateHighlightColor(polygon_color_));
396 glLineWidth(2*line_width_old);
398 controlEdgeSelIBO_.bind();
399 glDrawElements(GL_LINES, 2 * controlEdgeSelCount_, GL_UNSIGNED_INT, 0);
400 controlEdgeSelIBO_.unbind();
402 glLineWidth(line_width_old);
413 glDrawArrays(GL_LINE_STRIP, 0, bsplineCurve_.n_control_points());
423 if (controlPointSelCount_)
428 glColor(generateHighlightColor(polygon_color_));
431 controlPointSelIBO_.bind();
432 glDrawElements(GL_POINTS, controlPointSelCount_, GL_UNSIGNED_INT, 0);
433 controlPointSelIBO_.unbind();
435 glPointSize(point_size_old);
441 glPointSize(point_size_old + 4);
443 glDrawArrays(GL_POINTS, 0, bsplineCurve_.n_control_points());
445 glPointSize(point_size_old);
449 controlPointDecl_.deactivateFixedFunction();
450 controlPointVBO_.unbind();
458 template <
class BSplineCurve>
470 double cylinderRadius = _state.
line_width() * 0.2;
473 if( bsplineCurve_.edge_selections_available())
475 glColor(generateHighlightColor(polygon_color_));
478 for (
int i = 0; i < (int)bsplineCurve_.n_control_points()-1; ++i)
480 if (bsplineCurve_.edge_selection(i))
482 Point p = bsplineCurve_.get_control_point(i);
483 Point axis = bsplineCurve_.get_control_point(i+1) - bsplineCurve_.get_control_point(i);
484 draw_cylinder(p, axis, cylinderRadius, _state);
493 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points() - 1; ++i)
495 Point p = bsplineCurve_.get_control_point(i);
496 Point axis = bsplineCurve_.get_control_point(i+1) - bsplineCurve_.get_control_point(i);
497 draw_cylinder(p, axis, cylinderRadius, _state);
505 if (bsplineCurve_.n_control_points() == 0)
510 double sphereRadius = _state.
point_size() * 0.25;
513 if( bsplineCurve_.controlpoint_selections_available())
515 glColor(generateHighlightColor(polygon_color_));
518 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
519 if (bsplineCurve_.controlpoint_selection(i))
520 draw_sphere(bsplineCurve_.get_control_point(i), sphereRadius, _state, fancySphere_);
526 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
527 draw_sphere(bsplineCurve_.get_control_point(i), sphereRadius, _state, fancySphere_);
536 template <
class BSplineCurve>
541 glPushAttrib(GL_ALL_ATTRIB_BITS);
543 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
550 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
551 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
553 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
554 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
556 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
559 draw_textured_nurbs( _state);
560 glLineWidth(line_width_old);
570 template <
class BSplineCurve>
575 invalidateCurveLine_ =
true;
576 invalidateControlPointVBO_ =
true;
578 curve_samples_.clear();
580 std::pair< Vec3d, Vec4f > sample;
582 int d = bsplineCurve_.degree();
583 int k = bsplineCurve_.n_knots();
585 for (
int l = d; l < k - d - 1; ++l )
587 for (
int s = 0; s <= resolution_; ++s )
589 double step = s / (float) resolution_ ;
590 double u = bsplineCurve_.get_knot( l ) + step * ( bsplineCurve_.get_knot( l+1 ) - bsplineCurve_.get_knot( l ) );
593 if ( bsplineCurve_.get_knotvector_ref()->selections_available() )
595 if ( bsplineCurve_.get_knotvector_ref()->selection(l)
596 && bsplineCurve_.get_knotvector_ref()->selection(l+1))
597 sample.second = curve_highlight_color_;
599 sample.second = curve_color_;
602 sample.second = curve_color_;
604 sample.first = bsplineCurve_.curvePoint(u);
613 template <
class BSplineCurve>
623 pick_vertices(_state);
630 pick_spline(_state, 0);
637 _state.
pick_set_maximum (bsplineCurve_.n_control_points() + pick_texture_res_);
638 pick_vertices(_state);
639 pick_spline(_state, bsplineCurve_.n_control_points());
652 template <
class BSplineCurve>
662 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
668 int px = round( window_pos[0]);
669 int py = round( window_pos[1]);
671 double l = (_state.
eye() - (
Vec3d)bsplineCurve_.get_control_point(i)).norm();
672 double r = l*tan(angle);
675 draw_sphere(bsplineCurve_.get_control_point(i), r, _state, sphere_);
681 template <
class BSplineCurve >
686 glPushAttrib(GL_ALL_ATTRIB_BITS);
696 pick_create_texture( _state);
701 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
702 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
704 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
705 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
707 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
715 draw_textured_nurbs( _state);
716 glLineWidth(line_width_old);
730 template <
class BSplineCurve>
737 _state.
translate( _p0[0], _p0[1], _p0[2]);
739 _sphere->draw(_state,_r);
746 template <
class BSplineCurve>
752 _state.
translate(_p0[0], _p0[1], _p0[2]);
754 Point direction = _axis;
759 direction.normalize();
760 rot_angle = acos((z_axis | direction))*180/M_PI;
761 rot_normal = ((z_axis % direction).normalize());
764 if( fabs( rot_angle ) > 0.0001 && fabs( 180 - rot_angle ) > 0.0001)
765 _state.
rotate(rot_angle,rot_normal[0], rot_normal[1], rot_normal[2]);
767 _state.
rotate(rot_angle,1,0,0);
769 cylinder_->setBottomRadius(_r);
770 cylinder_->setTopRadius(_r);
771 cylinder_->draw(_state,_axis.norm());
778 template <
class BSplineCurve>
783 create_cp_selection_texture(_state);
784 controlPointSelectionTexture_valid_ =
true;
787 invalidateControlPointSelIBO_ =
true;
792 template <
class BSplineCurve>
797 create_knot_selection_texture(_state);
798 knotVectorSelectionTexture_valid_ =
true;
803 template <
class BSplineCurve>
809 glGenTextures( 1, &_texture_idx );
813 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
814 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
816 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
817 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
819 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
826 template <
class BSplineCurve>
831 if (bsplineCurve_.n_knots() == 0)
834 if(cp_selection_texture_idx_ == 0)
835 selection_init_texturing(cp_selection_texture_idx_);
837 QImage b(cp_selection_texture_res_, 2, QImage::Format_ARGB32);
839 int degree = bsplineCurve_.degree();
840 int numKnots = bsplineCurve_.n_knots();
842 double minu = bsplineCurve_.get_knot( degree );
843 double maxu = bsplineCurve_.get_knot( numKnots - degree -1 );
844 double diffu = maxu - minu;
845 if (diffu == 0.0)
return;
850 Vec4f curveColor = curve_color_;
851 Vec4f highlightColor = curve_highlight_color_;
855 for (
int m = 0; m < cp_selection_texture_res_; ++m)
857 double step_m = (double)m / (
double)cp_selection_texture_res_;
858 double u = step_m * diffu;
863 if (span[0] < 0 || span[1] < 0)
867 for (
int i = 0; i < degree+1; ++i)
869 int idx = span[0] + i;
872 if (bsplineCurve_.controlpoint_selected(idx))
873 alpha += bsplineCurve_.basisFunction(idx, degree, u);
877 Vec4f color = curveColor * (1.0 - alpha) + highlightColor * alpha;
880 b.setPixel (texelIdx, 0, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
881 b.setPixel (texelIdx, 1, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
889 cp_selection_texture_image_ = QGLWidget::convertToGLFormat( b );
893 glTexImage2D( GL_TEXTURE_2D,
894 0, GL_RGBA, cp_selection_texture_image_.width(), cp_selection_texture_image_.height(),
895 0, GL_RGBA, GL_UNSIGNED_BYTE, cp_selection_texture_image_.bits() );
900 template <
class BSplineCurve>
905 if (bsplineCurve_.n_knots() == 0)
908 if(knot_selection_texture_idx_ == 0)
909 selection_init_texturing(knot_selection_texture_idx_);
911 QImage b(knot_selection_texture_res_, 2, QImage::Format_ARGB32);
913 int degree = bsplineCurve_.degree();
914 int numKnots = bsplineCurve_.n_knots();
916 double minu = bsplineCurve_.get_knot( degree );
917 double maxu = bsplineCurve_.get_knot( numKnots - degree -1 );
918 double diffu = maxu - minu;
919 if (diffu == 0.0)
return;
924 std::vector<bool> selectedKnotSpans(numKnots,
false);
925 for (
int i = 0; i < numKnots; ++i)
927 if (bsplineCurve_.get_knotvector_ref()->selection(i))
930 ACG::Vec2i span = bsplineCurve_.span(bsplineCurve_.get_knot(i));
932 if (span[0] < 0 || span[1] < 0)
935 for(
int j = span[0]; j <= span[1]+degree; ++j)
936 selectedKnotSpans[j] =
true;
942 Vec4f curveColor = curve_color_;
943 Vec4f highlightColor = curve_highlight_color_;
945 for (
int m = 0; m < knot_selection_texture_res_; ++m)
947 double step_m = (double)m / (
double)knot_selection_texture_res_;
948 double u = step_m * diffu;
951 Vec2i interval = bsplineCurve_.interval(u);
953 if (selectedKnotSpans[interval[0]] && selectedKnotSpans[interval[1]])
954 color = highlightColor;
959 b.setPixel (texelIdx, 0, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
960 b.setPixel (texelIdx, 1, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
968 knot_selection_texture_image_ = QGLWidget::convertToGLFormat( b );
972 glTexImage2D( GL_TEXTURE_2D,
973 0, GL_RGBA, knot_selection_texture_image_.width(), knot_selection_texture_image_.height(),
974 0, GL_RGBA, GL_UNSIGNED_BYTE, knot_selection_texture_image_.bits() );
979 template <
class BSplineCurve>
984 pick_texture_res_ = 256;
985 pick_texture_baseidx_ = 0;
988 glGenTextures( 1, &pick_texture_idx_ );
992 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
993 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
995 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
996 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
998 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1005 template <
class BSplineCurve>
1010 if(pick_texture_idx_ == 0)
1011 pick_init_texturing();
1013 QImage b(pick_texture_res_, 2, QImage::Format_ARGB32);
1017 for(
int i = 0; i < pick_texture_res_; ++i)
1020 b.setPixel (i, 0, qRgba((
int)cur_col[0], (
int)cur_col[1], (
int)cur_col[2], (
int)cur_col[3]));
1021 b.setPixel (i, 1, qRgba((
int)cur_col[0], (
int)cur_col[1], (
int)cur_col[2], (
int)cur_col[3]));
1054 pick_texture_image_ = QGLWidget::convertToGLFormat( b );
1058 glTexImage2D( GL_TEXTURE_2D,
1059 0, GL_RGBA, pick_texture_image_.width(), pick_texture_image_.height(),
1060 0, GL_RGBA, GL_UNSIGNED_BYTE, pick_texture_image_.bits() );
1065 template <
class BSplineCurve>
1070 updateCurveBuffer();
1072 curveLineVBO_.bind();
1073 curveLineDecl_.activateFixedFunction();
1075 glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
1077 curveLineDecl_.deactivateFixedFunction();
1078 curveLineVBO_.unbind();
1083 template <
class BSplineCurve>
1088 if (!invalidateCurveLine_)
1092 if (!curveLineDecl_.getNumElements())
1101 std::vector<float> vboData(_numVertices * 4);
1103 for (
int i = 0; i < _numVertices; ++i)
1106 typename BSplineCurve::Scalar u01 =
typename BSplineCurve::Scalar(i) /
typename BSplineCurve::Scalar(_numVertices - 1);
1109 typename BSplineCurve::Scalar u = (1 - u01) * bsplineCurve_.lower() + u01 * bsplineCurve_.upper();
1112 typename BSplineCurve::Point pos = bsplineCurve_.curvePoint(u);
1115 for (
int k = 0; k < 3; ++k)
1116 vboData[i*4 + k] = pos[k];
1119 vboData[i*4 + 3] = u01;
1123 curveLineVBO_.del();
1125 curveLineVBO_.upload(vboData.size() * 4, &vboData[0], GL_STATIC_DRAW);
1128 curveLineVertices_ = _numVertices;
1130 invalidateCurveLine_ =
false;
1135 template <
class BSplineCurve>
1140 if (!invalidateControlPointVBO_)
1144 if (!controlPointDecl_.getNumElements())
1147 int numCP = bsplineCurve_.n_control_points();
1151 std::vector<float> vboData(numCP * 3);
1153 for (
int i = 0; i < numCP; ++i)
1155 typename BSplineCurve::Point pos = bsplineCurve_.get_control_point(i);
1156 for (
int k = 0; k < 3; ++k)
1157 vboData[i*3 + k] = pos[k];
1160 controlPointVBO_.del();
1162 controlPointVBO_.upload(vboData.size() * 4, &vboData[0], GL_STATIC_DRAW);
1164 invalidateControlPointVBO_ =
false;
1169 template <
class BSplineCurve>
1174 if (!invalidateControlPointSelIBO_)
1177 controlPointSelIBO_.del();
1179 if (bsplineCurve_.controlpoint_selections_available())
1181 int numCP = bsplineCurve_.n_control_points();
1185 for (
int i = 0; i < numCP; ++i)
1187 if (bsplineCurve_.controlpoint_selection(i))
1192 controlPointSelCount_ = numSel;
1198 std::vector<int> iboData(numSel);
1200 for (
int i = 0; i < numCP; ++i)
1202 if (bsplineCurve_.controlpoint_selection(i))
1203 iboData[numSel++] = i;
1206 controlPointSelIBO_.upload(numSel * 4, &iboData[0], GL_STATIC_DRAW);
1210 invalidateControlPointSelIBO_ =
false;
1215 template <
class BSplineCurve>
1220 if (!invalidateControlEdgeSelIBO_)
1223 controlEdgeSelIBO_.del();
1225 if (bsplineCurve_.edge_selections_available())
1227 int numCP = bsplineCurve_.n_control_points();
1228 int numE = numCP - 1;
1232 for (
int i = 0; i < numE; ++i)
1234 if (bsplineCurve_.edge_selection(i))
1239 controlEdgeSelCount_ = numSel;
1244 std::vector<int> iboData(numSel * 2);
1246 for (
int i = 0; i < numE; ++i)
1248 if (bsplineCurve_.edge_selection(i))
1250 iboData[numSel++] = i;
1251 iboData[numSel++] = (i+1)%numCP;
1255 controlEdgeSelIBO_.upload(numSel * 4, &iboData[0], GL_STATIC_DRAW);
1259 invalidateControlEdgeSelIBO_ =
false;
VectorT< float, 2 > Vec2f
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
void updateControlPointSelBuffer()
update control point selection buffer for visualization
unsigned int pick_current_index() const
Returns the current color picking index (can be used for caching)
void clearTextures()
disables texture support and removes all texture types
Vec3d eye() const
get eye point
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
DrawModeProperties stores a set of properties that defines, how to render an object.
void vector_cast(const src_t &_src, dst_t &_dst, GenProg::Int2Type< n >)
Cast vector type to another vector type by copying the vector elements.
VectorT< float, 4 > Vec4f
void setupShaderGenFromDrawmode(const SceneGraph::DrawModes::DrawModeProperties *_props)
Fills out ShaderGenDesc parameters based on Drawmode properties.
DrawMode WIREFRAME
draw wireframe
void create_cp_selection_texture(GLState &_state)
creates texture to put onto nurbs curve for visualization of control point selection ...
void drawFancyControlPolygon(DrawModes::DrawMode _drawMode, GLState &_state)
Renders the control polygon using cylinders and spheres to include shading effects.
void pick(GLState &_state, PickTarget _target)
picking
void drawControlPolygon(DrawModes::DrawMode _drawMode, GLState &_state)
Renders the control polygon.
void push_modelview_matrix()
push modelview matrix
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode)
draw lines and normals
void selection_init_texturing(GLuint &_texture_idx)
generate index and setup texture parameters for selection visualization
GLuint indexBuffer
Use vertex array object.
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
Vec4uc pick_get_name_color(unsigned int _idx)
int viewport_width() const
get viewport width
void create_knot_selection_texture(GLState &_state)
creates texture to put onto nurbs curve for visualization of knotvector selection ...
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
DrawMode POINTS
draw unlighted points using the default base color
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
PickTarget
What target to use for picking.
void drawFancyCurve(GLState &_state)
Renders the spline curve by sampling the curve and rendering cylinders in between the samples...
size_t getNumLayers() const
returns the layer count
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
static void enable(GLenum _cap)
replaces glEnable, but supports locking
VectorT< float, 3 > Vec3f
const Vec4f & base_color() const
get base color (used when lighting is off)
float point_size() const
get point size
void draw_textured_nurbs(GLState &_state)
draw textured nurbs patch
void translate(double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
translate by (_x, _y, _z)
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
void updateControlEdgeSelBuffer()
update control edge selection buffer for visualization
bool pick_set_maximum(unsigned int _idx)
Set the maximal number of primitives/components of your object.
void setupPointRendering(float _pointSize, const Vec2f &_screenSize)
Setup rendering of circle points.
ACG::Vec4f generateHighlightColor(ACG::Vec4f _color)
generates a color to highlight the curve from the given color
const DrawModeProperties * getLayer(unsigned int _i) const
returns the property set at layer i
static void disable(GLenum _cap)
replaces glDisable, but supports locking
Namespace providing different geometric functions concerning angles.
picks verices (may not be implemented for all nodes)
void updateCurveBuffer(int _numVertices=50)
update curve line buffer for drawing
Pick spline curve or surface (picks u or u,v coords respectively)
void drawTexturedCurve(GLState &_state, GLuint _texture_idx)
renders a textured cuve using the gluNurbsRenderer to vilualize either the control point ot the knot ...
void setupLineRendering(float _lineWidth, const Vec2f &_screenSize)
Setup rendering of thick lines.
void pop_modelview_matrix()
pop modelview matrix
void pick_set_name(unsigned int _idx)
sets the current name/color (like glLoadName(_idx))
void rotate(double _angle, double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
rotate around axis (_x, _y, _z) by _angle
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
DrawModes::DrawMode availableDrawModes() const
return available draw modes
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
update bounding box
void drawCurve(GLState &_state)
Renders the spline curve using gluNurbsRenderer.
pick any of the prior targets (should be implemented for all nodes)
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
int viewport_height() const
get viewport height
float line_width() const
get line width
void pick_init_texturing()
generate index and setup texture parameters
Interface class between scenegraph and renderer.
void resetLineRendering()
Reset shader template names blocked by line rendering.
VectorT< double, 3 > Vec3d
void pick_create_texture(GLState &_state)
create texture image
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
ShaderGenDesc shaderDesc
Drawmode and other shader params.
void updateControlPointBuffer()
update control point buffer for visualization
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
Vec3d viewing_direction() const
get viewing ray