Mercurial > hg > Database > Alice
view src/main/java/alice/test/topology/aquarium/ViewChange.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children | aefbe41fcf12 |
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 = 2.5f; float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0; float phi = 0; // flow float theta = 0; SimpleUniverse universe; TransformGroup Camera; Transform3D Transform_camera_pos; Transform3D Transform_camera_phi; Transform3D Transform_camera_theta; Vector3f Vector_camera_pos; public ViewChange(float x, float Sensitivity, GraphicsConfiguration config){ super(config); 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); System.out.println(x); camera_x = x; 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)); } }