URL mediaBase = getImportBase();
URL geoBase = buildURL(mediaBase,"geometry/");
GeometryBvr geo = importGeometry(buildURL(geoBase,"cube.x"));
geo = geo.transform(compose(
rotate(vector3(1,1,1), localTime),
scale3(1*cm) ));
Make geo draggable by creating a DraggableGeometry class
object (grabGeo). |
DraggableGeometry grabGeo = new DraggableGeometry(geo, origin3);
Initialize clr. Let it start out as red, change it to blue,
when the cube is grabbed, and return to red when the cube
is released. The grab and release events are obtained from the
getGrabEvent() and getReleaseEvent() methods of the DraggableGeometry
class respectively. |
ColorBvr clr = ColorBvr.newUninitBvr();
clr.init(until(red, grabGeo.getGrabEvent(),
until(blue, grabGeo.getReleaseEvent(), clr)));
Get the GeometryBvr part of grabGeo, by calling the getGeometryBvr()
method of DraggableGeometry. |
GeometryBvr pickableGeo = grabGeo.getGeometryBvr();
Apply clr to pickableGeo. |
pickableGeo = pickableGeo.diffuseColor(clr);
pickableGeo = union(pickableGeo, directionalLight);
CameraBvr cam = perspectiveCamera(toBvr(10*cm),toBvr(5*cm));
overlay the rendered on a black background. |
setImage(overlay(pickableGeo.render(cam), solidColorImage(black)));
}
}
That's all there is to it. Happy animating... |
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.