BBS: Inland Empire Archive Date: 03-21-93 (03:41) Number: 353 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Solid5 3/8 Conf: (2) Quik_Bas
'Page 3 of SOLID5.BAS begins here.
s1! = SIN(a1!): c1! = COS(a1!)
s2! = SIN(a2!): c2! = COS(a2!)
lx = 128 * s1! * c2! 'convert spherical coordinates to a vector
ly = 128 * s1! * s2! 'scale up by 128 for integer math
lz = 128 * c1!
FOR a = -128 TO 128 'precalculate the three light source tables
lx(a + 128) = lx * a 'for fast Lambert shading
ly(a + 128) = ly * a
lz(a + 128) = lz * a
NEXT
PRINT "Strike a key...": DO: LOOP WHILE INKEY$ = ""
R1 = 0: R2 = 0: R3 = 0 'three angles of rotation
ox = 0: oy = -50: oz = 1100 'object's origin (this program cannot _
currently
'handle the object when it goes behind the
_
viewer!)
s = 1: t = 0
SCREEN 7, , 0, 0
OUT &H3C8, 0 'set 16 shades
FOR a = 0 TO 15
OUT &H3C9, (a * 34) \ 10
OUT &H3C9, (a * 212) \ 100
OUT &H3C9, (a * 4) \ 10
IF a = 7 THEN OUT &H3C7, 16: OUT &H3C8, 16
NEXT
LINE (0, 100)-(319, 199), 9, BF
LINE (0, 0)-(319, 99), 3, BF
SCREEN 7, , 1, 0
LINE (0, 100)-(319, 199), 9, BF
LINE (0, 0)-(319, 99), 3, BF
YHigh(0) = -32768: ShadowYHigh(0) = -32768
YHigh(1) = -32768: ShadowYHigh(1) = -32768
DO
'Flip active and work pages so user doesn't see our messy drawing
SCREEN 7, , s, t: SWAP s, t
'Wait for vertical retrace to reduce flicker
WAIT &H3DA, 8
'Erase the old image from the screen
IF YHigh(s) <> -32768 THEN
IF YHigh(s) < 100 THEN
LINE (XLow(s), YLow(s))-(XHigh(s), YHigh(s)), 3, BF
ELSEIF YLow(s) < 100 THEN
LINE (XLow(s), YLow(s))-(XHigh(s), 99), 3, BF
LINE (XLow(s), 100)-(XHigh(s), YHigh(s)), 9, BF
ELSE
LINE (XLow(s), YLow(s))-(XHigh(s), YHigh(s)), 9, BF
END IF
END IF
IF ShadowYHigh(s) <> -32768 THEN
LINE (ShadowXLow(s), ShadowYLow(s))-(ShadowXHigh(s), ShadowYHig_
h(s)), 9, BF
END IF
RotatePoints
CullPolygons
ShadePolygons
XLow(s) = 32767: XHigh(s) = -32768
YLow(s) = 32767: YHigh(s) = -32768
DrawShadows
DrawObject
R1 = (R1 + D1) MOD 360: IF R1 < 0 THEN R1 = R1 + 360
R2 = (R2 + D2) MOD 360: IF R2 < 0 THEN R2 = R2 + 360
R3 = (R3 + D3) MOD 360: IF R3 < 0 THEN R3 = R3 + 360
oz = oz + dz: ox = ox + dx
IF oz < 600 THEN
oz = 600: dz = 0
ELSEIF oz > 8000 THEN
oz = 8000: dz = 0
END IF
IF ox < -4000 THEN
ox = -4000: dx = 0
ELSEIF ox > 4000 THEN
ox = 4000: dx = 0
END IF
a$ = INKEY$
SELECT CASE a$
CASE "4"
D1 = D1 - 2
CASE "6"
D1 = D1 + 2
CASE "8"
D2 = D2 - 2
CASE "2"
D2 = D2 + 2
CASE "5"
'Continued on page 4
--- MsgToss 2.0b
* Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET