group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
physics::ContactCache Class Reference

#include <ContactCache.hpp>

Classes

struct  Entry

Public Member Functions

ContactManifoldmerge (const ContactManifold &incoming)
 Look up the cached manifold for (a, b), copy accumulated impulses from any matching feature ids, then store incoming as the new cache entry.
void endFrame () noexcept
 Drop any cached manifolds that weren't merged this frame.
auto begin ()
 Iterate every live cached manifold (e.g. for the solver).
auto end ()
auto begin () const
auto end () const
size_t size () const noexcept
void clear () noexcept

Static Public Member Functions

static uint64_t pairKey (entt::entity a, entt::entity b) noexcept
 Canonical 64-bit key for an ordered pair (a, b) — undirected, so swapping a and b yields the same key.

Private Attributes

std::unordered_map< uint64_t, Entrycache_
uint32_t currentFrame_ = 0

Member Function Documentation

◆ begin() [1/2]

auto physics::ContactCache::begin ( )
inlinenodiscard

Iterate every live cached manifold (e.g. for the solver).

◆ begin() [2/2]

auto physics::ContactCache::begin ( ) const
inlinenodiscard

◆ clear()

void physics::ContactCache::clear ( )
noexcept

◆ end() [1/2]

auto physics::ContactCache::end ( )
inlinenodiscard

◆ end() [2/2]

auto physics::ContactCache::end ( ) const
inlinenodiscard

◆ endFrame()

void physics::ContactCache::endFrame ( )
noexcept

Drop any cached manifolds that weren't merged this frame.

MUST be called once per tick after every collision pair has been merged.

Here is the caller graph for this function:

◆ merge()

ContactManifold & physics::ContactCache::merge ( const ContactManifold & incoming)

Look up the cached manifold for (a, b), copy accumulated impulses from any matching feature ids, then store incoming as the new cache entry.

Returns the in-cache reference (already warm-started) for the solver to consume.

Here is the call graph for this function:

◆ pairKey()

uint64_t physics::ContactCache::pairKey ( entt::entity a,
entt::entity b )
staticnodiscardnoexcept

Canonical 64-bit key for an ordered pair (a, b) — undirected, so swapping a and b yields the same key.

Here is the caller graph for this function:

◆ size()

size_t physics::ContactCache::size ( ) const
inlinenodiscardnoexcept
Here is the caller graph for this function:

Member Data Documentation

◆ cache_

std::unordered_map<uint64_t, Entry> physics::ContactCache::cache_
private

◆ currentFrame_

uint32_t physics::ContactCache::currentFrame_ = 0
private

The documentation for this class was generated from the following files: