[nexuiz-commits] r7549 - trunk/data/particles
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 28 12:31:46 EDT 2009
Author: div0
Date: 2009-08-28 12:31:46 -0400 (Fri, 28 Aug 2009)
New Revision: 7549
Added:
trunk/data/particles/particlefont-template.png
trunk/data/particles/particlefont.pl
trunk/data/particles/particlefont.txt
Log:
particle font generator script, for new-style particle fonts
Added: trunk/data/particles/particlefont-template.png
===================================================================
(Binary files differ)
Property changes on: trunk/data/particles/particlefont-template.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/data/particles/particlefont.pl
===================================================================
--- trunk/data/particles/particlefont.pl (rev 0)
+++ trunk/data/particles/particlefont.pl 2009-08-28 16:31:46 UTC (rev 7549)
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+# particlefont.txt generator for DarkPlaces
+
+# this is eval'ed to not fail if Image::Magick is not installed
+my $magick =
+eval q{
+ use Image::Magick;
+ Image::Magick->new();
+}
+ or warn "Image::Magick not installed, not generating a TGA\n";
+
+sub checkmagick($)
+{
+ my ($e) = @_;
+ die $e if $e;
+ return $e;
+}
+
+my ($pixw, $pixh, $cols, $beamoffset, $beams) = @ARGV;
+defined $beams
+ or die "Usage: $0 pixw pixh columns beamoffset beams\n";
+
+if($magick)
+{
+ checkmagick $magick->Set(size => "${pixw}x${pixh}");
+ checkmagick $magick->ReadImage("xc:white");
+}
+
+my $square = 1.0 / $cols;
+my $rows = $cols - $beams;
+
+my $dx = 0.5 / $pixw;
+my $dy = 0.5 / $pixh;
+
+my $i = 0;
+for my $row(0..$rows-1)
+{
+ for my $col(0..$cols-1)
+ {
+ my $s0 = $col * $square + $dx;
+ my $s1 = ($col+1) * $square - $dx;
+ my $t0 = $row * $square + $dy;
+ my $t1 = ($row+1) * $square - $dy;
+ print "$i $s0 $t0 $s1 $t1\n";
+ if($magick)
+ {
+ checkmagick $magick->Draw(
+ fill => (($row + $col)%2 ? 'green' : 'white'),
+ primitive => 'rectangle',
+ points => sprintf "%d,%d %d,%d", $s0 * $pixw, $t0 * $pixh, $s1 * $pixw, $t1 * $pixh
+ );
+ checkmagick $magick->Annotate(
+ x => $s0 * $pixw,
+ y => $t1 * $pixh,
+ text => $i
+ );
+ }
+ ++$i;
+ }
+}
+
+$i = $beamoffset if $i < $beamoffset;
+for my $beam(0..$beams-1)
+{
+ my $s0 = 0;
+ my $s1 = 1;
+ my $row = $beam + $rows;
+ my $t0 = $row * $square + $dy;
+ my $t1 = ($row+1) * $square - $dy;
+ print "$i $s0 $t0 $s1 $t1\n";
+ if($magick)
+ {
+ checkmagick $magick->Draw(
+ fill => (($beam)%2 ? 'yellow' : 'red'),
+ primitive => 'rectangle',
+ points => sprintf "%d,%d %d,%d", $s0 * $pixw, $t0 * $pixh, $s1 * $pixw, $t1 * $pixh
+ );
+ checkmagick $magick->Annotate(
+ x => $s0 * $pixw,
+ y => $t1 * $pixh,
+ text => $i
+ );
+ }
+ ++$i;
+}
+
+if($magick)
+{
+ $magick->Write("particlefont-template.png");
+}
Added: trunk/data/particles/particlefont.txt
===================================================================
--- trunk/data/particles/particlefont.txt (rev 0)
+++ trunk/data/particles/particlefont.txt 2009-08-28 16:31:46 UTC (rev 7549)
@@ -0,0 +1,64 @@
+0 0.00048828125 0.00048828125 0.12451171875 0.12451171875
+1 0.12548828125 0.00048828125 0.24951171875 0.12451171875
+2 0.25048828125 0.00048828125 0.37451171875 0.12451171875
+3 0.37548828125 0.00048828125 0.49951171875 0.12451171875
+4 0.50048828125 0.00048828125 0.62451171875 0.12451171875
+5 0.62548828125 0.00048828125 0.74951171875 0.12451171875
+6 0.75048828125 0.00048828125 0.87451171875 0.12451171875
+7 0.87548828125 0.00048828125 0.99951171875 0.12451171875
+8 0.00048828125 0.12548828125 0.12451171875 0.24951171875
+9 0.12548828125 0.12548828125 0.24951171875 0.24951171875
+10 0.25048828125 0.12548828125 0.37451171875 0.24951171875
+11 0.37548828125 0.12548828125 0.49951171875 0.24951171875
+12 0.50048828125 0.12548828125 0.62451171875 0.24951171875
+13 0.62548828125 0.12548828125 0.74951171875 0.24951171875
+14 0.75048828125 0.12548828125 0.87451171875 0.24951171875
+15 0.87548828125 0.12548828125 0.99951171875 0.24951171875
+16 0.00048828125 0.25048828125 0.12451171875 0.37451171875
+17 0.12548828125 0.25048828125 0.24951171875 0.37451171875
+18 0.25048828125 0.25048828125 0.37451171875 0.37451171875
+19 0.37548828125 0.25048828125 0.49951171875 0.37451171875
+20 0.50048828125 0.25048828125 0.62451171875 0.37451171875
+21 0.62548828125 0.25048828125 0.74951171875 0.37451171875
+22 0.75048828125 0.25048828125 0.87451171875 0.37451171875
+23 0.87548828125 0.25048828125 0.99951171875 0.37451171875
+24 0.00048828125 0.37548828125 0.12451171875 0.49951171875
+25 0.12548828125 0.37548828125 0.24951171875 0.49951171875
+26 0.25048828125 0.37548828125 0.37451171875 0.49951171875
+27 0.37548828125 0.37548828125 0.49951171875 0.49951171875
+28 0.50048828125 0.37548828125 0.62451171875 0.49951171875
+29 0.62548828125 0.37548828125 0.74951171875 0.49951171875
+30 0.75048828125 0.37548828125 0.87451171875 0.49951171875
+31 0.87548828125 0.37548828125 0.99951171875 0.49951171875
+32 0.00048828125 0.50048828125 0.12451171875 0.62451171875
+33 0.12548828125 0.50048828125 0.24951171875 0.62451171875
+34 0.25048828125 0.50048828125 0.37451171875 0.62451171875
+35 0.37548828125 0.50048828125 0.49951171875 0.62451171875
+36 0.50048828125 0.50048828125 0.62451171875 0.62451171875
+37 0.62548828125 0.50048828125 0.74951171875 0.62451171875
+38 0.75048828125 0.50048828125 0.87451171875 0.62451171875
+39 0.87548828125 0.50048828125 0.99951171875 0.62451171875
+40 0.00048828125 0.62548828125 0.12451171875 0.74951171875
+41 0.12548828125 0.62548828125 0.24951171875 0.74951171875
+42 0.25048828125 0.62548828125 0.37451171875 0.74951171875
+43 0.37548828125 0.62548828125 0.49951171875 0.74951171875
+44 0.50048828125 0.62548828125 0.62451171875 0.74951171875
+45 0.62548828125 0.62548828125 0.74951171875 0.74951171875
+46 0.75048828125 0.62548828125 0.87451171875 0.74951171875
+47 0.87548828125 0.62548828125 0.99951171875 0.74951171875
+48 0.00048828125 0.75048828125 0.12451171875 0.87451171875
+49 0.12548828125 0.75048828125 0.24951171875 0.87451171875
+50 0.25048828125 0.75048828125 0.37451171875 0.87451171875
+51 0.37548828125 0.75048828125 0.49951171875 0.87451171875
+52 0.50048828125 0.75048828125 0.62451171875 0.87451171875
+53 0.62548828125 0.75048828125 0.74951171875 0.87451171875
+54 0.75048828125 0.75048828125 0.87451171875 0.87451171875
+55 0.87548828125 0.75048828125 0.99951171875 0.87451171875
+56 0.00048828125 0.87548828125 0.12451171875 0.99951171875
+57 0.12548828125 0.87548828125 0.24951171875 0.99951171875
+58 0.25048828125 0.87548828125 0.37451171875 0.99951171875
+59 0.37548828125 0.87548828125 0.49951171875 0.99951171875
+// 60 0.50048828125 0.87548828125 0.62451171875 0.99951171875 // do not touch nex beam
+61 0.62548828125 0.87548828125 0.74951171875 0.99951171875
+62 0.75048828125 0.87548828125 0.87451171875 0.99951171875
+63 0.87548828125 0.87548828125 0.99951171875 0.99951171875
More information about the nexuiz-commits
mailing list