bool ResizeBrushesToolController::doStartMouseDrag(const InputState& inputState) {
     if (!handleInput(inputState))
         return false;
     const bool split = inputState.modifierKeysDown(ModifierKeys::MKCtrlCmd);
     if (m_tool->beginResize(inputState.pickResult(), split)) {
         updateDragFaces(inputState);
         return true;
     }
     return false;
 }
            DragInfo doStartDrag(const InputState& inputState) {
                if (!inputState.modifierKeysDown(ModifierKeys::MKShift))
                    return DragInfo();
                
                if (!m_tool->polyhedron().polygon())
                    return DragInfo();
                
                m_oldPolyhedron = m_tool->polyhedron();

                const Polyhedron3::FaceHit hit = m_oldPolyhedron.pickFace(inputState.pickRay());
                const Vec3 origin    = inputState.pickRay().pointAtDistance(hit.distance);
                const Vec3 direction = hit.face->normal();
                
                const Line3 line(origin, direction);
                m_dragDir = line.direction;
                
                return DragInfo(new LineDragRestricter(line), new NoDragSnapper(), origin);
            }
            DragInfo doStartDrag(const InputState& inputState) {
                if (inputState.modifierKeysDown(ModifierKeys::MKShift))
                    return DragInfo();
                
                const Model::PickResult& pickResult = inputState.pickResult();
                const Model::Hit& hit = pickResult.query().pickable().type(Model::Brush::BrushHit).occluded().first();
                if (!hit.isMatch())
                    return DragInfo();

                m_oldPolyhedron = m_tool->polyhedron();
                
                const Model::BrushFace* face = Model::hitToFace(hit);
                m_plane = face->boundary();
                m_initialPoint = hit.hitPoint();
                updatePolyhedron(m_initialPoint);
                
                SurfaceDragRestricter* restricter = new SurfaceDragRestricter();
                restricter->setPickable(true);
                restricter->setType(Model::Brush::BrushHit);
                restricter->setOccluded(true);
                return DragInfo(restricter, new NoDragSnapper(), m_initialPoint);
            }
        void CreateComplexBrushToolController3D::doRender(const InputState& inputState, Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch) {
            m_tool->render(renderContext, renderBatch);
            
            const Polyhedron3& polyhedron = m_tool->polyhedron();
            if (!polyhedron.empty()) {
                Renderer::RenderService renderService(renderContext, renderBatch);
                renderService.setForegroundColor(pref(Preferences::HandleColor));
                renderService.setLineWidth(2.0f);
                
                const Polyhedron3::EdgeList& edges = polyhedron.edges();
                Polyhedron3::EdgeList::const_iterator eIt, eEnd;
                for (eIt = edges.begin(), eEnd = edges.end(); eIt != eEnd; ++eIt) {
                    const Polyhedron3::Edge* edge = *eIt;
                    renderService.renderLine(edge->firstVertex()->position(), edge->secondVertex()->position());
                }
                
                const Polyhedron3::VertexList& vertices = polyhedron.vertices();
                Polyhedron3::VertexList::const_iterator vIt, vEnd;
                for (vIt = vertices.begin(), vEnd = vertices.end(); vIt != vEnd; ++vIt) {
                    const Polyhedron3::Vertex* vertex = *vIt;
                    renderService.renderPointHandle(vertex->position());
                }
                
                if (polyhedron.polygon() && inputState.modifierKeysDown(ModifierKeys::MKShift)) {
                    const Polyhedron3::Face* face = polyhedron.faces().front();
                    const Vec3::List pos3 = face->vertexPositions();
                    Vec3f::List pos3f(pos3.size());
                    for (size_t i = 0; i < pos3.size(); ++i)
                        pos3f[i] = Vec3f(pos3[i]);
                    
                    renderService.setForegroundColor(Color(pref(Preferences::HandleColor), 0.5f));
                    renderService.renderFilledPolygon(pos3f);

                    std::reverse(pos3f.begin(), pos3f.end());
                    renderService.renderFilledPolygon(pos3f);
                }
            }
        }
 bool SetBrushFaceAttributesTool::copyAttributes(const InputState& inputState) const {
     return !inputState.modifierKeysDown(ModifierKeys::MKCtrlCmd);
 }