1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- var APP = {};
- APP.Player = function () {
- var loader = new THREE.ObjectLoader();
- var camera, scene, renderer;
- var scripts;
-
- this.dom = undefined;
- this.load = function ( json ) {
- renderer = new THREE.WebGLRenderer( { antialias: true } );
- scene = loader.parse( json );
- /*
- scripts = [];
- scene.traverse( function ( child ) {
- if ( child.script !== undefined ) {
- var script = new Function( 'scene', 'time', child.script.source ).bind( child );
- scripts.push( script );
- }
- } );
- */
- this.dom = renderer.domElement;
- };
- this.setCamera = function ( master ) {
- camera = master.clone();
- };
- this.setSize = function ( width, height ) {
- renderer.setSize( width, height );
- };
- var request;
- var animate = function ( time ) {
- request = requestAnimationFrame( animate );
- /*
- for ( var i = 0; i < scripts.length; i ++ ) {
- scripts[ i ]( scene, time );
- }
- */
- renderer.render( scene, camera );
- };
- this.play = function () {
- request = requestAnimationFrame( animate );
- };
- this.stop = function () {
- cancelAnimationFrame( request );
- };
- };
- APP.Script = function ( source ) {
- this.uuid = THREE.Math.generateUUID();
- this.source = source;
- };
|