SceneJS is an open-source 3D engine for JavaScript that provides a JSON-based scene graph API on WebGL. It was created by Lindsay Kay for efficient rendering of large numbers of objects for high-detail visualisation.
Features
Quick Start
First, include the SceneJS library in the <head> tag of your web page:
<script src="http://scenejs.org/api/latest/scenejs.js"></script>
Then build a scene. We'll make a spinning blue teapot:
var scene = SceneJS.createScene({
nodes:[
{
type:"material",
color: { r: 0.3, g: 0.3, b: 1.0 },
nodes:[
{
type: "rotate",
id: "myRotate",
y: 1.0,
angle: 0,
nodes: [
{
type:"geometry",
source:{
type:"teapot"
}
}
]
}
]
}
]
});
And voilĂ , one blue teapot:
Now let's start the teapot spinning:
var angle = 0;
var myRotate = scene.getNode("myRotate");
scene.on("tick",
function() {
myRotate.setAngle(angle += 0.5);
});
Plugins
To keep the core library small, SceneJS dynamically loads it's non-core functionality from a directory of
plugins. In the example above, the geometry node created its mesh using a teapot plugin, which SceneJS
loaded on-demand from the plugins directory within its repository on
GitHub.
If you'd rather serve the plugins yourself, then just copy that directory to your server and configure SceneJS to load them from there, like this:
SceneJS.configure({
pluginPath: "./foo/myPluginsDir"
});
Want to write your own plugins? Excellent, please read more about the plugin API here.