Example usage for javax.media.j3d PhysicalBody setLeftEyePosition

List of usage examples for javax.media.j3d PhysicalBody setLeftEyePosition

Introduction

In this page you can find the example usage for javax.media.j3d PhysicalBody setLeftEyePosition.

Prototype

public void setLeftEyePosition(Point3d position) 

Source Link

Document

Sets the user head object's left eye position.

Usage

From source file:StereoCube.java

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

    c1.setSize(180, 180);//w  ww  .j  a  v a2 s  .  c  o  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;// w  w  w.  j av  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);

}