bool CreateComplexBrushToolController3D::doShouldHandleMouseDrag(const InputState& inputState) const { if (!inputState.mouseButtonsDown(MouseButtons::MBLeft)) return false; if (!inputState.checkModifierKeys(MK_No, MK_No, MK_DontCare)) return false; return true; }
bool CreateComplexBrushToolController3D::doMouseDoubleClick(const InputState& inputState) { if (!inputState.mouseButtonsDown(MouseButtons::MBLeft)) return false; if (!inputState.checkModifierKeys(MK_No, MK_No, MK_No)) return false; const Model::PickResult& pickResult = inputState.pickResult(); const Model::Hit& hit = pickResult.query().pickable().type(Model::Brush::BrushHit).occluded().first(); if (!hit.isMatch()) return false; Polyhedron3 polyhedron = m_tool->polyhedron(); const Model::BrushFace* face = Model::hitToFace(hit); const Model::BrushFace::VertexList vertices = face->vertices(); Model::BrushFace::VertexList::const_iterator it, end; for (it = vertices.begin(), end = vertices.end(); it != end; ++it) polyhedron.addPoint((*it)->position()); m_tool->update(polyhedron); return true; }
bool CreateComplexBrushToolController3D::doMouseClick(const InputState& inputState) { if (!inputState.mouseButtonsDown(MouseButtons::MBLeft)) return false; if (!inputState.checkModifierKeys(MK_No, MK_No, MK_No)) return false; const Model::PickResult& pickResult = inputState.pickResult(); const Model::Hit& hit = pickResult.query().pickable().type(Model::Brush::BrushHit).occluded().first(); if (!hit.isMatch()) return false; const Grid& grid = m_tool->grid(); const Model::BrushFace* face = Model::hitToFace(hit); const Vec3 snapped = grid.snap(hit.hitPoint(), face->boundary()); Polyhedron3 polyhedron = m_tool->polyhedron(); polyhedron.addPoint(snapped); m_tool->update(polyhedron); return true; }