BBS: Inland Empire Archive Date: 03-21-93 (03:43) Number: 355 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Solid5 5/8 Conf: (2) Quik_Bas
'Page 5 of SOLID5.BAS begins here. END IF xd = xe - xs yd = ye - ys IF yd <> 0 THEN xi = xd \ yd: xrs = ABS(xd MOD yd) xr = -yd \ 2 IF ye > 199 THEN ye = 199 xdirect = SGN(xd) + xi FOR Y = ys TO ye IF xs < EdgeList(Y).Low THEN EdgeList(Y).Low = xs IF xs > EdgeList(Y).High THEN EdgeList(Y).High = xs xr = xr + xrs IF xr > 0 THEN xr = xr - yd xs = xs + xdirect ELSE xs = xs + xi END IF NEXT END SUB SUB DrawObject 'Find the center of each visible polygon, and prepare the order _ list. NumPolys = 0 FOR a = 0 TO MaxPolys IF Polys(a).Culled = False THEN 'is this polygon visible? Polys(NumPolys).ZOrder = a NumPolys = NumPolys + 1 Polys(a).ZCenter = Points(Polys(a).P1).ZWorld + Points(Poly_ s(a).P2).ZWorld + Points(Polys(a).P3).ZWorld END IF NEXT 'Sort the visible polygons by their Z center using a shell sort. NumPolys = NumPolys - 1 Mid = (NumPolys + 1) \ 2 DO FOR a = 0 TO NumPolys - Mid CompareLow = a CompareHigh = a + Mid DO WHILE Polys(Polys(CompareLow).ZOrder).ZCenter < _ Polys(Polys(CompareHigh).ZOrder).ZCenter SWAP Polys(CompareLow).ZOrder, Polys(CompareHigh).ZOrder CompareHigh = CompareLow CompareLow = CompareLow - Mid IF CompareLow < 0 THEN EXIT DO LOOP NEXT Mid = Mid \ 2 LOOP WHILE Mid > 0 'Plot the visible polygons. FOR Z = 0 TO NumPolys a = Polys(Z).ZOrder 'which polygon do we plot? P1 = Polys(a).P1: P2 = Polys(a).P2: P3 = Polys(a).P3 PolyFill (Points(P1).XView), (Points(P1).YView), (Points(P2).XV_ iew), (Points(P2).YView), (Points(P3).XView), (Points(P3).YView), _ (Polys(a).Intensity) NEXT END SUB SUB DrawShadows YLow = 32767: YHigh = -32768 XLow = 32767: XHigh = -32768 FOR a = 0 TO MaxPoints 'Project the 3-D point onto the ground plane... temp& = (Points(a).YWorld - 200) X = Points(a).XWorld - (temp& * lx) \ ly Y = 200 'ground plane has a constant Y coordinate Z = Points(a).ZWorld - (temp& * lz) \ ly 'Put the point into perspective xTemp = 160 + (X * 400&) \ Z yTemp = 100 + (Y * 300&) \ Z Points(a).XShadow = xTemp Points(a).YShadow = yTemp 'Find the lowest & highest X Y coordinates IF yTemp < YLow THEN YLow = yTemp IF yTemp > YHigh THEN YHigh = yTemp IF xTemp < XLow THEN XLow = xTemp IF xTemp > XHigh THEN XHigh = xTemp NEXT 'Store lowest & highest coordinates for later erasing... ShadowXLow(s) = XLow: ShadowYLow(s) = YLow 'Continued on page 6 --- 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