Mercurial > hg > Database > Alice
view src/alice/test/topology/aquarium/ViewChange.java @ 142:287aae21e7d8 working
minor change
author | sugi |
---|---|
date | Thu, 20 Sep 2012 22:05:32 +0900 |
parents | 4c71bbfe557d |
children | 6a69891b7232 |
line wrap: on
line source
package alice.test.topology.aquarium; import java.awt.*; import javax.media.j3d.*; import javax.vecmath.*; import com.sun.j3d.utils.universe.*; public class ViewChange extends Canvas3D { private static final long serialVersionUID = 1L; float sensitivity; float distance; float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0; float phi = 0;//(float)Math.PI; float theta = (float)Math.PI/3; SimpleUniverse universe; TransformGroup Camera; Transform3D Transform_camera_pos; Transform3D Transform_camera_phi; Transform3D Transform_camera_theta; Vector3f Vector_camera_pos; public ViewChange(float Distance, float Sensitivity, GraphicsConfiguration config){ super(config); distance = Distance; sensitivity = Sensitivity; universe = new SimpleUniverse(this); ViewingPlatform vp = universe.getViewingPlatform(); Camera = vp.getViewPlatformTransform(); camera_y = distance * (float)Math.sin(theta); camera_xz = distance * (float)Math.cos(theta); camera_x = camera_xz * (float)Math.sin(phi); camera_z = camera_xz * (float)Math.cos(phi); Vector_camera_pos = new Vector3f(camera_x, camera_y, camera_z); Transform_camera_pos = new Transform3D(); Transform_camera_pos.setTranslation(Vector_camera_pos); Transform_camera_phi = new Transform3D(); Transform_camera_theta = new Transform3D(); Transform_camera_theta.rotX(-theta); Transform_camera_phi.rotY(phi); Transform_camera_theta.mul(Transform_camera_phi); Transform_camera_pos.mul(Transform_camera_theta); Camera.setTransform(Transform_camera_pos); addMouseMotionListener(new MouseViewEvent(this)); } }