1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-01-20 09:20:13 +00:00
UltimateTrainingModpack/source/useful_visual.h
Shivam Dutt 216bcbc0c2 Moved Hash40 and Vector3f structs from l2c.cpp to useful.h
Moved LOAD64 macro from l2c_imports.hpp to useful.h
Moved round_to and the various linear interpolation functions from useful.h to useful_visual.h
More formatting fixes
2019-05-28 15:36:33 -05:00

31 lines
1.1 KiB
C

#ifndef USEFUL_VISUAL_H
#define USEFUL_VISUAL_H
#include "useful.h"
/**
* Rounds a number to the nearest multiple of another number.
*/
float round_to(float val, float align);
/**
* Linearly interpolates between two numbers, without bounds checking.
*/
float lerp(float min, float max, float t);
float unlerp(float min, float max, float val);
/**
* Linearly interpolates between two numbers, with bounds checking.
*/
float lerp_bounded(float min, float max, float t);
float unlerp_bounded(float min, float max, float val);
/**
* Linearly nterpolates between two colors, with bounds checking, accounting for gamma.
* arguments:
* - min_color (Vector3f) -- xyz maps to rgb, components are usually in the range [0.0f, 1.0f] but can go beyond to account for super-bright or super-dark colors
* - max_Color (Vector3f) -- same as minColor
* - t (float) -- how far to interpolate between the colors
* - gamma (float = 2.0f) -- used for color correction, helps avoid ugly dark colors when interpolating b/t bright colors
*/
Vector3f color_lerp(Vector3f min_color, Vector3f max_color, float t, float gamma = 2.0f);
#endif // USEFUL_VISUAL_H