The Sandy 3D engine has released a Haxe version, allowing programs to be compiled to Flash and now JavaScript (with the support from some additional libraries).
For those that have never heard of Haxe before, it is a multiplatform, open source programming language that can compile to a number of different targets including Flash, JavaScript, C++, PHP and Neko. This ability makes Haxe quite powerful: one application can be compiled and executed on a number of platforms and environments without altering the original source code. In this case we can make use of this to create 3D applications that run as a Flash applet, or as an embedded JavaScript application.
The JavaScript rendering is done through a compatibility layer that emulates the Haxe Flash library and outputs the result onto a Canvas element. The Canvas element has received quite a bit of attention lately because of its potential to displace Flash as the weapon of choice for multimedia websites. The Canvas element, and the JavaScript that controls it, are standard and should eventually be implemented across all web browsers. Even though the Canvas element is now only part of the next proposed HTML standard, it is currently implemented on a number of browsers including Chrome, FireFox, Opera and Safari.
Applications that use the Canvas element are mostly just experimental at this stage, mostly because Internet Explorer doesn’t support them directly. So, unlike Flash, there is a relatively small library of code that developers can extend in order to make Canvas applications. This is why the Haxe version of Sandy is so cool: it takes a mature project that was targeting the Flash platform and gives it the ability to run in JavaScript directly in the browser. As far as I’m aware this makes Sandy-HX is the most complete 3D engine available for JavaScript.
Having said that, getting Haxe to compile a Sandy 3D application to JavaScript does require a bit of mucking around. This article will show you how to get a small 3D JavaScript demo up and running.