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; } }
void mousePressEvent (State& state, const QMouseEvent& event) { if (event.button () == Qt::MiddleButton) { this->oldPos = ViewUtil::toIVec2 (event); if (event.modifiers () == Qt::ControlModifier) { Camera& cam = state.camera (); WingedFaceIntersection intersection; if (state.scene ().intersects (cam.ray (ViewUtil::toIVec2 (event)), intersection)) { cam.set ( intersection.position () , cam.position () - intersection.position () , cam.up () ); state.mainWindow ().mainWidget ().glWidget ().update (); } } } }
void updateCursorByIntersection (const ViewPointingEvent& e) { WingedFaceIntersection intersection; if (this->self->intersectsScene (e, intersection)) { this->cursor.enable (); this->cursor.position (intersection.position ()); } else { this->cursor.disable (); } }
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; } }
void setupCursor () { assert (this->brush.radius () > 0.0f); WingedFaceIntersection intersection; if (this->self->intersectsScene (this->self->cursorPosition (), intersection)) { this->cursor.enable (); this->cursor.position (intersection.position ()); } else { this->cursor.disable (); } this->cursor.radius (this->brush.radius ()); this->self->runSetupCursor (this->cursor); }