Tie it together and Construct the Model
public void createModel(BvrsToRun blst) {
set the URL bases for the media imports |
_mediaBase = getImportBase();
_sndBase = buildURL(_mediaBase,"sound/");
_movieBase = buildURL(_mediaBase,"movie/");
_geoBase = buildURL(_mediaBase,"geometry/");
create the reactive cycling image for the puzzle |
ImageBvr unitIm = createUnitImageForPuzzle();
tile the image of the puzzle for playability |
_puzz = new PuzzleLogic(unitIm, _viewedOn, _mediaBase);
ImageBvr puzzleIm = _puzz.getImage();
Give the puzzle a black background,
so the empty square will be black. |
puzzleIm = overlay(puzzleIm, solidColorImage(black));
Establish this as a runOnce bvr, so that when the code
switches modes, the puzzle doesn't restart. |
puzzleIm = (ImageBvr)puzzleIm.runOnce();
Now, create two images, one based on direct display and
one based on texturing on the fan: |
Translate the image down to center, and scale it down to 6 cms. |
ImageBvr directDisplayIm =
puzzleIm.transform(compose(scale2(0.06),
translate(-0.5,-0.5)));
Texture the image on a 3-D rotating fan |
ImageBvr projectedGeo = textureOnFan(puzzleIm);
projectedGeo =
projectedGeo.transform(compose(scale2(0.07),
translate(-0.5,-0.5)));
projectedGeo = overlay(projectedGeo, solidColorImage(black));
Cycle through 3-D and 2-D versions upon the toggle geometry event. |
ImageBvr imageToShow = ImageBvr.newUninitBvr();
_toggleGeomProjection = new AppTriggeredEvent();
imageToShow.init( until(directDisplayIm,
_toggleGeomProjection, until(projectedGeo,
_toggleGeomProjection, imageToShow)));
These are the resultant image and sound that constitute the model. |
setImage(imageToShow);
setSound(_puzz.getSound());
}
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.