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
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);
@rorydriscoll
rorydriscoll / gist:be1375a63999a272524a
Last active Aug 29, 2015
2D Perlin noise with derivatives
View gist:be1375a63999a272524a
static const int permutations[256] =
{
249, 69, 172, 0, 116, 3, 219, 221,
224, 5, 6, 145, 128, 131, 97, 108,
133, 14, 165, 45, 166, 127, 114, 111,
119, 20, 34, 4, 103, 67, 48, 158,
85, 143, 181, 238, 217, 173, 78, 139,
179, 77, 191, 89, 251, 150, 183, 8,
168, 225, 23, 65, 55, 247, 136, 104,
117, 193, 174, 106, 122, 199, 243, 211,
View unityambientproblem
Version:
Unity 5.0.1f1 Personal
Repro:
- Sync to scene at https://github.com/rorydriscoll/ld32
- Mark all objects under 'Geometry' game object as static
- Enable 'Baked GI' in the lighting panel, but not precomputed realtime GI
- Bake
@rorydriscoll
rorydriscoll / gist:10013303
Created Apr 7, 2014
Inspector window setup
View gist:10013303
As a post-build step, run type database compiler to grab the pdb and convert it to a custom type database format (just a list of types, fields and enumerators).
struct Type
{
// Name of the type
char name[TypeDatabaseBlueprint::Type::kMaxName];
// Unique id for this type
Hash id;
@rorydriscoll
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\\devenv.com", "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
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": [
"lua"
],
"repository": {
"general": {
"patterns": [
{
@rorydriscoll
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
rorydriscoll / ParseLua.py
Created Feb 17, 2012
Sublime Text 2 plugin to parse lua on the fly
View ParseLua.py
import sublime
import sublime_plugin
import re
from subprocess import Popen, PIPE
class ExampleCommand(sublime_plugin.EventListener):
TIMEOUT_MS = 200
def __init__(self):
@rorydriscoll
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;
You can’t perform that action at this time.