This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <inttypes.h> | |
#include <assert.h> | |
enum dim : uint8_t { | |
X, Y, Z, DIM_COUNT | |
}; |
This file contains 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 <stdio.h> | |
#include <tgmath.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <assert.h> | |
#include <string.h> | |
#define PI 3.141592653589793f | |
#define SEARCH_RADIUS 1.e-5f // Initial search radius for the local search procedure |
This file contains 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
#version 440 | |
#define STACK_SIZE 32 | |
#define INVALID_HIT_ID uint(-1) | |
// The primitive data be changed to the desired primitive type | |
// (including using BVHs as primitives for top-level BVH traversal). | |
#define PrimitiveData Triangle | |
#define HitData vec2 // Barycentric coordinates of a hit on a triangle (can be changed to anything) | |
#define intersect_ray_primitive(ray, prim, hit, tnear, tfar) \ |
This file contains 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 <cmath> | |
#include <iostream> | |
template <typename T> | |
struct dFloat { | |
T x, dx; | |
dFloat(T x, T dx = 0) : x(x), dx(dx) {} | |
}; | |
template <typename T> |
This file contains 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 <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
static bool is_prime(size_t i) { | |
if (i <= 1) | |
return false; | |
if (i <= 3) | |
return true; | |
if (i % 3 == 0 || i % 2 == 0) |
This file contains 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
#!/bin/env python3 | |
from mpl_toolkits import mplot3d | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import math | |
def vnorm(v): | |
return v / np.linalg.norm(v) | |
def draw_unit_sphere(ax): |
This file contains 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 <tgmath.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include <string.h> | |
#include <stdio.h> | |
// Discrete probability distribution sampling according to the method named | |
// "Squared Histogram" in "Fast Generation of Discrete Random Variables", |
This file contains 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
#!/bin/sh | |
# Disables notification sounds from gnome | |
dconf write /org/gnome/desktop/sound/event-sounds "false" | |
# Disables PulseAudio's suspend-on-idle to avoid cracks and pops | |
echo " | |
.include /etc/pulse/default.pa | |
.nofail | |
unload-module module-suspend-on-idle |
This file contains 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 <stdint.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <inttypes.h> | |
#include <assert.h> | |
#define REG_COUNT 64 | |
#define OPCODE_LIST(f) \ |
This file contains 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
// g++ bench_renderline.cpp -std=c++17 -O3 -march=native -o bench_renderline | |
// The benchmarked functions (RenderLine, ...) where taken from | |
// diasurgical/devilutionX | |
// Copyrights to their respective authors, license is "The Unlicense" | |
#include <cstdint> | |
#include <cstddef> | |
#include <cstring> | |
#include <climits> |
NewerOlder