PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::WorldConf Struct Reference

World configuration data. More...

#include <playrho/d2/WorldConf.hpp>

Collaboration diagram for playrho::d2::WorldConf:
[legend]

Public Member Functions

constexpr WorldConfUseContactCapacity (ContactCounter value) noexcept
 Uses the given value as the initial contact capacity.
 
constexpr WorldConfUseProxyCapacity (ContactCounter value) noexcept
 Uses the given value as the initial proxy capacity.
 
constexpr WorldConfUseTreeCapacity (ContactCounter value) noexcept
 Uses the given value as the initial dynamic tree size.
 
constexpr WorldConfUseUpstream (pmr::memory_resource *value) noexcept
 Uses the given min vertex radius value.
 
constexpr WorldConfUseVertexRadius (const Interval< Positive< Length >> &value) noexcept
 Uses the given vertex radius range value.
 

Public Attributes

ContactCounter contactCapacity = DefaultContactCapacity
 Initial contact capacity.
 
bool doStats = DefaultDoStats
 Whether to collect resource statistics or not. More...
 
ContactCounter proxyCapacity = DefaultProxyCapacity
 Initial proxy capacity.
 
BodyCounter reserveBodyConstraints = DefaultReserveBodyConstraints
 Initial reserve body constraints capacity in #-of-elements. More...
 
BodyCounter reserveBodyStack = DefaultReserveBodyStack
 Initial reserve body stack capacity in #-of-elements. More...
 
std::uint8_t reserveBuffers = DefaultReserveBuffers
 Initial reserve buffers capacity in #-of-elements.
 
ContactCounter reserveContactKeys = DefaultReserveContactKeys
 Initial reserve contact keys capacity in #-of-elements. More...
 
ContactCounter reserveDistanceConstraints = DefaultReserveDistanceConstraints
 Initial reserve distance constraints capacity in #-of-elements. More...
 
ContactCounter treeCapacity = DefaultTreeCapacity
 Initial tree size.
 
pmr::memory_resourceupstream = DefaultUpstream
 Upstream memory resource.
 
Interval< Positive< Length > > vertexRadius = DefaultVertexRadius
 Allowable vertex radius range. More...
 

Static Public Attributes

static constexpr auto DefaultContactCapacity = ContactCounter(2048u)
 Default contact capacity.
 
static constexpr auto DefaultDoStats = false
 Default do-stats value.
 
static constexpr auto DefaultProxyCapacity = ContactCounter(1024)
 Default initial proxy capacity.
 
static constexpr auto DefaultReserveBodyConstraints = BodyCounter(1024u)
 Default initial reserve body constraints capacity.
 
static constexpr auto DefaultReserveBodyStack = BodyCounter(16384u)
 Default initial reserve body stack capacity.
 
static constexpr auto DefaultReserveBuffers = std::uint8_t(1u)
 Default initial reserve buffers capacity.
 
static constexpr auto DefaultReserveContactKeys = ContactCounter(1024u)
 Default initial reserve contact keys capacity.
 
static constexpr auto DefaultReserveDistanceConstraints = ContactCounter{DefaultReserveBodyConstraints * 4u}
 Default initial reserve distance constraints capacity.
 
static constexpr auto DefaultTreeCapacity = ContactCounter(4096u)
 Default tree capacity.
 
static const auto DefaultUpstream = pmr::new_delete_resource()
 Default upstream memory resource. More...
 
static constexpr auto DefaultVertexRadius
 Default vertex radius range. More...
 

Detailed Description

World configuration data.

Member Data Documentation

◆ DefaultUpstream

const auto playrho::d2::WorldConf::DefaultUpstream = pmr::new_delete_resource()
inlinestatic

Default upstream memory resource.

Warning
The pointed to object must stay valid for the life of the configured world.

◆ DefaultVertexRadius

constexpr auto playrho::d2::WorldConf::DefaultVertexRadius
staticconstexpr
Initial value:
= Interval<Positive<Length>>{
}
constexpr auto DefaultMinVertexRadius
Default minimum vertex radius.
Definition: Settings.hpp:105
constexpr auto DefaultMaxVertexRadius
Default maximum vertex radius.
Definition: Settings.hpp:110

Default vertex radius range.

◆ doStats

bool playrho::d2::WorldConf::doStats = DefaultDoStats

Whether to collect resource statistics or not.

Note
The collected statistics can help tweak the reserve* data members to help avoid dynamic memory allocation during world step processing. Collecting these statistics incurs some performance overhead however, so consider disabling this setting after getting those data members tweaked to your needs.
See also
GetResourceStats(const World&).

◆ reserveBodyConstraints

BodyCounter playrho::d2::WorldConf::reserveBodyConstraints = DefaultReserveBodyConstraints

Initial reserve body constraints capacity in #-of-elements.

Note
This is tied to the number of bodies in the world.

◆ reserveBodyStack

BodyCounter playrho::d2::WorldConf::reserveBodyStack = DefaultReserveBodyStack

Initial reserve body stack capacity in #-of-elements.

Note
Max body stack #-of-elements capacity has upper bound of # of bodies in world.

◆ reserveContactKeys

ContactCounter playrho::d2::WorldConf::reserveContactKeys = DefaultReserveContactKeys

Initial reserve contact keys capacity in #-of-elements.

Note
This is used as the reserve buffer #-of-elements for finding contacts. The number of contact keys has an upper bound of the square of the number of bodies in the world.

◆ reserveDistanceConstraints

ContactCounter playrho::d2::WorldConf::reserveDistanceConstraints = DefaultReserveDistanceConstraints

Initial reserve distance constraints capacity in #-of-elements.

Note
This is used for reserving #-of-elements capacity for position and velocity constraints. It's tied to the number of contacts in the world.

◆ vertexRadius

Interval<Positive<Length> > playrho::d2::WorldConf::vertexRadius = DefaultVertexRadius

Allowable vertex radius range.

The allowable vertex radius range that this world establishes which shapes may be created with. Trying to create a shape having a vertex radius outside this range will be rejected.

Note
This value probably should not be changed except to experiment with what can happen.
Making the minimum too small means some shapes could have insufficient buffer for continuous collision.
Making the minimum too large may create artifacts for vertex collision.
Making the maximum too small or too large may cause numerical issues dealing with tolerance and target depth.

The documentation for this struct was generated from the following file: