engine/physics/src/physics/physics.cpp
/**
     * Add the entry of two overlapping objects to the cache.
     * Automatically creates the overlap, but is not symmetric.
     */
Add the entry of two overlapping objects to the cache.
Automatically creates the overlap, but is not symmetric.
Add the entry of two overlapping objects to the cache . Automatically creates the overlap but is not symmetric .
static void AddEntry(OverlapCache* cache, void* object_a, void* user_data_a, void* object_b, uint16_t group_a)
    {
        uint32_t size = cache->m_OverlapCache.Size();
        uint32_t capacity = cache->m_OverlapCache.Capacity();
        if (size > 3 * capacity / 4)
        {
            capacity += CACHE_EXPANSION;
            cache->m_OverlapCache.SetCapacity(3 * capacity / 4, capacity);
        }
        OverlapEntry entry;
        memset(&entry, 0, sizeof(entry));
        entry.m_Overlaps = (Overlap*)malloc(cache->m_TriggerOverlapCapacity * sizeof(Overlap));
        entry.m_UserData = user_data_a;
        entry.m_Group = group_a;
        AddOverlap(&entry, object_b, 0x0, cache->m_TriggerOverlapCapacity);
        cache->m_OverlapCache.Put((uintptr_t)object_a, entry);
    }
static void AddEntry ( OverlapCache * cache , void * object_a , void * user_data_a , void * object_b , uint16_t group_a ) { uint32_t size = cache -> m_OverlapCache . Size ( ) ; uint32_t capacity = cache -> m_OverlapCache . Capacity ( ) ; if ( size > 3 * capacity / 4 ) { capacity += CACHE_EXPANSION ; cache -> m_OverlapCache . SetCapacity ( 3 * capacity / 4 , capacity ) ; } OverlapEntry entry ; memset ( & entry , 0 , sizeof ( entry ) ) ; entry . m_Overlaps = ( Overlap * ) malloc ( cache -> m_TriggerOverlapCapacity * sizeof ( Overlap ) ) ; entry . m_UserData = user_data_a ; entry . m_Group = group_a ; AddOverlap ( & entry , object_b , 0x0 , cache -> m_TriggerOverlapCapacity ) ; cache -> m_OverlapCache . Put ( ( uintptr_t ) object_a , entry ) ; }
Add the entry of two overlapping objects to the cache.
Add the entry of two overlapping objects to the cache .
// Check if the cache needs to be expanded // Expand when 80% full // Add overlap to the entry // Add the entry