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); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); options = setupOptions(); dataManager = setupDataManager(); sensorManager = setupSensorManager(); listView = new ListViewComponent(this, setupAdapter()); listView.addListViewListener( new ListViewComponentListener() { @Override public void onListEvent(SceneData data) { onSceneSelected((OAScene) data); } }); dataManager.addDataListener( new OADataListener() { @Override public void dataUpdate(OADataEvent event) { if (event.getScene() != null) { listView.addItem(event.getScene()); } } }); // load up scenes already in the data manager List<OAScene> initialScenes = dataManager.getSceneList(); for (OAScene scene : initialScenes) { listView.addItem(scene); } // trigger to start loading up new scenes to the data manager setupScenes(dataManager); setupUILayout(listView); }
/** * Called back when the system is ready to load scenes initially. The default implementation * triggers loadScenes() method of the data manager. Subclasses could override the behavior to * setup custom scene data. * * @param dataManager The data manager where to populate the scene. */ protected void setupScenes(OADataManager dataManager) { dataManager.startLoading(); };