#include "utils.h" Vector2 randomDirection2(int seed, int* nextSeed) { Vector2 direction; direction.x = FT_RANDOM16(seed) % RANDOM_DIRECTION_UNITS; direction.y = FT_RANDOM16(seed) % RANDOM_DIRECTION_UNITS; direction.x -= RANDOM_DIRECTION_UNITS / 2.0; direction.y -= RANDOM_DIRECTION_UNITS / 2.0; if (nextSeed != NULL) { *nextSeed = seed; } return Vector2Normalize(direction); } Vector3 randomDirection3(int seed, int* nextSeed) { Vector3 direction; direction.x = FT_RANDOM16(seed) % RANDOM_DIRECTION_UNITS; direction.y = FT_RANDOM16(seed) % RANDOM_DIRECTION_UNITS; direction.z = FT_RANDOM16(seed) % RANDOM_DIRECTION_UNITS; direction.x -= RANDOM_DIRECTION_UNITS / 2.0; direction.y -= RANDOM_DIRECTION_UNITS / 2.0; direction.z -= RANDOM_DIRECTION_UNITS / 2.0; if (nextSeed != NULL) { *nextSeed = seed; } return Vector3Normalize(direction); } Image generateCubemapImage(const bool** cubemap, int width, int height) { // Allocate pixel data. Image image = (Image){ .data = FT_CALLOC(width * height, sizeof(Color)), .width = width, .height = height, .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, .mipmaps = 1 }; if (image.data == NULL) { ALLOCATION_ERROR; return image; } // Convert cubemap to image data. int index = 0; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { ((Color*)image.data)[index] = cubemap[y][x] ? BLACK : WHITE; ++index; } } return image; } // Why does the universe feel strange to exist in?