Skip to content

Instantly share code, notes, and snippets.

View mtwilliams's full-sized avatar
👺
small engines & big data

Michael Williams mtwilliams

👺
small engines & big data
View GitHub Profile
@mtwilliams
mtwilliams / example.bim
Created June 2, 2013 02:18
A simple Blender mesh exporter.
meshes = [
{
name = "plane"
materials = [
{
name="default"
textures=[
"diffuse"
]
}
@mtwilliams
mtwilliams / coalesce
Last active December 31, 2015 05:09
Coalescent of the most occurring largest number (in that order of priority.)
coalesce(L, R[n], occurrences = 1):
if L == R[0]:
return coalesce(L, R[1..n], occurrences + 1)
else:
A = coalesce(L, R[1..n], occurrences)
B = coalesce(R[0], R[1..n])
if A occurs more often than B:
return A
else if B occurs more often than A:
return B
@mtwilliams
mtwilliams / gist:7981203
Last active December 31, 2015 11:39
Builds a higher (less detailed) LOD of Minecraft style terrain by coalescing the most occurring then most prominent voxels.
typedef struct v3_octree_lod {
unsigned level;
v3_voxel_t voxels[0];
} v3_octree_lod_t;
V3_API void v3_octree_lod_coalesce(
const v3_octree_lod_t *coalesee,
v3_octree_lod_t *coalesed,
const v3_voxel_t *(*select)(const v3_voxel_t *V, const size_t V_n))
{
DEFINES += -DGAME_VERSION="\"$(shell build/version.sh)\""
DEFINES += -DENGINE_VERSION="\"$(shell cd engine; ../build/version.sh)\""
DEFINES += -DCONTENT_VERSION="\"$(shell cd data_src; ../build/version.sh)\""
struct renderable {
struct renderable *prev, *next;
bool (*render)(const struct renderable *r, ...);
};
static struct renderable *render_list_head_ = ...;
static struct renderable *render_list_tail_ = ...;
void render(...) {
const struct renderable* r = render_list_tail_;
@mtwilliams
mtwilliams / gist:564710e3d0283a2b10d3
Created July 29, 2014 18:47
Urna dependency compilation fails...
== Compilation error on file lib/socket/socks.ex ==
** (CompileError) lib/socket/socks.ex:50: function size/1 undefined
(stdlib) lists.erl:1336: :lists.foreach/2
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
(elixir) src/elixir.erl:170: :elixir.erl_eval/3
(elixir) src/elixir.erl:158: :elixir.eval_forms/4
(elixir) src/elixir_lexical.erl:17: :elixir_lexical.run/2
(elixir) src/elixir.erl:170: :elixir.erl_eval/3
@mtwilliams
mtwilliams / deferred.render_config.js
Created August 31, 2014 20:04
It is quite elegant to implement "Shadow Map Allocation" in Butane, if I must say.
settings = {
shadows = {
dynamic = {
atlas = {
dimensions = {
min = [1024, 1024]
max = [4096, 4096]
}
}
}
@mtwilliams
mtwilliams / Makefile
Created September 1, 2014 04:40
Forgive me Father for I have sinned.
$(BUILD)/lib/agl.lib: $(BUILD)/bin/agl.dll
@echo "[AR] $@"
@mkdir -p ${@D}
@dumpbin -exports "$(call posix-to-windows,$<)" > $(@:%.lib=%.exports)
@echo EXPORTS >> $(@:%.lib=%.def)
@tail -n +20 $(@:%.lib=%.exports) | awk -F" " '{print $$4}' | sed '/^$$/d' >> $(@:%.lib=%.def)
@rm $(@:%.lib=%.exports)
@lib $(ARFLAGS) -DEF:"$(call posix-to-windows,$(@:%.lib=%.def))" -OUT:"$(call posix-to-windows,$@)"
@mtwilliams
mtwilliams / gist:6434709f7f0d9ae4c9cf
Created June 15, 2015 05:21
Second restart results in immediate, catastrophic, wheels-fall-off failure... unfortunately.
$ docker -v
Docker version 1.6.2, build 7c8fca2
$ docker-compose --version
docker-compose 1.2.0
$ docker-compose up
Creating meetwalter_web_1...
Creating meetwalter_api_1...
Creating meetwalter_identity_1...
class Foo
attr_reader :meaning_of_life,
:how_long_do_i_have,
def initialize(three_score_and_ten=70)
@meaning_of_life = 42
@how_long_do_i_have = three_score_and_ten
end
end