FastUIDraw
Namespaces | Classes | Macros | Typedefs | Functions
Utility

Utility provides simple utility classes, the most important and commonly used ones being reference_counted_ptr, vecN, and c_array. Part of the main library libFastUIDraw. More...

Namespaces

 fastuidraw
 all classes and functions of FastUIDraw are in the namespace fastuidraw.
 

Classes

class  fastuidraw::BlendMode
 Class to hold the blend mode as exposed by typical 3D APIs. More...
 
class  fastuidraw::c_array< T >
 A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provide an STL-like iterator interface. More...
 
class  fastuidraw::DataBuffer
 DataBuffer is an implementation of DataBufferBase where the data is directly backed by memory. More...
 
class  fastuidraw::DataBufferBackingStore
 Represents a buffer directly stored in memory. More...
 
class  fastuidraw::DataBufferBase
 Base class for passing around buffers of data; derived classes have the responsibility of maintaining storage cleanup at destruction. More...
 
class  fastuidraw::gpu_dirty_state
 
class  fastuidraw::matrix3x3< T >
 A representation of a 3x3 matrix, that in addition to the NxN matrix functionality provides function for calculating the determinant. More...
 
class  fastuidraw::matrixNxM< N, M, T >
 A generic matrix class. The operator() is overloaded to access elements of the matrix as follows: More...
 
class  fastuidraw::Mutex
 
class  fastuidraw::orthogonal_projection_params< T >
 An orthogonal_projection_params holds the data to describe an orthogonal projection matrix without perspective. More...
 
class  fastuidraw::projection_params< T >
 A projection_params holds the data to describe a projection matrix with perspective. More...
 
class  fastuidraw::reference_count_atomic
 Reference counter that is thread safe by having increment and decrement operations by atomic operations, this is usually faster (and much faster) than reference_count_mutex. More...
 
class  fastuidraw::reference_count_non_concurrent
 Reference counter that is NOT thread safe. More...
 
class  fastuidraw::reference_counted< T >
 Defines default reference counting base classes. More...
 
class  fastuidraw::reference_counted_base< T, Counter >
 Base class to use for reference counted objects, for using reference_counted_ptr. See also reference_counted. Object deletion (when the reference count goes to zero) is performed via FASTUIDRAWdelete. As a consequence of using FASTUIDRAWdelete, objects must be created with FASTUIDRAWnew. More...
 
class  fastuidraw::reference_counted_ptr< T >
 A wrapper over a pointer to implement reference counting. More...
 
class  fastuidraw::resource_base
 A common base class to use for resources that need to be saved opaquely. More...
 
class  fastuidraw::static_resource
 Provided as a conveniance. The ctor calls generate_static_resource(). More...
 
class  fastuidraw::unvecN< T >
 
class  fastuidraw::vecN< T, N >
 vecN is a simple static array class with no virtual functions and no memory overhead. Supports runtim array index checking and STL style iterators via pointer iterators. More...
 

Macros

#define FASTUIDRAW_MASK(BIT0, NUMBITS)   (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(NUMBITS) << uint32_t(BIT0))
 
#define FASTUIDRAW_MASK_U64(BIT0, NUMBITS)   (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(NUMBITS) << uint64_t(BIT0))
 
#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(X)   ( (uint32_t(1) << uint32_t(X)) - uint32_t(1) )
 
#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(X)   ( (uint64_t(1) << uint64_t(X)) - uint64_t(1) )
 
#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED(X)   (FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X) >> 2u)
 
#define FASTUIDRAW_PI   3.14159265358979323846f
 
#define FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X)   (((X) + 3u) & ~3u)
 
#define FASTUIDRAWassert(X)
 
#define FASTUIDRAWcalloc(nmemb, size)   fastuidraw::memory::calloc_implement(nmemb, size, __FILE__, __LINE__)
 
#define FASTUIDRAWdelete(ptr)
 
#define FASTUIDRAWfree(ptr)   fastuidraw::memory::free_implement(ptr, __FILE__, __LINE__)
 
#define FASTUIDRAWmalloc(size)   fastuidraw::memory::malloc_implement(size, __FILE__, __LINE__)
 
#define FASTUIDRAWmessaged_assert(X, Y)
 
#define FASTUIDRAWnew   ::new(__FILE__, __LINE__)
 
#define FASTUIDRAWrealloc(ptr, size)   fastuidraw::memory::realloc_implement(ptr, size, __FILE__, __LINE__)
 
#define FASTUIDRAWstatic_assert(X)   static_assert(X, #X)
 
#define FASTUIDRAWunused(X)   do { (void)(X); } while(0)
 

Typedefs

typedef vecN< double, 1 > fastuidraw::dvec1
 
typedef vecN< double, 2 > fastuidraw::dvec2
 
typedef vecN< double, 3 > fastuidraw::dvec3
 
typedef vecN< double, 4 > fastuidraw::dvec4
 
typedef matrixNxM< 2, 2, float > fastuidraw::float2x2
 Convenience typedef to matrixNxM<2, float>
 
typedef matrix3x3< float > fastuidraw::float3x3
 Convenience typedef to matrix3x3<float>
 
typedef orthogonal_projection_params< float > fastuidraw::float_orthogonal_projection_params
 Convenience typedef for orthogonal_projection_params<float>
 
typedef projection_params< float > fastuidraw::float_projection_params
 Convenience typedef for projection_params<float>
 
typedef vecN< int16_t, 1 > fastuidraw::i16vec1
 
typedef vecN< int16_t, 2 > fastuidraw::i16vec2
 
typedef vecN< int16_t, 3 > fastuidraw::i16vec3
 
typedef vecN< int16_t, 4 > fastuidraw::i16vec4
 
typedef vecN< int32_t, 1 > fastuidraw::i32vec1
 
typedef vecN< int32_t, 2 > fastuidraw::i32vec2
 
typedef vecN< int32_t, 3 > fastuidraw::i32vec3
 
typedef vecN< int32_t, 4 > fastuidraw::i32vec4
 
typedef vecN< int64_t, 1 > fastuidraw::i64vec1
 
typedef vecN< int64_t, 2 > fastuidraw::i64vec2
 
typedef vecN< int64_t, 3 > fastuidraw::i64vec3
 
typedef vecN< int64_t, 4 > fastuidraw::i64vec4
 
typedef vecN< int8_t, 1 > fastuidraw::i8vec1
 
typedef vecN< int8_t, 2 > fastuidraw::i8vec2
 
typedef vecN< int8_t, 3 > fastuidraw::i8vec3
 
typedef vecN< int8_t, 4 > fastuidraw::i8vec4
 
typedef vecN< int32_t, 1 > fastuidraw::ivec1
 
typedef vecN< int32_t, 2 > fastuidraw::ivec2
 
typedef vecN< int32_t, 3 > fastuidraw::ivec3
 
typedef vecN< int32_t, 4 > fastuidraw::ivec4
 
typedef vecN< uint16_t, 1 > fastuidraw::u16vec1
 
typedef vecN< uint16_t, 2 > fastuidraw::u16vec2
 
typedef vecN< uint16_t, 3 > fastuidraw::u16vec3
 
typedef vecN< uint16_t, 4 > fastuidraw::u16vec4
 
typedef vecN< uint32_t, 1 > fastuidraw::u32vec1
 
typedef vecN< uint32_t, 2 > fastuidraw::u32vec2
 
typedef vecN< uint32_t, 3 > fastuidraw::u32vec3
 
typedef vecN< uint32_t, 4 > fastuidraw::u32vec4
 
typedef vecN< uint64_t, 1 > fastuidraw::u64vec1
 
typedef vecN< uint64_t, 2 > fastuidraw::u64vec2
 
typedef vecN< uint64_t, 3 > fastuidraw::u64vec3
 
typedef vecN< uint64_t, 4 > fastuidraw::u64vec4
 
typedef vecN< uint8_t, 1 > fastuidraw::u8vec1
 
typedef vecN< uint8_t, 2 > fastuidraw::u8vec2
 
typedef vecN< uint8_t, 3 > fastuidraw::u8vec3
 
typedef vecN< uint8_t, 4 > fastuidraw::u8vec4
 
typedef vecN< uint32_t, 1 > fastuidraw::uvec1
 
typedef vecN< uint32_t, 2 > fastuidraw::uvec2
 
typedef vecN< uint32_t, 3 > fastuidraw::uvec3
 
typedef vecN< uint32_t, 4 > fastuidraw::uvec4
 
typedef vecN< float, 1 > fastuidraw::vec1
 
typedef vecN< float, 2 > fastuidraw::vec2
 
typedef vecN< float, 3 > fastuidraw::vec3
 
typedef vecN< float, 4 > fastuidraw::vec4
 

Functions

void fastuidraw::convert_to_fp16 (c_array< const float > src, c_array< uint16_t > dst)
 
void fastuidraw::convert_to_fp32 (c_array< const uint16_t > src, c_array< float > dst)
 
template<typename T >
vecN< T, 3 > fastuidraw::cross_product (const vecN< T, 3 > &a, const vecN< T, 3 > &b)
 
template<typename T , size_t N>
fastuidraw::dot (const vecN< T, N > &a, const vecN< T, N > &b)
 
c_array< const uint8_t > fastuidraw::fetch_static_resource (c_string resource_label)
 
void fastuidraw::generate_static_resource (c_string resource_label, c_array< const uint8_t > value)
 
void fastuidraw::generate_static_resource (c_string resource_label, c_string value)
 
float fastuidraw::local_distance_from_pixel_distance (float distance, const vec2 &resolution, const float3x3 &transformation_matrix, const vec2 &point, const vec2 &direction)
 
template<typename T , size_t N>
fastuidraw::magnitude (const vecN< T, N > &in)
 
template<typename T , size_t N>
bool fastuidraw::magnitude_compare (const vecN< T, N > &a, const vecN< T, N > &b)
 
template<typename T , size_t N>
fastuidraw::magnitudeSq (const vecN< T, N > &in)
 
template<typename T , typename S >
bool fastuidraw::operator!= (T *lhs, const reference_counted_ptr< S > &rhs)
 
template<typename T , typename S >
bool fastuidraw::operator== (T *lhs, const reference_counted_ptr< S > &rhs)
 
uint32_t fastuidraw::pack_as_fp16 (vec2 src)
 
uint32_t fastuidraw::pack_as_fp16 (float x, float y)
 
uvec4 fastuidraw::pack_vec4 (float x, float y, float z, float w)
 
uvec4 fastuidraw::pack_vec4 (const vec4 &v)
 
template<typename T >
void fastuidraw::swap (reference_counted_ptr< T > &lhs, reference_counted_ptr< T > &rhs)
 
int fastuidraw::t_abs (int x)
 
long fastuidraw::t_abs (long x)
 
long long fastuidraw::t_abs (long long x)
 
float fastuidraw::t_abs (float x)
 
double fastuidraw::t_abs (double x)
 
long double fastuidraw::t_abs (long double x)
 
float fastuidraw::t_acos (float x)
 
double fastuidraw::t_acos (double x)
 
long double fastuidraw::t_acos (long double x)
 
float fastuidraw::t_asin (float x)
 
double fastuidraw::t_asin (double x)
 
long double fastuidraw::t_asin (long double x)
 
float fastuidraw::t_atan (float x)
 
double fastuidraw::t_atan (double x)
 
long double fastuidraw::t_atan (long double x)
 
float fastuidraw::t_atan2 (float y, float x)
 
double fastuidraw::t_atan2 (double y, double x)
 
long double fastuidraw::t_atan2 (long double y, long double x)
 
float fastuidraw::t_cos (float x)
 
double fastuidraw::t_cos (double x)
 
long double fastuidraw::t_cos (long double x)
 
template<typename T >
const T & fastuidraw::t_max (const T &a, const T &b)
 
template<typename T >
const T & fastuidraw::t_min (const T &a, const T &b)
 
template<typename T >
fastuidraw::t_sign (const T &a)
 
float fastuidraw::t_sin (float x)
 
double fastuidraw::t_sin (double x)
 
long double fastuidraw::t_sin (long double x)
 
float fastuidraw::t_sqrt (float x)
 
double fastuidraw::t_sqrt (double x)
 
long double fastuidraw::t_sqrt (long double x)
 
float fastuidraw::t_tan (float x)
 
double fastuidraw::t_tan (double x)
 
long double fastuidraw::t_tan (long double x)
 
template<typename T , size_t N>
fastuidraw::triangle_area (const vecN< T, N > &p0, const vecN< T, N > &p1, const vecN< T, N > &p2)
 

Detailed Description

Utility provides simple utility classes, the most important and commonly used ones being reference_counted_ptr, vecN, and c_array. Part of the main library libFastUIDraw.

Macro Definition Documentation

◆ FASTUIDRAW_MASK

#define FASTUIDRAW_MASK (   BIT0,
  NUMBITS 
)    (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(NUMBITS) << uint32_t(BIT0))

Macro that generates a 32-bit mask from number bits and location of bit0 to use

Parameters
BIT0first bit of mask
NUMBITSnuber bits of mask

Definition at line 59 of file util.hpp.

◆ FASTUIDRAW_MASK_U64

#define FASTUIDRAW_MASK_U64 (   BIT0,
  NUMBITS 
)    (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(NUMBITS) << uint64_t(BIT0))

Macro that generates a 64-bit mask from number bits and location of bit0 to use

Parameters
BIT0first bit of mask
NUMBITSnuber bits of mask

Definition at line 75 of file util.hpp.

◆ FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS

#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS (   X)    ( (uint32_t(1) << uint32_t(X)) - uint32_t(1) )

Macro that gives the maximum value that can be held with a given number of bits. Caveat: if X is 32 (or higher), bad things may happen from overflow.

Parameters
Xnumber bits

Definition at line 51 of file util.hpp.

◆ FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64

#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64 (   X)    ( (uint64_t(1) << uint64_t(X)) - uint64_t(1) )

Macro that gives the maximum value that can be held with a given number of bits, returning an unsigned 64-bit integer.

Parameters
Xnumber bits

Definition at line 67 of file util.hpp.

◆ FASTUIDRAW_NUMBER_BLOCK4_NEEDED

#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED (   X)    (FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X) >> 2u)

Macro to return how many blocks of size 4 to contain a given size, i.e. the smallest integer N so that 4 * N >= X where X is an uint32_t.

Definition at line 42 of file util.hpp.

◆ FASTUIDRAW_PI

#define FASTUIDRAW_PI   3.14159265358979323846f

Macro giving the value of pi as a float

Definition at line 35 of file math.hpp.

◆ FASTUIDRAW_ROUND_UP_MULTIPLE_OF4

#define FASTUIDRAW_ROUND_UP_MULTIPLE_OF4 (   X)    (((X) + 3u) & ~3u)

Macro to round up an uint32_t to a multiple or 4

Definition at line 35 of file util.hpp.

◆ FASTUIDRAWassert

#define FASTUIDRAWassert (   X)

If FASTUIDRAW_DEBUG is defined, checks if the statement is true and if it is not true prints to std::cerr and then aborts. If FastUIDRAW_DEBUG is not defined, then macro is empty (and thus the condition is not evaluated).

Parameters
Xcondition to check

Definition at line 99 of file util.hpp.

◆ FASTUIDRAWcalloc

#define FASTUIDRAWcalloc (   nmemb,
  size 
)    fastuidraw::memory::calloc_implement(nmemb, size, __FILE__, __LINE__)

For debug build of FastUIDraw, allocations with FASTUIDRAWcalloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::calloc.

Parameters
nmembnumber of elements to allocate
sizesize of each element in bytes

Definition at line 73 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWdelete

#define FASTUIDRAWdelete (   ptr)
Value:
do { \
fastuidraw::memory::check_object_exists(ptr, __FILE__, __LINE__); \
fastuidraw::memory::call_dtor(ptr); \
fastuidraw::memory::free_implement(ptr, __FILE__, __LINE__); \
} while(0)

Use FASTUIDRAWdelete to delete objects that were allocated with FASTUIDRAWnew. For debug builds of FastUIDraw, if the memory was not tracked an error message is emitted.

Parameters
ptraddress of object to delete, value must be a return value from FASTUIDRAWnew

Definition at line 49 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWfree

#define FASTUIDRAWfree (   ptr)    fastuidraw::memory::free_implement(ptr, __FILE__, __LINE__)

Use FASTUIDRAWfree for objects allocated with FASTUIDRAWmalloc, FASTUIDRAWrealloc and FASTUIDRAWcalloc. For release builds of FastUIDraw, maps to std::free.

Parameters
ptraddress of object to free

Definition at line 93 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWmalloc

#define FASTUIDRAWmalloc (   size)    fastuidraw::memory::malloc_implement(size, __FILE__, __LINE__)

For debug build of FastUIDraw, allocations with FASTUIDRAWmalloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::malloc.

Definition at line 62 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWmessaged_assert

#define FASTUIDRAWmessaged_assert (   X,
 
)
Value:
do { \
if (!(X)) { \
fastuidraw::assert_fail(Y, __FILE__, __LINE__); \
} } while(0)
void assert_fail(const char *str, const char *file, int line)

Regardless FASTUIDRAW_DEBUG is defined or not, checks if the statement is true and if it is not true prints to std::cerr. If FASTUIDRAW_DEBUG is defined also aborts.

Parameters
Xcondition to check
Ystring to print if condition is false

Definition at line 109 of file util.hpp.

◆ FASTUIDRAWnew

#define FASTUIDRAWnew   ::new(__FILE__, __LINE__)

When creating FastUIDraw objects, one must use FASTUIDRAWnew instead of new to create objects. For debug build of FastUIDraw, allocations with FASTUIDRAWnew are tracked and at program exit a list of those objects not deleted by FASTUIDRAWdelete are printed with the file and line number of the allocation. For release builds of FastUIDraw, allocations are not tracked and std::malloc is used to allocate memory. Do NOT use FASTUIDRAWnew for creating arrays (i.e. p = new type[N]) as FASTUIDRAWdelete does not handle array deletion.

Definition at line 39 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWrealloc

#define FASTUIDRAWrealloc (   ptr,
  size 
)    fastuidraw::memory::realloc_implement(ptr, size, __FILE__, __LINE__)

For debug build of FastUIDraw, allocations with FASTUIDRAWrealloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::realloc.

Parameters
ptrpointer at which to rellocate
sizenew size

Definition at line 84 of file fastuidraw_memory.hpp.

◆ FASTUIDRAWstatic_assert

#define FASTUIDRAWstatic_assert (   X)    static_assert(X, #X)

Conveniance for using static_assert where message is the condition stringified.

Definition at line 118 of file util.hpp.

◆ FASTUIDRAWunused

#define FASTUIDRAWunused (   X)    do { (void)(X); } while(0)

Macro to stop the compiler from reporting an argument as unused. Typically used on those arguments used in FASTUIDRAWassert invocation but otherwise unused.

Parameters
Xexpression of which to ignore the value

Definition at line 84 of file util.hpp.

Typedef Documentation

◆ dvec1

typedef vecN<double, 1> fastuidraw::dvec1

Conveniance typedef

Definition at line 1244 of file vecN.hpp.

◆ dvec2

typedef vecN<double, 2> fastuidraw::dvec2

Conveniance typedef

Definition at line 1248 of file vecN.hpp.

◆ dvec3

typedef vecN<double, 3> fastuidraw::dvec3

Conveniance typedef

Definition at line 1252 of file vecN.hpp.

◆ dvec4

typedef vecN<double, 4> fastuidraw::dvec4

Conveniance typedef

Definition at line 1256 of file vecN.hpp.

◆ i16vec1

typedef vecN<int16_t, 1> fastuidraw::i16vec1

Conveniance typedef

Definition at line 1312 of file vecN.hpp.

◆ i16vec2

typedef vecN<int16_t, 2> fastuidraw::i16vec2

Conveniance typedef

Definition at line 1316 of file vecN.hpp.

◆ i16vec3

typedef vecN<int16_t, 3> fastuidraw::i16vec3

Conveniance typedef

Definition at line 1320 of file vecN.hpp.

◆ i16vec4

typedef vecN<int16_t, 4> fastuidraw::i16vec4

Conveniance typedef

Definition at line 1324 of file vecN.hpp.

◆ i32vec1

typedef vecN<int32_t, 1> fastuidraw::i32vec1

Conveniance typedef

Definition at line 1329 of file vecN.hpp.

◆ i32vec2

typedef vecN<int32_t, 2> fastuidraw::i32vec2

Conveniance typedef

Definition at line 1333 of file vecN.hpp.

◆ i32vec3

typedef vecN<int32_t, 3> fastuidraw::i32vec3

Conveniance typedef

Definition at line 1337 of file vecN.hpp.

◆ i32vec4

typedef vecN<int32_t, 4> fastuidraw::i32vec4

Conveniance typedef

Definition at line 1341 of file vecN.hpp.

◆ i64vec1

typedef vecN<int64_t, 1> fastuidraw::i64vec1

Conveniance typedef

Definition at line 1346 of file vecN.hpp.

◆ i64vec2

typedef vecN<int64_t, 2> fastuidraw::i64vec2

Conveniance typedef

Definition at line 1350 of file vecN.hpp.

◆ i64vec3

typedef vecN<int64_t, 3> fastuidraw::i64vec3

Conveniance typedef

Definition at line 1354 of file vecN.hpp.

◆ i64vec4

typedef vecN<int64_t, 4> fastuidraw::i64vec4

Conveniance typedef

Definition at line 1358 of file vecN.hpp.

◆ i8vec1

typedef vecN<int8_t, 1> fastuidraw::i8vec1

Conveniance typedef

Definition at line 1295 of file vecN.hpp.

◆ i8vec2

typedef vecN<int8_t, 2> fastuidraw::i8vec2

Conveniance typedef

Definition at line 1299 of file vecN.hpp.

◆ i8vec3

typedef vecN<int8_t, 3> fastuidraw::i8vec3

Conveniance typedef

Definition at line 1303 of file vecN.hpp.

◆ i8vec4

typedef vecN<int8_t, 4> fastuidraw::i8vec4

Conveniance typedef

Definition at line 1307 of file vecN.hpp.

◆ ivec1

typedef vecN<int32_t, 1> fastuidraw::ivec1

Conveniance typedef

Definition at line 1261 of file vecN.hpp.

◆ ivec2

typedef vecN<int32_t, 2> fastuidraw::ivec2

Conveniance typedef

Definition at line 1265 of file vecN.hpp.

◆ ivec3

typedef vecN<int32_t, 3> fastuidraw::ivec3

Conveniance typedef

Definition at line 1269 of file vecN.hpp.

◆ ivec4

typedef vecN<int32_t, 4> fastuidraw::ivec4

Conveniance typedef

Definition at line 1273 of file vecN.hpp.

◆ u16vec1

typedef vecN<uint16_t, 1> fastuidraw::u16vec1

Conveniance typedef

Definition at line 1380 of file vecN.hpp.

◆ u16vec2

typedef vecN<uint16_t, 2> fastuidraw::u16vec2

Conveniance typedef

Definition at line 1384 of file vecN.hpp.

◆ u16vec3

typedef vecN<uint16_t, 3> fastuidraw::u16vec3

Conveniance typedef

Definition at line 1388 of file vecN.hpp.

◆ u16vec4

typedef vecN<uint16_t, 4> fastuidraw::u16vec4

Conveniance typedef

Definition at line 1392 of file vecN.hpp.

◆ u32vec1

typedef vecN<uint32_t, 1> fastuidraw::u32vec1

Conveniance typedef

Definition at line 1397 of file vecN.hpp.

◆ u32vec2

typedef vecN<uint32_t, 2> fastuidraw::u32vec2

Conveniance typedef

Definition at line 1401 of file vecN.hpp.

◆ u32vec3

typedef vecN<uint32_t, 3> fastuidraw::u32vec3

Conveniance typedef

Definition at line 1405 of file vecN.hpp.

◆ u32vec4

typedef vecN<uint32_t, 4> fastuidraw::u32vec4

Conveniance typedef

Definition at line 1409 of file vecN.hpp.

◆ u64vec1

typedef vecN<uint64_t, 1> fastuidraw::u64vec1

Conveniance typedef

Definition at line 1414 of file vecN.hpp.

◆ u64vec2

typedef vecN<uint64_t, 2> fastuidraw::u64vec2

Conveniance typedef

Definition at line 1418 of file vecN.hpp.

◆ u64vec3

typedef vecN<uint64_t, 3> fastuidraw::u64vec3

Conveniance typedef

Definition at line 1422 of file vecN.hpp.

◆ u64vec4

typedef vecN<uint64_t, 4> fastuidraw::u64vec4

Conveniance typedef

Definition at line 1426 of file vecN.hpp.

◆ u8vec1

typedef vecN<uint8_t, 1> fastuidraw::u8vec1

Conveniance typedef

Definition at line 1363 of file vecN.hpp.

◆ u8vec2

typedef vecN<uint8_t, 2> fastuidraw::u8vec2

Conveniance typedef

Definition at line 1367 of file vecN.hpp.

◆ u8vec3

typedef vecN<uint8_t, 3> fastuidraw::u8vec3

Conveniance typedef

Definition at line 1371 of file vecN.hpp.

◆ u8vec4

typedef vecN<uint8_t, 4> fastuidraw::u8vec4

Conveniance typedef

Definition at line 1375 of file vecN.hpp.

◆ uvec1

typedef vecN<uint32_t, 1> fastuidraw::uvec1

Conveniance typedef

Definition at line 1278 of file vecN.hpp.

◆ uvec2

typedef vecN<uint32_t, 2> fastuidraw::uvec2

Conveniance typedef

Definition at line 1282 of file vecN.hpp.

◆ uvec3

typedef vecN<uint32_t, 3> fastuidraw::uvec3

Conveniance typedef

Definition at line 1286 of file vecN.hpp.

◆ uvec4

typedef vecN<uint32_t, 4> fastuidraw::uvec4

Conveniance typedef

Definition at line 1290 of file vecN.hpp.

◆ vec1

typedef vecN<float, 1> fastuidraw::vec1

Conveniance typedef

Definition at line 1227 of file vecN.hpp.

◆ vec2

typedef vecN<float, 2> fastuidraw::vec2

Conveniance typedef

Definition at line 1231 of file vecN.hpp.

◆ vec3

typedef vecN<float, 3> fastuidraw::vec3

Conveniance typedef

Definition at line 1235 of file vecN.hpp.

◆ vec4

typedef vecN<float, 4> fastuidraw::vec4

Conveniance typedef

Definition at line 1239 of file vecN.hpp.

Function Documentation

◆ convert_to_fp16()

void fastuidraw::convert_to_fp16 ( c_array< const float >  src,
c_array< uint16_t >  dst 
)

Convert an array of 32-bit floating point values to an array of 16-bit half values

Parameters
srcfp32 value to convert
dstlocation to which to write fp16 values

◆ convert_to_fp32()

void fastuidraw::convert_to_fp32 ( c_array< const uint16_t >  src,
c_array< float >  dst 
)

Convert an array of 16-bit floating point values to an array of 32-bit half values

Parameters
srcfp16 value to convert
dstlocation to which to write fp32 values

◆ cross_product()

template<typename T >
vecN<T, 3> fastuidraw::cross_product ( const vecN< T, 3 > &  a,
const vecN< T, 3 > &  b 
)

Compute the cross produces of two vectors

Definition at line 1482 of file vecN.hpp.

◆ dot()

template<typename T , size_t N>
T fastuidraw::dot ( const vecN< T, N > &  a,
const vecN< T, N > &  b 
)

conveniance function, equivalent to

a.dot(b)
Parameters
aobject to perform dot
bobject passed as parameter to dot.

Definition at line 1124 of file vecN.hpp.

◆ fetch_static_resource()

c_array<const uint8_t> fastuidraw::fetch_static_resource ( c_string  resource_label)

Returns the data behind a resource. If no resource is found, returns an empty const_c_array.

Parameters
resource_labellabel of resource as specified by generate_static_resource().

◆ generate_static_resource() [1/2]

void fastuidraw::generate_static_resource ( c_string  resource_label,
c_array< const uint8_t >  value 
)

Generate and store a resource for use. Once a resource is added it cannot be removed.

Parameters
resource_label"name" of resource, the string is copied
value"value" of resource, the data behind value is copied

◆ generate_static_resource() [2/2]

void fastuidraw::generate_static_resource ( c_string  resource_label,
c_string  value 
)

Generate and store a resource for use. Once a resource is added it cannot be removed.

Parameters
resource_label"name" of resource, the string is copied
value"value" of resource, the data behind value is copied, the value is though of as a string and thus must be null-terminated. The created resource includes the end-of-string marker.

◆ local_distance_from_pixel_distance()

float fastuidraw::local_distance_from_pixel_distance ( float  distance,
const vec2 resolution,
const float3x3 transformation_matrix,
const vec2 point,
const vec2 direction 
)

Given a direction and location in LOCAL coordinates and a distance value in pixel coordinates, return that distance value in local coordinates.

Parameters
distancedistance value in pixel coordinates
resolutionresolution of viewport
transformation_matrixtransformation matrix from local coordinates to clip-coordinates
pointlocation in local coordinates
directiondirection in local coordinates

◆ magnitude()

template<typename T , size_t N>
T fastuidraw::magnitude ( const vecN< T, N > &  in)
inline

conveniance function, equivalent to

in.magnitude()
Parameters
inobject to perform magnitude

Definition at line 1154 of file vecN.hpp.

◆ magnitude_compare()

template<typename T , size_t N>
bool fastuidraw::magnitude_compare ( const vecN< T, N > &  a,
const vecN< T, N > &  b 
)

conveniance function to compare magnitude squares, equivalent to

a.magnitudeSq()<b.magnitudeSq();
Parameters
aleft hand side of comparison
bright hand side of comparison

Definition at line 1169 of file vecN.hpp.

◆ magnitudeSq()

template<typename T , size_t N>
T fastuidraw::magnitudeSq ( const vecN< T, N > &  in)
inline

conveniance function, equivalent to

in.magnitudeSq()
Parameters
inobject to perform magnitudeSq

Definition at line 1139 of file vecN.hpp.

◆ operator!=()

template<typename T , typename S >
bool fastuidraw::operator!= ( T *  lhs,
const reference_counted_ptr< S > &  rhs 
)
inline

Inequality comparison operator

Parameters
lhsleft hand side of operator
rhsright hand side of operator

Definition at line 393 of file reference_counted.hpp.

◆ operator==()

template<typename T , typename S >
bool fastuidraw::operator== ( T *  lhs,
const reference_counted_ptr< S > &  rhs 
)
inline

Equality comparison operator

Parameters
lhsleft hand side of operator
rhsright hand side of operator

Definition at line 379 of file reference_counted.hpp.

◆ pack_as_fp16() [1/2]

uint32_t fastuidraw::pack_as_fp16 ( vec2  src)
inline

Conveniance function to pack a single vec2 into an fp16-pair returned as a uint32_t.

Parameters
srcfloat-pair to pack as an fp16-pair.

Definition at line 474 of file c_array.hpp.

◆ pack_as_fp16() [2/2]

uint32_t fastuidraw::pack_as_fp16 ( float  x,
float  y 
)
inline

Provided as a conveniance, equivalent to

Definition at line 490 of file c_array.hpp.

◆ pack_vec4() [1/2]

uvec4 fastuidraw::pack_vec4 ( float  x,
float  y,
float  z,
float  w 
)
inline

Pack 4 float values into a uvec4 values via pack_float().

Parameters
xx-value
yy-value
zz-value
ww-value

Definition at line 1438 of file vecN.hpp.

◆ pack_vec4() [2/2]

uvec4 fastuidraw::pack_vec4 ( const vec4 v)
inline

Pack a vec4 into a uvec4 values via pack_float().

Parameters
vvalue to pack

Definition at line 1455 of file vecN.hpp.

◆ swap()

template<typename T >
void fastuidraw::swap ( reference_counted_ptr< T > &  lhs,
reference_counted_ptr< T > &  rhs 
)
inline

swap() routine, equivalent to

lhs.swap(rhs);
Parameters
lhsobject to swap
rhsobject to swap

Definition at line 410 of file reference_counted.hpp.

◆ t_abs() [1/6]

int fastuidraw::t_abs ( int  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 243 of file math.hpp.

◆ t_abs() [2/6]

long fastuidraw::t_abs ( long  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 250 of file math.hpp.

◆ t_abs() [3/6]

long long fastuidraw::t_abs ( long long  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 257 of file math.hpp.

◆ t_abs() [4/6]

float fastuidraw::t_abs ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 264 of file math.hpp.

◆ t_abs() [5/6]

double fastuidraw::t_abs ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 271 of file math.hpp.

◆ t_abs() [6/6]

long double fastuidraw::t_abs ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 278 of file math.hpp.

◆ t_acos() [1/3]

float fastuidraw::t_acos ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 110 of file math.hpp.

◆ t_acos() [2/3]

double fastuidraw::t_acos ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 166 of file math.hpp.

◆ t_acos() [3/3]

long double fastuidraw::t_acos ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 222 of file math.hpp.

◆ t_asin() [1/3]

float fastuidraw::t_asin ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 103 of file math.hpp.

◆ t_asin() [2/3]

double fastuidraw::t_asin ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 159 of file math.hpp.

◆ t_asin() [3/3]

long double fastuidraw::t_asin ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 215 of file math.hpp.

◆ t_atan() [1/3]

float fastuidraw::t_atan ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 117 of file math.hpp.

◆ t_atan() [2/3]

double fastuidraw::t_atan ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 173 of file math.hpp.

◆ t_atan() [3/3]

long double fastuidraw::t_atan ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 229 of file math.hpp.

◆ t_atan2() [1/3]

float fastuidraw::t_atan2 ( float  y,
float  x 
)
inline

Conveniance overload avoiding to rely on std::

Definition at line 124 of file math.hpp.

◆ t_atan2() [2/3]

double fastuidraw::t_atan2 ( double  y,
double  x 
)
inline

Conveniance overload avoiding to rely on std::

Definition at line 180 of file math.hpp.

◆ t_atan2() [3/3]

long double fastuidraw::t_atan2 ( long double  y,
long double  x 
)
inline

Conveniance overload avoiding to rely on std::

Definition at line 236 of file math.hpp.

◆ t_cos() [1/3]

float fastuidraw::t_cos ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 82 of file math.hpp.

◆ t_cos() [2/3]

double fastuidraw::t_cos ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 138 of file math.hpp.

◆ t_cos() [3/3]

long double fastuidraw::t_cos ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 194 of file math.hpp.

◆ t_max()

template<typename T >
const T& fastuidraw::t_max ( const T &  a,
const T &  b 
)
inline

Conveniance overload avoiding to rely on std::

Definition at line 54 of file math.hpp.

◆ t_min()

template<typename T >
const T& fastuidraw::t_min ( const T &  a,
const T &  b 
)
inline

Conveniance overload avoiding to rely on std::

Definition at line 43 of file math.hpp.

◆ t_sign()

template<typename T >
T fastuidraw::t_sign ( const T &  a)
inline

Return the sign of a value.

Definition at line 65 of file math.hpp.

◆ t_sin() [1/3]

float fastuidraw::t_sin ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 75 of file math.hpp.

◆ t_sin() [2/3]

double fastuidraw::t_sin ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 131 of file math.hpp.

◆ t_sin() [3/3]

long double fastuidraw::t_sin ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 187 of file math.hpp.

◆ t_sqrt() [1/3]

float fastuidraw::t_sqrt ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 96 of file math.hpp.

◆ t_sqrt() [2/3]

double fastuidraw::t_sqrt ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 152 of file math.hpp.

◆ t_sqrt() [3/3]

long double fastuidraw::t_sqrt ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 208 of file math.hpp.

◆ t_tan() [1/3]

float fastuidraw::t_tan ( float  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 89 of file math.hpp.

◆ t_tan() [2/3]

double fastuidraw::t_tan ( double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 145 of file math.hpp.

◆ t_tan() [3/3]

long double fastuidraw::t_tan ( long double  x)
inline

Conveniance overload avoiding to rely on std::

Definition at line 201 of file math.hpp.

◆ triangle_area()

template<typename T , size_t N>
T fastuidraw::triangle_area ( const vecN< T, N > &  p0,
const vecN< T, N > &  p1,
const vecN< T, N > &  p2 
)

Compute the area of a triangle using Heron's rule.

Definition at line 1465 of file vecN.hpp.