Scene.js 658 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. THREE.Scene = function () {
  5. this.objects = [];
  6. this.lights = [];
  7. this.addObject = function ( object ) {
  8. this.objects.push( object );
  9. };
  10. this.removeObject = function ( object ) {
  11. var i = this.objects.indexOf( object );
  12. if ( i !== -1 ) {
  13. this.objects.splice( i, 1 );
  14. }
  15. };
  16. this.addLight = function ( light ) {
  17. this.lights.push( light );
  18. };
  19. this.removeLight = function ( light ) {
  20. var i = this.lights.indexOf( light );
  21. if ( i !== -1 ) {
  22. this.lights.splice( i, 1 );
  23. }
  24. };
  25. this.toString = function () {
  26. return 'THREE.Scene ( ' + this.objects + ' )';
  27. };
  28. };