[alt.sources.d] 'prt' Ray Tracer

afoiani@nmsu.edu (Anthony Foiani) (12/06/90)

Hello there...

I just grabbed a copy of 'prt' off of a.s earlier this morning, and
got it running with no problems at all.  My only problem is what to do
with the 1.68MB output file I got.  What package[s]/monitors etc. do I
need to view them?  Feel free to mail if you prefer.  If others need
the information, I'll gladly post a summary.

It worked great, by the way.  We had a couple of sun 4/65s that
weren't doing much, so... ;-)

Thanks,
Tony Foiani
--
Tony Foiani  a.k.a. Tkil  (mcsajf@nmsuvm1.bitnet) or (afoiani@nmsu.edu)
Supporting:  Unix / DOS / VMS / Macintosh / "What's this?" / Apple II

pizzi@esacs.UUCP (Riccardo Pizzi) (12/07/90)

In article <AFOIANI.90Dec6021521@dante.nmsu.edu> afoiani@nmsu.edu (Anthony Foiani) writes:

>I just grabbed a copy of 'prt' off of a.s earlier this morning, and
>got it running with no problems at all.  My only problem is what to do
>with the 1.68MB output file I got.  What package[s]/monitors etc. do I
>need to view them?  Feel free to mail if you prefer.  If others need
>the information, I'll gladly post a summary.

I'm interested too.
E-mail tips please!!

Thanx

Rick
-- 
Riccardo Pizzi @ ESA Software, Rimini, ITALY
e-mail: pizzi%esacs@relay.EU.net -or- root@xtc.sublink.org
Public Access Unix @ +39-541-27858 (Telebit)
<< Object Oriented is an Opaque Disease >>

dean@coplex.UUCP (Dean Brooks) (12/09/90)

pizzi@esacs.UUCP (Riccardo Pizzi) writes:

>In article <AFOIANI.90Dec6021521@dante.nmsu.edu> afoiani@nmsu.edu (Anthony Foiani) writes:

>>I just grabbed a copy of 'prt' off of a.s earlier this morning, and
>>got it running with no problems at all.  My only problem is what to do
>>with the 1.68MB output file I got.  What package[s]/monitors etc. do I
>>need to view them?  Feel free to mail if you prefer.  If others need
>>the information, I'll gladly post a summary.

The output appears to be in "mtv" format.  To convert the format to
something viewable, grab a copy of "PBMPLUS" or the "fbm" utilities.
Those packages can convert the mtv format to something usable, such
as Amiga IFF, SunRaster, etc.

--
dean@coplex.UUCP   Dean A. Brooks
                   Copper Electronics, Inc.
                   Louisville, Ky
UUCP: !uunet!coplex!dean

mike@wang.com (Mike Sullivan) (12/18/90)

pizzi@esacs.UUCP (Riccardo Pizzi) writes:

>In article <AFOIANI.90Dec6021521@dante.nmsu.edu> afoiani@nmsu.edu (Anthony Foiani) writes:

>>I just grabbed a copy of 'prt' off of a.s earlier this morning, and
>>got it running with no problems at all.  My only problem is what to do
>>with the 1.68MB output file I got.  What package[s]/monitors etc. do I
>>need to view them?  Feel free to mail if you prefer.  If others need
>>the information, I'll gladly post a summary.

Well I downloaded the raytracer as well.  The format of the file is fairly 
straightforward so I wrote a quick c program to get it into a form I could use.

The file contains a newline termintated string containing the X and Y 
dimensions, followed by X * Y * 3 bytes. ( I guessed at the order (RGB))

I then took the three files generated and loaded them into PICLAB a DOS based 
program, in raw mode.  I was then able to convert it to GIF format.

Here is the program I wrote:
BEGIN------------------8<---------------cut here----------8<----------------

#include <stdio.h>

main(argc, argv)
int	argc;
char	**argv;
{
char	*pixbuf, *r_name, *g_name, *b_name;
FILE	*infile, *rfile, *gfile, *bfile;
int	x, y, row, col;

  if ( argc != 2 )
    printf( "Usage: rgbsplit filename" );
  
  if ( (infile = fopen( argv[1], "r" )) == 0 )
    { 
      perror( "rgbsplit" );
      exit(1);
    }
   r_name = (char *) malloc( strlen( argv[1] )+4 );
   g_name = (char *) malloc( strlen( argv[1] )+4 );
   b_name = (char *) malloc( strlen( argv[1] )+4 );
   strcpy( r_name, argv[1] );
   strcpy( g_name, argv[1] );
   strcpy( b_name, argv[1] );
   strcat( r_name, ".r8" );
   strcat( g_name, ".g8" );
   strcat( b_name, ".b8" );
   rfile = fopen( r_name, "w" );
   gfile = fopen( g_name, "w" );
   bfile = fopen( b_name, "w" );
   if ( !( rfile&&gfile&&bfile ) )
     {
       perror( "rgbfile" );
       exit(1);
     }
   fscanf( infile, "%d %d\n", &x, &y );
   if( x <= 0 || x > 2000 ) 
     {
       printf("rgbsplit: Error in format\n" );
       exit( x );
     }

   pixbuf = (char *) malloc( x* 3) ;

   for ( row = 0 ; row < y ; row++ )
     {
       fread( pixbuf, 1, 3*x, infile );
       for( col = 0 ; col < 3*x ; )
	 {
	   fwrite( &pixbuf[col++], 1, 1, rfile );
	   fwrite( &pixbuf[col++], 1, 1, gfile );
	   fwrite( &pixbuf[col++], 1, 1, bfile );
	 }
     }
}

END-----------8<----------cut here----------------------8<----------------
-- 
  ________________________
 /                    __  \  | Michael J. Sullivan    |ec.lec.tic adj Choosing
| \  \  /  /\  |\ |  /  `  | | Wang Laboratories Inc. |or consisting of what 
|  \/ \/  /--\ | \|  \__T  | | mike@WANG.COM	      |appears to be the best 
 \________________________/  | 			      |from diverse sources.