Importing and Defining the Media Parts
Build URL bases for importing images, geometries, and sounds. |
URL mediaBase = getImportBase();
URL imgBase = buildURL(mediaBase,"image/");
URL geoBase = buildURL(mediaBase,"geometry/");
URL sndBase = buildURL(mediaBase,"sound/");
Load the sound files that will be used for sound effects |
startSnd = importSound(buildURL(sndBase,"inflate.mp2"), startLen);
flipSnd = importSound(buildURL(sndBase,"clock1.mp2"), null);
endSnd = importSound(buildURL(sndBase,"deflate.mp2"), null);
This image will be tiled into the paper texture. |
paperTex = importImage(buildURL(imgBase,"sandbg1.jpg"));
Synthetically construct the front and back cover pages of the Album. |
ColorBvr labelColor = red;
ImageBvr front1 = renderStr(toBvr("Outdoors"), labelColor, toBvr(0), toBvr(0.003));
ImageBvr front2 = renderStr(toBvr("Album"), labelColor, toBvr(0), toBvr(-0.003));
ImageBvr front = overlay(front1, front2);
ImageBvr back = renderStr(toBvr("The End"), labelColor, toBvr(0), toBvr(0));
Import a list of images, some of these could have been .gif images.
We add the front and back covers appropriately,
and we add empty images to pair with them. |
ImageBvr pics[] = {emptyImage, front,
importImage(buildURL(imgBase,"phantom.jpg")),
importImage(buildURL(imgBase,"hiddenBeachSS.jpg")),
importImage(buildURL(imgBase,"hiddenBeachSG.jpg")),
importImage(buildURL(imgBase,"jotunheimen1.jpg")),
importImage(buildURL(imgBase,"redWoodCar.jpg")),
importImage(buildURL(imgBase,"wenatcheeCascades.jpg")),
importImage(buildURL(imgBase,"tulipsHol1.jpg")),
importImage(buildURL(imgBase,"tulipsHol2.jpg")),
importImage(buildURL(imgBase,"yosemiteCreek.jpg")),
importImage(buildURL(imgBase,"kidsUtah.jpg")),
importImage(buildURL(imgBase,"foliageUtah.jpg")),
back, emptyImage};
Ditto for corresponding labels. No labels for cover pages nor for empty ones. |
StringBvr lbls[] = {toBvr(""), toBvr(""),
toBvr("Crater Lk., Oregon"),
toBvr("Klamath, California"),
toBvr("Klamath, California"),
toBvr("Jotenheimen, Norway"),
toBvr("Redwoods N.P., California"),
toBvr("Cascades, Washington"),
toBvr("Tulip Garden, Holland"),
toBvr("Tulip Garden, Holland"),
toBvr("Yosemite, California"),
toBvr("Centerville, Utah"),
toBvr("Bountiful, Utah"),
toBvr(""), toBvr("")};
ArrayBvr labels = new ArrayBvr(lbls);
numPics = lbls.length - 2;
don't count the emptyImages
a [-1, 1] square in X and Y with [0, 1] texture coordinates for
both faces. |
GeometryBvr square = importGeometry(buildURL(geoBase,"square.x"));
frame is a [0, 2]x[-1, 1] square, on right hand side of Y axis |
GeometryBvr frame = square.transform(translate(1,0,0));
creates an array for the pages that are counter part to the pictures. |
GeometryBvr frames[] = new GeometryBvr[numPics + 2];
first and last correspond to the empty pictures |
frames[0] = emptyGeometry;
frames[numPics + 1] = emptyGeometry;
the rest correspond to the pictures |
for (int i=1; i<=numPics; i++)
frames[i] = frame.texture(normalPic(pics[i]));
Construct a Behavior Array of the pages, so we can use NumberBvr indices |
picFrames = new ArrayBvr(frames);
demarcates the line around which pages pivot |
NumberBvr lineThickness = toBvr(6 * mm);
3% of page size
Make the square very thin in the X direction.
We use a square to represent the line in 3D space. |
GeometryBvr pivotLine = square.diffuseColor(red).
transform(scale(lineThickness, toBvr(1), toBvr(1)));
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.