/* Program to use ADPro to put images on the faces of a revolving cube. Needs rexxmathlib.library. Any anim file or any still image that can be recognised by the Universal loader may be used for the background and the six sides (seven image files altogether). To leave a side blank, simply click on "Forget it" when asked for the file name. Black areas in the images are transparent; to prevent this, use the Dynamic Range command and set the minimum to 1 instead of 0; or, for an anim, load it into DPaint and change black in the palette to dark grey. */
/* $VER:AnimCube August 95 */
/* Careful - can make a very large trace file */
/*call open("STDERR","ram:traceAC","W")
trace r*/
address "ADPro"
if ~show("l", "rexxmathlib.library") then
if ~addlib("rexxmathlib.library", 0, -30,0) then
do
OKAY1 "Please install the rexxmathlib.library in your libs: directory before running this script."
exit
end
AA=6.2831853/360 /* 2pi divided by 360 */
OPTIONS RESULTS
/* Use the current screen format and number of colours. */
render_type
colours = ADPro_result
screen_type
stype = ADPro_result
getnumber '"Output width (pixels)"' 320 16 1280
if rc~=0 then do
okay1 "User aborted program"
exit
end
outwidth = ADPro_result
getnumber '"Output height (pixels)"' 256 16 1024
if rc~=0 then do
okay1 "User aborted program"
exit
end
outheight = ADPro_result
picsize = min(outwidth,outheight)
picsize2 = max(outwidth,outheight)
Xoffset = (outwidth-picsize)/2 /* for centring the cube in the display */
Yoffset = (picsize2-outwidth)/2
/* These defaults could be changed to give different angles of view. */
flength = 175 /* focal length */
cameraY = 400
cameraX = 0
cameraZ = picsize*3
lookatX = 0
lookatY = -(picsize/4)
lookatZ = -(picsize/2)
sides.0 = "BACKGROUND"
sides.1 = "FRONT"
sides.2 = "RIGHT"
sides.3 = "LEFT"
sides.4 = "BACK"
sides.5 = "TOP"
sides.6 = "BOTTOM"
getdir '"Select directory for temporary files"' "ADPro:"
when zmoves.front.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do
zfv = zmoves.front.value /* for program tracing */
zmoves.front.value = -70000
zmoves.front.order = j
end
when zmoves.right.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do
zrv = zmoves.right.value
zmoves.right.value = -70000
zmoves.right.order = j
end
when zmoves.left.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do
zlv = zmoves.left.value
zmoves.left.value = -70000
zmoves.left.order = j
end
when zmoves.back.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do
zbv = zmoves.back.value
zmoves.back.value = -70000
zmoves.back.order = j
end
when zmoves.top.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do
ztv = zmoves.top.value
zmoves.top.value = -70000
zmoves.top.order = j
end
when zmoves.bottom.value = max(zmoves.front.value, zmoves.right.value, zmoves.back.value, zmoves.left.value, zmoves.top.value, zmoves.bottom.value) then do