Skip to content

Instantly share code, notes, and snippets.

🐴
horsin around

nicebyte nicebyte

🐴
horsin around
Block or report user

Report or block nicebyte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicebyte
nicebyte / shadertoy_lib.glsl
Last active Jun 26, 2019
frequently used routines for shadertoy
View shadertoy_lib.glsl
vec2 aspectCorrectedCoords(in vec2 fragCoord) {
vec2 uv = fragCoord/iResolution.xy;
vec2 xy = uv * 2.0 - 1.0;
xy.x *= iResolution.x / iResolution.y;
return xy;
}
float nearPlaneDist(in float verticalFovDegrees) {
return 1.0 / tan(radians(verticalFovDegrees/2.0));
}
View dyn_arr.h
/*
Example usage:
typedef struct point { uint32_t x, y } point;
void foo() {
DYN_ARR_OF(point) points;
DYN_ARR_RESET(points, 100u);
uint32_t npoints = 200u;
for (uint32_t i = 0u; i < npoints; ++i) {
point p = {i, i * 10u};
DYN_ARR_APPEND(points, p);
View morton.c
/* Trying to achieve better cache locality for 2d
* arrays using Morton order.
*
* compile with:
* gcc morton.c -O3 -lrt -mbmi2
*/
#define _POSIX_C_SOURCE 199309L
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
You can’t perform that action at this time.