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 <artery-math.h> | |
using namespace artery; | |
// Fast Fourier Transform implementation by Viktor Chlumsky | |
template <typename T, typename U> | |
void fft(Complex<T> *dst, const U *src, int length, int stride = 1) { | |
if (!(length >>= 1)) { | |
*dst = *src; | |
return; |
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
#pragma once | |
#include <algorithm> | |
#include <vector> | |
template <typename T> struct NeverEmptyComparator { bool operator==(const T &) const { return false; } }; | |
/// Computes the Levenshtein distance between a and b but insertion/deletion of elements equal to EmptyComparator() is free | |
template <typename T, class EmptyComparator = NeverEmptyComparator<T> > |
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
#if !defined(SHADRON_VERSION) || SHADRON_VERSION < 140 | |
#error This script requires Shadron 1.4 or later | |
#endif | |
#include <rng> | |
#include <shapes> | |
#include <linearstep> | |
//////////////////////////////////////////////////////////////// |
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 <math_constants> | |
image Input = file("maze.png"); | |
glsl vec4 initialState(vec2 pos) { | |
vec4 input = texture(Input, pos); | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
// Detect starting point | |
if (input.g > 0.5 && input.r + input.b < 1.0) |
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
glsl { | |
// Signed distance from half-plane defined by oriented line segment (a, b) | |
float halfPlaneDistance(vec2 pos, vec2 a, vec2 b) { | |
return dot(normalize(vec2(b.y-a.y, a.x-b.x)), a-pos); | |
} | |
// Anti-aliased half-plane defined by oriented line segment (a, b) | |
float halfPlaneSmooth(vec2 pos, vec2 a, vec2 b, float border) { |
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 <math_constants> | |
#include <shapes> | |
const vec3 WHITE = vec3(1.0, 1.0, 1.0); | |
const vec3 RED = vec3(0.698, 0.132, 0.203); | |
const vec3 BLUE = vec3(0.234, 0.233, 0.430); | |
#define A 1.0 | |
#define B 1.9 |
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 <billboard> | |
#include <perlin> | |
#include <hsv> | |
param float OPACITY = 0.25; | |
glsl struct ParticleData { | |
vec2 position; | |
float phase; |
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 <math_constants> | |
#include <affine_transform> | |
#include <lighting> | |
param int sides = 3 : logrange(3, 12); | |
param float zRotation : range(-PI, PI); | |
param float xRotation : range(-PI, PI); | |
glsl struct FragmentData { |
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 "plot.shadron" | |
image Input = file("julia.png") : map(clamp); | |
#define PXSIZE shadron_PixelSize | |
param int STEPS = 8; | |
param float SIGMA = 1; | |
param float blurRange = 8 : range(256); |
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
#define PLOT_SAMPLES 3 | |
template <FN, XMIN, XMAX, YMIN, YMAX, XGRID, YGRID> | |
glsl vec4 plot(vec2 pos) { | |
vec2 tPos = vec2( | |
mix(float(XMIN), float(XMAX), pos.x), | |
mix(float(YMIN), float(YMAX), pos.y) | |
); | |
vec2 pxSize = vec2((XMAX)-(XMIN), (YMAX)-(YMIN))*shadron_PixelSize; |
NewerOlder