Created
November 2, 2009 08:12
-
-
Save xeolabs/224028 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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