;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;                                             ;;;;;;;;
;;;;;;;;  Example Shape #4-Shape broken down into 3  ;;;;;;;;
;;;;;;;;  seperate 'units' and sorted using IFVIS-   ;;;;;;;;
;;;;;;;;  GOTO to establish Left and Right views.    ;;;;;;;;
;;;;;;;;                                             ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	SHAPE 10000

;;;;;;;;;vertex list;;;;;;;;;;;;;;;;;;;;;;

	VERTEX 01,30,-15,+90
	VERTEX 02,30,+15,+90
	VERTEX 03,30,+10,-70
	VERTEX 04,30,-15,-90

	VERTEX 05,030,-5,+40
	VERTEX 06,130,+5,+10
	VERTEX 07,150,+5,-30
	VERTEX 08,030,-5,-20
	VERTEX 09,030,+5,+40
	VERTEX 10,030,+5,-20

	VERTEX 101,-30,-15,+90
	VERTEX 102,-30,+15,+90
	VERTEX 103,-30,+10,-70
	VERTEX 104,-30,-15,-90

	VERTEX 105,-030,-5,+40
	VERTEX 106,-130,+5,+10
	VERTEX 107,-150,+5,-30
	VERTEX 108,-030,-5,-20
	VERTEX 109,-030,+5,+40
	VERTEX 110,-030,+5,-20

	VERTEX 100,0,5,120

	VERTEX 200,00,-15,-50
	VERTEX 201,+5,-15,-90
	VERTEX 202,00,-50,-110
	VERTEX 203,-5,-15,-90

;;;;;;;;;condition list;;;;;;;;;;;;;;;;;;;

	IFVIS 4,1,2 GOTO right_view	;This command checks if the right side of the
				;plane's body is visible. If it is visible, 
				;then the viewer is obviously looking at the
				;object from its right-hand side; consequently
				;the label "right_view" below is jumped to.
				;If the facet is not visible and the condition
				;is therefore unsatisfied, the GOTO is 
				;ignored and the program continues processing
				;with the next line.

	IFVIS 102,101,104 GOTO left_view	;This command checks if the left side of the
				;plane's body is visible. If it is visible, 
				;then the viewer is obviously looking at the
				;object from its left-hand side; consequently
				;the label "left_view" below is jumped to.
				;If the facet is not visible and the condition
				;is therefore unsatisfied, then the viewer must
				;be looking directly down the middle of the
				;object:- this line is only ever reached when
				;the right side is not visible, so the only way
				;for both sides to be non-visible is when looking
				;down the centre.

	GOSUB left_wing		;When neither of the above IFVIS commands are
	GOSUB right_wing		;satisfied (ie:-centre view) the compiler ignores
	GOTO body			;both and carries on processing. These three call
				;commands reference the three modules in the 
				;correct order for a centre view.
right_view:
	GOSUB left_wing		;These three call commands reference the three
	GOSUB body		;modules in the correct order for a right viewing
	GOTO right_wing		;direction; ie:-left side first, then center and
				;lastly the right side of the object.
left_view:
	GOSUB right_wing		;These three call commands reference the three
	GOSUB body		;modules in the correct order for a left viewing
	GOTO left_wing		;direction; ie:-right side first, then center and
				;lastly the left side of the object.

				;Note how the last call command in each of the 
				;above is a GOTO and not a GOSUB like the previous
				;two. This is for the simple reason that if GOSUB
				;were used instead, then a RETURN command would
				;need to be added to stop the program continuing
				;processing into the next sequence of calls. With
				;a GOTO, control is returned to the PARENT PROGRAM
				;by the RETURN at the end of the last module called.

;;;;;;;;;modules;;;;;;;;;;;;;;;;;;;;;;;;;;

body:
	DRWPOLY 31,1,4,104,101	;this facet is the roof, it must go on before the
				;tail-fin

	DRWPOLY 30,200,201,202	;this is the tail-fin
	DRWPOLY 29,202,203,200	;
	DRWPOLY 33,202,201,203	;

	DRWPOLY 33,1,2,3,4		;this is the rest of the main body
	DRWPOLY 33,103,102,101,104	;
	DRWPOLY 35,104,4,3,103	;
	DRWPOLY 36,103,3,2,102	;

	DRWPOLY 30,100,1,101	;this is the nose
	DRWPOLY 32,100,2,1		;
	DRWPOLY 32,100,101,102	;
	DRWPOLY 34,100,102,2	;
	RETURN

left_wing:
	DRWPOLY 34,106,109,105
	DRWPOLY 36,108,110,107
	DRWPOLY 32,108,107,106,105
	DRWPOLY 37,106,107,110,109
	RETURN

right_wing:
	DRWPOLY 34,05,09,06
	DRWPOLY 36,07,10,08
	DRWPOLY 32,06,07,08,05
	DRWPOLY 37,10,07,06,09
	RETURN

	END
