Use new SGPickCallback drag option
Patch from Colin Geniet, optimise performance of dragging on most objects which don't need picked position for each drag.
This commit is contained in:
parent
2401232969
commit
2342ad49b5
1 changed files with 9 additions and 3 deletions
|
@ -283,9 +283,9 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
SGSceneryPicks pickList = globals->get_renderer()->pick(windowPos);
|
||||
if(pickList.empty())
|
||||
return;
|
||||
// Do not compute scenery picks unless a callback requests it, as it is costly.
|
||||
SGSceneryPicks pickList;
|
||||
bool did_pick = false;
|
||||
|
||||
for( ActivePickCallbacks::iterator mi = activePickCallbacks.begin();
|
||||
mi != activePickCallbacks.end();
|
||||
|
@ -294,6 +294,12 @@ public:
|
|||
SGPickCallbackList::iterator li;
|
||||
for( li = mi->second.begin(); li != mi->second.end(); ++li )
|
||||
{
|
||||
if (!did_pick && (*li)->needsDragPosition())
|
||||
{
|
||||
pickList = globals->get_renderer()->pick(windowPos);
|
||||
did_pick = true;
|
||||
}
|
||||
|
||||
const SGSceneryPick* pick = getPick(pickList, *li);
|
||||
(*li)->mouseMoved(*ea, pick ? &pick->info : 0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue