Example usage for javax.media.j3d View LEFT_EYE_VIEW

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

Introduction

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

Prototype

int LEFT_EYE_VIEW

To view the source code for javax.media.j3d View LEFT_EYE_VIEW.

Click Source Link

Document

Specifies that monoscopic view generated should be the view as seen from the left eye.

Usage

From source file:StereoCube.java

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

    c1.setSize(180, 180);/*from  ww w  .j a va 2  s.co  m*/
    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  www  . j a  v  a  2  s. c o  m
    }
    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);

}