Scene.js 795 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. var i = this.objects.indexOf( object );
  9. if ( i === -1 ) {
  10. this.objects.push( object );
  11. }
  12. };
  13. this.removeObject = function ( object ) {
  14. var i = this.objects.indexOf( object );
  15. if ( i !== -1 ) {
  16. this.objects.splice( i, 1 );
  17. }
  18. };
  19. this.addLight = function ( light ) {
  20. var i = this.lights.indexOf( light );
  21. if ( i === -1 ) {
  22. this.lights.push( light );
  23. }
  24. };
  25. this.removeLight = function ( light ) {
  26. var i = this.lights.indexOf( light );
  27. if ( i !== -1 ) {
  28. this.lights.splice( i, 1 );
  29. }
  30. };
  31. this.toString = function () {
  32. return 'THREE.Scene ( ' + this.objects + ' )';
  33. };
  34. };
粤ICP备19079148号