random sound selection for triggers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "math.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <glm/ext/matrix_transform.hpp>
|
||||
#include <string>
|
||||
|
||||
@@ -76,4 +77,7 @@ namespace anm2ed::util::math
|
||||
return glm::translate(mat4(1.0f), vec3(position, 0.0f)) * local;
|
||||
}
|
||||
|
||||
float random() { return (float)rand() / RAND_MAX; }
|
||||
float random_in_range(float min, float max) { return min + random() * (max - min); }
|
||||
void random_seed_set() { srand(std::time(nullptr)); }
|
||||
}
|
||||
@@ -5,25 +5,13 @@
|
||||
|
||||
namespace anm2ed::util::math
|
||||
{
|
||||
template <typename T> constexpr T percent_to_unit(T value)
|
||||
{
|
||||
return value / 100.0f;
|
||||
}
|
||||
template <typename T> constexpr T percent_to_unit(T value) { return value / 100.0f; }
|
||||
|
||||
template <typename T> constexpr T unit_to_percent(T value)
|
||||
{
|
||||
return value * 100.0f;
|
||||
}
|
||||
template <typename T> constexpr T unit_to_percent(T value) { return value * 100.0f; }
|
||||
|
||||
constexpr float uint8_to_float(int value)
|
||||
{
|
||||
return (float)(value / 255.0f);
|
||||
}
|
||||
constexpr float uint8_to_float(int value) { return (float)(value / 255.0f); }
|
||||
|
||||
constexpr int float_to_uint8(float value)
|
||||
{
|
||||
return (int)(value * 255);
|
||||
}
|
||||
constexpr int float_to_uint8(float value) { return (int)(value * 255); }
|
||||
|
||||
constexpr std::array<float, 16> uv_vertices_get(glm::vec2 uvMin, glm::vec2 uvMax)
|
||||
{
|
||||
@@ -41,4 +29,8 @@ namespace anm2ed::util::math
|
||||
|
||||
glm::mat4 quad_model_get(glm::vec2 = {}, glm::vec2 = {}, glm::vec2 = {}, glm::vec2 = glm::vec2(1.0f), float = {});
|
||||
glm::mat4 quad_model_parent_get(glm::vec2 = {}, glm::vec2 = {}, glm::vec2 = glm::vec2(1.0f), float = {});
|
||||
|
||||
float random();
|
||||
float random_in_range(float min, float max);
|
||||
void random_seed_set();
|
||||
}
|
||||
Reference in New Issue
Block a user