1 package edu
.mit
.ezyang
.gravity
.j3d
;
3 import com
.sun
.j3d
.utils
.behaviors
.mouse
.MouseRotate
;
4 import javax
.media
.j3d
.*;
5 import javax
.vecmath
.*;
8 * Customized TransformGroup class that implements mouse rotations, directional
9 * lighting and ambient lighting; this is the "frame" in which the universe
10 * operates, and can be rotated at the user's viewing pleasure.
11 * @author Edward Z. Yang <ezyang@mit.edu>
13 public class RotateGroup
extends TransformGroup
{
14 public RotateGroup() {
15 setCapability(TransformGroup
.ALLOW_TRANSFORM_WRITE
);
16 setCapability(TransformGroup
.ALLOW_TRANSFORM_READ
);
18 BoundingSphere bounds
= new BoundingSphere(new Point3d(0f
,0f
,0f
), 1000f
);
20 MouseRotate rotate
= new MouseRotate();
21 rotate
.setSchedulingBounds(bounds
);
22 rotate
.setTransformGroup(this);
25 DirectionalLight light
= new DirectionalLight(new Color3f(1f
, 1f
, 1f
), new Vector3f(4.0f
, -7.0f
, 7.0f
));
26 light
.setInfluencingBounds(bounds
);
29 AmbientLight ambLight
= new AmbientLight(new Color3f(.6f
, .6f
, .6f
));
30 ambLight
.setInfluencingBounds(bounds
);