arsa  2.7
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
irr::core Namespace Reference

Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace. More...

Namespaces

 unicode
 

Classes

class  aabbox3d
 Axis aligned bounding box in 3d dimensional space. More...
 
class  array
 Self reallocating template array (like stl vector) with additional features. More...
 
class  CMatrix4
 4x4 matrix. Mostly used as transformation matrix for 3d calculations. More...
 
class  dimension2d
 Specifies a 2 dimensional size. More...
 
union  FloatIntUnion32
 
union  inttofloat
 
class  irrAllocator
 Very simple allocator implementation, containers using it can be used across dll boundaries. More...
 
class  irrAllocatorFast
 Fast allocator, only to be used in containers inside the same memory heap. More...
 
class  line2d
 2D line between two points with intersection methods. More...
 
class  line3d
 3D line between two points with intersection methods. More...
 
class  list
 Doubly linked list template. More...
 
class  map
 map template for associative arrays using a red-black tree More...
 
class  plane3d
 Template plane class with some intersection testing methods. More...
 
class  quaternion
 Quaternion class for representing rotations. More...
 
class  rect
 Rectangle template. More...
 
class  string
 Very simple string class with some useful features. More...
 
class  triangle3d
 3d triangle template class for doing collision detection and other things. More...
 
class  ustring16
 UTF-16 string class. More...
 
class  vector2d
 2d vector template class with lots of operators and methods. More...
 
class  vector3d
 3d vector template class with lots of operators and methods. More...
 

Typedefs

typedef aabbox3d< f32aabbox3df
 Typedef for a f32 3d bounding box. More...
 
typedef aabbox3d< s32aabbox3di
 Typedef for an integer 3d bounding box. More...
 
typedef dimension2d< f32dimension2df
 Typedef for an f32 dimension. More...
 
typedef dimension2d< u32dimension2du
 Typedef for an unsigned integer dimension. More...
 
typedef dimension2d< s32dimension2di
 Typedef for an integer dimension. More...
 
typedef string< c8stringc
 Typedef for character strings. More...
 
typedef string< wchar_t > stringw
 Typedef for wide character strings. More...
 
typedef line2d< f32line2df
 Typedef for an f32 line. More...
 
typedef line2d< s32line2di
 Typedef for an integer line. More...
 
typedef line3d< f32line3df
 Typedef for an f32 line. More...
 
typedef line3d< s32line3di
 Typedef for an integer line. More...
 
typedef CMatrix4< f32matrix4
 Typedef for f32 matrix. More...
 
typedef plane3d< f32plane3df
 Typedef for a f32 3d plane. More...
 
typedef plane3d< s32plane3di
 Typedef for an integer 3d plane. More...
 
typedef vector2d< f32position2df
 
typedef vector2d< s32position2di
 
typedef rect< f32rectf
 Rectangle with float values. More...
 
typedef rect< s32recti
 Rectangle with int values. More...
 
typedef triangle3d< f32triangle3df
 Typedef for a f32 3d triangle. More...
 
typedef triangle3d< s32triangle3di
 Typedef for an integer 3d triangle. More...
 
typedef vector2d< f32vector2df
 Typedef for f32 2d vector. More...
 
typedef vector2d< s32vector2di
 Typedef for integer 2d vector. More...
 
typedef vector3d< f32vector3df
 Typedef for a f32 3d vector. More...
 
typedef vector3d< s32vector3di
 Typedef for an integer 3d vector. More...
 
typedef ustring16< irrAllocator< uchar16_t > > ustring
 

Enumerations

enum  eAllocStrategy { ALLOC_STRATEGY_SAFE = 0, ALLOC_STRATEGY_DOUBLE = 1, ALLOC_STRATEGY_SQRT = 2 }
 defines an allocation strategy (used only by irr::array so far) More...
 
enum  eLocaleID { IRR_LOCALE_ANSI = 0, IRR_LOCALE_GERMAN = 1 }
 
enum  EIntersectionRelation3D {
  ISREL3D_FRONT = 0, ISREL3D_BACK, ISREL3D_PLANAR, ISREL3D_SPANNING,
  ISREL3D_CLIPPED
}
 Enumeration for intersection relations of 3d objects. More...
 

Functions

s32 isFileExtension (const io::path &filename, const io::path &ext0, const io::path &ext1, const io::path &ext2)
 search if a filename has a proper extension More...
 
bool hasFileExtension (const io::path &filename, const io::path &ext0, const io::path &ext1="", const io::path &ext2="")
 search if a filename has a proper extension More...
 
io::pathcutFilenameExtension (io::path &dest, const io::path &source)
 cut the filename extension from a source file path and store it in a dest file path More...
 
io::pathgetFileNameExtension (io::path &dest, const io::path &source)
 get the filename extension from a file path More...
 
io::pathdeletePathFromFilename (io::path &filename)
 delete path from filename More...
 
io::pathdeletePathFromPath (io::path &filename, s32 pathCount)
 trim paths More...
 
s32 isInSameDirectory (const io::path &path, const io::path &file)
 
s32 isdigit (s32 c)
 some standard function ( to remove dependencies ) More...
 
s32 isspace (s32 c)
 
s32 isupper (s32 c)
 
u32 strtoul10 (const char *in, const char **out=0)
 Convert a simple string of base 10 digits into an unsigned 32 bit integer. More...
 
s32 strtol10 (const char *in, const char **out=0)
 Convert a simple string of base 10 digits into a signed 32 bit integer. More...
 
u32 ctoul16 (char in)
 Convert a hex-encoded character to an unsigned integer. More...
 
u32 strtoul16 (const char *in, const char **out=0)
 Convert a simple string of base 16 digits into an unsigned 32 bit integer. More...
 
u32 strtoul8 (const char *in, const char **out=0)
 Convert a simple string of base 8 digits into an unsigned 32 bit integer. More...
 
u32 strtoul_prefix (const char *in, const char **out=0)
 Convert a C-style prefixed string (hex, oct, integer) into an unsigned 32 bit integer. More...
 
f32 strtof10 (const char *in, const char **out=0)
 Converts a sequence of digits into a whole positive floating point value. More...
 
const char * fast_atof_move (const char *in, f32 &result)
 Provides a fast function for converting a string into a float. More...
 
float fast_atof (const char *floatAsString, const char **out=0)
 Convert a string to a floating point number. More...
 
template<class T >
void heapsink (T *array, s32 element, s32 max)
 Sinks an element into the heap. More...
 
template<class T >
void heapsort (T *array_, s32 size)
 Sorts an array with size 'size' using heapsort. More...
 
f32 radToDeg (f32 radians)
 Utility function to convert a radian value to degrees. More...
 
f64 radToDeg (f64 radians)
 Utility function to convert a radian value to degrees. More...
 
f32 degToRad (f32 degrees)
 Utility function to convert a degrees value to radians. More...
 
f64 degToRad (f64 degrees)
 Utility function to convert a degrees value to radians. More...
 
template<class T >
const T & min_ (const T &a, const T &b)
 returns minimum of two values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & min_ (const T &a, const T &b, const T &c)
 returns minimum of three values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & max_ (const T &a, const T &b)
 returns maximum of two values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & max_ (const T &a, const T &b, const T &c)
 returns maximum of three values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
abs_ (const T &a)
 returns abs of two values. Own implementation to get rid of STL (VS6 problems) More...
 
template<class T >
lerp (const T &a, const T &b, const f32 t)
 
template<class T >
constclamp (const T &value, const T &low, const T &high)
 clamps a value between low and high More...
 
template<class T1 , class T2 >
void swap (T1 &a, T2 &b)
 swaps the content of the passed parameters More...
 
template<class T >
roundingError ()
 
template<>
f32 roundingError ()
 
template<>
f64 roundingError ()
 
template<>
s32 roundingError ()
 
template<>
u32 roundingError ()
 
template<>
s64 roundingError ()
 
template<>
u64 roundingError ()
 
template<class T >
relativeErrorFactor ()
 
template<>
f32 relativeErrorFactor ()
 
template<>
f64 relativeErrorFactor ()
 
template<class T >
bool equals (const T a, const T b, const T tolerance=roundingError< T >())
 returns if a equals b, taking possible rounding errors into account More...
 
template<class T >
bool equalsRelative (const T a, const T b, const T factor=relativeErrorFactor< T >())
 
bool equalsByUlp (f32 a, f32 b, int maxUlpDiff)
 We compare the difference in ULP's (spacing between floating-point numbers, aka ULP=1 means there exists no float between). More...
 
bool iszero (const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
 returns if a equals zero, taking rounding errors into account More...
 
bool iszero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
 returns if a equals zero, taking rounding errors into account More...
 
bool isnotzero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
 returns if a equals not zero, taking rounding errors into account More...
 
bool iszero (const s32 a, const s32 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
bool iszero (const u32 a, const u32 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
bool iszero (const s64 a, const s64 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
s32 s32_min (s32 a, s32 b)
 
s32 s32_max (s32 a, s32 b)
 
s32 s32_clamp (s32 value, s32 low, s32 high)
 
u32 IR (f32 x)
 
f32 FR (u32 x)
 Floating-point representation of an integer value. More...
 
f32 FR (s32 x)
 
REALINLINE u32 if_c_a_else_b (const s32 condition, const u32 a, const u32 b)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE u16 if_c_a_else_b (const s16 condition, const u16 a, const u16 b)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE u32 if_c_a_else_0 (const s32 condition, const u32 a)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE void setbit_cond (u32 &state, s32 condition, u32 mask)
 
f32 round_ (f32 x)
 
REALINLINE f32 squareroot (const f32 f)
 
REALINLINE f64 squareroot (const f64 f)
 
REALINLINE s32 squareroot (const s32 f)
 
REALINLINE s64 squareroot (const s64 f)
 
REALINLINE f64 reciprocal_squareroot (const f64 x)
 
REALINLINE f32 reciprocal_squareroot (const f32 f)
 
REALINLINE s32 reciprocal_squareroot (const s32 x)
 
REALINLINE f32 reciprocal (const f32 f)
 
REALINLINE f64 reciprocal (const f64 f)
 
REALINLINE f32 reciprocal_approxim (const f32 f)
 
REALINLINE s32 floor32 (f32 x)
 
REALINLINE s32 ceil32 (f32 x)
 
REALINLINE s32 round32 (f32 x)
 
f32 f32_max3 (const f32 a, const f32 b, const f32 c)
 
f32 f32_min3 (const f32 a, const f32 b, const f32 c)
 
f32 fract (f32 x)
 
IRRLICHT_API void utf8ToWchar (const char *in, wchar_t *out, const u64 len)
 Convert this utf-8-encoded string to the platform's wchar. More...
 
IRRLICHT_API void wcharToUtf8 (const wchar_t *in, char *out, const u64 len)
 Convert this wchar string to utf-8. More...
 
template<class T >
CMatrix4< T > operator * (const T scalar, const CMatrix4< T > &mat)
 
template<class S , class T >
vector2d< T > operator * (const S scalar, const vector2d< T > &vector)
 
template<class S , class T >
vector3d< T > operator * (const S scalar, const vector3d< T > &vector)
 Function multiplying a scalar and a vector component-wise. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const ustring16< TAlloc > &right)
 Appends two ustring16s. More...
 
template<typename TAlloc , class B >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const B *const right)
 Appends a ustring16 and a null-terminated unicode string. More...
 
template<class B , typename TAlloc >
ustring16< TAlloc > operator+ (const B *const left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a null-terminated unicode string. More...
 
template<typename TAlloc , typename B , typename BAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const string< B, BAlloc > &right)
 Appends a ustring16 and an Irrlicht string. More...
 
template<typename TAlloc , typename B , typename BAlloc >
ustring16< TAlloc > operator+ (const string< B, BAlloc > &left, const ustring16< TAlloc > &right)
 Appends a ustring16 and an Irrlicht string. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const char right)
 Appends a ustring16 and a char. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const char left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a char. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const short right)
 Appends a ustring16 and a short. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const short left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a short. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const unsigned short right)
 Appends a ustring16 and an unsigned short. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const unsigned short left, const ustring16< TAlloc > &right)
 Appends a ustring16 and an unsigned short. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const int right)
 Appends a ustring16 and an int. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const int left, const ustring16< TAlloc > &right)
 Appends a ustring16 and an int. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const unsigned int right)
 Appends a ustring16 and an unsigned int. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const unsigned int left, const ustring16< TAlloc > &right)
 Appends a ustring16 and an unsigned int. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const long right)
 Appends a ustring16 and a long. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const long left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a long. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const unsigned long right)
 Appends a ustring16 and an unsigned long. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const unsigned long left, const ustring16< TAlloc > &right)
 Appends a ustring16 and an unsigned long. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const float right)
 Appends a ustring16 and a float. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const float left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a float. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const ustring16< TAlloc > &left, const double right)
 Appends a ustring16 and a double. More...
 
template<typename TAlloc >
ustring16< TAlloc > operator+ (const double left, const ustring16< TAlloc > &right)
 Appends a ustring16 and a double. More...
 

Variables

IRRLICHT_API irr::core::stringc LOCALE_DECIMAL_POINTS
 Selection of characters which count as decimal point in fast_atof. More...
 
const float fast_atof_table [17]
 
const s32 ROUNDING_ERROR_S32 = 0
 Rounding error constant often used when comparing f32 values. More...
 
const s64 ROUNDING_ERROR_S64 = 0
 
const f32 ROUNDING_ERROR_f32 = 0.000001f
 
const f64 ROUNDING_ERROR_f64 = 0.00000001
 
const f32 PI = 3.14159265359f
 Constant for PI. More...
 
const f32 RECIPROCAL_PI = 1.0f/PI
 Constant for reciprocal of PI. More...
 
const f32 HALF_PI = PI/2.0f
 Constant for half of PI. More...
 
const f64 PI64 = 3.1415926535897932384626433832795028841971693993751
 Constant for 64bit PI. More...
 
const f64 RECIPROCAL_PI64 = 1.0/PI64
 Constant for 64bit reciprocal of PI. More...
 
const f32 DEGTORAD = PI / 180.0f
 32bit Constant for converting from degrees to radians More...
 
const f32 RADTODEG = 180.0f / PI
 32bit constant for converting from radians to degrees (formally known as GRAD_PI) More...
 
const f64 DEGTORAD64 = PI64 / 180.0
 64bit constant for converting from degrees to radians (formally known as GRAD_PI2) More...
 
const f64 RADTODEG64 = 180.0 / PI64
 64bit constant for converting from radians to degrees More...
 
IRRLICHT_API const matrix4 IdentityMatrix
 global const identity matrix More...
 

Detailed Description

Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.

Typedef Documentation

◆ aabbox3df

Typedef for a f32 3d bounding box.

Definition at line 361 of file aabbox3d.h.

◆ aabbox3di

Typedef for an integer 3d bounding box.

Definition at line 363 of file aabbox3d.h.

◆ dimension2df

Typedef for an f32 dimension.

Definition at line 210 of file dimension2d.h.

◆ dimension2di

Typedef for an integer dimension.

There are few cases where negative dimensions make sense. Please consider using dimension2du instead.

Definition at line 217 of file dimension2d.h.

◆ dimension2du

Typedef for an unsigned integer dimension.

Definition at line 212 of file dimension2d.h.

◆ line2df

Typedef for an f32 line.

Definition at line 352 of file line2d.h.

◆ line2di

Typedef for an integer line.

Definition at line 354 of file line2d.h.

◆ line3df

Typedef for an f32 line.

Definition at line 136 of file line3d.h.

◆ line3di

Typedef for an integer line.

Definition at line 138 of file line3d.h.

◆ matrix4

Typedef for f32 matrix.

Definition at line 2377 of file matrix4.h.

◆ plane3df

Typedef for a f32 3d plane.

Definition at line 236 of file plane3d.h.

◆ plane3di

Typedef for an integer 3d plane.

Definition at line 239 of file plane3d.h.

◆ position2df

Deprecated:
position2d is now a synonym for vector2d, but vector2d should be used directly.

Definition at line 21 of file position2d.h.

◆ position2di

Deprecated:
position2d is now a synonym for vector2d, but vector2d should be used directly.

Definition at line 24 of file position2d.h.

◆ rectf

Rectangle with float values.

Definition at line 276 of file rect.h.

◆ recti

Rectangle with int values.

Definition at line 278 of file rect.h.

◆ stringc

Typedef for character strings.

Definition at line 1458 of file irrString.h.

◆ stringw

typedef string<wchar_t> irr::core::stringw

Typedef for wide character strings.

Definition at line 1461 of file irrString.h.

◆ triangle3df

Typedef for a f32 3d triangle.

Definition at line 270 of file triangle3d.h.

◆ triangle3di

Typedef for an integer 3d triangle.

Definition at line 273 of file triangle3d.h.

◆ ustring

Definition at line 3289 of file irrUString.h.

◆ vector2df

Typedef for f32 2d vector.

Definition at line 403 of file vector2d.h.

◆ vector2di

Typedef for integer 2d vector.

Definition at line 406 of file vector2d.h.

◆ vector3df

Typedef for a f32 3d vector.

Definition at line 461 of file vector3d.h.

◆ vector3di

Typedef for an integer 3d vector.

Definition at line 464 of file vector3d.h.

Enumeration Type Documentation

◆ eAllocStrategy

defines an allocation strategy (used only by irr::array so far)

Enumerator
ALLOC_STRATEGY_SAFE 
ALLOC_STRATEGY_DOUBLE 
ALLOC_STRATEGY_SQRT 

Definition at line 112 of file irrAllocator.h.

113 {
114  ALLOC_STRATEGY_SAFE = 0, // increase size by 1
115  ALLOC_STRATEGY_DOUBLE = 1, // double size when under 500 elements, beyond that increase by 1/4th size. Plus a small constant.
116  ALLOC_STRATEGY_SQRT = 2 // not implemented
117 };

◆ EIntersectionRelation3D

Enumeration for intersection relations of 3d objects.

Enumerator
ISREL3D_FRONT 
ISREL3D_BACK 
ISREL3D_PLANAR 
ISREL3D_SPANNING 
ISREL3D_CLIPPED 

Definition at line 17 of file plane3d.h.

◆ eLocaleID

Enumerator
IRR_LOCALE_ANSI 
IRR_LOCALE_GERMAN 

Definition at line 41 of file irrString.h.

Function Documentation

◆ abs_()

template<class T >
T irr::core::abs_ ( const T &  a)
inline

returns abs of two values. Own implementation to get rid of STL (VS6 problems)

Definition at line 152 of file irrMath.h.

153  {
154  return a < (T)0 ? -a : a;
155  }
GLboolean GLboolean GLboolean GLboolean a

◆ ceil32()

REALINLINE s32 irr::core::ceil32 ( f32  x)

Definition at line 651 of file irrMath.h.

652  {
653  return (s32) ceilf ( x );
654  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ clamp()

template<class T >
const T irr::core::clamp ( const T &  value,
const T &  low,
const T &  high 
)
inline

clamps a value between low and high

Definition at line 167 of file irrMath.h.

168  {
169  return min_ (max_(value,low), high);
170  }
const T & min_(const T &a, const T &b, const T &c)
returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:131
GLsizei const GLfloat * value
const T & max_(const T &a, const T &b, const T &c)
returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:145

◆ ctoul16()

u32 irr::core::ctoul16 ( char  in)
inline

Convert a hex-encoded character to an unsigned integer.

Parameters
[in]inThe digit to convert. Only digits 0 to 9 and chars A-F,a-f will be considered.
Returns
The unsigned integer value of the digit. 0xffffffff if the input is not hex

Definition at line 126 of file fast_atof.h.

127 {
128  if (in >= '0' && in <= '9')
129  return in - '0';
130  else if (in >= 'a' && in <= 'f')
131  return 10u + in - 'a';
132  else if (in >= 'A' && in <= 'F')
133  return 10u + in - 'A';
134  else
135  return 0xffffffff;
136 }
GLuint in

◆ cutFilenameExtension()

io::path& irr::core::cutFilenameExtension ( io::path dest,
const io::path source 
)
inline

cut the filename extension from a source file path and store it in a dest file path

Definition at line 48 of file coreutil.h.

49 {
50  s32 endPos = source.findLast ( '.' );
51  dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
52  return dest;
53 }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLsizei GLsizei GLchar * source

◆ degToRad() [1/2]

f32 irr::core::degToRad ( f32  degrees)
inline

Utility function to convert a degrees value to radians.

Provided as it can be clearer to write degToRad(X) than DEGTORAD * X

Parameters
degreesThe degrees value to convert to radians.

Definition at line 108 of file irrMath.h.

109  {
110  return DEGTORAD * degrees;
111  }
const f32 DEGTORAD
32bit Constant for converting from degrees to radians
Definition: irrMath.h:75

◆ degToRad() [2/2]

f64 irr::core::degToRad ( f64  degrees)
inline

Utility function to convert a degrees value to radians.

Provided as it can be clearer to write degToRad(X) than DEGTORAD * X

Parameters
degreesThe degrees value to convert to radians.

Definition at line 117 of file irrMath.h.

118  {
119  return DEGTORAD64 * degrees;
120  }
const f64 DEGTORAD64
64bit constant for converting from degrees to radians (formally known as GRAD_PI2)
Definition: irrMath.h:81

◆ deletePathFromFilename()

io::path& irr::core::deletePathFromFilename ( io::path filename)
inline

delete path from filename

Definition at line 67 of file coreutil.h.

68 {
69  // delete path from filename
70  const fschar_t* s = filename.c_str();
71  const fschar_t* p = s + filename.size();
72 
73  // search for path separator or beginning
74  while ( *p != '/' && *p != '\\' && p != s )
75  p--;
76 
77  if ( p != s )
78  {
79  ++p;
80  filename = p;
81  }
82  return filename;
83 }
const char * filename
Definition: SDL_assert.h:116
GLfloat GLfloat p
GLdouble s
Definition: SDL_opengl.h:2063
char fschar_t
Type name for character type used by the file system.
Definition: irrTypes.h:165

◆ deletePathFromPath()

io::path& irr::core::deletePathFromPath ( io::path filename,
s32  pathCount 
)
inline

trim paths

Definition at line 86 of file coreutil.h.

87 {
88  // delete path from filename
89  s32 i = filename.size();
90 
91  // search for path separator or beginning
92  while ( i>=0 )
93  {
94  if ( filename[i] == '/' || filename[i] == '\\' )
95  {
96  if ( --pathCount <= 0 )
97  break;
98  }
99  --i;
100  }
101 
102  if ( i>0 )
103  {
104  filename [ i + 1 ] = 0;
105  filename.validate();
106  }
107  else
108  filename="";
109  return filename;
110 }
const char * filename
Definition: SDL_assert.h:116
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70

◆ equals()

template<class T >
bool irr::core::equals ( const a,
const b,
const tolerance = roundingError<T>() 
)
inline

returns if a equals b, taking possible rounding errors into account

Definition at line 246 of file irrMath.h.

247  {
248  return (a + tolerance >= b) && (a - tolerance <= b);
249  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ equalsByUlp()

bool irr::core::equalsByUlp ( f32  a,
f32  b,
int  maxUlpDiff 
)
inline

We compare the difference in ULP's (spacing between floating-point numbers, aka ULP=1 means there exists no float between).

Definition at line 278 of file irrMath.h.

279  {
280  // Based on the ideas and code from Bruce Dawson on
281  // http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/
282  // When floats are interpreted as integers the two nearest possible float numbers differ just
283  // by one integer number. Also works the other way round, an integer of 1 interpreted as float
284  // is for example the smallest possible float number.
285 
286  const FloatIntUnion32 fa(a);
287  const FloatIntUnion32 fb(b);
288 
289  // Different signs, we could maybe get difference to 0, but so close to 0 using epsilons is better.
290  if ( fa.sign() != fb.sign() )
291  {
292  // Check for equality to make sure +0==-0
293  if (fa.i == fb.i)
294  return true;
295  return false;
296  }
297 
298  // Find the difference in ULPs.
299  const int ulpsDiff = abs_(fa.i- fb.i);
300  if (ulpsDiff <= maxUlpDiff)
301  return true;
302 
303  return false;
304  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
T abs_(const T &a)
returns abs of two values. Own implementation to get rid of STL (VS6 problems)
Definition: irrMath.h:152

◆ equalsRelative()

template<class T >
bool irr::core::equalsRelative ( const a,
const b,
const factor = relativeErrorFactor<T>() 
)
inline

returns if a equals b, taking relative error in form of factor this particular function does not involve any division.

Definition at line 255 of file irrMath.h.

256  {
257  //https://eagergames.wordpress.com/2017/04/01/fast-parallel-lines-and-vectors-test/
258 
259  const T maxi = max_( a, b);
260  const T mini = min_( a, b);
261  const T maxMagnitude = max_( maxi, -mini);
262 
263  return (maxMagnitude*factor + maxi) == (maxMagnitude*factor + mini); // MAD Wise
264  }
const T & min_(const T &a, const T &b, const T &c)
returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:131
const T & max_(const T &a, const T &b, const T &c)
returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:145
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ f32_max3()

f32 irr::core::f32_max3 ( const f32  a,
const f32  b,
const f32  c 
)
inline

Definition at line 662 of file irrMath.h.

663  {
664  return a > b ? (a > c ? a : c) : (b > c ? b : c);
665  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c

◆ f32_min3()

f32 irr::core::f32_min3 ( const f32  a,
const f32  b,
const f32  c 
)
inline

Definition at line 667 of file irrMath.h.

668  {
669  return a < b ? (a < c ? a : c) : (b < c ? b : c);
670  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c

◆ fast_atof()

float irr::core::fast_atof ( const char *  floatAsString,
const char **  out = 0 
)
inline

Convert a string to a floating point number.

Parameters
floatAsStringThe string to convert.
outOptional pointer to the first character in the string that wasn't used to create the float value.
Returns
Float value parsed from the input string

Definition at line 360 of file fast_atof.h.

361 {
362  float ret;
363  if (out)
364  *out=fast_atof_move(floatAsString, ret);
365  else
366  fast_atof_move(floatAsString, ret);
367  return ret;
368 }
const char * fast_atof_move(const char *in, f32 &result)
Provides a fast function for converting a string into a float.
Definition: fast_atof.h:310

◆ fast_atof_move()

const char* irr::core::fast_atof_move ( const char *  in,
f32 result 
)
inline

Provides a fast function for converting a string into a float.

This is not guaranteed to be as accurate as atof(), but is approximately 6 to 8 times as fast.

Parameters
[in]inThe string to convert.
[out]resultThe resultant float will be written here.
Returns
Pointer to the first character in the string that wasn't used to create the float value.

Definition at line 310 of file fast_atof.h.

311 {
312  // Please run the regression test when making any modifications to this function.
313 
314  result = 0.f;
315  if (!in)
316  return 0;
317 
318  const bool negative = ('-' == *in);
319  if (negative || ('+'==*in))
320  ++in;
321 
322  f32 value = strtof10(in, &in);
323 
324  if ( LOCALE_DECIMAL_POINTS.findFirst(*in) >= 0 )
325  {
326  const char* afterDecimal = ++in;
327  const f32 decimal = strtof10(in, &afterDecimal);
328  const size_t numDecimals = afterDecimal - in;
329  if (numDecimals < IRR_ATOF_TABLE_SIZE)
330  {
331  value += decimal * fast_atof_table[numDecimals];
332  }
333  else
334  {
335  value += decimal * (f32)pow(10.f, -(float)numDecimals);
336  }
337  in = afterDecimal;
338  }
339 
340  if ('e' == *in || 'E' == *in)
341  {
342  ++in;
343  // Assume that the exponent is a whole number.
344  // strtol10() will deal with both + and - signs,
345  // but calculate as f32 to prevent overflow at FLT_MAX
346  // Using pow with float cast instead of powf as otherwise accuracy decreases.
347  value *= (f32)pow(10.f, (f32)strtol10(in, &in));
348  }
349 
350  result = negative?-value:value;
351  return in;
352 }
GLuint64EXT * result
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
#define IRR_ATOF_TABLE_SIZE
Definition: fast_atof.h:20
s32 findFirst(T c) const
finds first occurrence of character in string
Definition: irrString.h:775
GLsizei const GLfloat * value
GLfloat f
f32 strtof10(const char *in, const char **out=0)
Converts a sequence of digits into a whole positive floating point value.
Definition: fast_atof.h:259
const float fast_atof_table[17]
Definition: fast_atof.h:22
s32 strtol10(const char *in, const char **out=0)
Convert a simple string of base 10 digits into a signed 32 bit integer.
Definition: fast_atof.h:90
GLuint in
IRRLICHT_API irr::core::stringc LOCALE_DECIMAL_POINTS
Selection of characters which count as decimal point in fast_atof.

◆ floor32()

REALINLINE s32 irr::core::floor32 ( f32  x)

Definition at line 646 of file irrMath.h.

647  {
648  return (s32) floorf ( x );
649  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ FR() [1/2]

f32 irr::core::FR ( u32  x)
inline

Floating-point representation of an integer value.

Definition at line 400 of file irrMath.h.

400 {inttofloat tmp; tmp.u=x; return tmp.f;}
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ FR() [2/2]

f32 irr::core::FR ( s32  x)
inline

Definition at line 401 of file irrMath.h.

401 {inttofloat tmp; tmp.s=x; return tmp.f;}
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ fract()

f32 irr::core::fract ( f32  x)
inline

Definition at line 672 of file irrMath.h.

673  {
674  return x - floorf ( x );
675  }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ getFileNameExtension()

io::path& irr::core::getFileNameExtension ( io::path dest,
const io::path source 
)
inline

get the filename extension from a file path

Definition at line 56 of file coreutil.h.

57 {
58  s32 endPos = source.findLast ( '.' );
59  if ( endPos < 0 )
60  dest = "";
61  else
62  dest = source.subString ( endPos, source.size () );
63  return dest;
64 }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLsizei GLsizei GLchar * source

◆ hasFileExtension()

bool irr::core::hasFileExtension ( const io::path filename,
const io::path ext0,
const io::path ext1 = "",
const io::path ext2 = "" 
)
inline

search if a filename has a proper extension

Definition at line 41 of file coreutil.h.

43 {
44  return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
45 }
const char * filename
Definition: SDL_assert.h:116
s32 isFileExtension(const io::path &filename, const io::path &ext0, const io::path &ext1, const io::path &ext2)
search if a filename has a proper extension
Definition: coreutil.h:23

◆ heapsink()

template<class T >
void irr::core::heapsink ( T *  array,
s32  element,
s32  max 
)
inline

Sinks an element into the heap.

Definition at line 17 of file heapsort.h.

18 {
19  while ((element<<1) < max) // there is a left child
20  {
21  s32 j = (element<<1);
22 
23  if (j+1 < max && array[j] < array[j+1])
24  j = j+1; // take right child
25 
26  if (array[element] < array[j])
27  {
28  T t = array[j]; // swap elements
29  array[j] = array[element];
30  array[element] = t;
31  element = j;
32  }
33  else
34  return;
35  }
36 }
GLdouble GLdouble t
Definition: SDL_opengl.h:2071
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLenum array

◆ heapsort()

template<class T >
void irr::core::heapsort ( T *  array_,
s32  size 
)
inline

Sorts an array with size 'size' using heapsort.

Definition at line 41 of file heapsort.h.

42 {
43  // for heapsink we pretend this is not c++, where
44  // arrays start with index 0. So we decrease the array pointer,
45  // the maximum always +2 and the element always +1
46 
47  T* virtualArray = array_ - 1;
48  s32 virtualSize = size + 2;
49  s32 i;
50 
51  // build heap
52 
53  for (i=((size-1)/2); i>=0; --i)
54  heapsink(virtualArray, i+1, virtualSize-1);
55 
56  // sort array, leave out the last element (0)
57  for (i=size-1; i>0; --i)
58  {
59  T t = array_[0];
60  array_[0] = array_[i];
61  array_[i] = t;
62  heapsink(virtualArray, 1, i + 1);
63  }
64 }
GLdouble GLdouble t
Definition: SDL_opengl.h:2071
void heapsink(T *array, s32 element, s32 max)
Sinks an element into the heap.
Definition: heapsort.h:17
GLsizeiptr size
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70

◆ if_c_a_else_0()

REALINLINE u32 irr::core::if_c_a_else_0 ( const s32  condition,
const u32  a 
)

conditional set based on mask and arithmetic shift

Definition at line 470 of file irrMath.h.

471  {
472  return ( -condition >> 31 ) & a;
473  }
GLenum condition
GLboolean GLboolean GLboolean GLboolean a

◆ if_c_a_else_b() [1/2]

REALINLINE u32 irr::core::if_c_a_else_b ( const s32  condition,
const u32  a,
const u32  b 
)

conditional set based on mask and arithmetic shift

Definition at line 458 of file irrMath.h.

459  {
460  return ( ( -condition >> 31 ) & ( a ^ b ) ) ^ b;
461  }
GLboolean GLboolean GLboolean b
GLenum condition
GLboolean GLboolean GLboolean GLboolean a

◆ if_c_a_else_b() [2/2]

REALINLINE u16 irr::core::if_c_a_else_b ( const s16  condition,
const u16  a,
const u16  b 
)

conditional set based on mask and arithmetic shift

Definition at line 464 of file irrMath.h.

465  {
466  return ( ( -condition >> 15 ) & ( a ^ b ) ) ^ b;
467  }
GLboolean GLboolean GLboolean b
GLenum condition
GLboolean GLboolean GLboolean GLboolean a

◆ IR()

u32 irr::core::IR ( f32  x)
inline

code is taken from IceFPU Integer representation of a floating-point value.

Definition at line 390 of file irrMath.h.

390 {inttofloat tmp; tmp.f=x; return tmp.u;}
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ isdigit()

s32 irr::core::isdigit ( s32  c)
inline

some standard function ( to remove dependencies )

Definition at line 197 of file coreutil.h.

197 { return c >= '0' && c <= '9'; }
const GLubyte * c

◆ isFileExtension()

s32 irr::core::isFileExtension ( const io::path filename,
const io::path ext0,
const io::path ext1,
const io::path ext2 
)
inline

search if a filename has a proper extension

Definition at line 23 of file coreutil.h.

25 {
26  s32 extPos = filename.findLast ( '.' );
27  if ( extPos < 0 )
28  return 0;
29 
30  extPos += 1;
31  if ( filename.equals_substring_ignore_case ( ext0, extPos ) )
32  return 1;
33  if ( filename.equals_substring_ignore_case ( ext1, extPos ) )
34  return 2;
35  if ( filename.equals_substring_ignore_case ( ext2, extPos ) )
36  return 3;
37  return 0;
38 }
const char * filename
Definition: SDL_assert.h:116
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70

◆ isInSameDirectory()

s32 irr::core::isInSameDirectory ( const io::path path,
const io::path file 
)
inline

looks if file is in the same directory of path. returns offset of directory. 0 means in same directory. 1 means file is direct child of path

Definition at line 114 of file coreutil.h.

115 {
116  if ( path.size() && !path.equalsn ( file, path.size() ) )
117  return -1;
118 
119  s32 subA = 0;
120  s32 subB = 0;
121  s32 pos = 0;
122  while ( (pos = path.findNext ( '/', pos )) >= 0 )
123  {
124  subA += 1;
125  pos += 1;
126  }
127 
128  pos = 0;
129  while ( (pos = file.findNext ( '/', pos )) >= 0 )
130  {
131  subB += 1;
132  pos += 1;
133  }
134 
135  return subB - subA;
136 }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLsizei const GLchar *const * path

◆ isnotzero()

bool irr::core::isnotzero ( const f32  a,
const f32  tolerance = ROUNDING_ERROR_f32 
)
inline

returns if a equals not zero, taking rounding errors into account

Definition at line 319 of file irrMath.h.

320  {
321  return fabsf(a) > tolerance;
322  }
GLboolean GLboolean GLboolean GLboolean a

◆ isspace()

s32 irr::core::isspace ( s32  c)
inline

Definition at line 198 of file coreutil.h.

198 { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
const GLubyte * c

◆ isupper()

s32 irr::core::isupper ( s32  c)
inline

Definition at line 199 of file coreutil.h.

199 { return c >= 'A' && c <= 'Z'; }
const GLubyte * c

◆ iszero() [1/5]

bool irr::core::iszero ( const f64  a,
const f64  tolerance = ROUNDING_ERROR_f64 
)
inline

returns if a equals zero, taking rounding errors into account

Definition at line 307 of file irrMath.h.

308  {
309  return fabs(a) <= tolerance;
310  }
GLboolean GLboolean GLboolean GLboolean a

◆ iszero() [2/5]

bool irr::core::iszero ( const f32  a,
const f32  tolerance = ROUNDING_ERROR_f32 
)
inline

returns if a equals zero, taking rounding errors into account

Definition at line 313 of file irrMath.h.

314  {
315  return fabsf(a) <= tolerance;
316  }
GLboolean GLboolean GLboolean GLboolean a

◆ iszero() [3/5]

bool irr::core::iszero ( const s32  a,
const s32  tolerance = 0 
)
inline

returns if a equals zero, taking rounding errors into account

Definition at line 325 of file irrMath.h.

326  {
327  return ( a & 0x7ffffff ) <= tolerance;
328  }
GLboolean GLboolean GLboolean GLboolean a

◆ iszero() [4/5]

bool irr::core::iszero ( const u32  a,
const u32  tolerance = 0 
)
inline

returns if a equals zero, taking rounding errors into account

Definition at line 331 of file irrMath.h.

332  {
333  return a <= tolerance;
334  }
GLboolean GLboolean GLboolean GLboolean a

◆ iszero() [5/5]

bool irr::core::iszero ( const s64  a,
const s64  tolerance = 0 
)
inline

returns if a equals zero, taking rounding errors into account

Definition at line 338 of file irrMath.h.

339  {
340  return abs_(a) <= tolerance;
341  }
GLboolean GLboolean GLboolean GLboolean a
T abs_(const T &a)
returns abs of two values. Own implementation to get rid of STL (VS6 problems)
Definition: irrMath.h:152

◆ lerp()

template<class T >
T irr::core::lerp ( const T &  a,
const T &  b,
const f32  t 
)
inline

returns linear interpolation of a and b with ratio t

Returns
: a if t==0, b if t==1, and the linear interpolation else

Definition at line 160 of file irrMath.h.

161  {
162  return (T)(a*(1.f-t)) + (b*t);
163  }
GLdouble GLdouble t
Definition: SDL_opengl.h:2071
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ max_() [1/2]

template<class T >
const T& irr::core::max_ ( const T &  a,
const T &  b 
)
inline

returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)

Definition at line 138 of file irrMath.h.

139  {
140  return a < b ? b : a;
141  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ max_() [2/2]

template<class T >
const T& irr::core::max_ ( const T &  a,
const T &  b,
const T &  c 
)
inline

returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)

Definition at line 145 of file irrMath.h.

146  {
147  return a < b ? max_(b, c) : max_(a, c);
148  }
const T & max_(const T &a, const T &b, const T &c)
returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:145
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c

◆ min_() [1/2]

template<class T >
const T& irr::core::min_ ( const T &  a,
const T &  b 
)
inline

returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)

Definition at line 124 of file irrMath.h.

125  {
126  return a < b ? a : b;
127  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ min_() [2/2]

template<class T >
const T& irr::core::min_ ( const T &  a,
const T &  b,
const T &  c 
)
inline

returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)

Definition at line 131 of file irrMath.h.

132  {
133  return a < b ? min_(a, c) : min_(b, c);
134  }
const T & min_(const T &a, const T &b, const T &c)
returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)
Definition: irrMath.h:131
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c

◆ operator *() [1/3]

template<class S , class T >
vector2d<T> irr::core::operator * ( const scalar,
const vector2d< T > &  vector 
)

Definition at line 409 of file vector2d.h.

409 { return vector*scalar; }

◆ operator *() [2/3]

template<class S , class T >
vector3d<T> irr::core::operator * ( const scalar,
const vector3d< T > &  vector 
)

Function multiplying a scalar and a vector component-wise.

Definition at line 468 of file vector3d.h.

468 { return vector*scalar; }

◆ operator *() [3/3]

template<class T >
CMatrix4<T> irr::core::operator * ( const scalar,
const CMatrix4< T > &  mat 
)
inline

Definition at line 2370 of file matrix4.h.

2371  {
2372  return mat*scalar;
2373  }

◆ operator+() [1/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const ustring16< TAlloc > &  right 
)
inline

Appends two ustring16s.

Definition at line 3294 of file irrUString.h.

3295 {
3296  ustring16<TAlloc> ret(left);
3297  ret += right;
3298  return ret;
3299 }
GLint left
GLdouble GLdouble right

◆ operator+() [2/23]

template<typename TAlloc , class B >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const B *const  right 
)
inline

Appends a ustring16 and a null-terminated unicode string.

Definition at line 3304 of file irrUString.h.

3305 {
3306  ustring16<TAlloc> ret(left);
3307  ret += right;
3308  return ret;
3309 }
GLint left
GLdouble GLdouble right

◆ operator+() [3/23]

template<class B , typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const B *const  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a null-terminated unicode string.

Definition at line 3314 of file irrUString.h.

3315 {
3316  ustring16<TAlloc> ret(left);
3317  ret += right;
3318  return ret;
3319 }
GLint left
GLdouble GLdouble right

◆ operator+() [4/23]

template<typename TAlloc , typename B , typename BAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const string< B, BAlloc > &  right 
)
inline

Appends a ustring16 and an Irrlicht string.

Definition at line 3324 of file irrUString.h.

3325 {
3326  ustring16<TAlloc> ret(left);
3327  ret += right;
3328  return ret;
3329 }
GLint left
GLdouble GLdouble right

◆ operator+() [5/23]

template<typename TAlloc , typename B , typename BAlloc >
ustring16<TAlloc> irr::core::operator+ ( const string< B, BAlloc > &  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and an Irrlicht string.

Definition at line 3334 of file irrUString.h.

3335 {
3336  ustring16<TAlloc> ret(left);
3337  ret += right;
3338  return ret;
3339 }
GLint left
GLdouble GLdouble right

◆ operator+() [6/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const char  right 
)
inline

Appends a ustring16 and a char.

Definition at line 3364 of file irrUString.h.

3365 {
3366  ustring16<TAlloc> ret(left);
3367  ret += right;
3368  return ret;
3369 }
GLint left
GLdouble GLdouble right

◆ operator+() [7/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const char  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a char.

Definition at line 3374 of file irrUString.h.

3375 {
3376  ustring16<TAlloc> ret(left);
3377  ret += right;
3378  return ret;
3379 }
GLint left
GLdouble GLdouble right

◆ operator+() [8/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const short  right 
)
inline

Appends a ustring16 and a short.

Definition at line 3406 of file irrUString.h.

3407 {
3408  ustring16<TAlloc> ret(left);
3409  ret += core::stringc(right);
3410  return ret;
3411 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [9/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const short  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a short.

Definition at line 3416 of file irrUString.h.

3417 {
3418  ustring16<TAlloc> ret(core::stringc(left));
3419  ret += right;
3420  return ret;
3421 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [10/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const unsigned short  right 
)
inline

Appends a ustring16 and an unsigned short.

Definition at line 3426 of file irrUString.h.

3427 {
3428  ustring16<TAlloc> ret(left);
3429  ret += core::stringc(right);
3430  return ret;
3431 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [11/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const unsigned short  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and an unsigned short.

Definition at line 3436 of file irrUString.h.

3437 {
3438  ustring16<TAlloc> ret(core::stringc(left));
3439  ret += right;
3440  return ret;
3441 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [12/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const int  right 
)
inline

Appends a ustring16 and an int.

Definition at line 3446 of file irrUString.h.

3447 {
3448  ustring16<TAlloc> ret(left);
3449  ret += core::stringc(right);
3450  return ret;
3451 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [13/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const int  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and an int.

Definition at line 3456 of file irrUString.h.

3457 {
3458  ustring16<TAlloc> ret(core::stringc(left));
3459  ret += right;
3460  return ret;
3461 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [14/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const unsigned int  right 
)
inline

Appends a ustring16 and an unsigned int.

Definition at line 3466 of file irrUString.h.

3467 {
3468  ustring16<TAlloc> ret(left);
3469  ret += core::stringc(right);
3470  return ret;
3471 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [15/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const unsigned int  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and an unsigned int.

Definition at line 3476 of file irrUString.h.

3477 {
3478  ustring16<TAlloc> ret(core::stringc(left));
3479  ret += right;
3480  return ret;
3481 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [16/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const long  right 
)
inline

Appends a ustring16 and a long.

Definition at line 3486 of file irrUString.h.

3487 {
3488  ustring16<TAlloc> ret(left);
3489  ret += core::stringc(right);
3490  return ret;
3491 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [17/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const long  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a long.

Definition at line 3496 of file irrUString.h.

3497 {
3498  ustring16<TAlloc> ret(core::stringc(left));
3499  ret += right;
3500  return ret;
3501 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [18/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const unsigned long  right 
)
inline

Appends a ustring16 and an unsigned long.

Definition at line 3506 of file irrUString.h.

3507 {
3508  ustring16<TAlloc> ret(left);
3509  ret += core::stringc(right);
3510  return ret;
3511 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [19/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const unsigned long  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and an unsigned long.

Definition at line 3516 of file irrUString.h.

3517 {
3518  ustring16<TAlloc> ret(core::stringc(left));
3519  ret += right;
3520  return ret;
3521 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [20/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const float  right 
)
inline

Appends a ustring16 and a float.

Definition at line 3526 of file irrUString.h.

3527 {
3528  ustring16<TAlloc> ret(left);
3529  ret += core::stringc(right);
3530  return ret;
3531 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [21/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const float  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a float.

Definition at line 3536 of file irrUString.h.

3537 {
3538  ustring16<TAlloc> ret(core::stringc(left));
3539  ret += right;
3540  return ret;
3541 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [22/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const ustring16< TAlloc > &  left,
const double  right 
)
inline

Appends a ustring16 and a double.

Definition at line 3546 of file irrUString.h.

3547 {
3548  ustring16<TAlloc> ret(left);
3549  ret += core::stringc(right);
3550  return ret;
3551 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ operator+() [23/23]

template<typename TAlloc >
ustring16<TAlloc> irr::core::operator+ ( const double  left,
const ustring16< TAlloc > &  right 
)
inline

Appends a ustring16 and a double.

Definition at line 3556 of file irrUString.h.

3557 {
3558  ustring16<TAlloc> ret(core::stringc(left));
3559  ret += right;
3560  return ret;
3561 }
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLint left
GLdouble GLdouble right

◆ radToDeg() [1/2]

f32 irr::core::radToDeg ( f32  radians)
inline

Utility function to convert a radian value to degrees.

Provided as it can be clearer to write radToDeg(X) than RADTODEG * X

Parameters
radiansThe radians value to convert to degrees.

Definition at line 90 of file irrMath.h.

91  {
92  return RADTODEG * radians;
93  }
const f32 RADTODEG
32bit constant for converting from radians to degrees (formally known as GRAD_PI)
Definition: irrMath.h:78

◆ radToDeg() [2/2]

f64 irr::core::radToDeg ( f64  radians)
inline

Utility function to convert a radian value to degrees.

Provided as it can be clearer to write radToDeg(X) than RADTODEG * X

Parameters
radiansThe radians value to convert to degrees.

Definition at line 99 of file irrMath.h.

100  {
101  return RADTODEG64 * radians;
102  }
const f64 RADTODEG64
64bit constant for converting from radians to degrees
Definition: irrMath.h:84

◆ reciprocal() [1/2]

REALINLINE f32 irr::core::reciprocal ( const f32  f)

Definition at line 562 of file irrMath.h.

563  {
564 #if defined (IRRLICHT_FAST_MATH)
565  // NOTE: Unlike with 1.f / f the values very close to 0 return -nan instead of inf
566 
567  // SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
568  // bi ts of the mantissa
569  // One Newton-Raphson Iteration:
570  // f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
571 #if defined(_MSC_VER) && !defined(_WIN64)
572  f32 rec;
573  __asm rcpss xmm0, f // xmm0 = rcpss(f)
574  __asm movss xmm1, f // xmm1 = f
575  __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
576  __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
577  __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
578  __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
579  // - f * rcpss(f) * rcpss(f)
580  __asm movss rec, xmm0 // return xmm0
581  return rec;
582 #else // no support yet for other compilers
583  return 1.f / f;
584 #endif
585  // instead set f to a high value to get a return value near zero..
587  // -1000000000000.f.. is use minus to stay negative..
588  // must test's here (plane.normal dot anything ) checks on <= 0.f
589  //u32 x = (-(AIR(f) != 0 ) >> 31 ) & ( IR(f) ^ 0xd368d4a5 ) ^ 0xd368d4a5;
590  //return 1.f / FR ( x );
591 
592 #else // no fast math
593  return 1.f / f;
594 #endif
595  }
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
GLfloat f

◆ reciprocal() [2/2]

REALINLINE f64 irr::core::reciprocal ( const f64  f)

Definition at line 598 of file irrMath.h.

599  {
600  return 1.0 / f;
601  }
GLfloat f

◆ reciprocal_approxim()

REALINLINE f32 irr::core::reciprocal_approxim ( const f32  f)

Definition at line 605 of file irrMath.h.

606  {
607 #if defined( IRRLICHT_FAST_MATH)
608 
609  // SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
610  // bi ts of the mantissa
611  // One Newton-Raphson Iteration:
612  // f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
613 #if defined(_MSC_VER) && !defined(_WIN64)
614  f32 rec;
615  __asm rcpss xmm0, f // xmm0 = rcpss(f)
616  __asm movss xmm1, f // xmm1 = f
617  __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
618  __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
619  __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
620  __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
621  // - f * rcpss(f) * rcpss(f)
622  __asm movss rec, xmm0 // return xmm0
623  return rec;
624 #else // no support yet for other compilers
625  return 1.f / f;
626 #endif
627 
628 /*
629  // SSE reciprocal estimate, accurate to 12 significant bits of
630  f32 rec;
631  __asm rcpss xmm0, f // xmm0 = rcpss(f)
632  __asm movss rec , xmm0 // return xmm0
633  return rec;
634 */
635 /*
636  register u32 x = 0x7F000000 - IR ( p );
637  const f32 r = FR ( x );
638  return r * (2.0f - p * r);
639 */
640 #else // no fast math
641  return 1.f / f;
642 #endif
643  }
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
GLfloat f

◆ reciprocal_squareroot() [1/3]

REALINLINE f64 irr::core::reciprocal_squareroot ( const f64  x)

Definition at line 521 of file irrMath.h.

522  {
523  return 1.0 / sqrt(x);
524  }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ reciprocal_squareroot() [2/3]

REALINLINE f32 irr::core::reciprocal_squareroot ( const f32  f)

Definition at line 527 of file irrMath.h.

528  {
529 #if defined ( IRRLICHT_FAST_MATH )
530  // NOTE: Unlike comment below says I found inaccuracies already at 4'th significant bit.
531  // p.E: Input 1, expected 1, got 0.999755859
532 
533  #if defined(_MSC_VER) && !defined(_WIN64)
534  // SSE reciprocal square root estimate, accurate to 12 significant
535  // bits of the mantissa
536  f32 recsqrt;
537  __asm rsqrtss xmm0, f // xmm0 = rsqrtss(f)
538  __asm movss recsqrt, xmm0 // return xmm0
539  return recsqrt;
540 
541 /*
542  // comes from Nvidia
543  u32 tmp = (u32(IEEE_1_0 << 1) + IEEE_1_0 - *(u32*)&x) >> 1;
544  f32 y = *(f32*)&tmp;
545  return y * (1.47f - 0.47f * x * y * y);
546 */
547  #else
548  return 1.f / sqrtf(f);
549  #endif
550 #else // no fast math
551  return 1.f / sqrtf(f);
552 #endif
553  }
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
GLfloat f

◆ reciprocal_squareroot() [3/3]

REALINLINE s32 irr::core::reciprocal_squareroot ( const s32  x)

Definition at line 556 of file irrMath.h.

557  {
558  return static_cast<s32>(reciprocal_squareroot(static_cast<f32>(x)));
559  }
REALINLINE s32 reciprocal_squareroot(const s32 x)
Definition: irrMath.h:556
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ relativeErrorFactor() [1/3]

template<class T >
T irr::core::relativeErrorFactor ( )
inline

Definition at line 227 of file irrMath.h.

228  {
229  return 1;
230  }

◆ relativeErrorFactor() [2/3]

template<>
f32 irr::core::relativeErrorFactor ( )
inline

Definition at line 233 of file irrMath.h.

234  {
235  return 4;
236  }

◆ relativeErrorFactor() [3/3]

template<>
f64 irr::core::relativeErrorFactor ( )
inline

Definition at line 239 of file irrMath.h.

240  {
241  return 8;
242  }

◆ round32()

REALINLINE s32 irr::core::round32 ( f32  x)

Definition at line 657 of file irrMath.h.

658  {
659  return (s32) round_(x);
660  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
f32 round_(f32 x)
Definition: irrMath.h:489

◆ round_()

f32 irr::core::round_ ( f32  x)
inline

Definition at line 489 of file irrMath.h.

490  {
491  return floorf( x + 0.5f );
492  }
GLfloat f
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ roundingError() [1/7]

template<class T >
T irr::core::roundingError ( )
inline

Definition at line 189 of file irrMath.h.

190  {
191  return ROUNDING_ERROR_f32;
192  }
const f32 ROUNDING_ERROR_f32
Definition: irrMath.h:50

◆ roundingError() [2/7]

template<>
f32 irr::core::roundingError ( )
inline

Definition at line 189 of file irrMath.h.

190  {
191  return ROUNDING_ERROR_f32;
192  }
const f32 ROUNDING_ERROR_f32
Definition: irrMath.h:50

◆ roundingError() [3/7]

template<>
f64 irr::core::roundingError ( )
inline

Definition at line 195 of file irrMath.h.

196  {
197  return ROUNDING_ERROR_f64;
198  }
const f64 ROUNDING_ERROR_f64
Definition: irrMath.h:51

◆ roundingError() [4/7]

template<>
s32 irr::core::roundingError ( )
inline

Definition at line 201 of file irrMath.h.

202  {
203  return ROUNDING_ERROR_S32;
204  }
const s32 ROUNDING_ERROR_S32
Rounding error constant often used when comparing f32 values.
Definition: irrMath.h:45

◆ roundingError() [5/7]

template<>
u32 irr::core::roundingError ( )
inline

Definition at line 207 of file irrMath.h.

208  {
209  return ROUNDING_ERROR_S32;
210  }
const s32 ROUNDING_ERROR_S32
Rounding error constant often used when comparing f32 values.
Definition: irrMath.h:45

◆ roundingError() [6/7]

template<>
s64 irr::core::roundingError ( )
inline

Definition at line 214 of file irrMath.h.

215  {
216  return ROUNDING_ERROR_S64;
217  }
const s64 ROUNDING_ERROR_S64
Definition: irrMath.h:48

◆ roundingError() [7/7]

template<>
u64 irr::core::roundingError ( )
inline

Definition at line 220 of file irrMath.h.

221  {
222  return ROUNDING_ERROR_S64;
223  }
const s64 ROUNDING_ERROR_S64
Definition: irrMath.h:48

◆ s32_clamp()

s32 irr::core::s32_clamp ( s32  value,
s32  low,
s32  high 
)
inline

Definition at line 356 of file irrMath.h.

357  {
358  return s32_min(s32_max(value,low), high);
359  }
s32 s32_min(s32 a, s32 b)
Definition: irrMath.h:344
s32 s32_max(s32 a, s32 b)
Definition: irrMath.h:350
GLsizei const GLfloat * value

◆ s32_max()

s32 irr::core::s32_max ( s32  a,
s32  b 
)
inline

Definition at line 350 of file irrMath.h.

351  {
352  const s32 mask = (a - b) >> 31;
353  return (b & mask) | (a & ~mask);
354  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLenum GLint GLuint mask
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ s32_min()

s32 irr::core::s32_min ( s32  a,
s32  b 
)
inline

Definition at line 344 of file irrMath.h.

345  {
346  const s32 mask = (a - b) >> 31;
347  return (a & mask) | (b & ~mask);
348  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
GLenum GLint GLuint mask
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

◆ setbit_cond()

REALINLINE void irr::core::setbit_cond ( u32 state,
s32  condition,
u32  mask 
)

Definition at line 479 of file irrMath.h.

480  {
481  // 0, or any positive to mask
482  //s32 conmask = -condition >> 31;
483  state ^= ( ( -condition >> 31 ) ^ state ) & mask;
484  }
GLenum GLint GLuint mask
GLenum condition

◆ squareroot() [1/4]

REALINLINE f32 irr::core::squareroot ( const f32  f)

Definition at line 495 of file irrMath.h.

496  {
497  return sqrtf(f);
498  }
GLfloat f

◆ squareroot() [2/4]

REALINLINE f64 irr::core::squareroot ( const f64  f)

Definition at line 501 of file irrMath.h.

502  {
503  return sqrt(f);
504  }
GLfloat f

◆ squareroot() [3/4]

REALINLINE s32 irr::core::squareroot ( const s32  f)

Definition at line 507 of file irrMath.h.

508  {
509  return static_cast<s32>(squareroot(static_cast<f32>(f)));
510  }
REALINLINE s64 squareroot(const s64 f)
Definition: irrMath.h:514
GLfloat f

◆ squareroot() [4/4]

REALINLINE s64 irr::core::squareroot ( const s64  f)

Definition at line 514 of file irrMath.h.

515  {
516  return static_cast<s64>(squareroot(static_cast<f64>(f)));
517  }
REALINLINE s64 squareroot(const s64 f)
Definition: irrMath.h:514
GLfloat f

◆ strtof10()

f32 irr::core::strtof10 ( const char *  in,
const char **  out = 0 
)
inline

Converts a sequence of digits into a whole positive floating point value.

Only digits 0 to 9 are parsed. Parsing stops at any other character, including sign characters or a decimal point.

Parameters
inthe sequence of digits to convert.
out(optional) will be set to point at the first non-converted character.
Returns
The whole positive floating point representation of the digit sequence.

Definition at line 259 of file fast_atof.h.

260 {
261  if (!in)
262  {
263  if (out)
264  *out = in;
265  return 0.f;
266  }
267 
268  const u32 MAX_SAFE_U32_VALUE = UINT_MAX / 10 - 10;
269  u32 intValue = 0;
270 
271  // Use integer arithmetic for as long as possible, for speed
272  // and precision.
273  while ( ( *in >= '0') && ( *in <= '9' ) )
274  {
275  // If it looks like we're going to overflow, bail out
276  // now and start using floating point.
277  if (intValue >= MAX_SAFE_U32_VALUE)
278  break;
279 
280  intValue = (intValue * 10) + (*in - '0');
281  ++in;
282  }
283 
284  f32 floatValue = (f32)intValue;
285 
286  // If there are any digits left to parse, then we need to use
287  // floating point arithmetic from here.
288  while ( ( *in >= '0') && ( *in <= '9' ) )
289  {
290  floatValue = (floatValue * 10.f) + (f32)(*in - '0');
291  ++in;
292  if (floatValue > FLT_MAX) // Just give up.
293  break;
294  }
295 
296  if (out)
297  *out = in;
298 
299  return floatValue;
300 }
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
#define FLT_MAX
Definition: irrMath.h:31
GLuint in

◆ strtol10()

s32 irr::core::strtol10 ( const char *  in,
const char **  out = 0 
)
inline

Convert a simple string of base 10 digits into a signed 32 bit integer.

Parameters
[in]inThe string of digits to convert. Only a leading - or + followed by digits 0 to 9 will be considered. Parsing stops at the first non-digit.
[out]out(optional) If provided, it will be set to point at the first character not used in the calculation.
Returns
The signed integer value of the digits. If the string specifies too many digits to encode in an s32 then +INT_MAX or -INT_MAX will be returned.

Definition at line 90 of file fast_atof.h.

91 {
92  if (!in)
93  {
94  if (out)
95  *out = in;
96  return 0;
97  }
98 
99  const bool negative = ('-' == *in);
100  if (negative || ('+' == *in))
101  ++in;
102 
103  const u32 unsignedValue = strtoul10(in,out);
104  if (unsignedValue > (u32)INT_MAX)
105  {
106  if (negative)
107  return (s32)INT_MIN;
108  else
109  return (s32)INT_MAX;
110  }
111  else
112  {
113  if (negative)
114  return -((s32)unsignedValue);
115  else
116  return (s32)unsignedValue;
117  }
118 }
u32 strtoul10(const char *in, const char **out=0)
Convert a simple string of base 10 digits into an unsigned 32 bit integer.
Definition: fast_atof.h:50
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in

◆ strtoul10()

u32 irr::core::strtoul10 ( const char *  in,
const char **  out = 0 
)
inline

Convert a simple string of base 10 digits into an unsigned 32 bit integer.

Parameters
[in]inThe string of digits to convert. No leading chars are allowed, only digits 0 to 9. Parsing stops at the first non-digit.
[out]out(optional) If provided, it will be set to point at the first character not used in the calculation.
Returns
The unsigned integer value of the digits. If the string specifies too many digits to encode in an u32 then INT_MAX will be returned.

Definition at line 50 of file fast_atof.h.

51 {
52  if (!in)
53  {
54  if (out)
55  *out = in;
56  return 0;
57  }
58 
59  bool overflow=false;
60  u32 unsignedValue = 0;
61  while ( ( *in >= '0') && ( *in <= '9' ))
62  {
63  const u32 tmp = ( unsignedValue * 10 ) + ( *in - '0' );
64  if (tmp<unsignedValue)
65  {
66  unsignedValue=(u32)0xffffffff;
67  overflow=true;
68  }
69  if (!overflow)
70  unsignedValue = tmp;
71  ++in;
72  }
73 
74  if (out)
75  *out = in;
76 
77  return unsignedValue;
78 }
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in

◆ strtoul16()

u32 irr::core::strtoul16 ( const char *  in,
const char **  out = 0 
)
inline

Convert a simple string of base 16 digits into an unsigned 32 bit integer.

Parameters
[in]inThe string of digits to convert. No leading chars are allowed, only digits 0 to 9 and chars A-F,a-f are allowed. Parsing stops at the first illegal char.
[out]out(optional) If provided, it will be set to point at the first character not used in the calculation.
Returns
The unsigned integer value of the digits. If the string specifies too many digits to encode in an u32 then INT_MAX will be returned.

Definition at line 147 of file fast_atof.h.

148 {
149  if (!in)
150  {
151  if (out)
152  *out = in;
153  return 0;
154  }
155 
156  bool overflow=false;
157  u32 unsignedValue = 0;
158  while (true)
159  {
160  u32 tmp = 0;
161  if ((*in >= '0') && (*in <= '9'))
162  tmp = (unsignedValue << 4u) + (*in - '0');
163  else if ((*in >= 'A') && (*in <= 'F'))
164  tmp = (unsignedValue << 4u) + (*in - 'A') + 10;
165  else if ((*in >= 'a') && (*in <= 'f'))
166  tmp = (unsignedValue << 4u) + (*in - 'a') + 10;
167  else
168  break;
169  if (tmp<unsignedValue)
170  {
171  unsignedValue=(u32)INT_MAX;
172  overflow=true;
173  }
174  if (!overflow)
175  unsignedValue = tmp;
176  ++in;
177  }
178 
179  if (out)
180  *out = in;
181 
182  return unsignedValue;
183 }
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in

◆ strtoul8()

u32 irr::core::strtoul8 ( const char *  in,
const char **  out = 0 
)
inline

Convert a simple string of base 8 digits into an unsigned 32 bit integer.

Parameters
[in]inThe string of digits to convert. No leading chars are allowed, only digits 0 to 7 are allowed. Parsing stops at the first illegal char.
[out]out(optional) If provided, it will be set to point at the first character not used in the calculation.
Returns
The unsigned integer value of the digits. If the string specifies too many digits to encode in an u32 then INT_MAX will be returned.

Definition at line 194 of file fast_atof.h.

195 {
196  if (!in)
197  {
198  if (out)
199  *out = in;
200  return 0;
201  }
202 
203  bool overflow=false;
204  u32 unsignedValue = 0;
205  while (true)
206  {
207  u32 tmp = 0;
208  if ((*in >= '0') && (*in <= '7'))
209  tmp = (unsignedValue << 3u) + (*in - '0');
210  else
211  break;
212  if (tmp<unsignedValue)
213  {
214  unsignedValue=(u32)INT_MAX;
215  overflow=true;
216  }
217  if (!overflow)
218  unsignedValue = tmp;
219  ++in;
220  }
221 
222  if (out)
223  *out = in;
224 
225  return unsignedValue;
226 }
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in

◆ strtoul_prefix()

u32 irr::core::strtoul_prefix ( const char *  in,
const char **  out = 0 
)
inline

Convert a C-style prefixed string (hex, oct, integer) into an unsigned 32 bit integer.

Parameters
[in]inThe string of digits to convert. If string starts with 0x the hex parser is used, if only leading 0 is used, oct parser is used. In all other cases, the usual unsigned parser is used.
[out]out(optional) If provided, it will be set to point at the first character not used in the calculation.
Returns
The unsigned integer value of the digits. If the string specifies too many digits to encode in an u32 then INT_MAX will be returned.

Definition at line 237 of file fast_atof.h.

238 {
239  if (!in)
240  {
241  if (out)
242  *out = in;
243  return 0;
244  }
245  if ('0'==in[0])
246  return ('x'==in[1] ? strtoul16(in+2,out) : strtoul8(in+1,out));
247  return strtoul10(in,out);
248 }
u32 strtoul10(const char *in, const char **out=0)
Convert a simple string of base 10 digits into an unsigned 32 bit integer.
Definition: fast_atof.h:50
u32 strtoul8(const char *in, const char **out=0)
Convert a simple string of base 8 digits into an unsigned 32 bit integer.
Definition: fast_atof.h:194
u32 strtoul16(const char *in, const char **out=0)
Convert a simple string of base 16 digits into an unsigned 32 bit integer.
Definition: fast_atof.h:147
GLuint in

◆ swap()

template<class T1 , class T2 >
void irr::core::swap ( T1 &  a,
T2 &  b 
)
inline

swaps the content of the passed parameters

Definition at line 178 of file irrMath.h.

179  {
180  T1 c(a);
181  a = b;
182  b = c;
183  }
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c

◆ utf8ToWchar()

IRRLICHT_API void irr::core::utf8ToWchar ( const char *  in,
wchar_t *  out,
const u64  len 
)

Convert this utf-8-encoded string to the platform's wchar.

The resulting string is always NULL-terminated and well-formed.

Parameters
lenThe size of the output buffer in bytes.

◆ wcharToUtf8()

IRRLICHT_API void irr::core::wcharToUtf8 ( const wchar_t *  in,
char *  out,
const u64  len 
)

Convert this wchar string to utf-8.

The resulting string is always NULL-terminated and well-formed.

Parameters
lenThe size of the output buffer in bytes.

Variable Documentation

◆ DEGTORAD

const f32 irr::core::DEGTORAD = PI / 180.0f

32bit Constant for converting from degrees to radians

Definition at line 75 of file irrMath.h.

◆ DEGTORAD64

const f64 irr::core::DEGTORAD64 = PI64 / 180.0

64bit constant for converting from degrees to radians (formally known as GRAD_PI2)

Definition at line 81 of file irrMath.h.

◆ fast_atof_table

const float irr::core::fast_atof_table[17]
Initial value:
= {
0.f,
0.1f,
0.01f,
0.001f,
0.0001f,
0.00001f,
0.000001f,
0.0000001f,
0.00000001f,
0.000000001f,
0.0000000001f,
0.00000000001f,
0.000000000001f,
0.0000000000001f,
0.00000000000001f,
0.000000000000001f,
0.0000000000000001f
}

Definition at line 22 of file fast_atof.h.

◆ HALF_PI

const f32 irr::core::HALF_PI = PI/2.0f

Constant for half of PI.

Definition at line 63 of file irrMath.h.

◆ IdentityMatrix

IRRLICHT_API const matrix4 irr::core::IdentityMatrix

global const identity matrix

◆ LOCALE_DECIMAL_POINTS

IRRLICHT_API irr::core::stringc irr::core::LOCALE_DECIMAL_POINTS

Selection of characters which count as decimal point in fast_atof.

◆ PI

const f32 irr::core::PI = 3.14159265359f

Constant for PI.

Definition at line 57 of file irrMath.h.

◆ PI64

const f64 irr::core::PI64 = 3.1415926535897932384626433832795028841971693993751

Constant for 64bit PI.

Definition at line 69 of file irrMath.h.

◆ RADTODEG

const f32 irr::core::RADTODEG = 180.0f / PI

32bit constant for converting from radians to degrees (formally known as GRAD_PI)

Definition at line 78 of file irrMath.h.

◆ RADTODEG64

const f64 irr::core::RADTODEG64 = 180.0 / PI64

64bit constant for converting from radians to degrees

Definition at line 84 of file irrMath.h.

◆ RECIPROCAL_PI

const f32 irr::core::RECIPROCAL_PI = 1.0f/PI

Constant for reciprocal of PI.

Definition at line 60 of file irrMath.h.

◆ RECIPROCAL_PI64

const f64 irr::core::RECIPROCAL_PI64 = 1.0/PI64

Constant for 64bit reciprocal of PI.

Definition at line 72 of file irrMath.h.

◆ ROUNDING_ERROR_f32

const f32 irr::core::ROUNDING_ERROR_f32 = 0.000001f

Definition at line 50 of file irrMath.h.

◆ ROUNDING_ERROR_f64

const f64 irr::core::ROUNDING_ERROR_f64 = 0.00000001

Definition at line 51 of file irrMath.h.

◆ ROUNDING_ERROR_S32

const s32 irr::core::ROUNDING_ERROR_S32 = 0

Rounding error constant often used when comparing f32 values.

Definition at line 45 of file irrMath.h.

◆ ROUNDING_ERROR_S64

const s64 irr::core::ROUNDING_ERROR_S64 = 0

Definition at line 48 of file irrMath.h.