Skip to content

Instantly share code, notes, and snippets.

Rory rorydriscoll

Block or report user

Report or block rorydriscoll

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
rorydriscoll / FullScreenQuad.hlsl
Created Dec 19, 2011
A vertex shader that uses the vertex ID to generate a full-screen quad. Don't bind vertex buffer, index buffer or input layout. Just render three vertices!
View FullScreenQuad.hlsl
struct Output
float4 position_cs : SV_POSITION;
float2 texcoord : TEXCOORD;
Output main(uint id: SV_VertexID)
Output output;
rorydriscoll / Generator.cpp
Last active Dec 14, 2016
Wave Function Collapse propagation
View Generator.cpp
struct Block
__forceinline void Clear()
vector[0] = vector[1] = _mm_setzero_si128();
__forceinline void Fill()
vector[0] = vector[1] = _mm_set_epi64x(0xffffffffffffffff, 0xffffffffffffffff);
View Shader.glsl
// bind gloss {label:"Gloss", default:0.5, max:1, step:0.01}
// bind cdiff {label:"Diffuse Colour", r:0.6, g:0.0, b:0.0}
// bind cspec {label:"Specular Colour", r:0.3, g:0.3, b:0.3}
// bind lightstrength {label:"Light Strength", default:3, max:100, step:0.1}
// bind envtop {label:"Environment Top", r:0.0, g:0.2, b:0.4}
// bind envmiddle {label:"Environment Middle", r:0.2, g:0.2, b:0.2}
// bind envbottom {label:"Environment Bottom", r:0.01, g:0.1, b:0.01}
// bind refractiveindex {label:"Refracive Index", default:1.5, max:3, step:0.1}
// bind normalmap {label:"Normal Map", default:false}
// bind diffuse {label:"Diffuse", default:true}
rorydriscoll / VS.sublime-build
Created Jul 10, 2012
Sublime Text Visual Studio
View VS.sublime-build
"cmd": ["C:\\Program Files (x86)\\Microsoft Visual Studio 8\\Common7\\IDE\\", "C:\\Users\\rdriscoll\\Desktop\\Foo\\Foo.sln", "/Build"]
View StringHash.cpp
template<unsigned int N, unsigned int I>
struct FnvHash
__forceinline static uint32 Hash(const char (&text)[N])
return (FnvHash<N, I - 1>::Hash(text) ^ text[I - 1]) * 16777619u;
template<unsigned int N>
rorydriscoll / Lua.JSON-tmLanguage
Created Feb 24, 2012
Lua Grammar for Sublime Text 2. All you need is Lua.tmLanguage (i.e. You don't need the JSON file). Copy Lua.tmLanguage over your existing version and restart Sublime Text.
View Lua.JSON-tmLanguage
"name": "Lua",
"scopeName": "source.lua",
"fileTypes": [
"repository": {
"general": {
"patterns": [
rorydriscoll /
Created Feb 17, 2012
Sublime Text 2 plugin to parse lua on the fly
import sublime
import sublime_plugin
import re
from subprocess import Popen, PIPE
class ExampleCommand(sublime_plugin.EventListener):
def __init__(self):
rorydriscoll / lua.sublime-build
Created Feb 17, 2012
Sublime Text build system for Lua
View lua.sublime-build
"cmd": ["lua", "$file"],
"file_regex": "^lua: (...*?):([0-9]*):?([0-9]*)",
"selector": "source.lua"
rorydriscoll / FeatherUI.cpp
Created Jan 8, 2012
Mikko Mononen's UI 'feathering' technique
View FeatherUI.cpp
void CalculateEdgeNormal(float& nx, float& ny, float x0, float y0, float x1, float y1)
const float x01 = x1 - x0;
const float y01 = y1 - y0;
const float length = Sqrt(x01 * x01 + y01 * y01);
const float dx = x01 / length;
const float dy = y01 / length;
rorydriscoll / SubsetSum
Created Dec 3, 2011
Subset sum problem
View SubsetSum
var max_sum = -Inf, best_begin = 0, best_end = 0, cur_begin = 0, cur_sum = 0
for (i = 0; i < values.length; ++i)
# Add the current value into our working sum
cur_sum += values[i]
# Update the max sum if we beat it
if cur_sum > max_sum:
max_sum = cur_sum
You can’t perform that action at this time.