
; CyberTexture Peel Demo By David Ramsden

; Be sure to set the drive and path according to your system
; configuration before starting this animation.
;
; This .CTL file assumes that you have named all of the objects "TestObjc"
; (the default) and renames them automatically as it loads them in. Also,
; make sure that your objects are saved as JAY1.3D2, JAY2.3D2...JAY10.3D2

; Hint: Try setting the camera to a different position after you've
;       created the first one.
;
; Hint 2: You can save a lot of memory by mapping your Jayhawk
; horizontally.


alert "  CYBER TEXTURE  |    Peel Demo    |By David Ramsden"

; Load in all of the .3D2 files and save them back out as one file

load3D"a:\jay1.3D2":rename TestObjc, HAWK1
merge3D"a:\jay2.3D2":rename TestObjc, HAWK2
merge3D"a:\jay3.3D2":rename TestObjc, HAWK3
merge3D"a:\jay4.3D2":rename TestObjc, HAWK4
merge3D"a:\jay5.3D2":rename TestObjc, HAWK5
merge3D"a:\jay6.3D2":rename TestObjc, HAWK6
merge3D"a:\jay7.3D2":rename TestObjc, HAWK7
merge3D"a:\jay8.3D2":rename TestObjc, HAWK8
merge3D"a:\jay9.3D2":rename TestObjc, HAWK9
merge3D"a:\jay10.3D2":rename TestObjc, HAWK10

; Next, we need to create the joints where the picture will be bent.
;
; Hint: If you want to try this effect on another picture, it is much
;       easier if you position the joints manually.

cube J1, 1: cube J2, 1: cube J3, 1: cube J4, 1: cube J5, 1
cube J6, 1: cube J7, 1: cube J8, 1: cube J9, 1

clrgrp:select J1:xlate 0,0,684
clrgrp:select J2:xlate 0,0,541
clrgrp:select J3:xlate 0,0,398
clrgrp:select J4:xlate 0,0,255
clrgrp:select J5:xlate 0,0,112
clrgrp:select J6:xlate 0,0,-31
clrgrp:select J7:xlate 0,0,-174
clrgrp:select J8:xlate 0,0,-317
clrgrp:select J9:xlate 0,0,-460
allgrp

; Save everything out to disk.

saveall"a:\jayall.3d2"


; Now we start the animation and clear any trees just to be careful.

rstart "a:\peel",m:draft:view s
zoom 300:perspec 0:cam1 0,0,0
superview:record:record:record

treeclr

; Put all of the objects into a hierarchical tree

treeadd HAWK1,HAWK2,HAWK3,HAWK4,HAWK5,HAWK6,HAWK7,HAWK8,HAWK9,HAWK10

; Finally, we relate all of the "strips" together with the joints.

relate  HAWK2, HAWK1, J1
relate  HAWK3, HAWK2, J2
relate  HAWK4, HAWK3, J3
relate  HAWK5, HAWK4, J4
relate  HAWK6, HAWK5, J5
relate  HAWK7, HAWK6, J6
relate  HAWK8, HAWK7, J7
relate  HAWK9, HAWK8, J8
relate  HAWK10, HAWK9, J9

; Now we animate them. It starts with rotating just the last object
; (the feet of the JayHawk). Then, it rotates the last one again and
; the next object... and this continues until all of the objects are
; rolled up into themselves.


position HAWK10, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
position HAWK5, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
position HAWK5, 20,0,0
position HAWK4, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
position HAWK5, 20,0,0
position HAWK4, 20,0,0
position HAWK3, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
position HAWK5, 20,0,0
position HAWK4, 20,0,0
position HAWK3, 20,0,0
position HAWK2, 20,0,0
gosub SHOWPIC

position HAWK10, 20,0,0
position HAWK9, 20,0,0
position HAWK8, 20,0,0
position HAWK7, 20,0,0
position HAWK6, 20,0,0
position HAWK5, 20,0,0
position HAWK4, 20,0,0
position HAWK3, 20,0,0
position HAWK2, 20,0,0
position HAWK1, 20,0,0
gosub SHOWPIC
record:record:record:record
rstop:end


@SHOWPIC:
load3D"a:\jayall.3D2"
zoom 300:perspec 0:cam1 0,0,0
treeset HAWK1
superview:record
return

