engine/physics/src/physics/physics.cpp
/**
     * Prunes an entry, used to iterate the cache when pruning.
     */
Prunes an entry, used to iterate the cache when pruning.
Prunes an entry used to iterate the cache when pruning .
static void PruneOverlap(PruneContext* context, const uintptr_t* key, OverlapEntry* value)
    {
        TriggerExitedCallback callback = context->m_Callback;
        void* user_data = context->m_UserData;
        OverlapCache* cache = context->m_Cache;
        void* object_a = (void*)*key;
        uint32_t i = 0;
        while (i < value->m_OverlapCount)
        {
            Overlap& overlap = value->m_Overlaps[i];
            if (overlap.m_Count == 0)
            {
                OverlapEntry* entry = cache->m_OverlapCache.Get((uintptr_t)overlap.m_Object);
                if (callback != 0x0)
                {
                    TriggerExit data;
                    data.m_UserDataA = value->m_UserData;
                    data.m_UserDataB = entry->m_UserData;
                    data.m_GroupA = value->m_Group;
                    data.m_GroupB = entry->m_Group;
                    callback(data, user_data);
                }
                RemoveOverlap(entry, object_a);
                overlap = value->m_Overlaps[value->m_OverlapCount-1];
                --value->m_OverlapCount;
            }
            else
            {
                ++i;
            }
        }
    }
static void PruneOverlap ( PruneContext * context , const uintptr_t * key , OverlapEntry * value ) { TriggerExitedCallback callback = context -> m_Callback ; void * user_data = context -> m_UserData ; OverlapCache * cache = context -> m_Cache ; void * object_a = ( void * ) * key ; uint32_t i = 0 ; while ( i < value -> m_OverlapCount ) { Overlap & overlap = value -> m_Overlaps [ i ] ; if ( overlap . m_Count == 0 ) { OverlapEntry * entry = cache -> m_OverlapCache . Get ( ( uintptr_t ) overlap . m_Object ) ; if ( callback != 0x0 ) { TriggerExit data ; data . m_UserDataA = value -> m_UserData ; data . m_UserDataB = entry -> m_UserData ; data . m_GroupA = value -> m_Group ; data . m_GroupB = entry -> m_Group ; callback ( data , user_data ) ; } RemoveOverlap ( entry , object_a ) ; overlap = value -> m_Overlaps [ value -> m_OverlapCount - 1 ] ; -- value -> m_OverlapCount ; } else { ++ i ; } } }
Prunes an entry, used to iterate the cache when pruning.
Prunes an entry used to iterate the cache when pruning .
// Iterate overlaps // Condition to prune: no registered contacts // Trigger exit callback