219 if (!this->modeDirty)
226 this->modeDirty =
false;
236 if (this->axis.X() > 0)
239 this->materials[AM_ACTIVE],
false);
241 this->materials[AM_HANDLE],
false);
243 if (this->axis.Y() > 0)
246 this->materials[AM_ACTIVE],
false);
248 this->materials[AM_HANDLE],
false);
250 if (this->axis.Z() > 0)
253 this->materials[AM_ACTIVE],
false);
255 this->materials[AM_HANDLE],
false);
264 if (this->axis.X() > 0)
267 this->materials[AM_ACTIVE],
false);
269 this->materials[AM_HANDLE],
false);
271 if (this->axis.Y() > 0)
274 this->materials[AM_ACTIVE],
false);
276 this->materials[AM_HANDLE],
false);
278 if (this->axis.Z() > 0)
281 this->materials[AM_ACTIVE],
false);
283 this->materials[AM_HANDLE],
false);
291 if (this->axis.X() > 0)
294 this->materials[AM_ACTIVE],
false);
296 this->materials[AM_HANDLE],
false);
298 if (this->axis.Y() > 0)
301 this->materials[AM_ACTIVE],
false);
303 this->materials[AM_HANDLE],
false);
305 if (this->axis.Z() > 0)
308 this->materials[AM_ACTIVE],
false);
310 this->materials[AM_HANDLE],
false);
314 this->modeDirty =
false;
381 xMat->SetDepthWriteEnabled(
false);
382 xMat->SetDepthCheckEnabled(
false);
383 yMat->SetDepthWriteEnabled(
false);
384 yMat->SetDepthCheckEnabled(
false);
385 zMat->SetDepthWriteEnabled(
false);
386 zMat->SetDepthCheckEnabled(
false);
387 activeMat->SetDepthWriteEnabled(
false);
388 activeMat->SetDepthCheckEnabled(
false);
394 oMat->SetAmbient(0.5, 0.5, 0.5);
395 oMat->SetDiffuse(0.5, 0.5, 0.5);
396 oMat->SetEmissive(0.5, 0.5, 0.5);
397 oMat->SetTransparency(0.5);
398 oMat->SetCastShadows(
false);
399 oMat->SetReceiveShadows(
false);
400 oMat->SetLightingEnabled(
false);
401 oMat->SetDepthWriteEnabled(
false);
402 oMat->SetDepthCheckEnabled(
false);
409 handleMat->SetAmbient(0.0, 0.0, 0.0);
410 handleMat->SetDiffuse(0.0, 0.0, 0.0);
411 handleMat->SetEmissive(0.0, 0.0, 0.0);
412 handleMat->SetTransparency(1.0);
413 handleMat->SetCastShadows(
false);
414 handleMat->SetReceiveShadows(
false);
415 handleMat->SetLightingEnabled(
false);
416 handleMat->SetDepthWriteEnabled(
false);
417 handleMat->SetDepthCheckEnabled(
false);
420 this->materials[AM_X] = xMat;
421 this->materials[AM_Y] = yMat;
422 this->materials[AM_Z] = zMat;
423 this->materials[AM_ACTIVE] = activeMat;
424 this->materials[AM_O] = oMat;
425 this->materials[AM_HANDLE] = handleMat;
436 transShaftXVis->AddGeometry(this->
Scene()->CreateCylinder());
437 transShaftXVis->SetOrigin(0, 0, 0.5);
438 transShaftXVis->SetLocalPosition(0, 0, 0.5);
439 transShaftXVis->SetLocalScale(0.02, 0.02, 0.45);
440 transXVis->AddChild(transShaftXVis);
443 transHeadXVis->AddGeometry(this->
Scene()->CreateCone());
444 transHeadXVis->SetOrigin(0, 0, -0.5);
445 transHeadXVis->SetLocalPosition(0, 0, 0.5);
446 transHeadXVis->SetLocalScale(0.07, 0.07, 0.2);
447 transXVis->AddChild(transHeadXVis);
449 transXVis->SetMaterial(this->materials[AM_X],
false);
450 transXVis->SetLocalRotation(0,
GZ_PI * 0.5, 0);
451 transVis->AddChild(transXVis);
456 transShaftYVis->AddGeometry(this->
Scene()->CreateCylinder());
457 transShaftYVis->SetOrigin(0, 0, 0.5);
458 transShaftYVis->SetLocalPosition(0, 0, 0.5);
459 transShaftYVis->SetLocalScale(0.02, 0.02, 0.45);
460 transYVis->AddChild(transShaftYVis);
463 transHeadYVis->AddGeometry(this->
Scene()->CreateCone());
464 transHeadYVis->SetOrigin(0, 0, -0.5);
465 transHeadYVis->SetLocalPosition(0, 0, 0.5);
466 transHeadYVis->SetLocalScale(0.07, 0.07, 0.2);
467 transYVis->AddChild(transHeadYVis);
469 transYVis->SetMaterial(this->materials[AM_Y],
false);
470 transYVis->SetLocalRotation(-
GZ_PI * 0.5, 0, 0);
471 transVis->AddChild(transYVis);
476 transShaftZVis->AddGeometry(this->
Scene()->CreateCylinder());
477 transShaftZVis->SetOrigin(0, 0, 0.5);
478 transShaftZVis->SetLocalPosition(0, 0, 0.5);
479 transShaftZVis->SetLocalScale(0.02, 0.02, 0.45);
480 transZVis->AddChild(transShaftZVis);
483 transHeadZVis->AddGeometry(this->
Scene()->CreateCone());
484 transHeadZVis->SetOrigin(0, 0, -0.5);
485 transHeadZVis->SetLocalPosition(0, 0, 0.5);
486 transHeadZVis->SetLocalScale(0.07, 0.07, 0.2);
487 transZVis->AddChild(transHeadZVis);
489 transZVis->SetMaterial(this->materials[AM_Z],
false);
490 transVis->AddChild(transZVis);
494 transOrigin->AddGeometry(this->
Scene()->CreateSphere());
495 transOrigin->SetLocalScale(0.05, 0.05, 0.05);
496 transOrigin->SetMaterial(this->materials[AM_O],
false);
497 transVis->AddChild(transOrigin);
508 transHandleXVis->AddGeometry(this->
Scene()->CreateCylinder());
509 transHandleXVis->SetLocalPosition(0, 0, 0.35);
510 transHandleXVis->SetLocalScale(0.11, 0.11, 0.7);
511 transHandleXVis->SetMaterial(this->materials[AM_HANDLE],
false);
512 transXVis->AddChild(transHandleXVis);
515 transHandleYVis->AddGeometry(this->
Scene()->CreateCylinder());
516 transHandleYVis->SetLocalPosition(0, 0, 0.35);
517 transHandleYVis->SetLocalScale(0.11, 0.11, 0.7);
518 transHandleYVis->SetMaterial(this->materials[AM_HANDLE],
false);
519 transYVis->AddChild(transHandleYVis);
522 transHandleZVis->AddGeometry(this->
Scene()->CreateCylinder());
523 transHandleZVis->SetLocalPosition(0, 0, 0.35);
524 transHandleZVis->SetLocalScale(0.11, 0.11, 0.7);
525 transHandleZVis->SetMaterial(this->materials[AM_HANDLE],
false);
526 transZVis->AddChild(transHandleZVis);
532 this->AddChild(transVis);
541 if (!meshMgr->
HasMesh(rotMeshName))
545 if (!meshMgr->
HasMesh(rotFullMeshName))
547 meshMgr->
CreateTube(rotFullMeshName, 1.0f, 1.02f, 0.02f, 1, 64,
551 std::string rotHandleMeshName =
"gizmo_rotate_handle";
552 if (!meshMgr->
HasMesh(rotHandleMeshName))
554 meshMgr->
CreateTube(rotHandleMeshName, 0.95f, 1.07f, 0.1f, 1, 64,
562 rotXVis->AddGeometry(this->
Scene()->CreateMesh(rotMeshName));
563 rotXVis->SetLocalRotation(0,
GZ_PI * 0.5, 0);
564 rotXVis->SetLocalScale(0.5, 0.5, 0.5);
565 rotXVis->SetMaterial(this->materials[AM_X],
false);
566 rotVis->AddChild(rotXVis);
570 rotYVis->AddGeometry(this->
Scene()->CreateMesh(rotMeshName));
571 rotYVis->SetLocalRotation(
GZ_PI * 0.5, 0, 0);
572 rotYVis->SetLocalScale(0.5, 0.5, 0.5);
573 rotYVis->SetMaterial(this->materials[AM_Y],
false);
574 rotVis->AddChild(rotYVis);
578 rotZVis->AddGeometry(this->
Scene()->CreateMesh(rotMeshName));
579 rotZVis->SetLocalScale(0.5, 0.5, 0.5);
580 rotZVis->SetMaterial(this->materials[AM_Z],
false);
581 rotVis->AddChild(rotZVis);
585 rotFullVis->AddGeometry(this->
Scene()->CreateMesh(rotFullMeshName));
586 rotFullVis->SetLocalScale(0.5, 0.5, 0.5);
587 rotFullVis->SetMaterial(this->materials[AM_O],
false);
588 rotVis->AddChild(rotFullVis);
599 rotHandleXVis->AddGeometry(this->
Scene()->CreateMesh(rotHandleMeshName));
600 rotHandleXVis->SetMaterial(this->materials[AM_HANDLE],
false);
601 rotXVis->AddChild(rotHandleXVis);
604 rotHandleYVis->AddGeometry(this->
Scene()->CreateMesh(rotHandleMeshName));
605 rotHandleYVis->SetMaterial(this->materials[AM_HANDLE],
false);
606 rotYVis->AddChild(rotHandleYVis);
609 rotHandleZVis->AddGeometry(this->
Scene()->CreateMesh(rotHandleMeshName));
610 rotHandleZVis->SetMaterial(this->materials[AM_HANDLE],
false);
611 rotZVis->AddChild(rotHandleZVis);
617 this->AddChild(rotVis);
629 scaleShaftXVis->AddGeometry(this->
Scene()->CreateCylinder());
630 scaleShaftXVis->SetOrigin(0, 0, 0.5);
631 scaleShaftXVis->SetLocalPosition(0, 0, 0.5);
632 scaleShaftXVis->SetLocalScale(0.02, 0.02, 0.5);
633 scaleXVis->AddChild(scaleShaftXVis);
636 scaleHeadXVis->AddGeometry(this->
Scene()->CreateBox());
637 scaleHeadXVis->SetOrigin(0, 0, -0.5);
638 scaleHeadXVis->SetLocalPosition(0, 0, 0.5);
639 scaleHeadXVis->SetLocalScale(0.07, 0.07, 0.07);
640 scaleXVis->AddChild(scaleHeadXVis);
642 scaleXVis->SetMaterial(this->materials[AM_X],
false);
643 scaleXVis->SetLocalRotation(0,
GZ_PI * 0.5, 0);
644 scaleVis->AddChild(scaleXVis);
649 scaleShaftYVis->AddGeometry(this->
Scene()->CreateCylinder());
650 scaleShaftYVis->SetOrigin(0, 0, 0.5);
651 scaleShaftYVis->SetLocalPosition(0, 0, 0.5);
652 scaleShaftYVis->SetLocalScale(0.02, 0.02, 0.5);
653 scaleYVis->AddChild(scaleShaftYVis);
656 scaleHeadYVis->AddGeometry(this->
Scene()->CreateBox());
657 scaleHeadYVis->SetOrigin(0, 0, -0.5);
658 scaleHeadYVis->SetLocalPosition(0, 0, 0.5);
659 scaleHeadYVis->SetLocalScale(0.07, 0.07, 0.07);
660 scaleYVis->AddChild(scaleHeadYVis);
662 scaleYVis->SetMaterial(this->materials[AM_Y],
false);
663 scaleYVis->SetLocalRotation(-
GZ_PI * 0.5, 0, 0);
664 scaleVis->AddChild(scaleYVis);
669 scaleShaftZVis->AddGeometry(this->
Scene()->CreateCylinder());
670 scaleShaftZVis->SetOrigin(0, 0, 0.5);
671 scaleShaftZVis->SetLocalPosition(0, 0, 0.5);
672 scaleShaftZVis->SetLocalScale(0.02, 0.02, 0.5);
673 scaleZVis->AddChild(scaleShaftZVis);
676 scaleHeadZVis->AddGeometry(this->
Scene()->CreateBox());
677 scaleHeadZVis->SetOrigin(0, 0, -0.5);
678 scaleHeadZVis->SetLocalPosition(0, 0, 0.5);
679 scaleHeadZVis->SetLocalScale(0.07, 0.07, 0.07);
680 scaleZVis->AddChild(scaleHeadZVis);
682 scaleZVis->SetMaterial(this->materials[AM_Z],
false);
683 scaleVis->AddChild(scaleZVis);
691 scaleHandleXVis->AddGeometry(this->
Scene()->CreateCylinder());
692 scaleHandleXVis->SetLocalPosition(0, 0, 0.285);
693 scaleHandleXVis->SetLocalScale(0.11, 0.11, 0.57);
694 scaleHandleXVis->SetMaterial(this->materials[AM_HANDLE],
false);
695 scaleXVis->AddChild(scaleHandleXVis);
698 scaleHandleYVis->AddGeometry(this->
Scene()->CreateCylinder());
699 scaleHandleYVis->SetLocalPosition(0, 0, 0.285);
700 scaleHandleYVis->SetLocalScale(0.11, 0.11, 0.57);
701 scaleHandleYVis->SetMaterial(this->materials[AM_HANDLE],
false);
702 scaleYVis->AddChild(scaleHandleYVis);
705 scaleHandleZVis->AddGeometry(this->
Scene()->CreateCylinder());
706 scaleHandleZVis->SetLocalPosition(0, 0, 0.285);
707 scaleHandleZVis->SetLocalScale(0.11, 0.11, 0.57);
708 scaleHandleZVis->SetMaterial(this->materials[AM_HANDLE],
false);
709 scaleZVis->AddChild(scaleHandleZVis);
715 this->AddChild(scaleVis);