Skip to content

Instantly share code, notes, and snippets.

@brunofarache
Forked from anonymous/y3d-script.js
Last active December 21, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunofarache/6228194 to your computer and use it in GitHub Desktop.
Save brunofarache/6228194 to your computer and use it in GitHub Desktop.
/**
* Loading a teapot.obj file
*
* https://gist.github.com/brunofarache/6228194
*/
YUI().use('y3d-scene', 'y3d-camera', 'y3d-obj-loader', 'io-base', function(Y) {
var scene = new Y.Scene({
camera: new Y.Camera({
position: {
z: 290
}
}),
background: '#272822'
});
var io = new Y.IO({emitFacade: true}),
config = {
on: {
complete: function(event) {
var loader = new Y.ObjLoader({ src: event.data.responseText });
var geometry = loader.load();
geometry.set('color', '#ffaa00');
geometry.set('position.x', -6);
geometry.set('position.z', 50);
geometry.set('wireframe', true);
scene.add(geometry);
scene.render();
}
}
};
io.send('examples/obj/teapot.obj', config);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment