Browse Source

rm WebXR Distribution; Add Android Distribution;

bjorn 3 years ago
parent
commit
38120d8631
1 changed files with 6 additions and 84 deletions
  1. 6 84
      guides/Distribution.md

+ 6 - 84
guides/Distribution.md

@@ -51,90 +51,12 @@ as well.
 
 
 Finally, `LÖVR.app` can be renamed to `Awesome VR Project.app` and distributed as a zip.
 Finally, `LÖVR.app` can be renamed to `Awesome VR Project.app` and distributed as a zip.
 
 
-WebXR
+Android
 ---
 ---
 
 
-To package a project for running a browser, first follow the steps in the "Creating an Archive"
-section above to get a zip file of the project.
+To create an APK for Android systems, the `-DANDROID_ASSETS=/path/to/project` CMake option can be
+provided to include a LÖVR project in the APK when compiling.  See the `Compiling` guide for more
+info.
 
 
-Next, you'll need an HTML file to visit in the browser.  See [`lovr.html`](https://github.com/bjornbytes/lovr/blob/master/etc/lovr.html)
-for a small example file that can be customized.
-
-> Note: When using the lovr.html file from the repo, be sure to replace `{{{ SCRIPT }}}` with a
-> script tag pointing to lovr.js, like `<script type="text/javascript" src="lovr.js"></script>`.
-
-You can also create your own page, but at a minimum it should:
-
-- Have a `<canvas>` element with an id of `canvas`.
-- Declare a `Module` global in JavaScript to configure various settings.
-- Include a `preRun` function to download the archive and add it to the virtual filesystem.
-- Include a `<script>` tag with a web build of LÖVR.
-  - The latest web build is hosted at `https://lovr.org/static/f/lovr.js`.
-  - Versioned web builds are hosted at `https://lovr.org/static/f/<version>/lovr.js`.
-  - You can also use your own `lovr.js` and `lovr.wasm` files (see Compiling guide for instructions
-    on building those).
-
-The `Module.preRun` array contains functions to run before starting up LÖVR.  One of the functions
-in this array should use emscripten's `Module.FS_createPreloadedFile` function to download the
-project's archive and add it to the virtual filesystem.  The path in the filesystem should then be
-added as a command line argument by adding it to the `Module.arguments` array.  This will cause LÖVR
-to run the project file when it starts up, just like on the command line.  Here's an example:
-
-```
-var path = '/MegaExperience.lovr'; // The path in the virtual filesystem
-var url = '/projects/MegaExperience.lovr'; // The url to download
-
-// Add a preRun task to download the archive and put it in the filesystem
-Module.preRun.push(function() {
-  Module.FS_createPreloadedFile('/', path, url, true, false);
-});
-
-// Pass the filesystem path as a virtual command line argument
-Module.arguments = [path];
-```
-
-Optionally, the page can include a button to enter and exit immersive VR mode, using
-`Module.lovr.enterVR` and `Module.lovr.exitVR`:
-
-```
-// Only do button-related things if WebXR is supported and working
-if (navigator.xr) {
-  navigator.xr.isSessionSupported('immersive-vr').then(function(supported) {
-    if (!supported) {
-      return;
-    }
-
-    // Ok, VR is supported.  Add a button to the page.
-    var button = document.createElement('button');
-    document.body.appendChild(button);
-    button.textContent = 'VR!';
-
-    // Keep track of whether VR is active.
-    var active = false;
-
-    // When the button is clicked, toggle VR state.
-    button.addEventListener('click', function() {
-      if (!active) {
-        Module.lovr.enterVR().then(function(session) {
-
-          // Once this promise resolves, VR is active.
-          active = true;
-
-          // The raw WebXR session object is accessible here.
-          // Listen for when the session ends.
-          session.addEventListener('end', function() {
-            active = false;
-          });
-        });
-      } else {
-        Module.lovr.exitVR().then(function() {
-          active = false;
-        });
-      }
-    });
-  });
-}
-```
-
-The HTML file, the zip file, and the `lovr.js` and `lovr.wasm` files (if being served directly)
-can then be distributed on a web server.
+(TODO: Mention other approaches like `aapt add`, `apktool`, or
+unzipping/modifying/rezipping/resigning).