Example #1
0
  bool updateBrushAndCursorByIntersection (const ViewPointingEvent& e, bool useRecentOctree) {
    WingedFaceIntersection intersection;

    if (this->self->intersectsScene (e, intersection)) {
      this->cursor.enable   ();
      this->cursor.position (intersection.position ());

      if (e.primaryButton ()) {
        this->brush.mesh (&intersection.mesh ());

        if (useRecentOctree) {
          Intersection octreeIntersection;
          if (this->self->intersectsRecentOctree (e, octreeIntersection)) {
            return this->brush.updatePointOfAction ( octreeIntersection.position ()
                                                   , octreeIntersection.normal () );
          }
          else {
            return this->brush.updatePointOfAction ( intersection.position ()
                                                   , intersection.normal () );
          }
        }
        else {
          return this->brush.updatePointOfAction ( intersection.position ()
                                                 , intersection.normal () );
        }
      }
      else {
        return false;
      }
    }
    else {
      this->cursor.disable ();
      return false;
    }
  }
Example #2
0
 ToolResponse runReleaseEvent (const ViewPointingEvent& e) {
   if (e.primaryButton ()) {
     WingedFaceIntersection intersection;
     if (this->self->intersectsScene (e, intersection)) {
       Scene& scene = this->self->state ().scene ();
       this->self->snapshotWingedMeshes ();
       scene.deleteMesh (intersection.mesh ());
       return ToolResponse::Redraw;
     }
   }
   return ToolResponse::None;
 }
Example #3
0
 bool initializeDraglikeStroke (const ViewPointingEvent& e, ToolUtilMovement& movement) {
   if (e.primaryButton ()) {
     WingedFaceIntersection intersection;
     if (this->self->intersectsScene (e, intersection)) {
       this->brush.mesh (&intersection.mesh ());
       this->brush.setPointOfAction (intersection.position (), intersection.normal ());
       
       this->cursor.disable ();
       movement.resetPosition (intersection.position ());
       return true;
     }
     else {
       this->cursor.enable ();
       this->brush.resetPointOfAction ();
       return false;
     }
   }
   else {
     this->cursor.enable ();
     this->brush.resetPointOfAction ();
     return false;
   }
 }