Skip to content

Instantly share code, notes, and snippets.

View scheibel's full-sized avatar

Willy Scheibel scheibel

View GitHub Profile
@scheibel
scheibel / gist:e08e8b586fb6f487a8d7
Created September 16, 2015 12:38
C++ time measurement with STL
#include <chrono>
#include <iostream>
int main()
{
auto start = std::chrono::high_resolution_clock::now();
std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start).count() << "ms" << std::endl;
}
@scheibel
scheibel / distance-field-shader.glsl
Created December 28, 2019 10:08
Stripped-down distance field rendering fragment shader
precision mediump float;
layout(location = 0) out vec4 fragColor;
uniform sampler2D u_glyphs;
uniform vec4 u_color;
uniform float u_aaStepScale;
uniform int u_aaSampling;
varying vec2 v_uv;
@scheibel
scheibel / stripped-down-excerpt-shader.glsl
Created December 28, 2019 10:12
The revelant excerpt of the further stripped-down shader
float aastep(float t, float value) {
return step(t, value);
}
float tex(float t, vec2 uv) {
return aastep(t, texture(u_glyphs, uv)[channel]);
}
@scheibel
scheibel / minimal-aastep.glsl
Created December 28, 2019 10:13
Minimal version of the aastep function
float aastep(float t, float value) {
return t;
}
@scheibel
scheibel / shader-toy-demo.glsl
Created December 28, 2019 10:14
ShaderToy demo
float utilityFunction(float t, float value)
{
return t;
}
float subFunction(float t, vec2 uv)
{
return utilityFunction(t, texture(iChannel0, uv)[0]);
}