Warm tip: This article is reproduced from serverfault.com, please click

compilation-在现代Linux上安装xplanet版本0.95a或将代码更新为xplanet 1.3

(compilation - Install xplanet version 0.95a on a modern Linux or update code to xplanet 1.3)

发布于 2020-12-01 18:32:55

我有一个tcl用于生成行星的旧脚本,但该脚本需要与xplanet0.95a版本一起运行,因为xplanetv1是完全重写的代码,无法与我使用的所有选项一起使用。

旧版本仍在这里提供但是如何在Ubuntu 20.04上安装呢?

还是转换tcl脚本很容易,因此它将在v1.3上运行?

#! /usr/bin/wish

# create the file planet_conf with
# echo "1">planet_conf
#
# create maps from png with
# convert foo.ppm -compress none color_maps/colormap{0-27}.ppm

set fileid [open planet_conf r]
    set numb [read $fileid]
close $fileid

while {$numb < 10000} {
    set numb [expr {$numb +1}]
    set mixer [expr {0.1+(rand()*0.3)}]
    set crater [expr {int(rand()*3)}]
    set fade_number [expr {10+ int(rand()*7)}]  
    set randmap [expr {int(rand()*28)}]
    set randmap_crat [expr {int(rand()*28)}] 
    set randmap_atmos [expr {int(rand()*28)}]
    set dimensiona [expr {(rand()*3.1)}]
    set modus [expr {int(rand()*7)}]
    set dim [expr {0.5+$dimensiona}]
    set pow [expr {0.5+(rand()*1)}]
    set dim_atmos [expr {0.3+$dimensiona}]
        set pow_atmos [expr {0.3+(rand()*1)}]
    set degree [expr {96+(int(rand()*50))}]
    set invert [expr {(rand()*1)}]
    set size [expr {0.06+(rand()*0.15)}]
    puts $numb 
    puts "atmosphere map..."
    catch { exec  ppmforge -clouds -power $pow_atmos -width 600 -height 300 -mesh 1024 -dimension $dim_atmos > atmos.ppm } result
    catch {exec pnmremap -map=./color_maps/colormap$randmap_atmos.ppm atmos.ppm > atmos_remap.ppm} result
    catch { exec pnmsmooth -size 9 9 atmos_remap.ppm > atmos_cut.ppm } result
    catch { exec pnmcut atmos_cut.ppm -left 30 -right 286 -top 30 -bottom 286 > ./images/atmos_day_vorlage.ppm } result
    catch { exec pnmcut atmos_cut.ppm -left 287 -right 542 -top 30 -bottom 286 > atmos_dark.ppm } result
    catch { exec ppmbrighten -v -60 atmos_dark.ppm > ./images/atmos_night_vorlage.ppm } result
    puts "premapping..."
    if { $crater == 1 } {
        puts "crater"
        catch { exec pgmcrater -height 300 -width 600 > crater.pgm } result
        catch { exec pgmtoppm -map color_maps/colormap$randmap_crat.ppm  crater.pgm > crater.ppm  } result 
        puts $result    
        catch { exec  ppmforge -clouds -power $pow -width 600 -height 300 -mesh 1024 -dimension $dim > test.ppm } result
        puts $result
        if { $modus == 1} {
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -shift } result
        } elseif { $modus == 5} {
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -mix } result
        } elseif { $modus == 2} { 
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -spread } result
        } elseif { $modus == 3} { 
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -edge } result
        } elseif { $modus == 4} {
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -bentley } result
        } else {
            catch { exec /usr/bin/ppmfade -f test.ppm -l crater.ppm -relief } result
        }
        puts $result
        catch { exec cp fade.00$fade_number.ppm test.ppm } result
        puts $result
    } else {
         catch { exec  /usr/bin/ppmforge -clouds -power $pow -width 600 -height 300 -mesh 1024 -dimension $dim > test.ppm } result
    }
    puts $result
    puts "smoothing..."
    catch { exec pnmsmooth -size 5 5 test.ppm > test_smooth.ppm } result
    puts $result
    catch {exec pnmremap -map=./color_maps/colormap$randmap.ppm test_smooth.ppm > test_remap.ppm } result
    if { $invert < 0.5 } {
        puts "inverted"
        catch { exec pnminvert test_remap.ppm > test_middle.ppm } result
    } else {
        catch { exec cp test_remap.ppm test_middle.ppm } result
    }
    catch { exec pnmcut test_middle.ppm -left 30 -right 286 -top 30 -bottom 286 > ./images/vorlage_day.ppm } result
    catch { exec pnmcut test_remap.ppm -left 287 -right 542 -top 30 -bottom 286 > test_dark.ppm } result
    catch { exec ppmbrighten -v -70 test_dark.ppm > ./images/vorlage_night.ppm } result
    puts $result
    puts "planet generating ..."
    catch {exec xplanet -starfreq 0 -date "24 Jun 1999 11:02:17" -image vorlage_day.ppm -night_image vorlage_night.ppm -blend -radius 40 -output planet.ppm } result
    if {$result == ""} {
        puts "ok"
    } else {
        puts $result
    }
     catch {exec xplanet -starfreq 0 -date "24 Jun 1999 11:02:17" -image atmos_vorlage.ppm -night_image atmos_night_vorlage.ppm -blend -radius 41 -output atmos_ready.ppm } result
        if {$result == ""} {
            puts "ok"
        } else {
            puts $result
        }
    catch { exec ppmmix $mixer planet.ppm atmos_ready.ppm > complete.ppm } result 
    puts "scaling"  
    catch { exec pnmscale $size complete.ppm > planet_s1.ppm } result
    catch { exec ppmtojpeg planet_s1.ppm > planet_s1_$numb.jpg } result

    puts "" 
    set fileid [open planet_conf w]
        puts $fileid $numb
    close $fileid
    after 10 exec sleep 4
    #catch {exec display test$numb.jpg } result
}

Questioner
rubo77
Viewed
22
rubo77 2020-12-05 00:51:45

我设法将其转换为xplanetv1.3:

1。

我必须创建两个配置文件,这两个xplanet调用使用了该文件

configs/xplanet_night.conf

[default]
min_radius_for_label=1000
[mars]
map=temp/atmos_vorlage.ppm
night_map=temp/atmos_night_vorlage.ppm

configs/xplanet_day.conf

[default]
min_radius_for_label=1000
[mars]
map=temp/vorlage_day.ppm
night_map=temp/vorlage_night.ppm

2。

然后我修改了脚本,使它看起来像这样:https :
//github.com/rubo77/spacetrace-planet-generator

在此处输入图片说明