void BrushInstance::testSelectComponents (Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode) { test.BeginMesh(localToWorld()); switch (mode) { case SelectionSystem::eVertex: { for (VertexInstances::iterator i = m_vertexInstances.begin(); i != m_vertexInstances.end(); ++i) { (*i).testSelect(selector, test); } } break; case SelectionSystem::eEdge: { for (EdgeInstances::iterator i = m_edgeInstances.begin(); i != m_edgeInstances.end(); ++i) { (*i).testSelect(selector, test); } } break; case SelectionSystem::eFace: { if (test.getVolume().fill()) { for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) { (*i).testSelect(selector, test); } } else { for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) { (*i).testSelect_centroid(selector, test); } } } break; default: break; } }
// Perform selection test void RenderablePicoModel::testSelect (Selector& selector, SelectionTest& test, const Matrix4& localToWorld) { // Perform a volume intersection (AABB) check on each surface. For those // that intersect, call the surface's own testSelection method to perform // a proper selection test. for (SurfaceList::iterator i = _surfVec.begin(); i != _surfVec.end(); ++i) { // Check volume intersection if (test.getVolume().TestAABB(i->localAABB(), localToWorld) != VOLUME_OUTSIDE) { // Volume intersection passed, delegate the selection test i->testSelect(selector, test, localToWorld); } } }