home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
201-225
/
apd214
/
showobj.amos
/
showobj.amosSourceCode
Wrap
AMOS Source Code
|
1978-02-21
|
7KB
|
277 lines
Hide On
'
' VECTOR OBJECT SHOWER BY NICK.
'THIS PROGRAM WAS DESIGNED TO DISPLAY OBJECTS CREATED ON PAPER
'TO SEE WETHER THEY LOOKED GOOD ENOUGH TO PUT ON TO A DEMO WHICH IM
'ABOUT TO START WORK ON. BUT I DECIDED TO WRITE AN OBJECT EDITOR SO THAT
'I COULD RELEASE IT TO YOU LOT OUT THERE, BECAUSE ITS GREAT FUN!!!
'
'
'THE ROUTINE CAN HANDLE ANY NUMBER OF POINTS, AND CAN ZOOM IN AND OUT
'AND FREELY ROTATE IMAGES AROUND AND INTO THE SCREEN.
'NB.THE OBJECT EDITOR LIMITS YOU TO 50 POINTS
'
'IT SUPPORTS WIRE FRAME GRAPHICS, AND SCALES THE OBJECTS WITH
'A PERSPECTIVE ROUTINE.
'
'
'THERE ARE ALREADY A FEW OBJECTS THAT I HAVE DESIGNED ON HERE
'TO CHANGE THE OBJECT YOU SHOULD GO THROUGH THIS LISTING UNTIL
'YOU COME TO THE OBJECT DATA, THEN CHOOSE AN OBJECT. NEXT TO THE REM
'STATEMENT OF THE NAME YOULL SEE A NUMBER IN BRACKETS CHANGE THE NPS
'VARIABLE TO THIS NUMBER ~~~
'
'YOULL FIND THE LINE SETTING NPS IS SEPARATED FROM THE REST OF THE PROGRAM
'WITH THE LINE: 'POINTS NUMBER VARIABLE' WRITTEN ABOVE IT!
'
'NOW GO BACK AND REMOVE THESE ' SYMBOLS FROM THE FRONT OF THE DATA STATEMENTS
'OF THE OBJECT YOU WANT TO SEE.
'NOW FIND THE OLD OBJECT ( THE ONE WITHOUT ' BY THE DATA STATEMENTS)
'AND PUT ' SYMBOLS OR REM IN FRONT OF THEM
'
'YOU CAN NOW RUN THE PROGRAM!!! HAVE FUN!!!!
'
'
'PS. YOU CAN ENTER YOUR OWN OBJECTS TOO!! YOU CAN MAKE 2 DIMENSIONAL
'OBJECTS WITH MY OBJECT EDITOR PROGRAM. JUST ENTER YOUR OWN DATA STATEMENTS
'IN THE SAME WAY THAT I HAVE, AND REMEMBER TO SET NPS TO THE NUMBER OF
'POINTS THAT THE OBJECT EDITOR SAYS ARE IN YOUR OBJECT.
'ALWAYS ENTER THEM IN THE ORDER THAT THE OBJECT EDITOR GIVES YOU
'AND MAKE SURE THEY ARE IN X,Y,Z ORDER.
'
'IF YOU WANT 3D OBJECTS, IM AFRAID YOULL HAVE TO DESIGN THEM ON PAPER!
'THIS ROUTINE CAN HANDLE THEM,IF YOU KNOW WHAT YOUR DOING.
'(SORRY BUT I DONT FANCY CODING A 3D OBJECT EDITOR! WAIT FOR AMOS 3D!)
'
'
'
'THESE PROGRAMS ARE SHAREWARE!!! IF YOU LIKE AND USE THEM, PLEASE SEND
'A POSTAL ORDER FOR A SMALL AMOUNT (ABOUT 2 QUID) TO:
'
'
'
' NICK
' 44 HEOL-Y-GWRGAN
' MARGAM
' PORT TALBOT
' WEST GLAM
' SA13 2DG
'
'AND YOULL GET MY NEXT PROGRAM OR DEMO OR WHATEVER!
'
'
'
Screen Open 1,320,240,2,Lowres
Screen Open 0,320,40,2,Lowres
Curs Off
Flash Off
Cls 0
Centre "VECTOR OBJECT SHOWER BY NICK!"
Print
Centre "{Q ZOOM IN} {A ZOOM OUT}"
Print
Centre "{O ROTATE X} {P ROTATE Y} {0-QUIT}"
Set Rainbow 0,1,250,"(1,1,15)(37,-1,15)","(3,1,15)(19,-1,15)","(2,1,15)(8,-1,15)"
Rainbow 0,0,80,250
Screen 1
Double Buffer
Autoback 0
Screen Swap
'
' points number variable
'
NPS=29
'
'
'
Curs Off : Paper 0 : Cls
Dim X#(NPS),Y#(NPS),Z#(NPS)
XIDGIN#=100 : YRIGIN#=100
ZEDSCALE#=0.002
XPOSITION#=-70 : YPOSITION#=0 : ZPOSITION#=150
For I=1 To NPS
Read X#(I),Y#(I),Z#(I)
Next I
'
' OBJECT DATA
'
' objects check numbers in brackets for no of points!
'
'ENTER YOUR OWN OBJECT DATA HERE!!!!!!!!
'
'
'amos logo(29)
Data -14,4,0,-14,-3,0,-10,-3,0,-10,4,0,-10,0,0
Data -14,0,0,-14,4,0,-9,4,0,-9,-3,0,-5,-3,0
Data -7,-3,0,-7,0,0,-7,-3,0,-5,-3,0,-5,4,0
Data -4,4,0,-4,-3,0,0,-3,0,0,4,0,-4,4,0
Data 5,4,0,5,0,0,1,0,0,1,-3,0,5,-3,0
Data 13,-3,0,10,-4,0,10,-2,0,13,-3,0
'
'
'
'CRAP SHAPE(6)
'
'Data -7,-8,0,-7,0,0,3,0,0,6,-4,0,3,-8,0,-7,-8,0
'
'
'letter c (14)
'Data -2,1,0,-1,2,0,1,2,0,2,1,0,2,0,0
'Data 1,0,0,1,1,0,-1,1,0,-1,-2,0,2,-2,0
'Data 1,-3,0,-1,-3,0,-2,-2,0,-2,1,0
'
'nick(21)
'
'Data -5,2,0,-5,-2,0,-5,2,0,-3,-2,0,-3,2,0
'Data -3,-2,0,-2,-2,0,-2,2,0,-2,-2,0,1,-2,0
'Data -1,0,0,1,2,0,-1,0,0,1,-2,0,4,-2,0
'Data 2,0,0,4,2,0,2,0,0,2,2,0,2,-2,0
'Data -5,-2,0
'
'tandem (39)
'Data -2,3,0,-1,4,0,1,4,0,2,3,0,1,2,0
'Data -1,2,0,-2,3,0,-1,3,1,1,3,1,2,3,0
'Data 1,4,0,1,3,1,1,2,0,1,-2,0,1,2,0
'Data 2,3,0,1,3,1,-1,3,1,-1,4,0,-1,3,1
'Data -1,2,0,-1,-2,0,-2,-3,0,-1,-4,0,-1,-3,-1
'Data -2,-3,0,-1,-2,0,1,-2,0,2,-3,0,1,-4,0
'Data 1,-3,-1,2,-3,0,1,-4,0,-1,-4,0,-1,-3,-1
'Data -1,-2,0,1,-2,0,1,-3,-1,-1,-3,-1
'
'hexagon (13)
'
'Data -3,1,0,-2,2,0,-1,3,0,1,3,0,2,2,0
'Data 3,1,0,3,-1,0,2,-2,0,1,-3,0,-1,-3,0
'Data -2,-2,0,-3,-1,0,-3,1,0
'
'
'diamond(14)
'Data -2,0,0,0,2,0,2,0,0,0,-2,0,-2,0,0
'Data 0,0,2,2,0,0,0,0,-2,-2,0,0,0,2,0
'Data 0,0,-2,0,-2,0,0,0,2,0,2,0
'
'
'space ship v1 (17)
'
'Data -10,-5,-2,-4,3,-2,0,5,-2,4,3,-2,10,-5,-2
'Data -10,-5,-2,-4,-5,2,4,-5,2,10,-5,-2,4,3,-2
'Data 0,0,2,-4,3,-2,0,5,-2,0,0,2,-4,-5,2
'Data 4,-5,2,0,0,2
'
'give way (5)
'
'Data 0,0,0,0,2,0,-1,3,0,1,3,0,0,2,0
'
'house(23)
'
'Data -10,5,0,10,5,0,10,-5,0,-10,-5,0,-10,5,0
'Data -10,5,10,10,5,10,10,5,0,10,5,10,10,0,15
'Data -10,0,15,-10,5,10,-10,-5,10,-10,-5,0,-10,-5,10
'Data 10,-5,10,10,-5,0,10,-5,10,10,5,10,10,0,15,10,-5,10
'Data -10,-5,10,-10,0,15
'
'disk(19)
'Data -7,7,0,7,7,0,7,-7,0,-7,-7,0,-7,7,0
'Data -6,7,0,-6,0,0,6,0,0,6,7,0,7,7,0
'Data 7,-7,0,4,-7,0,4,-2,0,-4,-2,0,-4,-7,0
'Data 0,-7,0,0,-4,0,-2,-4,0,-2,-7,0
'
'
'tree (10)
'Data 0,0,0,0,1,0,-1,1,0,0,3,0,1,1,0
'Data 0,1,0,0,1,1,0,3,0,0,1,-1,0,1,0
'
'big space ship (24)
'Data -4,4,-5,4,4,-5,5,3,-5,6,0,-5,2,-2,-5
'Data -2,-2,-5,-1,0,15,1,0,15,2,-2,-5,-2,-2,-5
'Data -6,0,-5,-5,3,-5,-4,4,-5,-1,0,15,1,0,15
'Data 4,4,-5,5,3,-5,1,0,15,-1,0,15,-5,3,-5
'Data -6,0,-5,-1,0,15,1,0,15,6,0,-5
'
'space ship2(19)
'
'Data -7,-5,-1,-7,0,-1,-2,1,-1,0,10,-1,2,1,-1
'
'Data 7,0,-1,7,-5,-1,-7,-5,-1,-2,-5,-1,-2,1,-1
'
'Data 0,1,3,2,1,-1,2,-5,-1,0,-5,3,0,1,3
'
'Data 0,10,-1,-2,1,-1,-2,-5,-1,0,-5,3
'
'OBJECT1(8)
'Data -5,-5,0,0,5,0,5,-5,0,0,0,10,-5,-5,0,5,-5,0,0,5,0,0,0,10
'OBJECT2(10)
'
'Data 0,5,0,5,0,0,0,-5,0,-5,0,0,0,5,0,0,0,10,0,-5,0,5,0,0,0,0,10,-5,0,0
'
'cube (16)
'Data -5,-5,-5,-5,-5,5,5,-5,5,5,-5,-5,-5,-5,-5
'Data -5,5,-5,-5,5,5,-5,-5,5,-5,5,5,5,5,5
'Data 5,-5,5,5,5,5,5,5,-5,5,-5,-5,5,5,-5,-5,5,-5
'
'
Gosub DDRAWBODY
DDEGREE#=11.25
RRADIAN#=DDEGREE#*2*Pi#/360
Do
'For J=1 To 100
Gosub SPIN
'If zposition#>60 Then zposition#=zposition#-2
XPOSITION#=20
YPOSITION#=20
Cls
Gosub DDRAWBODY
'Next J
Loop
'
'
Cls
Gosub DDRAWBODY
SPIN:
'Repeat
K$=Inkey$
'Until K$<>""
For I=1 To NPS
K$=Upper$(K$)
If(K$="Q") and(ZPOSITION#>60) Then ZPOSITION#=ZPOSITION#-1
If(K$="A") and(ZPOSITION#<160) Then ZPOSITION#=ZPOSITION#+1
If K$="O" Then Gosub TURN
If K$="P" Then Gosub TURN2
If K$="0" Then End
Clear Key
Next I
Return
'
TURN:
C#=X#(I)*Cos(RRADIAN#)-Y#(I)*Sin(RRADIAN#)
Y#(I)=X#(I)*Sin(RRADIAN#)+Y#(I)*Cos(RRADIAN#)
X#(I)=C#
Return
'
TURN2:
C#=Y#(I)*Cos(RRADIAN#)-Z#(I)*Sin(RRADIAN#)
Z#(I)=Y#(I)*Sin(RRADIAN#)+Z#(I)*Cos(RRADIAN#)
Y#(I)=C#
Return
'
DDRAWBODY:
XABSOLX#=X#(1)+XPOSITION# : YABSOLX#=Y#(1)+YPOSITION# : ZABSOLX#=Z#(1)+ZPOSITION#
Gosub PERSPECTIVE
XOLD#=XSCR# : YOLD#=YSCR#
For I=2 To NPS
XABSOLX#=X#(I)+XPOSITION# : YABSOLX#=Y#(I)+YPOSITION# : ZABSOLX#=Z#(I)+ZPOSITION#
Gosub PERSPECTIVE
Draw XOLD#,YOLD# To XSCR#,YSCR#
XOLD#=XSCR# : YOLD#=YSCR#
Next I
Screen Swap
Wait Vbl
Return
'
PERSPECTIVE:
XSCR#=XABSOLX#/(ZABSOLX#*ZEDSCALE#)
YSCR#=YABSOLX#/(ZABSOLX#*ZEDSCALE#)
XSCR#=XSCR#
YSCR#=YSCR#
Return
'