Example usage for javax.media.j3d View getPhysicalBody

List of usage examples for javax.media.j3d View getPhysicalBody

Introduction

In this page you can find the example usage for javax.media.j3d View getPhysicalBody.

Prototype

public PhysicalBody getPhysicalBody() 

Source Link

Document

Returns a reference to the view model's PhysicalBody object.

Usage

From source file:StereoCube.java

public void init() {
    setLayout(new FlowLayout());
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

    c1.setSize(180, 180);/*  w  w  w  .  j a  v a  2 s .c om*/
    c1.setMonoscopicViewPolicy(View.LEFT_EYE_VIEW);
    add(c1);

    c2.setSize(180, 180);
    c2.setMonoscopicViewPolicy(View.RIGHT_EYE_VIEW);
    add(c2);

    // Create a simple scene and attach it to the virtual universe
    scene = createSceneGraph(0);
    u = new SimpleUniverse(c1);

    View view0 = u.getViewer().getView();
    View view = new View();
    PhysicalBody myBod = view0.getPhysicalBody();
    myBod.setLeftEyePosition(new Point3d(-.006, 0.0, 0.0)); // default is(-0.033, 0.0, 0.0)
    myBod.setRightEyePosition(new Point3d(+.006, 0.0, 0.0));
    view.setPhysicalBody(myBod);
    view.setPhysicalEnvironment(view0.getPhysicalEnvironment());
    view.attachViewPlatform(u.getViewingPlatform().getViewPlatform());
    view.addCanvas3D(c2);

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    u.getViewingPlatform().setNominalViewingTransform();
    u.addBranchGraph(scene);

}

From source file:StereoGirl.java

public void init() {
    setLayout(new FlowLayout());
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    String v = getParameter("url");
    if (v != null) {
        URLString = v;//from w  w w .  j  a  va  2 s.c om
    }
    c1.setSize(140, 140);
    c1.setMonoscopicViewPolicy(View.LEFT_EYE_VIEW);
    add(c1);

    c2.setSize(140, 140);
    c2.setMonoscopicViewPolicy(View.RIGHT_EYE_VIEW);
    add(c2);

    // Create a simple scene and attach it to the virtual universe
    scene = createSceneGraph(0);
    u = new SimpleUniverse(c1);

    View view0 = u.getViewer().getView();
    View view = new View();
    PhysicalBody myBod = view0.getPhysicalBody();
    myBod.setLeftEyePosition(new Point3d(-.006, 0.0, 0.0)); // default
    // is(-0.033,
    // 0.0, 0.0)
    myBod.setRightEyePosition(new Point3d(+.006, 0.0, 0.0));
    view.setPhysicalBody(myBod);
    view.setPhysicalEnvironment(view0.getPhysicalEnvironment());
    view.attachViewPlatform(u.getViewingPlatform().getViewPlatform());
    view.addCanvas3D(c2);

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    u.getViewingPlatform().setNominalViewingTransform();
    u.addBranchGraph(scene);

}