--- /dev/null
+*.o
+*.d
+*.swp
+*.a
+erebus/erebus
+xerebus/xerebus
--- /dev/null
+PREFIX ?= /usr/local
+opt_targ = erebus xerebus
+opt_opt = -ffast-math
+opt_dbg = -g
+# --------------------------
+export PREFIX
+export opt_opt
+export opt_dbg
+
+.PHONY: all
+all: liberebus $(opt_targ)
+
+.PHONY: clean
+clean: liberebus-clean erebus-clean xerebus-clean
+
+.PHONY: cleandep
+cleandep: liberebus-cleandep erebus-cleandep xerebus-cleandep
+
+.PHONY: install
+install: liberebus-install erebus-install xerebus-install
+
+.PHONY: uninstall
+uninstall: liberebus-uninstall erebus-uninstall xerebus-uninstall
+
+# --- liberebus ---
+.PHONY: liberebus
+liberebus:
+ $(MAKE) -C liberebus
+
+.PHONY: liberebus-clean
+liberebus-clean:
+ $(MAKE) -C liberebus clean
+
+.PHONY: liberebus-cleandep
+liberebus-cleandep:
+ $(MAKE) -C liberebus cleandep
+
+.PHONY: liberebus-install
+liberebus-install:
+ $(MAKE) -C liberebus install
+
+.PHONY: liberebus-uninstall
+liberebus-uninstall:
+ $(MAKE) -C liberebus uninstall
+
+# --- erebus ---
+.PHONY: erebus
+erebus:
+ $(MAKE) -C erebus
+
+.PHONY: erebus-clean
+erebus-clean:
+ $(MAKE) -C erebus clean
+
+.PHONY: erebus-cleandep
+erebus-cleandep:
+ $(MAKE) -C erebus cleandep
+
+.PHONY: erebus-install
+erebus-install:
+ $(MAKE) -C erebus install
+
+.PHONY: erebus-uninstall
+erebus-uninstall:
+ $(MAKE) -C erebus uninstall
+
+# --- xerebus ---
+.PHONY: xerebus
+xerebus:
+ $(MAKE) -C xerebus
+
+.PHONY: xerebus-clean
+xerebus-clean:
+ $(MAKE) -C xerebus clean
+
+.PHONY: xerebus-cleandep
+xerebus-cleandep:
+ $(MAKE) -C xerebus cleandep
+
+.PHONY: xerebus-install
+xerebus-install:
+ $(MAKE) -C xerebus install
+
+.PHONY: xerebus-uninstall
+xerebus-uninstall:
+ $(MAKE) -C xerebus uninstall
--- /dev/null
+src = $(wildcard src/*.c)
+obj = $(src:.c=.o)
+dep = $(src:.c=.d)
+
+bin = erebus
+
+incdir = -I../liberebus/include
+libdir = -L../liberebus
+
+CFLAGS = -pedantic -Wall $(opt_dbg) $(opt_opt) $(incdir)
+LDFLAGS = $(libdir) -lerebus
+
+$(bin): $(obj)
+ $(CC) -o $@ $(obj) $(LDFLAGS)
+
+-include $(dep)
+
+.PHONY: clean
+clean:
+ rm -f $(obj) $(bin)
+
+.PHONY: cleandep
+cleandep:
+ rm -f $(dep)
+
+.PHONY: install
+install: $(bin)
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
+
+.PHONY: uninstall
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
--- /dev/null
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
--- /dev/null
+src = $(wildcard src/*.c)
+obj = $(src:.c=.o)
+dep = $(src:.c=.d)
+
+name = erebus
+alib = lib$(name).a
+
+incdir = -Iinclude
+
+CFLAGS = -pedantic -Wall $(opt_dbg) $(opt_opt) $(incdir)
+LDFLAGS = -lm
+
+$(alib): $(obj)
+ $(AR) rcs $@ $(obj)
+
+-include $(dep)
+
+.PHONY: clean
+clean:
+ rm -f $(obj) $(alib)
+
+.PHONY: cleandep
+cleandep:
+ rm -f $(dep)
+
+.PHONY: install
+install: $(alib)
+ mkdir -p $(DESTDIR)$(PREFIX)/include/erebus $(DESTDIR)$(PREFIX)/lib
+ cp $(alib) $(DESTDIR)$(PREFIX)/lib/$(alib)
+ cp include/*.h $(DESTDIR)$(PREFIX)/include/erebus/
+
+.PHONY: uninstall
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/lib/$(alib)
+ rm -f $(DESTDIR)$(PREFIX)/include/erebus/*.h
+ rmdir $(DESTDIR)$(PREFIX)/include/erebus
--- /dev/null
+#ifndef RENDLIB_H_
+#define RENDLIB_H_
+
+#include <cgmath/cgmath.h>
+
+struct erb_node;
+struct erb_surf;
+struct erb_ray;
+struct erb_hit;
+
+typedef int (*erb_intersect_func)(struct erb_surf *surf, struct erb_ray *ray, struct erb_hit *hit);
+typedef void (*erb_sample_func)(struct erb_surf *surf, cgm_vec3 *pos);
+
+struct erb_node {
+ struct erb_node *par; /* parent node */
+ struct erb_node *clist; /* child nodes */
+ struct erb_surf *surflist; /* surfaces in this node */
+ float xform[16], inv_xform[16]; /* global transformation */
+ float node_xform[16], inv_node_xform[16]; /* local transformation */
+};
+
+struct erb_surf {
+ struct erb_node *node; /* transformation node for this surface */
+
+ erb_intersect_func isect; /* intersection routine */
+ erb_sample_func sample; /* random sample generation */
+};
+
+struct erb_ray {
+ cgm_vec3 o, d; /* origin and direction */
+ float tmin, tmax; /* segment bounds */
+ float ior; /* IOR of the medium through which this ray travels */
+ float total_dist; /* travel distance accumulator */
+};
+
+struct erb_hit {
+ float t, err;
+ struct erb_surf *surf;
+};
+
+int erb_init(void);
+void erb_cleanup(void);
+
+#endif /* RENDLIB_H_ */
--- /dev/null
+#include "erebus.h"
+
+int erb_init(void)
+{
+ return 0;
+}
+
+void erb_cleanup(void)
+{
+}
--- /dev/null
+src = $(wildcard src/*.c)
+obj = $(src:.c=.o)
+dep = $(src:.c=.d)
+
+bin = xerebus
+
+def = -DMINIGLUT_USE_LIBC
+incdir = -I../liberebus/include
+libdir = -L../liberebus
+
+CFLAGS = -pedantic -Wall $(opt_dbg) $(opt_opt) $(def) $(incdir)
+LDFLAGS = $(libdir) -lerebus -lGL -lX11
+
+$(bin): $(obj)
+ $(CC) -o $@ $(obj) $(LDFLAGS)
+
+-include $(dep)
+
+.PHONY: clean
+clean:
+ rm -f $(obj) $(bin)
+
+.PHONY: cleandep
+cleandep:
+ rm -f $(dep)
+
+.PHONY: install
+install: $(bin)
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
+
+.PHONY: uninstall
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
--- /dev/null
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ return 0;
+}