Skip to content

Instantly share code, notes, and snippets.

@xeolabs
Created November 2, 2009 08:12
Show Gist options
  • Select an option

  • Save xeolabs/224028 to your computer and use it in GitHub Desktop.

Select an option

Save xeolabs/224028 to your computer and use it in GitHub Desktop.
// Example SceneJS scene definition - renders the venerable OpenGL teapot
with (SceneJs) {
var scene = graph({}, // node always has a config object
renderer({ canvasId: 'mycanvas'},
shader({ type: 'simple-shader' },
lights({
lights: [
{
pos: { x: 0.0, y: 50.0, z: -50.0 }
}
]},
frustum({ fovy : 60.0, aspect : 1.0, near : 0.1, far : 400.0},
lookAt({
eye : { x: 5.0, y: 5.0, z: -7.0},
up : { y: 1.0 }
},
rotate(function(scope) {
return {
angle: scope.get('angle'), x : 1.0
};
},
material({
ambient: { r:0.5, g:0.5, b:0.9 },
diffuse: { r:0.5, g:0.5, b:0.9 },
specular: { r:0.5, g:0.5, b:0.9 }},
objects.teapot()
)
) // rotate
) // lookAt
) // frustum
) // lights
) // shader
) // renderer
); // scene
scene.render({angle: 45.0});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment