orig/objview.rb
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 39 0216da79ade0
permissions -rwxr-xr-x
New IES test file with spaces in file name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     1
#!/usr/bin/env ruby
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     2
# RCSid: $Id$
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     3
#
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     4
# objview.rb, v1.1 2012.07.04 RPG
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     5
# Ruby port of objview.csh
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     6
#
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     7
# Make a nice view of an object, or luminaire
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     8
# Arguments are scene input files
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     9
#
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    10
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    11
require 'optparse'
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    12
require 'ostruct'
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    13
require 'tempfile'
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    14
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    15
class Optparse
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    16
  #
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    17
  # Return a structure describing the options.
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    18
  #
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    19
  def self.parse(args)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    20
    # The options specified on the command line will be collected in *options*.
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    21
    options = OpenStruct.new
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    22
 
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    23
    opts = OptionParser.new do |opts|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    24
      opts.banner = "Usage: (ruby) objview.rb [options] [radiance scene input files]"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    25
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    26
      opts.separator ""
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    27
      opts.separator "Options:"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    28
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    29
      options.radopt = []
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    30
      options.glradopt = []
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    31
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    32
      options.up = "Z"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    33
      opts.on("-u, --up", String, [:X, :Y, :Z], "View up vector (X, Y, or Z)") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    34
        options.up = n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    35
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    36
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    37
      #Specify display device (qt is only option for Windows)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    38
      if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    39
        options.dev = "qt"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    40
      else
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    41
        options.dev = "x11"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    42
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    43
      opts.on("-o, --odev", String, [:x11, :qt], "Output device (x11 or qt)") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    44
        options.dev = n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    45
        options.radopt << "-o #{options.dev}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    46
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    47
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    48
      options.procs = "1"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    49
      opts.on("-N, --nprocs", String, "Number of processors (UNIX ony)") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    50
        options.procs = n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    51
        options.radopt << "-N #{options.procs}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    52
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    53
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    54
      options.vw = "XYZ"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    55
      opts.on("-v", "--view", String, "View specification") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    56
        options.view = n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    57
        options.radopt << "-v #{options.view}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    58
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    59
     
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    60
      options.ltv = false
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    61
      opts.on("-l", "--ltview", "Luminaire viewer mode") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    62
        options.ltv = true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    63
        options.vw = "y"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    64
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    65
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    66
      #set "room" size for ltview, default is 4' square box (in meters)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    67
      options.rsiz = "0.6096"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    68
      opts.on("-r", "--roomsize", String, "Room scaling factor for ltview") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    69
        options.rsiz = n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    70
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    71
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    72
      opts.on("-d", "--debug", "Run verbosely") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    73
        options.verbose = true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    74
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    75
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    76
      opts.on("-g", "--ogl", "Use OpenGL (glrad)") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    77
        options.ogl = true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    78
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    79
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    80
      opts.on("-e", "--rad", "Set rad options") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    81
        options.radopt << n
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    82
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    83
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    84
      opts.on("-S", "--glrad", "Set glrad options") do |n|
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    85
        options.glradopt = "-S #{n}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    86
      end     
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    87
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    88
      # No argument, shows at tail.  This will print an options summary.
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    89
      opts.on_tail("-h", "--help", "Show this message") do
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    90
        puts opts
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    91
        exit
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    92
      end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    93
      
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    94
    end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    95
    
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    96
    opts.parse!(args)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    97
    options
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    98
    
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    99
  end  # parse()
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   100
  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   101
end  # class Optparse
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   102
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   103
options = Optparse.parse(ARGV)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   104
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   105
# utility function: print statement and execute as system call
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   106
def exec_statement(s)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   107
  if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   108
    s = s.gsub("/", "\\")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   109
  end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   110
  puts "'#{s}'"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   111
  result = system(s)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   112
  puts
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   113
  return result
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   114
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   115
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   116
exec = "system"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   117
if options.verbose == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   118
  puts options
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   119
  puts "Input file(s): #{ARGV}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   120
  exec = "exec_statement"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   121
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   122
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   123
#not needed(?)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   124
#octree = Tempfile.new(['objview_', '.oct'])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   125
#ambf = Tempfile.new(['objview_', '.amb'])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   126
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   127
if options.ltv == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   128
  rendopts = "-ab 1 -ds .15"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   129
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   130
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   131
# not sure how these options are supposed to work... RPG
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   132
#
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   133
# 	case -s:
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   134
# 	case -w:
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   135
# 		set opts=($opts $argv[1])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   136
# 		breaksw
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   137
# 	case -b*:
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   138
# 		set rendopts=($rendopts -bv)
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   139
# 		breaksw
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   140
# 	case -V:
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   141
#
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   142
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   143
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   144
if not ARGV[0]
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   145
  puts "No input files specified"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   146
  exit 1
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   147
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   148
  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   149
if options.ogl == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   150
  if rendopts
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   151
    puts "bad option for glrad"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   152
    exit 1
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   153
  else
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   154
    if options.glradopt == true 
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   155
      puts "bad option for rad"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   156
      exit 1
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   157
    end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   158
  end  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   159
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   160
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   161
if options.ltv == false
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   162
  # create lights input file for objview
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   163
  lights = Tempfile.new(['lt_', '.rad'])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   164
  lights.write("void glow dim 0 0 4 .1 .1 .15 0\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   165
  lights.write("dim source background 0 0 4 0 0 1 360\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   166
  lights.write("void light bright 0 0 3 1000 1000 1000\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   167
  lights.write("bright source sun1 0 0 4 1 .2 1 5\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   168
  lights.write("bright source sun2 0 0 4 .3 1 1 5\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   169
  lights.write("bright source sun3 0 0 4 -1 -.7 1 5\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   170
  if options.verbose == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   171
    lights.rewind
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   172
    lightsread = lights.read
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   173
    puts "\nlights file:"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   174
    puts lightsread
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   175
  end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   176
  lights.close
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   177
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   178
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   179
if options.ltv == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   180
  #create room input file for ltview
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   181
  room = Tempfile.new(['lt_', '.rad'])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   182
  room.write("void plastic surf\n0\n0\n5\n.2 .2 .2 0 0\n\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   183
  room.write("surf polygon floor\n0\n0\n12\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   184
  room.write("-#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   185
  room.write("-#{options.rsiz} -#{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   186
  room.write("#{options.rsiz} -#{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   187
  room.write("#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   188
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   189
  room.write("surf polygon clg\n0\n0\n12\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   190
  room.write("-#{options.rsiz} #{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   191
  room.write("-#{options.rsiz} -#{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   192
  room.write("#{options.rsiz} -#{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   193
  room.write("#{options.rsiz} #{options.rsiz} #{options.rsiz}\n\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   194
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   195
  room.write("surf polygon wall-north\n0\n0\n12\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   196
  room.write("-#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   197
  room.write("#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   198
  room.write("#{options.rsiz} #{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   199
  room.write("-#{options.rsiz} #{options.rsiz} #{options.rsiz}\n\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   200
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   201
  room.write("surf polygon wall-east\n0\n0\n12\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   202
  room.write("#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   203
  room.write("#{options.rsiz} -#{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   204
  room.write("#{options.rsiz} -#{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   205
  room.write("#{options.rsiz} #{options.rsiz} #{options.rsiz}\n\n")  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   206
  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   207
  room.write("surf polygon wall-west\n0\n0\n12\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   208
  room.write("-#{options.rsiz} #{options.rsiz} -#{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   209
  room.write("-#{options.rsiz} #{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   210
  room.write("-#{options.rsiz} -#{options.rsiz} #{options.rsiz}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   211
  room.write("-#{options.rsiz} -#{options.rsiz} -#{options.rsiz}\n\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   212
  if options.verbose == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   213
    room.rewind
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   214
    roomread = room.read
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   215
    puts "\nroom file:"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   216
    puts roomread
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   217
  end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   218
  room.close
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   219
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   220
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   221
# create .rif file
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   222
rif = Tempfile.new(['ov_', '.rif'])
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   223
if options.ltv == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   224
  rif.write("scene= #{ARGV.join(' ')} #{room.path}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   225
else
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   226
  rif.write("scene= #{ARGV.join(' ')} #{lights.path}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   227
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   228
rif.write("EXPOSURE= .5\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   229
rif.write("UP= #{options.up}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   230
rif.write("view= #{options.vw}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   231
rif.write("oconv= -f\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   232
rif.write("render= #{rendopts}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   233
#doesn't rad handle the construction and destruction of these files (below) on its own? RPG
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   234
#rif.write("OCTREE= #{octree.path}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   235
#rif.write("AMBF= #{ambf.path}\n")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   236
if options.verbose == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   237
  rif.rewind
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   238
  rifread = rif.read
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   239
  puts "\nrif file:"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   240
  puts rifread
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   241
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   242
rif.close
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   243
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   244
puts "radopt = #{options.radopt.join(" ")}"
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   245
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   246
#run executive control program of choice
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   247
if options.ogl == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   248
  exec("glrad #{options.radopt.join(" ")} #{rif.path}")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   249
else
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   250
  exec("rad -o #{options.dev} #{options.radopt.join(" ")} #{rif.path}")
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   251
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   252
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   253
# clean up temp files
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   254
if coptions.ltv == true
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   255
  room.unlink
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   256
else  
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   257
  lights.unlink
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   258
end
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   259
rif.unlink
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   260
#ambf.unlink
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   261
#octree.unlink
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   262
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   263
exit 0
0216da79ade0 orig/objview.rb: Windows version of objview.csh with extra ltview functionality
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   264