HoloJs Overview
What is HoloJs
HoloJS is an execution host for Augmented and Virtual Reality applications written in JavaScript and rendered with WebGL. It provides implementations for WebGL, WebVR, WebAudio, Gamepad APIs, Canvas, XmlHttpRequest, Image such that existing WebGL web apps run in HoloJs with little to no modifications.
Note: HoloJs implements a minimal DOM, just enough to fully implement WebGL.
Most
DOM operations, like creating elements, CSS, etc. will fail. DOM support is restricted to the following
elements: window, canvas, image.
HoloJs extends the web standards with interfaces that abstract the underlying hardware and make it easier to
create experiences for various form factors and headsets:
- CanvasVR represents the rendering surface of the currently attached device. An attached device can be a HoloLens, Windows Mixed Reality headset, or in the absence of these a 2D desktop window. The script application does not need to manage this canvas element. Obtaining a CanvasVR element is done through the standard document.createElement(...).
- Spatial Mapping. HoloLens only. To be documented.
- Voice commands. To be documented.
- Spatial anchors. Currently HoloLens only. To be documented.
How to use HoloJs
Depending on goals, HoloJs can be used in a variety of ways:- Build from scratch and embedd in your C++ project. This approach is
suitable
if the existing HoloJs implementation does not meet
requirements and modifying the underlying C++ code can achieve your goals. An example would be
adding
support for additional headsets (Oculus, HTC Vive, etc.), platforms (Android, Linux, etc.) or
exposing
more platform features to the script app.
Clone the code from https://github.com/Microsoft/HoloJS and follow the build instructions - Use the HoloJs Nuget package in your C++ code. This approach is suitable if you want to create a standalone JavaScript AR/VR that you can publish as a Win32 or UWP app.
- Use Spin to create AR and VR experiences in minutes that others can view using the Spin View app for Windows and HoloLens. This method is suitable if your experience does not require any additional platform capabilities beyond those already provided by HoloJs. This method does not require C++ knowledge; all coding is done in JavaScript/Visual Studio Code and no compilation is required.
Under the hood
Internally, HoloJs uses a variety of open source components to create the hosting environment:- ChakraCore provides the JavaScript runtime.
- ANGLE provides the WebGL implementation for the Win32 platform.
- Microsoft ANGLE provides the WebGL implementation for the UWP and HoloLens platform.
- LabSound provides the WebAudio implementation, including spatial audio rendering.
- ChakraCore debugger provides the debugger protocol implementation that enables editing and debugging HoloJs apps using Visual Studio Code.
- Win2D provides the implementation for canvas's 2D context on the Windows platform.
- ZipLib provides cross platform archive decompression.