updatemat.pl 872 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/perl -w
  2. my @acs = glob("*.ac");
  3. foreach my $ac (@acs)
  4. {
  5. my $tmp = $ac . ".tmp";
  6. system("cp $ac $tmp");
  7. open(AC, $ac) || die("unable to open $ac");
  8. open(TMPAC, ">$tmp") || die("Unable to open $tmp");
  9. foreach (<AC>)
  10. {
  11. if (/MATERIAL "metal"/)
  12. {
  13. # Metal
  14. print TMPAC "MATERIAL \"metal\" rgb 0 0 0 amb 0.1 0.1 0.12 emis 0 0 0 spec 0.2 0.2 0.2 shi 10 trans 0\n";
  15. }
  16. elsif (/MATERIAL "face"/)
  17. {
  18. # A red-flood lit instrument face
  19. print TMPAC "MATERIAL \"face\" rgb 0 0 0 amb 1.0 1.0 1.0 emis 0.3 0 0 spec 0 0 0 shi 10 trans 0\n";
  20. }
  21. elsif (/MATERIAL "unlitface"/)
  22. {
  23. # An unlit face
  24. print TMPAC "MATERIAL \"face\" rgb 0 0 0 amb 1.0 1.0 1.0 emis 0 0 0 spec 0 0 0 shi 10 trans 0\n";
  25. }
  26. else
  27. {
  28. print TMPAC $_;
  29. }
  30. }
  31. close(AC);
  32. close(TMPAC);
  33. system("mv $tmp $ac");
  34. }