com.sun.j3d.utils.behaviors.vp.OrbitBehavior Java Examples

The following examples show how to use com.sun.j3d.utils.behaviors.vp.OrbitBehavior. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main3D.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X������”\�ɂ���
 * 
 * @param canvas �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), 100);

    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds);

    ViewingPlatform vp = universe.getViewingPlatform();
    vp.setViewPlatformBehavior(orbit);
}
 
Example #2
Source File: Main3D.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X������”\�ɂ���
 * 
 * @param canvas �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), 100);

    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds);

    ViewingPlatform vp = universe.getViewingPlatform();
    vp.setViewPlatformBehavior(orbit);
}
 
Example #3
Source File: MainPanel.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X����
 * 
 * @param canvas
 *            �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds); // �e�����y�ڂ��͈͂�ݒ�

    ViewingPlatform vp = universe.getViewingPlatform(); // ���_���擾
    vp.setViewPlatformBehavior(orbit); // ���_���}�E�X�Ő���”\�ɂȂ�
}
 
Example #4
Source File: Main.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X������”\�ɂ���
 * 
 * @param canvas �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), 100);

    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds);

    ViewingPlatform vp = universe.getViewingPlatform();
    vp.setViewPlatformBehavior(orbit);
}
 
Example #5
Source File: MainPanel.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X����
 * 
 * @param canvas
 *            �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds); // �e�����y�ڂ��͈͂�ݒ�

    ViewingPlatform vp = universe.getViewingPlatform(); // ���_���擾
    vp.setViewPlatformBehavior(orbit); // ���_���}�E�X�Ő���”\�ɂȂ�
}
 
Example #6
Source File: Main.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X������”\�ɂ���
 * 
 * @param canvas �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(), Double.POSITIVE_INFINITY);

    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds);

    ViewingPlatform vp = universe.getViewingPlatform();
    vp.setViewPlatformBehavior(orbit);
}
 
Example #7
Source File: CrystalBall.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X������”\�ɂ���
 * 
 * @param canvas �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), 100);

    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds);

    ViewingPlatform vp = universe.getViewingPlatform();
    vp.setViewPlatformBehavior(orbit);
}
 
Example #8
Source File: MainPanel.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �}�E�X����
 * 
 * @param canvas
 *            �L�����o�X
 */
private void orbitControls(Canvas3D canvas) {
    OrbitBehavior orbit = new OrbitBehavior(canvas,
            OrbitBehavior.REVERSE_ALL);
    orbit.setSchedulingBounds(bounds); // �e�����y�ڂ��͈͂�ݒ�

    ViewingPlatform vp = universe.getViewingPlatform(); // ���_���擾
    vp.setViewPlatformBehavior(orbit); // ���_���}�E�X�Ő���”\�ɂȂ�
}
 
Example #9
Source File: StdDraw3D.java    From algorithms-sedgewick-wayne with MIT License 4 votes vote down vote up
/**
 * Initializes a 3D scene
 */
public static void init() {
    Panel canvasPanel = new Panel();
    createCanvasPanel(canvasPanel);

    if (frame != null) {
        frame.setVisible(false);
    }
    frame = new JFrame();
    frame.add(canvasPanel);

    canvas.addKeyListener(stdDraw3D);
    canvas.addMouseListener(stdDraw3D);
    canvas.addMouseMotionListener(stdDraw3D);

    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // closes all windows
    frame.setResizable(false);
    frame.pack();

    rootGroup = new BranchGroup();
    rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
    rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);

    shapeGroup1 = new BranchGroup();
    shapeGroup1.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
    shapeGroup1.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
    shapeGroup1.setCapability(BranchGroup.ALLOW_DETACH);

    shapeGroup2 = new BranchGroup();
    shapeGroup2.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
    shapeGroup2.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
    shapeGroup2.setCapability(BranchGroup.ALLOW_DETACH);

    lightGroup = new BranchGroup();
    lightGroup.setCapability(BranchGroup.ALLOW_DETACH);
    lightGroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);

    addLight();

    onscreenGroup = shapeGroup1;
    offscreenGroup = shapeGroup2;

    rootGroup.addChild(onscreenGroup);
    rootGroup.addChild(lightGroup);

    universe = new SimpleUniverse(canvas, 2);
    universe.addBranchGraph(rootGroup);

    ViewingPlatform viewingPlatform = universe.getViewingPlatform();
    viewingPlatform.setNominalViewingTransform();
    zoomOut();

    // Add orbit behavior to the ViewingPlatform
    OrbitBehavior orbit = new OrbitBehavior(canvas, OrbitBehavior.REVERSE_ALL ^ OrbitBehavior.STOP_ZOOM);
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), width);
    orbit.setMinRadius(0);
    orbit.setSchedulingBounds(bounds);
    viewingPlatform.setViewPlatformBehavior(orbit);

    setPenColor(WHITE);
    setPenWidth(1);

    frame.setVisible(true);
}