| 128 | } |
| 129 | |
| 130 | void WindowToWorldTestApp::mouseDown( MouseEvent event ) |
| 131 | { |
| 132 | // Check if mouse is inside rectangle, by converting the mouse coordinates |
| 133 | // to world space and then to object space. [ Excercising gl::windowToWorldCoord() ]. |
| 134 | vec3 world = gl::windowToWorldCoord( event.getPos() ); |
| 135 | vec4 object = glm::inverse( mRectangle.matrix() ) * vec4( world, 1 ); |
| 136 | |
| 137 | // Now we can simply use Area::contains() to find out if the mouse is inside. |
| 138 | mIsClicked = mRectangle.area.contains( vec2( object ) ); |
| 139 | if( mIsClicked ) { |
| 140 | mMouseInitial = event.getPos(); |
| 141 | mRectangleInitial = mRectangle; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | void WindowToWorldTestApp::mouseDrag( MouseEvent event ) |
| 146 | { |
nothing calls this directly
no test coverage detected