⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genimages.pl

📁 开源游戏代码
💻 PL
字号:
#!/usr/bin/perl -w# $Id: genimages.pl,v 1.7 2000/04/24 14:51:28 marijn Exp $# This script generates the images that go along with the AIRTRAFFIC program.# POVRAY and Imagemagick (convert) needed for the generation.# Licenced under the GPL, see the COPYING file for more information.$x_res = 30;$y_res = 30;$keep_temp_files = 0;$keep_xpm_files = 1;##### PROGRAMFILES $povray_bin = "/usr/bin/povray";$povray_opt = "-P -V +A";$convert_bin= "/usr/X11R6/bin/convert";$convert_opt= "-verbose";$header_dir = "../src/";##### some statics;my($normal_color) = "<.8, .6, .6>";my($change_color) = "<0.4, 0.4, 1>";my($active_color) = "<1, 0.3, 0.3>";my($ignore_colors)= ["#667f66", "#667e66"];my($nr_of_images) = 8; # make 8 pictures, 45deg difference between each#do_plane_images("jet", "N", $normal_color, $nr_of_images, $ignore_colors);#do_plane_images("jet", "C", $change_color, $nr_of_images, $ignore_colors);#do_plane_images("jet", "A", $active_color, $nr_of_images, $ignore_colors);$ignore_colors = ["Gray50"];do_object_image("airport",  $ignore_colors);sub do_plane_images{ # generate a type of image    my($image, $type, $color, $nr, $ignore_colors) = @_;    my($pov_file, $i, $temp_tga, $tmpl_file, $temp_xpm, $image_xpm);    $tmpl_file = "$image.pov";    my($step_size) = 360/$nr;    for($i=0; $i<$nr; $i++) {	$pov_file  = make_pov($tmpl_file, $type, $color, ($step_size * $i) );	$temp_tga  = make_tga($pov_file);	$temp_xpm  = tga2image($temp_tga);    }}sub do_object_image{    my($image, $ig_col) = @_;    my($pov_file, $i, $nr, $temp_tga, $temp_file, $tmpl_file, $image_xpm);    $tmpl_file = "$image.pov";    $nr = 5;        for($i=0; $i<$nr; $i++) { 	$povfile   = make_pov($tmpl_file, $i+1);	$temp_tga  = make_tga($povfile);	$temp_xpm  = tga2image($temp_tga);    }}sub make_pov { # make a povray file that is used for parsing    my($tmpl_file, $type, $color, $pos) = @_;    my($row);    my($temp_file) = $tmpl_file;    if( !defined( $type  ) ) { $type  = "" };    if( !defined( $color ) ) { $color = "" };    if( !defined( $pos   ) ) { $pos   = "" };        if($pos ne "") {	for(;length($pos) < 3;) {	    $pos = "0" . $pos;	}    }    $temp_file	=~ s/(.*).pov/$1$pos$type.temp.pov/;    open(TMPL, "<$tmpl_file")     || die("Can't open file $tmpl_file: $!");    open(TEMPFILE, ">$temp_file") || die("Can't open file $temp_file: $!");    while(defined($row = <TMPL>)) {	$row =~ s/--COLOR--/$color/g;	$row =~ s/--TYPE--/$type/g;	$row =~ s/--DIRECTION--/$pos/g;	print(TEMPFILE $row);    }    close(TMPL);    close(TEMPFILE);    return $temp_file;}sub make_tga { # generate the tga file with povray    my($pov_file) = $_[0];    my($tga_file) = $pov_file;    $tga_file =~ s/(.*).pov/$1.tga/;    print `$povray_bin +I$pov_file +$tga_file +W$x_res +H$y_res $povray_opt`. "\n";    if($keep_temp_files == 0) {	unlink($pov_file);    }    return $tga_file;}sub tga2image { # convert the tga to XPM    my($tga_file) = $_[0];    my($image_file) = $tga_file;    $image_file =~ s/(.*)\.temp\.tga/$1\.png/;    #    die(join(",", $tga_file, $xpm_file));    print `$convert_bin $convert_opt $tga_file PNG:$image_file` . "\n";        if($keep_temp_files == 0) {	unlink($tga_file);    }    return $image_file;}# ChangeLog# ---------# $Log: genimages.pl,v $# Revision 1.7  2000/04/24 14:51:28  marijn# Added different airport images.## Revision 1.6  2000/04/08 14:07:24  marijn# Changed from xpm's in the executable to external png files.## Revision 1.5  2000/03/09 00:00:29  marijn# Added a README and added GPL references## Revision 1.4  2000/01/04 23:20:15  marijn# renamed airport images from "air" to "airport" for clarity## Revision 1.3  2000/01/01 18:38:05  marijn# airports are now being generated automaticly## Revision 1.2  1999/12/23 01:42:06  marijn# Autogenerating of a headerfile in the src/ with the xpm images.## Revision 1.1  1999/12/19 05:04:08  marijn# Automatic generation of xpm files complete#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -