예제 #1
0
  private final void initScenes() {
    // setup light
    if ((options & OAARComponentBase.OPTION_DISABLE_DEFAULT_LIGHT) == 0) {
      Light light =
          new Light(
              0,
              2.0f,
              0,
              1.0f,
              new Vector4f(0.0823f, 0.3294f, 0.580f, 1.0f), // Ambient
              new Vector4f(0f, 0f, 0f, 1.0f), // Specular
              new Vector4f(1.0f, 1.0f, 1.0f, 1.0f)); // Diffuse
      sceneView.getSceneGraph().addLight(light);
    }

    // setup grid
    if ((options & OAARComponentBase.OPTION_HIDE_GRID) == 0) setupGrid();

    // load up scenes in the data manager : this is placed here to match sceneView.unload() in
    // onPause()
    List<OAScene> initialScenes = dataManager.getSceneList();
    for (OAScene scene : initialScenes) {
      sceneView.getSceneGraph().addSceneToNodeTree(scene);
    }
  }
예제 #2
0
  @Override
  protected void onDestroy() {
    Log.d("ARComponentBase", "onDestroy()");
    sceneView
        .onDestroy(); // should call to destroy gl context which was intentionally left in onPause
    sceneView
        .getSceneGraph()
        .destroySceneGraph(); // necessary to make work again when started again
    // registration.releaseCamera();

    super.onDestroy();
    System.gc();
  }
예제 #3
0
 private final void initTouch() {
   sceneView.addTouchListener(
       new TouchListener() {
         @Override
         public void touched(TouchEvent event) {
           Message msg = Message.obtain(touchHandler, 0, event.getScene());
           touchHandler.sendMessage(msg);
         }
       });
 }
예제 #4
0
  @Override
  protected void onPause() {
    Log.d("ARComponentBase", "onPause()");

    sensorManager.pause();
    sceneView.onPause();
    arView.onPause();

    super.onPause();
  }
예제 #5
0
  @Override
  protected void onResume() {
    Log.d("ARComponentBase", "onResume()");
    super.onResume();

    arView.onResume();
    sceneView.onResume();
    sensorManager.resume();

    /*/ // no use
    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {

    	@Override
    	public void run() {
    		sceneView.bringToFront();
    		if(compassView != null) compassView.bringToFront();
    	}

    }, 2500);
    /**/
  }
예제 #6
0
 private void setupGrid() {
   sceneView.setGridVisible(true);
 }
예제 #7
0
 /**
  * Calculate the view coordinate point of the given scene
  *
  * @param scene The scene of interest
  * @param point Point to be assigned with the view coordinate point of the given scene
  */
 public void getViewCoordinatePoint(OAScene scene, Point point) {
   if (sceneView != null) sceneView.getViewCoordinatePoint(scene, point);
 }