JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Changes from August-November 2006 -- detailed history was lost.
[vor.git] / font_guts.c
diff --git a/font_guts.c b/font_guts.c
new file mode 100644 (file)
index 0000000..af076cb
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+#define TEMPLATE_WIDTH 1870
+#define TEMPLATE_HEIGHT 17
+
+#define OUTPUT_WIDTH 29.0
+
+#define FACTOR (OUTPUT_WIDTH / (float)TEMPLATE_WIDTH)
+#define XMIN (0 - (TEMPLATE_WIDTH / 2))
+#define YMIN (TEMPLATE_HEIGHT / 2)
+
+int main(int argc, char** argv) {
+       int bit, x, y;
+
+       x = XMIN; y = YMIN;
+       while((bit = getc(stdin)) != EOF) {
+               if(bit == '\n') {
+                       x = XMIN;
+                       --y;
+                       continue;
+               }
+
+               if(bit == '#') {
+                       // parameters to sphere (in a blob) are: {<x, y, z>, diameter, center-density}
+                       printf("sphere { <%f, %f, 0>, %f, 2 }\n", (float)(x * FACTOR), (float)(y * FACTOR), (float)(2.5 * FACTOR));
+               }
+               ++x;
+       }
+
+       return 0;
+}