| 703 | } |
| 704 | |
| 705 | void CornerControllerObject::initDefault() |
| 706 | { |
| 707 | std::shared_ptr<Mesh> arrowMeshCCW = std::make_shared<Mesh>( makeCornerControllerRotationArrowMesh( 0.4f, Vector2f( 1.1f, 0.1f ), true ) ); |
| 708 | std::shared_ptr<Mesh> arrowMeshCW = std::make_shared<Mesh>( makeCornerControllerRotationArrowMesh( 0.4f, Vector2f( 1.1f, 0.0f ), false ) ); |
| 709 | std::shared_ptr<Mesh> basisControllerMesh = std::make_shared<Mesh>( makeCornerControllerMesh( 0.8f ) ); |
| 710 | |
| 711 | auto basisViewControllerHoverable = std::make_shared<ObjectMesh>(); |
| 712 | auto basisViewControllerNonHoverable = std::make_shared<ObjectMesh>(); |
| 713 | auto arrowCCW = std::make_shared<ObjectMesh>(); |
| 714 | auto arrowCW = std::make_shared<ObjectMesh>(); |
| 715 | |
| 716 | auto textures = loadCornerControllerTextures(); |
| 717 | |
| 718 | auto setupCube = [&] ( std::shared_ptr<ObjectMesh> obj, bool hoverable ) |
| 719 | { |
| 720 | obj->setMesh( basisControllerMesh ); |
| 721 | obj->setName( hoverable ? "CVC Hoverable" : "CVC Non-Hoverable" ); |
| 722 | obj->setFlatShading( true ); |
| 723 | obj->setVisualizeProperty( true, MeshVisualizePropertyType::BordersHighlight, ViewportMask::all() ); |
| 724 | obj->setVisualizeProperty( true, MeshVisualizePropertyType::PolygonOffsetFromCamera, ViewportMask::all() ); |
| 725 | obj->setVisualizeProperty( false, MeshVisualizePropertyType::EnableShading, ViewportMask::all() ); |
| 726 | |
| 727 | obj->setUVCoords( makeCornerControllerUVCoords() ); |
| 728 | obj->setEdgeWidth( 0.2f ); |
| 729 | |
| 730 | if ( hoverable ) |
| 731 | { |
| 732 | obj->setTextures( textures ); |
| 733 | } |
| 734 | else |
| 735 | { |
| 736 | if ( !textures.empty() ) |
| 737 | obj->setTextures( { textures.front() } ); |
| 738 | } |
| 739 | |
| 740 | if ( !obj->getTextures().empty() ) |
| 741 | { |
| 742 | if ( hoverable ) |
| 743 | obj->setTexturePerFace( getCornerControllerTextureMap() ); |
| 744 | obj->setVisualizeProperty( true, MeshVisualizePropertyType::Texture, ViewportMask::all() ); |
| 745 | } |
| 746 | }; |
| 747 | |
| 748 | auto setupArrow = [&] ( std::shared_ptr<ObjectMesh> obj, bool cw ) |
| 749 | { |
| 750 | obj->setMesh( cw ? arrowMeshCW : arrowMeshCCW ); |
| 751 | obj->setName( cw ? "CW" : "CCW" ); |
| 752 | obj->setFlatShading( true ); |
| 753 | obj->setVisualizeProperty( true, MeshVisualizePropertyType::BordersHighlight, ViewportMask::all() ); |
| 754 | obj->setVisualizeProperty( true, MeshVisualizePropertyType::PolygonOffsetFromCamera, ViewportMask::all() ); |
| 755 | obj->setVisualizeProperty( false, MeshVisualizePropertyType::EnableShading, ViewportMask::all() ); |
| 756 | obj->setEdgeWidth( 0.3f ); |
| 757 | }; |
| 758 | |
| 759 | setupCube( basisViewControllerHoverable, true ); |
| 760 | setupCube( basisViewControllerNonHoverable, false ); |
| 761 | basisViewControllerHoverable->setVisibilityMask( ViewportMask() ); |
| 762 | setupArrow( arrowCW, true ); |
no test coverage detected