home *** CD-ROM | disk | FTP | other *** search
- /* CMD: Follow the Leader
- *
- * creates a scene in which object clones follow a common path
- * copyright © 1995 by Seth Stroh, Tue July 27, 1995
- *
- */
-
- NUMERIC DIGITS 6
- libadd = addlib("LWModelerARexx.port",0)
- signal on error
- signal on syntax
-
- RexxMathLib = "rexxmathlib.library"
- IF POS(RexxMathLib , SHOW('Libraries')) = 0 THEN
- IF ~ADDLIB(RexxMathLib , 0 , -30, 0) THEN DO
- call notify(1,"!Cant find rexxmathlib.library")
- exit
- end
-
-
- /* initialise variables */
-
- version = 'v0.5'
- sysnam = 'Follow the Leader' version
- ObjectName = "3D:Objects"
- PathName = "3D:Motions"
- SceneName = "3D:Scenes"
-
- ObjDisso = 2
- FadeFram = 15
- ObClones = 8
- ObOffset = 15
- PathLoop = 2
-
- /* setup user control panel */
-
- Do Forever
- call req_begin sysnam
- id_obds = req_addcontrol("object dissolve",'CH',"none abrupt smooth")
- id_dsfr = req_addcontrol("disolve frames",'n')
- id_clon = req_addcontrol("object clones",'n')
- id_ofst = req_addcontrol("object offset",'n')
- id_nmlp = req_addcontrol("number of loops",'n')
-
- call req_setval id_obds, ObjDisso
- call req_setval id_dsfr, FadeFram
- call req_setval id_clon, ObClones
- call req_setval id_ofst, ObOffset
- call req_setval id_nmlp, PathLoop
-
- if (~req_post()) then do
- call req_end
- exit
- end
-
-
- /* set variables to match user control panel */
-
- ObjDisso = req_getval(id_obds)
- FadeFram = req_getval(id_dsfr)
- ObClones = req_getval(id_clon)
- ObOffset = req_getval(id_ofst)
- PathLoop = req_getval(id_nmlp)
-
-
- /* get object, path, and scene name and check path duration */
-
- ObjectName = getfilename("object name",ObjectName)
- if ObjectName='(none)' then do
- call req_end
- exit
- end
-
- PathName = getfilename("motion path name",PathName)
- if PathName='(none)' then do
- call req_end
- exit
- end
-
- SceneName = getfilename("scene name",SceneName)
- if SceneName='(none)' then do
- call req_end
- exit
- end
-
- If open('mpath',PathName,'r')~=1 then do
- call notify(1,"!Cant find path file")
- exit
- end
- ptemp = readln('mpath')
- if ptemp ~= "LWMO" then do
- call notify(1,"!Not a valid motion path file"
- exit
- end
- ptemp = readln('mpath')
- ptemp = readln('mpath')
-
- PathKeys = readln('mpath')
-
- Index = 1
- do while Index <= PathKeys
- pdata.Index = readln('mpath')
- pdatb.Index = readln('mpath')
- Index = Index + 1
- end
- call close('mpath')
-
- PathFrames = Word(pdatb.PathKeys,1)
-
- If open(scene,SceneName,'w')~=1 then do
- call notify(1,"!Could not open the scene file")
- exit
- end
-
- call startscene
- call addnull
-
- ObIndex = 1
- do while ObIndex <= ObClones
- ObOfs = ObOffset*(ObIndex-1)
- call AddObject
- ObIndex = ObIndex + 1
- end
-
- call finishscene
- call close('scene')
-
- /* thats all folks */
-
- exit
- call end_all
- end /* forever */
-
-
- /* subroutines */
-
- startscene: /* open the scene file and make first entries */
- call writeln scene, "LWSC"
- call writeln scene, "1"
- call writeln scene, ""
- call writeln scene, "FirstFrame 1"
- call writeln scene, "LastFrame "||Trunc(PathFrames*PathLoop+ObOffset*(ObClones-1))
- call writeln scene, "FrameStep 1"
- call writeln scene, ""
- return
-
-
- addnull: /* add a null object */
- call writeln scene, "AddNullObject Center Point"
- call writeln scene, "ShowObject 4"
- call writeln scene, "ObjectMotion (unnamed)"
- call writeln scene, " 9"
- call writeln scene, " 1"
- call writeln scene, " 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0"
- call writeln scene, " 0 0 0.0 0.0 0.0"
- call writeln scene, "EndBehavior 1"
- call writeln scene, "ShadowOptions 7"
- return
-
-
- addobject: /* add an object to the scene file */
- call writeln scene, "LoadObject "||ObjectName
- call writeln scene, "ShowObject 4"
- call writeln scene, "ObjectMotion (unnamed)"
- call writeln scene, " 9"
- call writeln scene, " "Trunc(PathKeys*PathLoop+1)
-
- call writeln scene, " "pdata.1
- call writeln scene, " "pdatb.1
-
- tObOfs = ObOfs
- Loop = 1
- do while Loop <= PathLoop
- Index = 1
- do while Index <= PathKeys
- call writeln scene, " "pdata.Index
- tempa = word(pdatb.Index,1) + ObOfs
- if Index = 1 then tempa = tempa + 1
- tempb = word(pdatb.Index,2)
- tempc = word(pdatb.Index,3)
- tempd = word(pdatb.Index,4)
- tempe = word(pdatb.Index,5)
- call writeln scene, " "Trunc(tempa)" "Trunc(tempb)" "tempc" "tempd" "tempe
- Index = Index + 1
- end
- Loop = Loop + 1
- ObOfs = ObOfs + PathFrames
- end
- call writeln scene, "EndBehavior 1"
- call writeln scene, "ParentObject 1"
-
- if ObjDisso = 2 then do
- call writeln scene, "ObjDissolve (envelope)"
- call writeln scene, " 1"
- call writeln scene, " 5"
- call writeln scene, " 1.0"
- call writeln scene, " 0 1 0.0 0.0 0.0"
- call writeln scene, " 1.0"
- call writeln scene, " "Trunc(tObOfs)" 1 0.0 0.0 0.0"
- call writeln scene, " 0.0"
- call writeln scene, " "Trunc(tObOfs+1)" 1 0.0 0.0 0.0"
- call writeln scene, " 0.0"
- call writeln scene, " "Trunc(ObOfs-1)" 1 0.0 0.0 0.0"
- call writeln scene, " 1.0"
- call writeln scene, " "Trunc(ObOfs)" 1 0.0 0.0 0.0"
- call writeln scene, "EndBehavior 1"
- end
-
- if ObjDisso = 3 then do
- call writeln scene, "ObjDissolve (envelope)"
- call writeln scene, " 1"
- call writeln scene, " 5"
- call writeln scene, " 1.0"
- call writeln scene, " 0 1 0.0 0.0 0.0"
- call writeln scene, " 1.0"
- call writeln scene, " "Trunc(tObOfs)" 1 0.0 0.0 0.0"
- call writeln scene, " 0.0"
- call writeln scene, " "Trunc(tObOfs+FadeFram)" 1 0.0 0.0 0.0"
- call writeln scene, " 0.0"
- call writeln scene, " "Trunc(ObOfs-FadeFram)" 1 0.0 0.0 0.0"
- call writeln scene, " 1.0"
- call writeln scene, " "Trunc(ObOfs)" 1 0.0 0.0 0.0"
- call writeln scene, "EndBehavior 1"
- end
-
- call writeln scene, "ShadowOptions 7"
- call writeln scene, ""
- return
-
-
- finishscene:
- call writeln scene, "AmbientColor 255 255 255"
- call writeln scene, "AmbIntensity 0.250000"
- call writeln scene, ""
- call writeln scene, "AddLight"
- call writeln scene, "LightName Light"
- call writeln scene, "ShowLight 0"
- call writeln scene, "LightMotion (unnamed)"
- call writeln scene, " 9"
- call writeln scene, " 1"
- call writeln scene, " 0.0 0.0 0.0 30.000000 45.000000 0.0 1.0 1.0 1.0"
- call writeln scene, " 0 0 0.0 0.0 0.0"
- call writeln scene, "EndBehavior 1"
- call writeln scene, "LightColor 255 255 255"
- call writeln scene, "LgtIntensity 1.000000"
- call writeln scene, "LightType 2"
- call writeln scene, "Falloff 0.000000"
- call writeln scene, "ConeAngle 30.000000"
- call writeln scene, "EdgeAngle 5.000000"
- call writeln scene, "ShadowCasting 1"
- call writeln scene, ""
- call writeln scene, "ShowCamera 1"
- call writeln scene, "CameraMotion (unnamed)"
- call writeln scene, " 9"
- call writeln scene, " 1"
- call writeln scene, " 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0"
- call writeln scene, " 0 0 0.0 0.0 0.0"
- call writeln scene, "EndBehavior 1"
- call writeln scene, "ZoomFactor 3.200000"
- call writeln scene, "RenderMode 2"
- call writeln scene, "RayTraceEffects 0"
- call writeln scene, "Resolution 1"
- call writeln scene, "Overscan 1"
- call writeln scene, "SegmentMemory 2200000"
- call writeln scene, "Antialiasing 0"
- call writeln scene, "AdaptiveSampling 1"
- call writeln scene, "AdaptiveThreshold 12"
- call writeln scene, "FilmSize 2"
- call writeln scene, "FieldRendering 0"
- call writeln scene, "MotionBlur 0"
- call writeln scene, "DepthOfField 0"
- call writeln scene, ""
- call writeln scene, "SolidBackdrop 1"
- call writeln scene, "BackdropColor 0 0 0"
- call writeln scene, "ZenithColor 0 40 80"
- call writeln scene, "SkyColor 120 180 240"
- call writeln scene, "GroundColor 50 40 30"
- call writeln scene, "NadirColor 100 80 60"
- call writeln scene, "FogType 0"
- call writeln scene, "DitherIntensity 1"
- call writeln scene, "AnimatedDither 0"
- call writeln scene, ""
- call writeln scene, "RenderDisplayDevice 0"
- call writeln scene, "DataOverlayLabel"
- call writeln scene, ""
- call writeln scene, "ViewMode 5"
- call writeln scene, "ViewAimpoint 0.000000 0.000000 0.000000"
- call writeln scene, "ViewDirection 0.000000 0.000000 0.000000"
- call writeln scene, "ViewZoomFactor 3.200000"
- call writeln scene, "LayoutGrid 4"
- call writeln scene, "GridSize 1.000000"
- call writeln scene, "ShowMotionPath 1"
- call writeln scene, "ShowSafeArea 0"
- call writeln scene, "ShowBGImage 0"
- call writeln scene, "ShowFogRadius 0"
- call writeln scene, "ShowRedraw 0"
- return
-
-
- syntax: /* tell me where it all went wrong */
- error:
- call end_all
- t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL||sourceline(SIGL))
- exit
-