예제 #1
0
  private void initializeUbitrack() {
    ubitrackFacade.initUbitrack();

    poseReceiver = new PoseReceiver();
    if (!ubitrackFacade.setPoseCallback("posesink", poseReceiver)) {
      return;
    }
    poseReceiver2 = new PoseReceiver();
    if (!ubitrackFacade.setPoseCallback("posesink2", poseReceiver2)) {
      return;
    }

    imageReceiver = new ImageReceiver();
    if (!ubitrackFacade.setImageCallback("imgsink", imageReceiver)) {
      return;
    }

    BackgroundObject backgroundObject = new BackgroundObject();
    viewer.addObject(backgroundObject);
    imageReceiver.setBackground(backgroundObject.getBackground());
    poseReceiver2.setTransformGroup(sheepObject.getTransformGroup());
    poseReceiver.setTransformGroup(cubeObject.getTransformGroup());

    ubitrackFacade.startDataflow();
  }
예제 #2
0
  private void loadSheep() {
    VrmlLoader loader = new VrmlLoader();
    Scene myScene = null;
    try {
      myScene = loader.load("models" + File.separator + "Sheep.wrl");
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IncorrectFormatException e) {
      e.printStackTrace();
    } catch (ParsingErrorException e) {
      e.printStackTrace();
    }

    BranchGroup bg = new BranchGroup();
    TransformGroup offset = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.setRotation(new AxisAngle4d(1.0, 0.0, 0.0, Math.PI / 2));
    t3d.setTranslation(new Vector3d(0.0, 0.0, 0.025));
    offset.setTransform(t3d);
    bg.addChild(offset);
    offset.addChild(myScene.getSceneGroup());

    sheepObject = new ModelObject(bg);

    viewer.addObject(sheepObject);
  }
예제 #3
0
  private void initializeJava3D() {
    System.out.println("Creating Viewer - " + EXERCISE);
    viewer = new ViewerUbitrack(EXERCISE, ubitrackFacade);

    BlueAppearance blueAppearance = new BlueAppearance();

    cubeObject = new CubeObject(blueAppearance);
    viewer.addObject(cubeObject);

    System.out.println("Done");
  }