bin/objview.pl
changeset 36 3e70c0b64ec7
parent 6 b5d9ad64026d
--- a/bin/objview.pl	Sat Nov 30 23:25:26 2013 +0000
+++ b/bin/objview.pl	Sat Nov 30 23:25:38 2013 +0000
@@ -7,7 +7,7 @@
 # The only extra functionality is that we accept a scene on STDIN
 # if no file name is given.
 #
-# Axel, Oct 2010
+# Axel, Nov 2013
 
 use strict;
 use warnings;
@@ -31,6 +31,9 @@
 while (@ARGV) {
 	$_ = $ARGV[0];
 	if (m/-g/) {   # OpenGL output
+		if ( $^O =~ /MSWin32/ ) {
+			die("OpenGL view is not available under Windows.\n");
+		}
 		$usegl = 1;
 	} elsif (m/-u/) {   # up direction
 		$up = $ARGV[1];
@@ -80,12 +83,10 @@
 # Make sure we don't confuse glrad and rad options.
 if ($usegl) {
 	if ($radopt) {
-		#system "glrad";  # Why are we launching glrad anyhow?
 		die("objview: glrad output requested, but rad option passed.\n");
 	}
 } else {
 	if ($glradopt) {
-		#system "rad";
 		die("objview: rad output requested, but glrad option passed.\n");
 	}
 }
@@ -102,11 +103,25 @@
 EndOfLights
 close(FH);
 
-my $scenes = join(' ', @ARGV) . " $lights";
+my @scenes = @ARGV;
+push (@scenes, $lights);
+
+# Make this work under Windoze
+if ( $^O =~ /MSWin32/ ) {
+	for my $i (0 .. $#scenes) {
+		# rad doesn't like Windows-style backslashes.
+		$scenes[$i] =~ s{\\}{/}g;
+	}
+	$octree =~ s{\\}{/}g;
+	$ambf =~ s{\\}{/}g;
+	$raddev = "qt";
+}
+
+my $scene = join(' ', @scenes);
 open(FH, ">$rif") or
 		die("objview: Can't write to temporary file $rif\n");
 print FH <<EndOfRif;
-scene= $scenes
+scene= $scene
 EXPOSURE= .5
 UP= $up
 view= $vw