This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <raylib.h> | |
#include <raymath.h> | |
#include <stdint.h> | |
#define min(a, b) (a) < (b) ? (a) : (b) | |
#define max(a, b) (a) > (b) ? (a) : (b) | |
static void | |
GridFromHeightMap(Vector3 *grid_positions, // output grid | |
int32_t grid_width, // point count x axis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <raylib.h> | |
#include <raymath.h> | |
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist) | |
{ | |
// Calculate direction vector and distance between listener and sound source | |
Vector3 direction = Vector3Subtract(position, listener.position); | |
float distance = Vector3Length(direction); | |
// Apply logarithmic distance attenuation and clamp between 0-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Library -------------------------------------------------------------------------- | |
#include <string.h> | |
#include <assert.h> | |
struct ui_box {int x,y,w,h;}; | |
typedef unsigned long long ui_id; | |
struct ui_node { | |
int parent; | |
int lst, end, nxt; | |
int siz[2]; |