lessen code duplication
This commit is contained in:
parent
66e6781c9b
commit
9f29864f50
|
|
@ -3787,6 +3787,7 @@ const SelectionIntersection& bestIntersection() const {
|
||||||
|
|
||||||
class BestSelector : public Selector
|
class BestSelector : public Selector
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
SelectionIntersection m_intersection;
|
SelectionIntersection m_intersection;
|
||||||
Selectable* m_selectable;
|
Selectable* m_selectable;
|
||||||
SelectionIntersection m_bestIntersection;
|
SelectionIntersection m_bestIntersection;
|
||||||
|
|
@ -3823,20 +3824,9 @@ const SelectionIntersection& bestIntersection() const {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeepBestSelector : public Selector
|
class DeepBestSelector : public BestSelector // copy of class BestSelector with 2.f depthEpsilon
|
||||||
{
|
{
|
||||||
SelectionIntersection m_intersection;
|
|
||||||
Selectable* m_selectable;
|
|
||||||
SelectionIntersection m_bestIntersection;
|
|
||||||
std::list<Selectable*> m_bestSelectable;
|
|
||||||
public:
|
public:
|
||||||
DeepBestSelector() : m_bestIntersection( SelectionIntersection() ), m_bestSelectable( 0 ){
|
|
||||||
}
|
|
||||||
|
|
||||||
void pushSelectable( Selectable& selectable ){
|
|
||||||
m_intersection = SelectionIntersection();
|
|
||||||
m_selectable = &selectable;
|
|
||||||
}
|
|
||||||
void popSelectable(){
|
void popSelectable(){
|
||||||
if ( m_intersection.equalEpsilon( m_bestIntersection, 0.25f, 2.f ) ) {
|
if ( m_intersection.equalEpsilon( m_bestIntersection, 0.25f, 2.f ) ) {
|
||||||
m_bestSelectable.push_back( m_selectable );
|
m_bestSelectable.push_back( m_selectable );
|
||||||
|
|
@ -3849,13 +3839,6 @@ void popSelectable(){
|
||||||
}
|
}
|
||||||
m_intersection = SelectionIntersection();
|
m_intersection = SelectionIntersection();
|
||||||
}
|
}
|
||||||
void addIntersection( const SelectionIntersection& intersection ){
|
|
||||||
assign_if_closer( m_intersection, intersection );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<Selectable*>& best(){
|
|
||||||
return m_bestSelectable;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BestPointSelector : public Selector
|
class BestPointSelector : public Selector
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user