CoriEngine
Loading...
Searching...
No Matches
Cori::Utility Namespace Reference

A namespace for utilities of different kinds. More...

Namespaces

namespace  Internal

Classes

struct  AABB
 Axis-Aligned bounding box. More...
struct  HashedTag64
 HashedTag that uses a 64bit string hash (FNV-1a). More...
class  RandomUint32
 Random uint32_t generator. More...

Concepts

concept  IsInPack
 Checks if T is present in Types pack.
concept  HasDuplicates
 Checks if Types pack has duplicated types.
concept  IsStreamable
 Checks if T can be streamed.

Typedefs

using StringHash64 = uint64_t
using StringHash32 = entt::hashed_string::hash_type

Functions

AABB CalculateAABB (const glm::mat3 &transform, const glm::vec2 halfSize)
 Calculates the AABB for the quad taking into account rotation and scale.
bool AABBOverlapCheck (const AABB &a, const AABB &b)
 Checks if 2 AABBs overlap.
template<typename T>
consteval uint64_t GetAggregateStructUID ()
 Generates a stable, unique ID for an aggregate struct at compile-time.
constexpr std::uint64_t fnv1a64 (const char *str, const std::size_t len)
 Computes the 64bit FNV-1a string hash.
std::u32string Utf8ToUtf32 (const std::string_view &view)
 Converts a UTF-8 variable length encoded string to a UTF-32 fixed length encoded string.
std::u32string Utf8ToUtf32 (const std::string &string)
 Converts a UTF-8 variable length encoded string to a UTF-32 fixed length encoded string.

Detailed Description

A namespace for utilities of different kinds.

Typedef Documentation

◆ StringHash32

using Cori::Utility::StringHash32 = entt::hashed_string::hash_type

Definition at line 19 of file StringHash.hpp.

◆ StringHash64

using Cori::Utility::StringHash64 = uint64_t

Definition at line 18 of file StringHash.hpp.

Function Documentation

◆ AABBOverlapCheck()

bool Cori::Utility::AABBOverlapCheck ( const AABB & a,
const AABB & b )
inlinenodiscard

Checks if 2 AABBs overlap.

Parameters
aFirst AABB.
bSecond AABB.
Returns
True if overlap, false othwerise.

Definition at line 47 of file AABB.hpp.

◆ CalculateAABB()

AABB Cori::Utility::CalculateAABB ( const glm::mat3 & transform,
const glm::vec2 halfSize )
inlinenodiscard

Calculates the AABB for the quad taking into account rotation and scale.

Parameters
transformTransform of the quad. Position in the matrix should be the center of the quad.
halfSizeHalf size of the quad.
Returns
A calculated AABB.

Definition at line 22 of file AABB.hpp.

◆ fnv1a64()

std::uint64_t Cori::Utility::fnv1a64 ( const char * str,
const std::size_t len )
constexpr

Computes the 64bit FNV-1a string hash.

Definition at line 9 of file StringHash.hpp.

◆ GetAggregateStructUID()

template<typename T>
uint64_t Cori::Utility::GetAggregateStructUID ( )
consteval

Generates a stable, unique ID for an aggregate struct at compile-time.

Template Parameters
TStruct type to generate the UID for.
Returns
Unique struct ID.

The ID is sensitive to the struct's name and the order and types of its members.
It is stable across different runs for the same compiler.

Definition at line 56 of file AggregateStructUID.hpp.

Here is the call graph for this function:

◆ Utf8ToUtf32() [1/2]

std::u32string Cori::Utility::Utf8ToUtf32 ( const std::string & string)
inline

Converts a UTF-8 variable length encoded string to a UTF-32 fixed length encoded string.

Parameters
stringUTF-8 variable length encoded string.
Returns
UTF-32 fixed length encoded string.

Definition at line 37 of file UTF.hpp.

Here is the call graph for this function:

◆ Utf8ToUtf32() [2/2]

std::u32string Cori::Utility::Utf8ToUtf32 ( const std::string_view & view)
inline

Converts a UTF-8 variable length encoded string to a UTF-32 fixed length encoded string.

Parameters
viewView to the UTF-8 variable length encoded string.
Returns
UTF-32 fixed length encoded string.

Definition at line 11 of file UTF.hpp.