Header file for helper functions.
More...
#include "Defines.h"
|
#define | SAFE_DELETE(p) {delete (p); (p) = nullptr;}; |
| Safe delete of a pointer. More...
|
|
#define | lerp(t, a, b) (a + t*(b - a)) |
| Linear interpolation.
|
|
#define | spline3(t) (t*t*(3.0f - 2.0f*t)) |
| Cubic spline.
|
|
#define | spline5(t) (t*t*t*(10.0f + 3.0f*t*(2.0f*t - 5.0f))) |
| Quintic spline.
|
|
#define | clamp(a, b, c) (((b)<(a))?(a):(((b)>(c))?(c):(b))) |
| Clamp between values.
|
|
◆ SAFE_DELETE
#define SAFE_DELETE |
( |
|
p | ) |
{delete (p); (p) = nullptr;}; |
Note that it is OK to delete a null pointer. Note the brackets and braces also.
◆ HSVtoRGB()
XMFLOAT4 HSVtoRGB |
( |
float |
h, |
|
|
float |
s, |
|
|
float |
v |
|
) |
| |
Convert color in HSV format to RGB format. This is a helper function for generating a pseudorandom color. I snagged it from the interwebs.
- Parameters
-
h | Hue. |
s | Saturation. |
v | Value. |
- Returns
- Color in RGB format with an alpha value of 1.
◆ MakeWideFileName()
void MakeWideFileName |
( |
_In_ const char * |
filename, |
|
|
_Out_ wchar_t *& |
wfilename |
|
) |
| |
Helper function to make a wide file name out of a regular one. Creates a wide buffer and stores the wide version of a regular file name in it. Remember to delete the wide file name after it has been used.
- Parameters
-
filename | [in] The original file name. |
wfilename | [out] The wide file name. |