52 #define ACG_BSPLINECURVENODET_C 56 #include "BSplineCurveNodeT.hh" 57 #include <ACG/GL/gl.hh> 58 #include <ACG/GL/GLError.hh> 59 #include <ACG/GL/IRenderer.hh> 60 #include <ACG/Utils/VSToolsT.hh> 62 #include <OpenMesh/Core/Utils/vector_cast.hh> 74 template <
class BSplineCurve>
79 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
81 _bbMin.
minimize(bsplineCurve_.get_control_point(i));
82 _bbMax.
maximize(bsplineCurve_.get_control_point(i));
88 template <
class BSplineCurve>
113 template <
class BSplineCurve>
118 glPushAttrib(GL_ENABLE_BIT);
121 if ( bspline_selection_draw_mode_ == CONTROLPOINT
122 && controlPointSelectionTexture_valid_ ==
false)
123 updateControlPointSelectionTexture(_state);
125 if ( bspline_selection_draw_mode_ == KNOTVECTOR
126 && knotVectorSelectionTexture_valid_ ==
false)
127 updateKnotVectorSelectionTexture(_state);
134 if (bspline_draw_mode_ == NORMAL)
138 else if (bspline_draw_mode_ == FANCY)
142 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
148 render( _state,
false, _drawMode);
155 render( _state,
false, _drawMode);
164 template <
class BSplineCurve>
170 if ( bspline_selection_draw_mode_ == CONTROLPOINT
171 && controlPointSelectionTexture_valid_ ==
false)
172 updateControlPointSelectionTexture(_state);
174 if ( bspline_selection_draw_mode_ == KNOTVECTOR
175 && knotVectorSelectionTexture_valid_ ==
false)
176 updateKnotVectorSelectionTexture(_state);
197 if (props->primitive() == DrawModes::PRIMITIVE_POINT)
199 ro.glDrawArrays(GL_POINTS, 0, curveLineVertices_);
202 else if (props->primitive() == DrawModes::PRIMITIVE_WIREFRAME)
204 ro.glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
210 if (render_control_polygon_)
212 updateControlPointBuffer();
213 updateControlPointSelBuffer();
214 updateControlEdgeSelBuffer();
231 if (controlEdgeSelCount_)
233 ro.emissive = highlightColor;
237 ro.glDrawElements(GL_LINES, 2 * controlEdgeSelCount_, GL_UNSIGNED_INT, 0);
242 ro.emissive = polygonColor;
244 ro.glDrawArrays(GL_LINE_STRIP, 0, bsplineCurve_.n_control_points());
250 if (controlPointSelCount_)
252 ro.emissive = highlightColor;
256 ro.glDrawElements(GL_POINTS, controlPointSelCount_, GL_UNSIGNED_INT, 0);
261 ro.emissive = polygonColor;
263 ro.glDrawElements(GL_POINTS, bsplineCurve_.n_control_points(), GL_UNSIGNED_INT, 0);
270 template <
class BSplineCurve>
276 if (render_control_polygon_)
278 if (bspline_draw_mode_ == NORMAL)
279 drawControlPolygon(_drawMode, _state);
280 else if (bspline_draw_mode_ == FANCY)
281 drawFancyControlPolygon(_drawMode, _state);
288 if (bspline_selection_draw_mode_ == NONE)
290 if (bspline_draw_mode_ == NORMAL)
293 drawFancyCurve(_state);
297 if (bspline_selection_draw_mode_ == CONTROLPOINT) {
298 drawTexturedCurve(_state, cp_selection_texture_idx_);
300 else if (bspline_selection_draw_mode_ == KNOTVECTOR) {
301 drawTexturedCurve(_state, knot_selection_texture_idx_);
309 template <
class BSplineCurve>
316 curveLineVBO_.bind();
317 curveLineDecl_.activateFixedFunction();
319 glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
321 curveLineDecl_.deactivateFixedFunction();
322 curveLineVBO_.unbind();
327 template <
class BSplineCurve>
334 double cylinderRadius = _state.
line_width() * 0.2;
336 for (
int i = 0; i < (int)curve_samples_.size() - 1; ++i)
338 Vec3d p = curve_samples_[i].first;
339 Vec3d p_next = curve_samples_[i+1].first;
340 draw_cylinder(p, p_next - p, cylinderRadius, _state);
346 template <
class BSplineCurve>
351 float c1 = _color[0]*1.5;
352 c1 = c1 > 1.0 ? 1.0 : c1;
354 float c2 = _color[1]*1.5;
355 c2 = c2 > 1.0 ? 1.0 : c2;
357 float c3 = _color[2]*1.5;
358 c3 = c3 > 1.0 ? 1.0 : c3;
360 return Vec4f( c1, c2, c3, _color[3]);
365 template <
class BSplineCurve>
370 updateControlPointBuffer();
371 updateControlPointSelBuffer();
372 updateControlEdgeSelBuffer();
377 controlPointVBO_.bind();
378 controlPointDecl_.activateFixedFunction();
384 if( bsplineCurve_.edge_selections_available())
389 glColor(generateHighlightColor(polygon_color_));
390 glLineWidth(2*line_width_old);
392 controlEdgeSelIBO_.bind();
393 glDrawElements(GL_LINES, 2 * controlEdgeSelCount_, GL_UNSIGNED_INT, 0);
394 controlEdgeSelIBO_.unbind();
396 glLineWidth(line_width_old);
407 glDrawArrays(GL_LINE_STRIP, 0, bsplineCurve_.n_control_points());
417 if (controlPointSelCount_)
422 glColor(generateHighlightColor(polygon_color_));
425 controlPointSelIBO_.bind();
426 glDrawElements(GL_POINTS, controlPointSelCount_, GL_UNSIGNED_INT, 0);
427 controlPointSelIBO_.unbind();
429 glPointSize(point_size_old);
435 glPointSize(point_size_old + 4);
437 glDrawArrays(GL_POINTS, 0, bsplineCurve_.n_control_points());
439 glPointSize(point_size_old);
443 controlPointDecl_.deactivateFixedFunction();
444 controlPointVBO_.unbind();
452 template <
class BSplineCurve>
464 double cylinderRadius = _state.
line_width() * 0.2;
467 if( bsplineCurve_.edge_selections_available())
469 glColor(generateHighlightColor(polygon_color_));
472 for (
int i = 0; i < (int)bsplineCurve_.n_control_points()-1; ++i)
474 if (bsplineCurve_.edge_selection(i))
476 Point p = bsplineCurve_.get_control_point(i);
477 Point axis = bsplineCurve_.get_control_point(i+1) - bsplineCurve_.get_control_point(i);
478 draw_cylinder(p, axis, cylinderRadius, _state);
487 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points() - 1; ++i)
489 Point p = bsplineCurve_.get_control_point(i);
490 Point axis = bsplineCurve_.get_control_point(i+1) - bsplineCurve_.get_control_point(i);
491 draw_cylinder(p, axis, cylinderRadius, _state);
499 if (bsplineCurve_.n_control_points() == 0)
504 double sphereRadius = _state.
point_size() * 0.25;
507 if( bsplineCurve_.controlpoint_selections_available())
509 glColor(generateHighlightColor(polygon_color_));
512 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
513 if (bsplineCurve_.controlpoint_selection(i))
514 draw_sphere(bsplineCurve_.get_control_point(i), sphereRadius, _state, fancySphere_);
520 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
521 draw_sphere(bsplineCurve_.get_control_point(i), sphereRadius, _state, fancySphere_);
530 template <
class BSplineCurve>
535 glPushAttrib(GL_ALL_ATTRIB_BITS);
537 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
544 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
545 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
547 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
548 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
550 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
553 draw_textured_nurbs( _state);
554 glLineWidth(line_width_old);
564 template <
class BSplineCurve>
569 invalidateCurveLine_ =
true;
570 invalidateControlPointVBO_ =
true;
572 curve_samples_.clear();
574 std::pair< Vec3d, Vec4f > sample;
576 int d = bsplineCurve_.degree();
577 int k = bsplineCurve_.n_knots();
579 for (
int l = d; l < k - d - 1; ++l )
581 for (
int s = 0; s <= resolution_; ++s )
583 double step = s / (float) resolution_ ;
584 double u = bsplineCurve_.get_knot( l ) + step * ( bsplineCurve_.get_knot( l+1 ) - bsplineCurve_.get_knot( l ) );
587 if ( bsplineCurve_.get_knotvector_ref()->selections_available() )
589 if ( bsplineCurve_.get_knotvector_ref()->selection(l)
590 && bsplineCurve_.get_knotvector_ref()->selection(l+1))
591 sample.second = curve_highlight_color_;
593 sample.second = curve_color_;
596 sample.second = curve_color_;
598 sample.first = bsplineCurve_.curvePoint(u);
607 template <
class BSplineCurve>
617 pick_vertices(_state);
624 pick_spline(_state, 0);
631 _state.
pick_set_maximum (bsplineCurve_.n_control_points() + pick_texture_res_);
632 pick_vertices(_state);
633 pick_spline(_state, bsplineCurve_.n_control_points());
646 template <
class BSplineCurve>
656 for (
unsigned int i = 0; i < bsplineCurve_.n_control_points(); ++i)
662 int px = round( window_pos[0]);
663 int py = round( window_pos[1]);
665 double l = (_state.
eye() - (
Vec3d)bsplineCurve_.get_control_point(i)).norm();
666 double r = l*tan(angle);
669 draw_sphere(bsplineCurve_.get_control_point(i), r, _state, sphere_);
675 template <
class BSplineCurve >
680 glPushAttrib(GL_ALL_ATTRIB_BITS);
690 pick_create_texture( _state);
695 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
696 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
698 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
699 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
701 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
709 draw_textured_nurbs( _state);
710 glLineWidth(line_width_old);
724 template <
class BSplineCurve>
731 _state.
translate( _p0[0], _p0[1], _p0[2]);
733 _sphere->draw(_state,_r);
740 template <
class BSplineCurve>
746 _state.
translate(_p0[0], _p0[1], _p0[2]);
748 Point direction = _axis;
753 direction.normalize();
754 rot_angle = acos((z_axis | direction))*180/M_PI;
755 rot_normal = ((z_axis % direction).normalize());
758 if( fabs( rot_angle ) > 0.0001 && fabs( 180 - rot_angle ) > 0.0001)
759 _state.
rotate(rot_angle,rot_normal[0], rot_normal[1], rot_normal[2]);
761 _state.
rotate(rot_angle,1,0,0);
763 cylinder_->setBottomRadius(_r);
764 cylinder_->setTopRadius(_r);
765 cylinder_->draw(_state,_axis.norm());
772 template <
class BSplineCurve>
777 create_cp_selection_texture(_state);
778 controlPointSelectionTexture_valid_ =
true;
781 invalidateControlPointSelIBO_ =
true;
786 template <
class BSplineCurve>
791 create_knot_selection_texture(_state);
792 knotVectorSelectionTexture_valid_ =
true;
797 template <
class BSplineCurve>
803 glGenTextures( 1, &_texture_idx );
807 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
808 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
810 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
811 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
813 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
820 template <
class BSplineCurve>
825 if (bsplineCurve_.n_knots() == 0)
828 if(cp_selection_texture_idx_ == 0)
829 selection_init_texturing(cp_selection_texture_idx_);
831 QImage b(cp_selection_texture_res_, 2, QImage::Format_ARGB32);
833 int degree = bsplineCurve_.degree();
834 int numKnots = bsplineCurve_.n_knots();
836 double minu = bsplineCurve_.get_knot( degree );
837 double maxu = bsplineCurve_.get_knot( numKnots - degree -1 );
838 double diffu = maxu - minu;
839 if (diffu == 0.0)
return;
844 Vec4f curveColor = curve_color_;
845 Vec4f highlightColor = curve_highlight_color_;
849 for (
int m = 0; m < cp_selection_texture_res_; ++m)
851 double step_m = (double)m / (
double)cp_selection_texture_res_;
852 double u = step_m * diffu;
857 if (span[0] < 0 || span[1] < 0)
861 for (
int i = 0; i < degree+1; ++i)
863 int idx = span[0] + i;
866 if (bsplineCurve_.controlpoint_selected(idx))
867 alpha += bsplineCurve_.basisFunction(idx, degree, u);
871 Vec4f color = curveColor * (1.0 - alpha) + highlightColor * alpha;
874 b.setPixel (texelIdx, 0, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
875 b.setPixel (texelIdx, 1, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
883 cp_selection_texture_image_ = QGLWidget::convertToGLFormat( b );
887 glTexImage2D( GL_TEXTURE_2D,
888 0, GL_RGBA, cp_selection_texture_image_.width(), cp_selection_texture_image_.height(),
889 0, GL_RGBA, GL_UNSIGNED_BYTE, cp_selection_texture_image_.bits() );
894 template <
class BSplineCurve>
899 if (bsplineCurve_.n_knots() == 0)
902 if(knot_selection_texture_idx_ == 0)
903 selection_init_texturing(knot_selection_texture_idx_);
905 QImage b(knot_selection_texture_res_, 2, QImage::Format_ARGB32);
907 int degree = bsplineCurve_.degree();
908 int numKnots = bsplineCurve_.n_knots();
910 double minu = bsplineCurve_.get_knot( degree );
911 double maxu = bsplineCurve_.get_knot( numKnots - degree -1 );
912 double diffu = maxu - minu;
913 if (diffu == 0.0)
return;
918 std::vector<bool> selectedKnotSpans(numKnots,
false);
919 for (
int i = 0; i < numKnots; ++i)
921 if (bsplineCurve_.get_knotvector_ref()->selection(i))
924 ACG::Vec2i span = bsplineCurve_.span(bsplineCurve_.get_knot(i));
926 if (span[0] < 0 || span[1] < 0)
929 for(
int j = span[0]; j <= span[1]+degree; ++j)
930 selectedKnotSpans[j] =
true;
936 Vec4f curveColor = curve_color_;
937 Vec4f highlightColor = curve_highlight_color_;
939 for (
int m = 0; m < knot_selection_texture_res_; ++m)
941 double step_m = (double)m / (
double)knot_selection_texture_res_;
942 double u = step_m * diffu;
945 Vec2i interval = bsplineCurve_.interval(u);
947 if (selectedKnotSpans[interval[0]] && selectedKnotSpans[interval[1]])
948 color = highlightColor;
953 b.setPixel (texelIdx, 0, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
954 b.setPixel (texelIdx, 1, qRgba((
int)(color[0]*255.0), (
int)(color[1]*255.0), (
int)(color[2]*255.0), 255));
962 knot_selection_texture_image_ = QGLWidget::convertToGLFormat( b );
966 glTexImage2D( GL_TEXTURE_2D,
967 0, GL_RGBA, knot_selection_texture_image_.width(), knot_selection_texture_image_.height(),
968 0, GL_RGBA, GL_UNSIGNED_BYTE, knot_selection_texture_image_.bits() );
973 template <
class BSplineCurve>
978 pick_texture_res_ = 256;
979 pick_texture_baseidx_ = 0;
982 glGenTextures( 1, &pick_texture_idx_ );
986 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
987 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
989 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
990 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
992 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
999 template <
class BSplineCurve>
1004 if(pick_texture_idx_ == 0)
1005 pick_init_texturing();
1007 QImage b(pick_texture_res_, 2, QImage::Format_ARGB32);
1011 for(
int i = 0; i < pick_texture_res_; ++i)
1014 b.setPixel (i, 0, qRgba((
int)cur_col[0], (
int)cur_col[1], (
int)cur_col[2], (
int)cur_col[3]));
1015 b.setPixel (i, 1, qRgba((
int)cur_col[0], (
int)cur_col[1], (
int)cur_col[2], (
int)cur_col[3]));
1048 pick_texture_image_ = QGLWidget::convertToGLFormat( b );
1052 glTexImage2D( GL_TEXTURE_2D,
1053 0, GL_RGBA, pick_texture_image_.width(), pick_texture_image_.height(),
1054 0, GL_RGBA, GL_UNSIGNED_BYTE, pick_texture_image_.bits() );
1059 template <
class BSplineCurve>
1064 updateCurveBuffer();
1066 curveLineVBO_.bind();
1067 curveLineDecl_.activateFixedFunction();
1069 glDrawArrays(GL_LINE_STRIP, 0, curveLineVertices_);
1071 curveLineDecl_.deactivateFixedFunction();
1072 curveLineVBO_.unbind();
1077 template <
class BSplineCurve>
1082 if (!invalidateCurveLine_)
1086 if (!curveLineDecl_.getNumElements())
1095 std::vector<float> vboData(_numVertices * 4);
1097 for (
int i = 0; i < _numVertices; ++i)
1100 typename BSplineCurve::Scalar u01 =
typename BSplineCurve::Scalar(i) /
typename BSplineCurve::Scalar(_numVertices - 1);
1103 typename BSplineCurve::Scalar u = (1 - u01) * bsplineCurve_.lower() + u01 * bsplineCurve_.upper();
1106 typename BSplineCurve::Point pos = bsplineCurve_.curvePoint(u);
1109 for (
int k = 0; k < 3; ++k)
1110 vboData[i*4 + k] = pos[k];
1113 vboData[i*4 + 3] = u01;
1117 curveLineVBO_.del();
1119 curveLineVBO_.upload(vboData.size() * 4, &vboData[0], GL_STATIC_DRAW);
1122 curveLineVertices_ = _numVertices;
1124 invalidateCurveLine_ =
false;
1129 template <
class BSplineCurve>
1134 if (!invalidateControlPointVBO_)
1138 if (!controlPointDecl_.getNumElements())
1141 int numCP = bsplineCurve_.n_control_points();
1145 std::vector<float> vboData(numCP * 3);
1147 for (
int i = 0; i < numCP; ++i)
1149 typename BSplineCurve::Point pos = bsplineCurve_.get_control_point(i);
1150 for (
int k = 0; k < 3; ++k)
1151 vboData[i*3 + k] = pos[k];
1154 controlPointVBO_.del();
1156 controlPointVBO_.upload(vboData.size() * 4, &vboData[0], GL_STATIC_DRAW);
1158 invalidateControlPointVBO_ =
false;
1163 template <
class BSplineCurve>
1168 if (!invalidateControlPointSelIBO_)
1171 controlPointSelIBO_.del();
1173 if (bsplineCurve_.controlpoint_selections_available())
1175 int numCP = bsplineCurve_.n_control_points();
1179 for (
int i = 0; i < numCP; ++i)
1181 if (bsplineCurve_.controlpoint_selection(i))
1186 controlPointSelCount_ = numSel;
1192 std::vector<int> iboData(numSel);
1194 for (
int i = 0; i < numCP; ++i)
1196 if (bsplineCurve_.controlpoint_selection(i))
1197 iboData[numSel++] = i;
1200 controlPointSelIBO_.upload(numSel * 4, &iboData[0], GL_STATIC_DRAW);
1204 invalidateControlPointSelIBO_ =
false;
1209 template <
class BSplineCurve>
1214 if (!invalidateControlEdgeSelIBO_)
1217 controlEdgeSelIBO_.del();
1219 if (bsplineCurve_.edge_selections_available())
1221 int numCP = bsplineCurve_.n_control_points();
1222 int numE = numCP - 1;
1226 for (
int i = 0; i < numE; ++i)
1228 if (bsplineCurve_.edge_selection(i))
1233 controlEdgeSelCount_ = numSel;
1238 std::vector<int> iboData(numSel * 2);
1240 for (
int i = 0; i < numE; ++i)
1242 if (bsplineCurve_.edge_selection(i))
1244 iboData[numSel++] = i;
1245 iboData[numSel++] = (i+1)%numCP;
1249 controlEdgeSelIBO_.upload(numSel * 4, &iboData[0], GL_STATIC_DRAW);
1253 invalidateControlEdgeSelIBO_ =
false;
static void enable(GLenum _cap, bool _warnRemoved=true)
replaces glEnable, but supports locking
void draw_textured_nurbs(GLState &_state)
draw textured nurbs patch
void updateControlPointSelBuffer()
update control point selection buffer for visualization
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
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.
Vec3d viewing_direction() const
get viewing ray
void pop_modelview_matrix()
pop modelview matrix
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
float point_size() const
get point size
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax) override
update bounding box
int viewport_width() const
get viewport width
VectorT< float, 2 > Vec2f
void resetLineRendering()
Reset shader template names blocked by line rendering.
Namespace providing different geometric functions concerning angles.
void create_cp_selection_texture(GLState &_state)
creates texture to put onto nurbs curve for visualization of control point selection ...
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
VectorT< float, 4 > Vec4f
void drawFancyCurve(GLState &_state)
Renders the spline curve by sampling the curve and rendering cylinders in between the samples...
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
const Vec4f & base_color() const
get base color (used when lighting is off)
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
ShaderGenDesc shaderDesc
Drawmode and other shader params.
size_t 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
DrawModes::DrawMode availableDrawModes() const override
return available draw modes
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
void pick(GLState &_state, PickTarget _target) override
picking
Vec4uc pick_get_name_color(size_t _idx)
void setupLineRendering(float _lineWidth, const Vec2f &_screenSize)
Setup rendering of thick lines.
void create_knot_selection_texture(GLState &_state)
creates texture to put onto nurbs curve for visualization of knotvector selection ...
PickTarget
What target to use for picking.
void push_modelview_matrix()
push modelview matrix
void pick_create_texture(GLState &_state)
create texture image
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
VectorT< float, 3 > Vec3f
void updateControlPointBuffer()
update control point buffer for visualization
void setupPointRendering(float _pointSize, const Vec2f &_screenSize)
Setup rendering of circle points.
pick any of the prior targets (should be implemented for all nodes)
bool pick_set_maximum(size_t _idx)
Set the maximal number of primitives/components of your object.
void drawCurve(GLState &_state)
Renders the spline curve using gluNurbsRenderer.
picks verices (may not be implemented for all nodes)
GLuint indexBuffer
Use vertex array object.
int viewport_height() const
get viewport height
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode) override
draw lines and normals
DrawMode POINTS
draw unlighted points using the default base color
void updateCurveBuffer(int _numVertices=50)
update curve line buffer for drawing
DrawModeProperties stores a set of properties that defines, how to render an object.
void rotate(double _angle, double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
rotate around axis (_x, _y, _z) by _angle
virtual void addRenderObject(RenderObject *_renderObject)
Callback for the scenegraph nodes, which send new render objects via this function.
void drawTexturedCurve(GLState &_state, GLuint _texture_idx)
renders a textured cuve using the gluNurbsRenderer to vilualize either the control point ot the knot ...
void pick_init_texturing()
generate index and setup texture parameters
DrawMode WIREFRAME
draw wireframe
void pick_set_name(size_t _idx)
sets the current name/color (like glLoadName(_idx))
void selection_init_texturing(GLuint &_texture_idx)
generate index and setup texture parameters for selection visualization
Pick spline curve or surface (picks u or u,v coords respectively)
void updateControlEdgeSelBuffer()
update control edge selection buffer for visualization
void setupShaderGenFromDrawmode(const SceneGraph::DrawModes::DrawModeProperties *_props)
Fills out ShaderGenDesc parameters based on Drawmode properties.
ACG::Vec4f generateHighlightColor(ACG::Vec4f _color)
generates a color to highlight the curve from the given color
float line_width() const
get line width
const DrawModeProperties * getLayer(unsigned int _i) const
returns the property set at layer i
void drawFancyControlPolygon(DrawModes::DrawMode _drawMode, GLState &_state)
Renders the control polygon using cylinders and spheres to include shading effects.
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
Interface class between scenegraph and renderer.
size_t getNumLayers() const
returns the layer count
void drawControlPolygon(DrawModes::DrawMode _drawMode, GLState &_state)
Renders the control polygon.
Vec3d eye() const
get eye point
void translate(double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
translate by (_x, _y, _z)
VectorT< double, 3 > Vec3d
void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat) override
Deferred draw call with shader based renderer.