;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;                                             ;;;;;;;;
;;;;;;;;  Example Shape #5-Shape broken down into 3  ;;;;;;;;
;;;;;;;;  seperate 'units' and sorted using IFVIS-   ;;;;;;;;
;;;;;;;;  GOSUB to call the left and right sides.    ;;;;;;;;
;;;;;;;;                                             ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	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

;;;;;;;;;;facet list;;;;;;;;;;;;;;;;;;;;;;;

	IFVIS 2,1,4 GOSUB right_wing		;This line checks the INNER right side
					;of the plane's body and calls the 
					;right_wing module straight away if the
					;condition is satisfied. Either way,
					;the program continues processing with
					;the next line down.

	IFVIS 104,101,102 GOSUB left_wing	;This line checks the INNER left side
					;of the plane's body and calls the 
					;left_wing module straight away if the
					;condition is satisfied. Either way,
					;the program continues processing with
					;the next line down.

	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		;

	IFVIS 102,101,104 GOSUB left_wing	;This line now checks the left side
					;of the plane's body and calls the 
					;left_wing module straight away if the
					;condition is satisfied. Either way,
					;the program continues processing with
					;the next line down.

	IFVIS 4,1,2 GOSUB right_wing		;This line now checks the right side
					;of the plane's body and calls the 
					;right_wing module straight away if the
					;condition is satisfied. Either way,
					;the program continues processing with
					;the next line down.
	RETURN

;The last two IFVIS...GOSUB lines above could actually be IFVIS...GOTO commands in this example,
;resulting in fractionally faster render time for the shape (the RETURN could also be removed).
;If however the body was tapered at one end, IFVIS...GOSUB would be essential because certain
;views would require both wings to appear over the body.

;Using this method, no lists of calls defining different views is necessary as in EXAMPLE#04.
;This is because the IFVIS...GOSUB commands determine the view direction and correct call order
;as they go along.

;In this example the BODY is not a module as in EXAMPLE#04. Because this method would only 
;require it to be called once, it would be a waste of both SHAPE FILE space and render time (for
;the GOSUB+RETURN) if it were a module outside the main program loop.

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

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
