Boiler Plates

imports

import java.awt.*; use Event and Dimension
import com.ms.dxmedia.*; DirectAnimation classes
import java.net.*; building URLs
public class GeoImage extends DXMApplet {
public void init() {
super.init() ;
setModel(new GeoImageModel(this));
}
}
class GeoImageModel extends Model {

stores the height of the applet viewport in the member variable.

private NumberBvr _halfHeightNum;
GeoImageModel(DXMApplet dxma) {
Dimension dim = dxma.getSize();

The base unit of measure for DirectAnimation is the meter. Convert the size into meters by multiplying it with the pixelBvr.

_halfHeightNum = mul(toBvr(dim.height*0.5),pixelBvr);
}
public void createModel(BvrsToRun blst) {

Don't want part of geoimage to be clipped when its center is at distOfTravel, so set the near plane slightly further than that and set the projection point a bit further than the near plane.

NumberBvr nearDist = add(distOfTravel, mul(toBvr(2.5), maxHalfExtent));
CameraBvr camera = perspectiveCamera(add(nearDist,
mul(maxHalfExtent, toBvr(10))), nearDist);

turn on the lights and render geoimage into an image

GeometryBvr lights = ambientLight;
GeometryBvr scene = union(lights, loopingGeoImage);
ImageBvr renderedGeo = scene.render(camera);

finally set what's to be displayed on a blue background

ImageBvr model = overlay(renderedGeo,
overlay(lableImage,
overlay(picture, solidColorImage(blue))));

the sound behavior to be presented

setSound(loopingSound);

the image behavior to be rendered

setImage(model);
}
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.