#
# For each form we have
#
-# module Commitid_Form_2D(.4)
-# module Commitid_Form()
+# module Commitid_Form_2D() { ... }
+# module Commitid_Form() { ... }
+#
+# These have their origin in the bottom left corner. The 3D model
+# is a positive, has its origin halfway through, and is twice the
+# depth in height, so it can be added or subtracted.
#
# And we provide
#
# Tiny8:
# git rev-list --first-parent --count HEAD
# typically 3-4 characters but we allow for up to 6
+# padded with zeroes; if too long we reduce mod 10^n
# eg
# Tiny4 1070
#
# Tiny4Q 10
# 70
#
-# Git4
-# Git6
-# Git8
-# git-rev-parse HEAD
+# Git4 Git4Q
+# Git6 Git6Q
+# Git8 Git8Q
+# git-rev-parse HEAD (prefix of requested length)
# eg
# Git6 82f2a2
}
sub gentextmodule ($@) {
- my ($modulename, @lines) = @_;
- p "module $modulename(){\n";
+ my ($form, @lines) = @_;
+ my $modb = "Commitid_$form";
+ p "module ${modb}_2D(){\n";
p " scale(Commitid__scale()){\n";
my $y = @lines;
foreach my $line (@lines) {
}
p " }\n";
p "}\n";
+ p "module ${modb}(){\n";
+ p " d=Commitid_depth();\n";
+ p " translate([0,0,-d]) linear_extrude(height=d*2) ${modb}_2D();\n";
+ p "}\n";
}
our @demo;
parsefont();
-gentextmodule('Commitid_FontDemo_2D', @demo);
+gentextmodule('FontDemo', @demo);
__DATA__