home *** CD-ROM | disk | FTP | other *** search
- REM Program to create VIVID compatible .MAP files
- REM *********************************************
- REM Paul Smith - Raytech BBS - +44 862 88340
- REM *********************************************
- REM Raytracing support in the UK !
-
- CLS
- PRINT "MAP V0.5 by Paul Smith - Raytech BBS - +44 862 88340"
- PRINT
- PRINT "Creates a smoothly shaded .MAP file for Vivid or Fractint"
- PRINT
- PRINT
- INPUT "Enter output file name :"; F$
- INPUT "Enter number of control points :"; P
- P = P - 1
- DIM CP(P, 4)
- FOR D = 0 TO P
- IF D = 0 THEN PRINT "Assuming control point at 0": CP(D, 0) = 0: GOTO ASSUME
- IF D = P THEN PRINT "Assuming control point at 255": CP(D, 0) = 255: GOTO ASSUME
- PRINT "Enter position for control point number"; D;
- INPUT ""; CP(D, 0)
- ASSUME:
- NEXT D
- FOR D = 0 TO P
- PRINT "Enter R,G,B triple for control point at position"; CP(D, 0);
- INPUT ""; CP(D, 1), CP(D, 2), CP(D, 3)
- NEXT D
-
- REM Sort array into ascending order here if required.
- REM At present the program depends on having control points
- REM in logical ascending order.
-
- OPEN F$ FOR OUTPUT AS #1
-
- FOR S = 0 TO P - 1: REM step through segments (i.e. between control points)
- SP = CP(S + 1, 0) - CP(S, 0): REM calculate Points in the Segment
- RI = (CP(S + 1, 1) - CP(S, 1)) / SP: REM calculate Red Interval for this segment
- GI = (CP(S + 1, 2) - CP(S, 2)) / SP: REM calculate Green Interval for this segment
- BI = (CP(S + 1, 3) - CP(S, 3)) / SP: REM calculate Blue Interval for this segment
-
- FOR N = 0 TO SP - 1: REM step through individual output triples.
- PRINT #1, INT(RI * N) + CP(S, 1);
- PRINT #1, INT(GI * N) + CP(S, 2);
- PRINT #1, INT(BI * N) + CP(S, 3)
- NEXT N, S
-
- CLOSE #1
-
- SYSTEM
-
-
-
-
-
-