diff options
Diffstat (limited to 'src/rodeo_math.c')
| -rw-r--r-- | src/rodeo_math.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/rodeo_math.c b/src/rodeo_math.c index 0e19a1e..0e421ed 100644 --- a/src/rodeo_math.c +++ b/src/rodeo_math.c @@ -2,12 +2,18 @@ // -- internal -- // public #include "rodeo.h" +// private +#include "rodeo_internal.h" // -- system -- #include <stdint.h> +#include <math.h> // -- external -- #include "SDL2/SDL.h" +#include "stc/crandom.h" +#define CGLM_FORCE_DEPTH_ZERO_TO_ONE +#include "cglm/cglm.h" // rounds to nearest rather then truncation rodeo_color_RGBA8_t @@ -32,17 +38,39 @@ rodeo_color_RGBA8_to_RGBAFloat(const rodeo_color_RGBA8_t color) }; } +void +rodeo_random_seed_set(uint64_t seed) +{ + irodeo_random_seed_set(stc64_new(seed)); +} + double -rodeo_random_simple_float_get(void) +rodeo_random_double_get(void) { - return 0; + stc64_t *seed = irodeo_random_seed_get(); + return stc64_randf(seed); } uint64_t -rodeo_random_simple_uint64_get(void) +rodeo_random_uint64_get(void) { - return 0; + stc64_t *seed = irodeo_random_seed_get(); + return stc64_rand(seed); } +// need to test this, might be wrong +/* +rodeo_vector2_t +rodeo_angle_to_vector2(float angle) +{ + rodeo_vector2_t result = { {1.0f, 0.0f} }; + glm_vec2_rotate( + (float*)&(result.array), + angle * 2.0f * (float)GLM_PI, + (float*)&result.array + ); + return result; +} +*/ |
