63 #include "TranslationManipulatorNode.hh"
65 #include <ACG/GL/IRenderer.hh>
67 #include <Math_Tools/Math_Tools.hh>
80 #define SNAP_PIXEL_TOLERANCE 30
84 const Vec4f colors[4][6] = {
88 Vec4f(0.2f,0.2f,0.2f,1.0f),
Vec4f(0.5f,0.5f,0.5f,1.0f),
Vec4f(0.8f,0.8f,0.8f,1.0f),
90 Vec4f(0.2f,0.2f,0.2f,0.2f),
Vec4f(0.5f,0.5f,0.5f,0.4f),
Vec4f(0.8f,0.8f,0.8f,0.6f)
95 Vec4f(0.2f,0.0f,0.0f,1.0f),
Vec4f(0.5f,0.0f,0.0f,1.0f),
Vec4f(0.8f,0.0f,0.0f,1.0f),
97 Vec4f(0.3f,0.1f,0.1f,0.2f),
Vec4f(0.5f,0.2f,0.2f,0.4f),
Vec4f(0.8f,0.4f,0.4f,0.6f)
102 Vec4f(0.0f,0.2f,0.0f,1.0f),
Vec4f(0.0f,0.5f,0.0f,1.0f),
Vec4f(0.0f,0.8f,0.0f,1.0f),
104 Vec4f(0.1f,0.3f,0.1f,0.2f),
Vec4f(0.2f,0.5f,0.2f,0.4f),
Vec4f(0.4f,0.8f,0.4f,0.6f)
109 Vec4f(0.0f,0.0f,0.2f,1.0f),
Vec4f(0.0f,0.0f,0.5f,1.0f),
Vec4f(0.0f,0.0f,0.8f,1.0f),
111 Vec4f(0.1f,0.1f,0.3f,0.2f),
Vec4f(0.2f,0.2f,0.5f,0.4f),
Vec4f(0.4f,0.4f,0.8f,0.6f)
118 TranslationManipulatorNode::Element::Element () :
119 active_target_color_ (0.0, 0.0, 0.0, 1.0),
120 active_current_color_ (0.0, 0.0, 0.0, 1.0),
121 inactive_target_color_ (0.0, 0.0, 0.0, 1.0),
122 inactive_current_color_ (0.0, 0.0, 0.0, 1.0),
134 draw_manipulator_(false),
143 manipulator_radius_(20.0),
144 manipulator_height_(20),
145 set_manipulator_radius_(1.0),
146 set_manipulator_height_(1.0),
147 manipulator_slices_(10),
148 manipulator_stacks_(10),
149 any_axis_clicked_(false),
150 any_top_clicked_(false),
151 outer_ring_clicked_(false),
152 any_axis_over_(false),
153 any_top_over_(false),
154 outer_ring_over_(false),
155 resize_current_ (0.0),
156 mode_ (TranslationRotation),
160 auto_size_length_(1.0),
161 activeRotations_(ALL_AXIS)
166 axisBottom_ =
new ACG::GLCone(manipulator_slices_, manipulator_stacks_,
167 (1.0 - resize_current_) * manipulator_radius_,
168 (1.0 + resize_current_) * manipulator_radius_,
false,
true);
169 axisCenter_ =
new ACG::GLCone(manipulator_slices_, manipulator_stacks_,
170 (1.0 - resize_current_) * manipulator_radius_,
171 (1.0 + resize_current_) * manipulator_radius_,
false,
true);
172 axisTop_ =
new ACG::GLCone(manipulator_slices_, manipulator_stacks_,
173 (1.0 - resize_current_) * manipulator_radius_,
174 (1.0 + resize_current_) * manipulator_radius_,
false,
true);
176 sphere_ =
new ACG::GLSphere(manipulator_slices_, manipulator_stacks_);
177 circle_ =
new ACG::GLDisk(30, 30, 2.0f*manipulator_height_ - manipulator_height_/4.0f, 2.0f*manipulator_height_);
181 updateTargetColors ();
182 for (
unsigned int i = 0; i < TranslationManipulatorNode::NumElements; i++)
184 element_[i].active_current_color_ = element_[i].active_target_color_;
185 element_[i].inactive_current_color_ = element_[i].inactive_target_color_;
241 glMatrixMode(GL_MODELVIEW);
248 model *= localTransformation_;
257 void TranslationManipulatorNode::updateTargetColors ()
260 element_[Origin].active_target_color_ = colors[0][0];
261 element_[XAxis].active_target_color_ = colors[1][0];
262 element_[YAxis].active_target_color_ = colors[2][0];
263 element_[ZAxis].active_target_color_ = colors[3][0];
264 element_[XTop].active_target_color_ = colors[1][0];
265 element_[YTop].active_target_color_ = colors[2][0];
266 element_[ZTop].active_target_color_ = colors[3][0];
267 element_[XRing].active_target_color_ = colors[1][0];
268 element_[YRing].active_target_color_ = colors[2][0];
269 element_[ZRing].active_target_color_ = colors[3][0];
271 element_[Origin].inactive_target_color_ = colors[0][3];
272 element_[XAxis].inactive_target_color_ = colors[1][3];
273 element_[YAxis].inactive_target_color_ = colors[2][3];
274 element_[ZAxis].inactive_target_color_ = colors[3][3];
275 element_[XTop].inactive_target_color_ = colors[1][3];
276 element_[YTop].inactive_target_color_ = colors[2][3];
277 element_[ZTop].inactive_target_color_ = colors[3][3];
278 element_[XRing].inactive_target_color_ = colors[1][3];
279 element_[YRing].inactive_target_color_ = colors[2][3];
280 element_[ZRing].inactive_target_color_ = colors[3][3];
284 element_[XRing].active_target_color_[3] = 1.0;
285 element_[YRing].active_target_color_[3] = 1.0;
286 element_[ZRing].active_target_color_[3] = 1.0;
289 if (mode_ == Resize || mode_ == Place)
290 for (
unsigned int i = 0; i < 3; i++)
292 element_[XRing + i].active_target_color_[3] = 0.0;
293 element_[XRing + i].inactive_target_color_[3] = 0.0;
297 if(element_[Origin].clicked_){
298 element_[Origin].active_target_color_ = colors[0][2];
299 element_[Origin].inactive_target_color_ = colors[0][5];
300 for (
unsigned int i = 1; i < NumElements - 3; i++)
302 element_[i].active_target_color_ = (colors[0][2] *
static_cast<float>(0.5) ) + (colors[((i-1)%3) + 1][2] * static_cast<float>(0.5));
303 element_[i].inactive_target_color_ = (colors[0][5] *
static_cast<float>(0.5)) + (colors[((i-1)%3) + 1][5] * static_cast<float>(0.5) );
306 }
else if(element_[Origin].over_){
307 element_[Origin].active_target_color_ = colors[0][1];
308 element_[Origin].inactive_target_color_ = colors[0][4];
309 for (
unsigned int i = 1; i < NumElements - 3; i++)
311 element_[i].active_target_color_ = (colors[0][1] *
static_cast<float>(0.5)) + (colors[((i-1)%3) + 1][1] * static_cast<float>(0.5));
312 element_[i].inactive_target_color_ = (colors[0][4] *
static_cast<float>(0.5)) + (colors[((i-1)%3) + 1][4] * static_cast<float>(0.5));
317 for (
unsigned int i = 0; i < 3; i++)
318 if (element_[i + XTop].clicked_)
320 element_[i + XTop].active_target_color_ = colors[i+1][2];
321 element_[i + XTop].inactive_target_color_ = colors[i+1][5];
322 if (mode_ != TranslationRotation)
324 element_[i + XAxis].active_target_color_ = colors[i+1][2];
325 element_[i + XAxis].inactive_target_color_ = colors[i+1][5];
327 if (mode_ != Resize) {
328 element_[i + XRing].active_target_color_ = colors[i+1][2];
329 element_[i + XRing].inactive_target_color_ = colors[i+1][5];
332 }
else if (element_[i + XTop].over_)
334 element_[i + XTop].active_target_color_ = colors[i+1][1];
335 element_[i + XTop].inactive_target_color_ = colors[i+1][4];
336 if (mode_ != TranslationRotation)
338 element_[i + XAxis].active_target_color_ = colors[i+1][1];
339 element_[i + XAxis].inactive_target_color_ = colors[i+1][4];
341 if (mode_ != Resize) {
342 element_[i + XRing].active_target_color_ = colors[i+1][1];
343 element_[i + XRing].inactive_target_color_ = colors[i+1][4];
348 for (
unsigned int i = 0; i < 3; i++)
349 if (element_[i + XAxis].clicked_)
351 element_[i + XTop].active_target_color_ = colors[i+1][2];
352 element_[i + XTop].inactive_target_color_ = colors[i+1][5];
353 element_[i + XAxis].active_target_color_ = colors[i+1][2];
354 element_[i + XAxis].inactive_target_color_ = colors[i+1][5];
355 if (mode_ == LocalRotation) {
356 element_[i + XRing].active_target_color_ = colors[i+1][2];
357 element_[i + XRing].inactive_target_color_ = colors[i+1][5];
360 }
else if (element_[i + XAxis].over_)
362 element_[i + XTop].active_target_color_ = colors[i+1][1];
363 element_[i + XTop].inactive_target_color_ = colors[i+1][4];
364 element_[i + XAxis].active_target_color_ = colors[i+1][1];
365 element_[i + XAxis].inactive_target_color_ = colors[i+1][4];
366 if (mode_ == LocalRotation) {
367 element_[i + XRing].active_target_color_ = colors[i+1][1];
368 element_[i + XRing].inactive_target_color_ = colors[i+1][4];
373 if (mode_ != Resize) {
374 for (
unsigned int i = 0; i < 3; i++) {
375 if (element_[i + XRing].clicked_)
377 element_[i + XRing].active_target_color_ = colors[i+1][2];
378 element_[i + XRing].inactive_target_color_ = colors[i+1][5];
380 }
else if (element_[i + XRing].over_)
382 element_[i + XRing].active_target_color_ = colors[i+1][1];
383 element_[i + XRing].inactive_target_color_ = colors[i+1][4];
393 bool TranslationManipulatorNode::updateCurrentColors (GLState& _state)
397 float value = (float)_state.msSinceLastRedraw () / 1000.0;
405 for (
unsigned int i = 0; i < NumElements; i++)
407 Vec4f diff = element_[i].active_target_color_ -
408 element_[i].active_current_color_;
410 for (
unsigned int j = 0; j < 4; j++)
413 else if (diff[j] < -value)
416 element_[i].active_current_color_ += diff;
418 diff = element_[i].inactive_target_color_ -
419 element_[i].inactive_current_color_;
421 for (
unsigned int j = 0; j < 4; j++)
424 else if (diff[j] < -value)
427 element_[i].inactive_current_color_ += diff;
429 rv |= element_[i].active_target_color_ != element_[i].active_current_color_ ||
430 element_[i].inactive_target_color_ != element_[i].inactive_current_color_;
433 float diff = ((mode_ == Resize) ? 1.0 : 0.0) - resize_current_;
437 else if (diff < -value)
440 resize_current_ += diff;
441 rv |= resize_current_ != ((mode_ == Resize) ? 1.0 : 0.0);
448 void TranslationManipulatorNode::drawManipulator (GLState& _state,
bool _active)
450 glPushAttrib(GL_ENABLE_BIT );
454 _state.push_modelview_matrix();
483 _state.set_diffuse_color(element_[ZAxis].active_current_color_);
484 _state.set_specular_color(element_[ZAxis].active_current_color_);
486 _state.set_diffuse_color(element_[ZAxis].inactive_current_color_);
487 _state.set_specular_color(element_[ZAxis].inactive_current_color_);
491 axisBottom_->setBottomRadius((1.0 - resize_current_) * manipulator_radius_);
492 axisBottom_->setTopRadius((1.0 + resize_current_) * manipulator_radius_);
493 axisBottom_->draw(_state, manipulator_height_/2.0);
496 _state.translate(0.0, 0.0, manipulator_height_/2);
498 axisCenter_->setBottomRadius(manipulator_radius_);
499 axisCenter_->setTopRadius(manipulator_radius_);
500 axisCenter_->draw(_state, manipulator_height_/2.0);
506 _state.set_diffuse_color(element_[ZTop].active_current_color_);
507 _state.set_specular_color(element_[ZTop].active_current_color_);
509 _state.set_diffuse_color(element_[ZTop].inactive_current_color_);
510 _state.set_specular_color(element_[ZTop].inactive_current_color_);
513 _state.translate(0.0, 0.0, manipulator_height_/2);
514 axisTop_->setBottomRadius(manipulator_radius_*2.0);
515 axisTop_->setTopRadius(0.0);
516 axisTop_->draw(_state, manipulator_height_/2.0);
517 _state.translate(0.0, 0.0, -manipulator_height_);
522 _state.rotate(-90, 1.0, 0.0, 0.0);
525 _state.set_diffuse_color(element_[YAxis].active_current_color_);
526 _state.set_specular_color(element_[YAxis].active_current_color_);
528 _state.set_diffuse_color(element_[YAxis].inactive_current_color_);
529 _state.set_specular_color(element_[YAxis].inactive_current_color_);
533 axisBottom_->setBottomRadius((1.0 - resize_current_) * manipulator_radius_);
534 axisBottom_->setTopRadius((1.0 + resize_current_) * manipulator_radius_);
535 axisBottom_->draw(_state, manipulator_height_/2.0);
538 _state.translate(0.0, 0.0, manipulator_height_/2);
540 axisCenter_->setBottomRadius(manipulator_radius_);
541 axisCenter_->setTopRadius(manipulator_radius_);
542 axisCenter_->draw(_state, manipulator_height_/2.0);
548 _state.set_diffuse_color(element_[YTop].active_current_color_);
549 _state.set_specular_color(element_[YTop].active_current_color_);
551 _state.set_diffuse_color(element_[YTop].inactive_current_color_);
552 _state.set_specular_color(element_[YTop].inactive_current_color_);
555 _state.translate(0.0, 0.0, manipulator_height_/2);
556 axisTop_->setBottomRadius(manipulator_radius_*2.0);
557 axisTop_->setTopRadius(0.0);
558 axisTop_->draw(_state, manipulator_height_/2.0);
559 _state.translate(0.0, 0.0, -manipulator_height_);
565 _state.rotate(90, 0.0, 1.0, 0.0);
568 _state.set_diffuse_color(element_[XAxis].active_current_color_);
569 _state.set_specular_color(element_[XAxis].active_current_color_);
571 _state.set_diffuse_color(element_[XAxis].inactive_current_color_);
572 _state.set_specular_color(element_[XAxis].inactive_current_color_);
576 axisBottom_->setBottomRadius((1.0 - resize_current_) * manipulator_radius_);
577 axisBottom_->setTopRadius((1.0 + resize_current_) * manipulator_radius_);
578 axisBottom_->draw(_state, manipulator_height_/2.0);
581 _state.translate(0.0, 0.0, manipulator_height_/2);
583 axisCenter_->setBottomRadius(manipulator_radius_);
584 axisCenter_->setTopRadius(manipulator_radius_);
585 axisCenter_->draw(_state, manipulator_height_/2.0);
591 _state.set_diffuse_color(element_[XTop].active_current_color_);
592 _state.set_specular_color(element_[XTop].active_current_color_);
594 _state.set_diffuse_color(element_[XTop].inactive_current_color_);
595 _state.set_specular_color(element_[XTop].inactive_current_color_);
598 _state.translate(0.0, 0.0, manipulator_height_/2);
599 axisTop_->setBottomRadius(manipulator_radius_*2.0);
600 axisTop_->setTopRadius(0.0);
601 axisTop_->draw(_state, manipulator_height_/2.0);
602 _state.translate(0.0, 0.0, -manipulator_height_);
609 _state.set_diffuse_color(element_[Origin].active_current_color_);
610 _state.set_specular_color(element_[Origin].active_current_color_);
612 _state.set_diffuse_color(element_[Origin].inactive_current_color_);
613 _state.set_specular_color(element_[Origin].inactive_current_color_);
616 sphere_->draw(_state, manipulator_radius_*2);
623 glPushAttrib(GL_LIGHTING_BIT);
627 circle_->setInnerRadius(2.0f*manipulator_height_ - manipulator_height_/4.0f);
628 circle_->setOuterRadius(2.0f*manipulator_height_);
630 if ( activeRotations_ & X_AXIS) {
633 _state.set_diffuse_color(element_[XRing].active_current_color_);
634 _state.set_ambient_color(element_[XRing].active_current_color_);
635 _state.set_color(element_[XRing].active_current_color_);
638 _state.set_diffuse_color(element_[XRing].inactive_current_color_);
639 _state.set_ambient_color(element_[XRing].inactive_current_color_);
640 _state.set_color(element_[XRing].inactive_current_color_);
644 circle_->draw(_state);
648 _state.rotate(90, 0.0, 1.0, 0.0);
649 if ( activeRotations_ & Y_AXIS) {
652 _state.set_diffuse_color(element_[YRing].active_current_color_);
653 _state.set_ambient_color(element_[YRing].active_current_color_);
654 _state.set_color(element_[YRing].active_current_color_);
657 _state.set_diffuse_color(element_[YRing].inactive_current_color_);
658 _state.set_ambient_color(element_[YRing].inactive_current_color_);
659 _state.set_color(element_[YRing].inactive_current_color_);
663 circle_->draw(_state);
666 _state.rotate(90, 1.0, 0.0, 0.0);
667 if ( activeRotations_ & Z_AXIS) {
670 _state.set_diffuse_color(element_[ZRing].active_current_color_);
671 _state.set_ambient_color(element_[ZRing].active_current_color_);
672 _state.set_color(element_[ZRing].active_current_color_);
675 _state.set_diffuse_color(element_[ZRing].inactive_current_color_);
676 _state.set_ambient_color(element_[ZRing].inactive_current_color_);
677 _state.set_color(element_[ZRing].inactive_current_color_);
681 circle_->draw(_state);
688 _state.pop_modelview_matrix();
699 if (draw_manipulator_) {
702 glPushAttrib(GL_LIGHTING_BIT);
707 glPushAttrib(GL_DEPTH_BUFFER_BIT);
711 glPushAttrib(GL_COLOR_BUFFER_BIT);
713 glPushAttrib(GL_ENABLE_BIT);
723 updateTargetColors ();
724 if (updateCurrentColors (_state))
729 glDepthMask(GL_FALSE);
732 drawManipulator(_state,
false);
736 glDepthMask(GL_TRUE);
737 drawManipulator(_state,
true);
767 world *= localTransformation_;
779 if (draw_manipulator_)
788 updateTargetColors ();
789 if (updateCurrentColors (_state))
806 ro.depthWrite =
false;
809 ro.blendSrc = GL_SRC_ALPHA;
813 addManipulatorToRenderer(_renderer, &ro,
false);
820 ro.depthWrite =
true;
823 addManipulatorToRenderer(_renderer, &ro,
true);
829 void TranslationManipulatorNode::addAxisToRenderer (
IRenderer* _renderer,
RenderObject* _baseRO,
bool _active,
int _axis)
831 assert(_axis >= XAxis && _axis - 3 >= 0 && _axis <= ZAxis);
833 for (
int i = 0; i < 3; ++i)
834 _baseRO->emissive[i] = _active ? element_[_axis].active_current_color_[i] : element_[_axis].inactive_current_color_[i];
837 axisBottom_->setBottomRadius((1.0 - resize_current_) * manipulator_radius_);
838 axisBottom_->setTopRadius((1.0 + resize_current_) * manipulator_radius_);
839 axisBottom_->addToRenderer(_renderer, _baseRO, manipulator_height_/2.0f);
844 axisCenter_->setBottomRadius(manipulator_radius_);
845 axisCenter_->setTopRadius(manipulator_radius_);
846 axisCenter_->addToRenderer(_renderer, _baseRO, manipulator_height_/2.0f);
852 for (
int i = 0; i < 3; ++i)
853 _baseRO->emissive[i] = _active ? (element_[_axis-3].active_current_color_[i]) : (element_[_axis-3].inactive_current_color_[i]);
856 axisTop_->setBottomRadius(manipulator_radius_*2.0);
857 axisTop_->setTopRadius(0.0);
858 axisTop_->addToRenderer(_renderer, _baseRO, manipulator_height_/2.0f);
865 void TranslationManipulatorNode::addManipulatorToRenderer (
IRenderer* _renderer,
RenderObject* _baseRO,
bool _active)
867 _baseRO->culling =
false;
876 _baseRO->debugName =
"TranslationManipulatorNode.z";
877 addAxisToRenderer(_renderer, _baseRO, _active, ZAxis);
883 _baseRO->debugName =
"TranslationManipulatorNode.y";
885 addAxisToRenderer(_renderer, _baseRO, _active, YAxis);
891 _baseRO->debugName =
"TranslationManipulatorNode.x";
893 addAxisToRenderer(_renderer, _baseRO, _active, XAxis);
899 _baseRO->debugName =
"TranslationManipulatorNode.sphere";
901 for (
int i = 0; i < 3; ++i)
902 _baseRO->emissive[i] = _active ? (element_[Origin].active_current_color_[i]) : (element_[Origin].inactive_current_color_[i]);
904 sphere_->addToRenderer(_renderer, _baseRO, manipulator_radius_ * 2.0f);
913 circle_->setInnerRadius(2.0f*manipulator_height_ - manipulator_height_/4.0f);
914 circle_->setOuterRadius(2.0f*manipulator_height_);
916 if ( activeRotations_ & X_AXIS)
918 _baseRO->
name =
"TranslationManipulatorNode.x_ring";
920 for (
int i = 0; i < 3; ++i)
921 _baseRO->emissive[i] = _active ? (element_[XRing].active_current_color_[i]) : (element_[XRing].inactive_current_color_[i]);
923 circle_->addToRenderer_primitive(_renderer, _baseRO);
928 if ( activeRotations_ & Y_AXIS)
930 _baseRO->debugName =
"TranslationManipulatorNode.y_ring";
932 for (
int i = 0; i < 3; ++i)
933 _baseRO->emissive[i] = _active ? (element_[YRing].active_current_color_[i]) : (element_[YRing].inactive_current_color_[i]);
934 circle_->addToRenderer_primitive(_renderer, _baseRO);
938 if ( activeRotations_ & Z_AXIS)
940 _baseRO->debugName =
"TranslationManipulatorNode.z_ring";
942 for (
int i = 0; i < 3; ++i)
943 _baseRO->emissive[i] = _active ? (element_[ZRing].active_current_color_[i]) : (element_[ZRing].inactive_current_color_[i]);
944 circle_->addToRenderer_primitive(_renderer, _baseRO);
963 if (!draw_manipulator_)
967 Vec2i newPoint2D(_event->pos().x(), _event->pos().y());
969 bool rot[3], trans[3];
971 bool lockOldPoint =
false;
975 switch (_event->type()) {
978 case QEvent::MouseButtonPress: {
979 for (i = 0; i < NumElements; i++)
980 element_[i].clicked_ =
false;
984 draggingOrigin3D_ =
center();
989 if ((mode_ != LocalRotation) && (mode_ != Rotation))
990 element_[Origin].clicked_ =
hitSphere(_state, newPoint2D);
992 element_[Origin].clicked_ =
false;
998 any_axis_clicked_ =
mapToCylinder(_state, newPoint2D, Click);
1001 if (mode_ != Resize)
1002 outer_ring_clicked_ =
mapToSphere(_state, newPoint2D, newPoint3D, Click);
1004 outer_ring_clicked_ =
false;
1007 if (element_[Origin].clicked_) {
1008 for (i = 1; i < NumElements; i++)
1009 element_[i].clicked_ =
false;
1010 any_axis_clicked_ =
false;
1011 any_top_clicked_ =
false;
1012 outer_ring_clicked_ =
false;
1013 }
else if (any_top_clicked_) {
1014 for (i = XAxis; i < NumElements; i++)
1015 element_[i].clicked_ =
false;
1016 any_axis_clicked_ =
false;
1017 outer_ring_clicked_ =
false;
1018 }
else if (any_axis_clicked_) {
1019 for (i = XRing; i < NumElements; i++)
1020 element_[i].clicked_ =
false;
1021 outer_ring_clicked_ =
false;
1022 }
else if (outer_ring_clicked_) {
1023 for (i = 0; i < XRing; i++)
1024 element_[i].clicked_ =
false;
1025 any_axis_clicked_ =
false;
1026 any_top_clicked_ =
false;
1030 if ( (_event->modifiers() & Qt::ControlModifier) && (_event->modifiers() & Qt::AltModifier) ) {
1034 oldPoint2D_ = newPoint2D;
1035 currentScale_ =
Vec3d(1.0, 1.0, 1.0);
1038 touched_ = element_[Origin].clicked_
1040 || any_axis_clicked_
1041 || outer_ring_clicked_;
1046 case QEvent::MouseButtonRelease: {
1048 for (i = 0; i < NumElements; i++) {
1049 if (element_[i].clicked_)
1051 element_[i].clicked_ =
false;
1056 || any_axis_clicked_
1057 || outer_ring_clicked_;
1059 any_axis_clicked_ =
false;
1060 any_top_clicked_ =
false;
1061 outer_ring_clicked_ =
false;
1067 case QEvent::MouseButtonDblClick: {
1068 draw_manipulator_ = !draw_manipulator_;
1073 case QEvent::MouseMove: {
1074 if (!draw_manipulator_) {
1080 Qt::KeyboardModifiers mods = Qt::ShiftModifier | Qt::ControlModifier;
1082 for (i = 0; i < NumElements; i++)
1083 element_[i].over_ =
false;
1084 any_axis_over_ =
false;
1085 any_top_over_ =
false;
1086 outer_ring_over_ =
false;
1088 if (!(element_[Origin].clicked_ || any_top_clicked_ || any_axis_clicked_ || outer_ring_clicked_)) {
1090 if ((mode_ != LocalRotation) && (mode_ != Rotation))
1091 element_[Origin].over_ =
hitSphere(_state, newPoint2D);
1093 element_[Origin].over_ =
false;
1097 if (mode_ != Place) {
1102 if (mode_ != Place) {
1107 if (mode_ != Resize) {
1108 outer_ring_over_ =
mapToSphere(_state, newPoint2D, newPoint3D, Over);
1110 outer_ring_over_ =
false;
1114 if (element_[Origin].over_) {
1115 for (i = 1; i < NumElements; i++)
1116 element_[i].over_ =
false;
1117 any_axis_over_ =
false;
1118 any_top_over_ =
false;
1119 outer_ring_over_ =
false;
1120 }
else if (any_top_over_) {
1121 for (i = XAxis; i < NumElements; i++)
1122 element_[i].over_ =
false;
1123 any_axis_over_ =
false;
1124 outer_ring_over_ =
false;
1125 }
else if (any_axis_over_) {
1126 for (i = XRing; i < NumElements; i++)
1127 element_[i].over_ =
false;
1128 outer_ring_over_ =
false;
1129 }
else if (outer_ring_over_) {
1130 for (i = 0; i < XRing; i++)
1131 element_[i].over_ =
false;
1132 any_axis_over_ =
false;
1133 any_top_over_ =
false;
1140 for (i = 0; i < 3; i++) {
1141 rot[i] = element_[XTop + i].clicked_ || element_[XRing + i].clicked_;
1145 case TranslationRotation:
1146 for (i = 0; i < 3; i++) {
1147 rot[i] = element_[XTop + i].clicked_ || element_[XRing + i].clicked_;
1148 trans[i] = element_[XAxis + i].clicked_;
1152 for (i = 0; i < 3; i++) {
1153 rot[i] = element_[XTop + i].clicked_ || element_[XRing + i].clicked_ || element_[XAxis + i].clicked_;
1160 for (i = 0; i < 3; i++) {
1162 trans[i] = element_[XTop + i].clicked_ || element_[XAxis + i].clicked_;
1168 if (element_[Origin].clicked_) {
1177 if (std::abs(d_origin[0] - newPoint2D[0]) < SNAP_PIXEL_TOLERANCE
1178 && std::abs(_state.
context_height() - d_origin[1] - newPoint2D[1]) < SNAP_PIXEL_TOLERANCE
1179 && (_event->modifiers() & Qt::AltModifier) ) {
1180 newPoint2D = oldPoint2D_;
1182 if (mode_ != Resize) {
1190 Vec3d ntrans = newvec - oldvec;
1192 if (mode_ != Resize)
1196 scale(
Vec3d(1.0 / currentScale_[0], 1.0 / currentScale_[1], 1.0 / currentScale_[2]));
1197 double positive = -1;
1198 if (newPoint2D[0] - oldPoint2D_[0] + oldPoint2D_[1] - newPoint2D[1] > 0)
1201 Vec2d div =
Vec2d(newPoint2D[0], newPoint2D[1]) -
Vec2d(oldPoint2D_[0], oldPoint2D_[1]);
1204 scaleValue *= positive;
1205 currentScale_ +=
Vec3d(scaleValue, scaleValue, scaleValue);
1207 scale(currentScale_);
1229 if (std::abs(d_origin[0] - newPoint2D[0]) < SNAP_PIXEL_TOLERANCE
1230 && std::abs(_state.
context_height() - d_origin[1] - newPoint2D[1]) < SNAP_PIXEL_TOLERANCE
1231 && (_event->modifiers() & Qt::AltModifier) ) {
1232 newPoint2D = oldPoint2D_;
1234 if (mode_ != Resize) {
1240 Vec3d ntrans = newvec - oldvec;
1245 if (mode_ == Resize) {
1247 double positive = -1;
1251 if (currentScale_[0] < 0)
1259 scaleValue *= positive;
1266 m.
scale(
Vec3d(1.0 / currentScale_[0], 1.0 / currentScale_[1], 1.0 / currentScale_[2]));
1271 currentScale_ +=
Vec3d(scaleValue, 0.0, 0.0);
1273 m = localTransformation_;
1274 m.
scale(currentScale_);
1301 if (std::abs(d_origin[0] - newPoint2D[0]) < SNAP_PIXEL_TOLERANCE
1302 && std::abs(_state.
context_height() - d_origin[1] - newPoint2D[1]) < SNAP_PIXEL_TOLERANCE
1303 && (_event->modifiers() & Qt::AltModifier) ) {
1304 newPoint2D = oldPoint2D_;
1306 if (mode_ != Resize) {
1312 Vec3d ntrans = newvec - oldvec;
1317 if (mode_ == Resize) {
1319 double positive = -1;
1323 if (currentScale_[1] < 0)
1331 scaleValue *= positive;
1338 m.
scale(
Vec3d(1.0 / currentScale_[0], 1.0 / currentScale_[1], 1.0 / currentScale_[2]));
1343 currentScale_ +=
Vec3d(0.0, scaleValue, 0.0);
1345 m = localTransformation_;
1346 m.
scale(currentScale_);
1374 if (std::abs(d_origin[0] - newPoint2D[0]) < SNAP_PIXEL_TOLERANCE
1375 && std::abs(_state.
context_height() - d_origin[1] - newPoint2D[1]) < SNAP_PIXEL_TOLERANCE
1376 && (_event->modifiers() & Qt::AltModifier) ) {
1377 newPoint2D = oldPoint2D_;
1379 if (mode_ != Resize) {
1385 Vec3d ntrans = newvec - oldvec;
1390 if (mode_ == Resize) {
1392 double positive = -1;
1396 if (currentScale_[2] < 0)
1404 scaleValue *= positive;
1411 m.
scale(
Vec3d(1.0 / currentScale_[0], 1.0 / currentScale_[1], 1.0 / currentScale_[2]));
1416 currentScale_ +=
Vec3d(0.0, 0.0, scaleValue);
1418 m = localTransformation_;
1419 m.
scale(currentScale_);
1432 if (rot[0] && (activeRotations_ & X_AXIS)) {
1437 Vec2i dist = oldPoint2D_ - newPoint2D;
1441 if (_event->modifiers() == mods) {
1444 lockOldPoint =
true;
1459 if (mode_ == LocalRotation) {
1480 if (rot[1] && (activeRotations_ & Y_AXIS)) {
1485 Vec2i dist = oldPoint2D_ - newPoint2D;
1489 if (_event->modifiers() == mods) {
1492 lockOldPoint =
true;
1505 if (mode_ == LocalRotation) {
1523 if (rot[2] && (activeRotations_ & Z_AXIS)) {
1528 Vec2i dist = oldPoint2D_ - newPoint2D;
1533 if (_event->modifiers() == mods) {
1536 lockOldPoint =
true;
1546 rotation = -dist[1];
1549 if (mode_ == LocalRotation) {
1577 oldPoint2D_ = newPoint2D;
1588 unsigned int x = _v2[0];
1593 Vec3d origin, direction;
1599 _state.
scale(2*manipulator_radius_);
1610 double a = direction.sqrnorm(),
1611 b = 2.0 * (origin | direction),
1612 c = origin.sqrnorm() - 1.0,
1628 unsigned int x = _v2[0];
1633 Vec3d origin, direction;
1639 _state.
scale(manipulator_height_+4*manipulator_radius_);
1649 double a = direction.sqrnorm(),
1650 b = 2.0 * (origin | direction),
1651 c = origin.sqrnorm() - 1.0,
1666 StateUpdates _updateStates )
1669 unsigned int x = _v1[0];
1687 _state.
rotate(-90, 1.0, 0.0, 0.0);
1691 _state.
rotate(90, 0.0, 1.0, 0.0);
1703 const Vec3d origin2(0,0,0),
1704 cylinderAxis(0.0, 0.0, 1.0);
1708 Vec3d normalX = (directionX % cylinderAxis).normalize();
1709 Vec3d vdX = ((origin2 - originX) % directionX);
1710 double axis_hitX = (normalX | vdX);
1711 double orthodistanceX = std::abs( ( origin2 - originX ) | normalX);
1714 Vec3d normalY = (directionY % cylinderAxis).normalize();
1715 Vec3d vdY = ((origin2 - originY) % directionY);
1716 double axis_hitY = (normalY | vdY);
1717 double orthodistanceY = std::abs( ( origin2 - originY ) | normalY);
1720 Vec3d normalZ = (directionZ % cylinderAxis).normalize();
1721 Vec3d vdZ = ((origin2 - originZ) % directionZ);
1722 double axis_hitZ = (normalZ | vdZ);
1723 double orthodistanceZ = std::abs( ( origin2 - originZ ) | normalZ);
1725 if ( _updateStates == None )
1728 if ( ( orthodistanceX < manipulator_radius_ ) &&
1729 ( axis_hitX >= 0 ) &&
1730 ( axis_hitX <= manipulator_height_ ) )
1734 if ( _updateStates == Click)
1735 element_[XAxis].clicked_ =
true;
1737 element_[XAxis].over_ =
true;
1739 }
else if ( ( orthodistanceY < manipulator_radius_ ) &&
1740 ( axis_hitY >= 0 ) &&
1741 ( axis_hitY <= manipulator_height_))
1745 if ( _updateStates == Click)
1746 element_[YAxis].clicked_ =
true;
1748 element_[YAxis].over_ =
true;
1750 }
else if ( ( orthodistanceZ < manipulator_radius_ ) &&
1751 ( axis_hitZ >= 0 ) &&
1752 ( axis_hitZ <= manipulator_height_ ) )
1755 if ( _updateStates == Click)
1756 element_[ZAxis].clicked_ =
true;
1758 element_[ZAxis].over_ =
true;
1762 if ( _updateStates == Click)
1763 return (element_[XAxis].clicked_ || element_[YAxis].clicked_ || element_[ZAxis].clicked_);
1765 return (element_[XAxis].over_ || element_[YAxis].over_ || element_[ZAxis].over_);
1777 StateUpdates _updateStates )
1780 unsigned int x = _v1[0];
1794 _state.
translate( 0.0, 0.0, manipulator_height_);
1796 _state.
translate( 0.0, 0.0, -manipulator_height_);
1799 _state.
rotate(-90, 1.0, 0.0, 0.0);
1800 _state.
translate(0.0, 0.0 , manipulator_height_ );
1802 _state.
translate(0.0, 0.0, -manipulator_height_);
1805 _state.
rotate(90, 0.0, 1.0, 0.0);
1806 _state.
translate(0.0, 0.0, manipulator_height_);
1808 _state.
translate(0.0, 0.0, -manipulator_height_);
1819 const Vec3d origin2(0,0,0),
1820 cylinderAxis(0.0, 0.0, 1.0);
1823 Vec3d normalX = (directionX % cylinderAxis).normalize();
1824 Vec3d vdX = ((origin2 - originX) % directionX );
1825 double axis_hitX = (normalX | vdX);
1826 double orthodistanceX = std::abs( ( origin2 - originX ) | normalX);
1829 Vec3d normalY = (directionY % cylinderAxis).normalize();
1830 Vec3d vdY = ((origin2 - originY) % directionY);
1831 double axis_hitY = (normalY | vdY);
1832 double orthodistanceY = std::abs( ( origin2 - originY ) | normalY);
1835 Vec3d normalZ = (directionZ % cylinderAxis).normalize();
1836 Vec3d vdZ = ((origin2 - originZ) % directionZ);
1837 double axis_hitZ = (normalZ | vdZ);
1838 double orthodistanceZ = std::abs( ( origin2 - originZ ) | normalZ);
1840 if ( _updateStates == None )
1845 if ( ( orthodistanceX < manipulator_radius_ * 2.0 ) &&
1846 ( axis_hitX >= 0.0 ) &&
1847 ( axis_hitX <= manipulator_height_ / 2.0 ) )
1851 if ( _updateStates == Click)
1852 element_[XTop].clicked_ =
true;
1854 element_[XTop].over_ =
true;
1856 }
else if ( ( orthodistanceY < manipulator_radius_ * 2.0 ) &&
1857 ( axis_hitY >= 0.0 ) &&
1858 ( axis_hitY <= manipulator_height_ / 2.0 ) )
1862 if ( _updateStates == Click)
1863 element_[YTop].clicked_ =
true;
1865 element_[YTop].over_ =
true;
1867 }
else if ( ( orthodistanceZ < manipulator_radius_ * 2.0 ) &&
1868 ( axis_hitZ >= 0.0 ) &&
1869 ( axis_hitZ <= manipulator_height_ / 2.0 ) )
1873 if ( _updateStates == Click)
1874 element_[ZTop].clicked_ =
true;
1876 element_[ZTop].over_ =
true;
1880 if ( _updateStates == Click)
1881 return (element_[XTop].clicked_ || element_[YTop].clicked_ || element_[ZTop].clicked_);
1882 return (element_[XTop].over_ || element_[YTop].over_ || element_[ZTop].over_);
1894 StateUpdates _updateStates)
1897 unsigned int x = _v2[0];
1901 Vec3d originXY, directionXY,
1902 originYZ, directionYZ,
1903 originZX, directionZX;
1911 _state.
rotate(90, 0.0, 1.0, 0.0);
1913 _state.
rotate(90, 1.0, 0.0, 0.0);
1921 double t1 = -originXY[2]/directionXY[2];
1922 Vec3d hitPointXY = originXY + directionXY*t1;
1924 double t2 = -originYZ[2]/directionYZ[2];
1925 Vec3d hitPointYZ = originYZ + directionYZ*t2;
1927 double t3 = -originZX[2]/directionZX[2];
1928 Vec3d hitPointZX = originZX + directionZX*t3;
1931 bool t1_near =
false, t2_near =
false, t3_near =
false;
1932 if( t1 <= t2 && t1 <= t3)
1934 if( t2 <= t1 && t2 <= t3)
1936 if( t3 <= t1 && t3 <= t2)
1939 bool xy_hit = hitPointXY.length() > 2*manipulator_height_ - manipulator_height_/4.0 &&
1940 hitPointXY.length() < 2*manipulator_height_;
1942 bool yz_hit = hitPointYZ.length() > 2*manipulator_height_ - manipulator_height_/4.0 &&
1943 hitPointYZ.length() < 2*manipulator_height_;
1945 bool zx_hit = hitPointZX.length() > 2*manipulator_height_ - manipulator_height_/4.0 &&
1946 hitPointZX.length() < 2*manipulator_height_;
1949 bool more_than_one_hit = (xy_hit && yz_hit) || (xy_hit && zx_hit) || (yz_hit && zx_hit);
1961 if(xy_hit && (!more_than_one_hit || t1_near))
1964 if ( _updateStates == Click)
1965 element_[ZRing].clicked_ =
true;
1966 else if ( _updateStates == Over)
1967 element_[ZRing].over_ =
true;
1972 else if(yz_hit && (!more_than_one_hit || t2_near))
1975 if ( _updateStates == Click)
1976 element_[XRing].clicked_ =
true;
1977 else if ( _updateStates == Over)
1978 element_[XRing].over_ =
true;
1983 else if(zx_hit && (!more_than_one_hit || t3_near))
1986 if ( _updateStates == Click)
1987 element_[YRing].clicked_ =
true;
1988 else if ( _updateStates == Over)
1989 element_[YRing].over_ =
true;
2008 if (draw_manipulator_) {
2010 updateSize (_state);
2015 glPushAttrib(GL_DEPTH_BUFFER_BIT);
2031 axisBottom_->setBottomRadius(manipulator_radius_);
2032 axisBottom_->setTopRadius(manipulator_radius_);
2033 axisBottom_->draw(_state, manipulator_height_);
2036 _state.
translate(0.0, 0.0, manipulator_height_);
2037 axisTop_->setBottomRadius(manipulator_radius_*2.0);
2038 axisTop_->setTopRadius(manipulator_radius_*2.0);
2039 axisTop_->draw(_state, manipulator_height_/2.0);
2040 _state.
translate(0.0, 0.0, -manipulator_height_);
2046 _state.
rotate(-90, 1.0, 0.0, 0.0);
2047 axisBottom_->setBottomRadius(manipulator_radius_);
2048 axisBottom_->setTopRadius(manipulator_radius_);
2049 axisBottom_->draw(_state, manipulator_height_);
2052 _state.
translate(0.0, 0.0, manipulator_height_);
2053 axisTop_->setBottomRadius(manipulator_radius_*2.0);
2054 axisTop_->setTopRadius(manipulator_radius_*2.0);
2055 axisTop_->draw(_state, manipulator_height_/2.0);
2056 _state.
translate(0.0, 0.0, -manipulator_height_);
2063 _state.
rotate(90, 0.0, 1.0, 0.0);
2065 axisBottom_->setBottomRadius(manipulator_radius_);
2066 axisBottom_->setTopRadius(manipulator_radius_);
2067 axisBottom_->draw(_state, manipulator_height_);
2070 _state.
translate(0.0, 0.0, manipulator_height_);
2071 axisTop_->setBottomRadius(manipulator_radius_*2.0);
2072 axisTop_->setTopRadius(manipulator_radius_*2.0);
2073 axisTop_->draw(_state, manipulator_height_/2.0);
2075 _state.
translate(0.0, 0.0, -manipulator_height_);
2082 sphere_->draw(_state, manipulator_radius_*2);
2089 circle_->setInnerRadius(2.0f*manipulator_height_ - manipulator_height_/4.0f);
2090 circle_->setOuterRadius(2.0f*manipulator_height_);
2091 if ( activeRotations_ & X_AXIS)
2092 circle_->draw(_state);
2094 _state.
rotate(90, 0.0, 1.0, 0.0);
2095 if ( activeRotations_ & Y_AXIS)
2096 circle_->draw(_state);
2098 _state.
rotate(90, 1.0, 0.0, 0.0);
2099 if ( activeRotations_ & Z_AXIS)
2100 circle_->draw(_state);
2121 const Vec3d cross = _directionX % _directionY;
2123 localTransformation_(0,0) = _directionX[0];
2124 localTransformation_(1,0) = _directionX[1];
2125 localTransformation_(2,0) = _directionX[2];
2126 localTransformation_(3,0) = 0.0;
2128 localTransformation_(0,1) = _directionY[0];
2129 localTransformation_(1,1) = _directionY[1];
2130 localTransformation_(2,1) = _directionY[2];
2131 localTransformation_(3,1) = 0.0;
2133 localTransformation_(0,2) = cross[0];
2134 localTransformation_(1,2) = cross[1];
2135 localTransformation_(2,2) = cross[2];
2136 localTransformation_(3,2) = 0.0;
2146 return MathTools::sane_normalized( localTransformation_.
transform_vector(dirX_) );
2155 return MathTools::sane_normalized( localTransformation_.
transform_vector(dirY_) );
2164 return MathTools::sane_normalized(localTransformation_.
transform_vector(dirZ_));
2169 double TranslationManipulatorNode::get_screen_length (
GLState& _state,
Vec3d& _point)
const
2175 return uproj.length ();
2180 void TranslationManipulatorNode::updateSize (
GLState& _state)
2182 if (auto_size_ != TranslationManipulatorNode::Never)
2186 int tmp, width, height;
2190 auto_size_length_ = get_screen_length (_state, point) * (width + height) * 0.02;
2192 if (auto_size_ == TranslationManipulatorNode::Once)
2193 auto_size_ = TranslationManipulatorNode::Never;
2196 manipulator_radius_ = set_manipulator_radius_ * auto_size_length_;
2197 manipulator_height_ = set_manipulator_height_ * auto_size_length_;
2205 if (!draw_manipulator_)
2208 float r = 2 * manipulator_height_;
int viewport_width() const
get viewport width
const Vec3d & center() const
get center
bool pick_set_maximum(size_t _idx)
Set the maximal number of primitives/components of your object.
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
bool mapToCylinderTop(GLState &_state, const Vec2i &_v2, StateUpdates _updateStates=None)
void set_updateGL(bool _b)
should GL matrices be updated after each matrix operation
void rotate(double _angle, double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
rotate around axis (_x, _y, _z) by _angle
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
static void blendFunc(GLenum _sfactor, GLenum _dfactor)
replaces glBlendFunc, supports locking
bool invert()
matrix inversion (returns true on success)
bool hitOuterSphere(GLState &_state, const Vec2i &_v2)
Determine whether the outer sphere has been hit by the cursor.
void set_diffuse_color(const Vec4f &_col)
set diffuse color
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
const Vec4f & diffuse_color() const
get diffuse color
void pop_modelview_matrix()
pop modelview matrix
virtual void setIdentity()
~TranslationManipulatorNode()
Destructor.
void push_modelview_matrix()
push modelview matrix
void set_modelview(const GLMatrixd &_m)
set modelview
const GLMatrixd & rotation() const
return rotation matrix
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
Namespace providing different geometric functions concerning angles.
static void enable(GLenum _cap)
replaces glEnable, but supports locking
bool hitSphere(GLState &_state, const Vec2i &_v2)
Determine whether the origin sphere has been hit.
const GLMatrixd & inverse_scale() const
return inverse scale matrix
void set_specular_color(const Vec4f &_col)
set specular color
Vec3d directionX() const
Get current direction of x-Axis in world coordinates.
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
ManipulatorMode
enum to define the manipulator mode
static void disable(GLenum _cap)
replaces glDisable, but supports locking
void rotate(Scalar angle, Scalar x, Scalar y, Scalar z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
void setDirty(bool _dirty=true)
mark node for redrawn
bool mapToSphere(GLState &_state, const Vec2i &_v2, Vec3d &_v3, StateUpdates _updateStates=None)
pick any of the prior targets (should be implemented for all nodes)
GLMatrixd computeWorldMatrix()
computes world matrix, transforms from model to world space
void clearTextures()
disables texture support and removes all texture types
const Vec4f & specular_color() const
get specular color
void update_rotation(GLState &_state)
update the internal rotation matrix ( internal rotation may be changed without modifiing children of ...
void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
create renderobjects for shaderpipeline renderer
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
bounding box of node
TranslationManipulatorNode(BaseNode *_parent=0, const std::string &_name="<TranslationTranslationManipulatorNode>")
Default constructor.
void draw(GLState &_state, const DrawModes::DrawMode &_drawMode)
draw the cylinder (if enabled)
Vec3d directionZ() const
Get current direction of z-Axis in world coordinates.
void set_direction(const Vec3d &_directionX, const Vec3d &_directionY)
Set direction in world coordinates.
Execute action the children first and then on this node.
const GLMatrixd & inverse_rotation() const
return inverse rotation matrix
GLMatrixd modelview
Modelview transform.
picks faces (should be implemented for all nodes)
virtual void setIdentity()
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void mult_matrix(const GLMatrixd &_m, const GLMatrixd &_inv_m, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply by a given transformation matrix
void translate(double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
translate by (_x, _y, _z)
void setMode(ManipulatorMode _mode)
set current operation mode
std::string name
Name for logging.
int viewport_height() const
get viewport height
int priority
Priority to allow sorting of objects.
VectorT< float, 4 > Vec4f
const GLMatrixd & scale() const
return scale matrix
const GLMatrixd & modelview() const
get modelview matrix
void viewing_ray(int _x, int _y, Vec3d &_origin, Vec3d &_direction) const
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
void scale(double _s)
scale by (_s, _s, _s)
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
void update_manipulator_system(GLState &_state)
set the current state to follow manipulator transformation
PickTarget
What target to use for picking.
void scale(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with scaling matrix (x,y,z)
virtual void mouseEvent(GLState &_state, QMouseEvent *_event)
get mouse events
bool mapToCylinder(GLState &_state, const Vec2i &_v2, StateUpdates _updateStates=None)
Interface class between scenegraph and renderer.
void pick_set_name(size_t _idx)
sets the current name/color (like glLoadName(_idx))
VectorT< double, 2 > Vec2d
bool touched_
stores if this manipulator was used in order to avoid emitting manipulatorMoved unnecessarily ...
int context_width() const
get gl context width
int context_height() const
get gl context height
Vec3d directionY() const
Get current direction of y-Axis in world coordinates.
VectorT< double, 3 > Vec3d
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
void identity()
setup an identity matrix
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
void pick(GLState &_state, PickTarget _target)
leave node
ShaderGenDesc shaderDesc
Drawmode and other shader params.
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.