GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::CollisionLayers Class Reference

Set of collision layers that a collider may belong to. More...

#include <GREM/physics/Shape.hpp>

Public Member Functions

constexpr CollisionLayers () noexcept=default
 Construct an empty layer set.
constexpr CollisionLayers (CollisionLayer layer) noexcept
 Construct a layer set containing only one specific layer.
constexpr bool operator== (const CollisionLayers &other) const noexcept=default
 Compare this layer set to another for equality.
constexpr bool empty () const noexcept
 Check if the layer set is empty.
constexpr bool contains (CollisionLayer layer) const noexcept
 Check if the layer set contains the given layer.
constexpr bool containsAnyOf (CollisionLayers layers) const noexcept
 Check if the layer set contains at least one of the given layers.
constexpr bool containsAllOf (CollisionLayers layers) const noexcept
 Check if the layer set contains all of the given layers.

Static Public Attributes

static const CollisionLayers ALL = ~CollisionLayers{}
 Set containing all possible layers.

Friends

constexpr CollisionLayers operator~ (CollisionLayers a) noexcept
 Get the complement of a layer set.
constexpr CollisionLayers operator& (CollisionLayers a, CollisionLayers b) noexcept
 Get the intersection of two layer sets.
constexpr CollisionLayers operator| (CollisionLayers a, CollisionLayers b) noexcept
 Get the union of two layer sets.
constexpr CollisionLayers operator^ (CollisionLayers a, CollisionLayers b) noexcept
 Get the symmetric difference of two layer sets.
constexpr CollisionLayers & operator&= (CollisionLayers &a, CollisionLayers b) noexcept
 Assign the intersection of two layer sets to the first set.
constexpr CollisionLayers & operator|= (CollisionLayers &a, CollisionLayers b) noexcept
 Assign the union of two layer sets to the first set.
constexpr CollisionLayers & operator^= (CollisionLayers &a, CollisionLayers b) noexcept
 Assign the symmetric difference of two layer sets to the first set.

Detailed Description

Set of collision layers that a collider may belong to.

Constructor & Destructor Documentation

◆ CollisionLayers() [1/2]

grem::physics::CollisionLayers::CollisionLayers ( )
constexprdefaultnoexcept

Construct an empty layer set.

◆ CollisionLayers() [2/2]

grem::physics::CollisionLayers::CollisionLayers ( CollisionLayer layer)
inlineconstexprnoexcept

Construct a layer set containing only one specific layer.

Parameters
layerlayer identifier to include.
Note
Layer sets can be combined using operator|(CollisionLayer, CollisionLayer).

Member Function Documentation

◆ operator==()

bool grem::physics::CollisionLayers::operator== ( const CollisionLayers & other) const
nodiscardconstexprdefaultnoexcept

Compare this layer set to another for equality.

Parameters
otherthe layer set to compare this one to.
Returns
true if the layer sets are equal, false otherwise.

◆ empty()

bool grem::physics::CollisionLayers::empty ( ) const
inlinenodiscardconstexprnoexcept

Check if the layer set is empty.

Returns
true if the set contains no layers, false otherwise.

◆ contains()

bool grem::physics::CollisionLayers::contains ( CollisionLayer layer) const
inlinenodiscardconstexprnoexcept

Check if the layer set contains the given layer.

Parameters
layerlayer identifier to check for.
Returns
true if the set contains the given layer, false otherwise.

◆ containsAnyOf()

bool grem::physics::CollisionLayers::containsAnyOf ( CollisionLayers layers) const
inlinenodiscardconstexprnoexcept

Check if the layer set contains at least one of the given layers.

Parameters
layerslayer set to check for.
Returns
true if the set contains at least one of the given layers, false otherwise.

◆ containsAllOf()

bool grem::physics::CollisionLayers::containsAllOf ( CollisionLayers layers) const
inlinenodiscardconstexprnoexcept

Check if the layer set contains all of the given layers.

Parameters
layerslayer set to check for.
Returns
true if the set contains all of the given layers, false otherwise.

◆ operator~

CollisionLayers operator~ ( CollisionLayers a)
friend

Get the complement of a layer set.

Parameters
athe set to invert.
Returns
a set containing all possible layers except those in the given set.

◆ operator&

CollisionLayers operator& ( CollisionLayers a,
CollisionLayers b )
friend

Get the intersection of two layer sets.

Parameters
afirst layer set.
bsecond layer set.
Returns
a set containing all layers contained in both a and b.

◆ operator|

CollisionLayers operator| ( CollisionLayers a,
CollisionLayers b )
friend

Get the union of two layer sets.

Parameters
afirst layer set.
bsecond layer set.
Returns
a set containing all layers contained in a or b or both.

◆ operator^

CollisionLayers operator^ ( CollisionLayers a,
CollisionLayers b )
friend

Get the symmetric difference of two layer sets.

Parameters
afirst layer set.
bsecond layer set.
Returns
a set containing all layers contained in either a or b, but not both.

◆ operator&=

CollisionLayers & operator&= ( CollisionLayers & a,
CollisionLayers b )
friend

Assign the intersection of two layer sets to the first set.

Parameters
afirst layer set.
bsecond layer set.
Returns
a reference to the first set, which was assigned to.

◆ operator|=

CollisionLayers & operator|= ( CollisionLayers & a,
CollisionLayers b )
friend

Assign the union of two layer sets to the first set.

Parameters
afirst layer set.
bsecond layer set.
Returns
a reference to the first set, which was assigned to.

◆ operator^=

CollisionLayers & operator^= ( CollisionLayers & a,
CollisionLayers b )
friend

Assign the symmetric difference of two layer sets to the first set.

Parameters
afirst layer set.
bsecond layer set.
Returns
a reference to the first set, which was assigned to.

Member Data Documentation

◆ ALL

CollisionLayers grem::physics::CollisionLayers::ALL = ~CollisionLayers{}
inlinestaticconstexpr

Set containing all possible layers.


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