UNPKG

1.14 kBJavaScriptView Raw
1import { Object3D } from '../core/Object3D.js';
2
3/**
4 * @author mrdoob / http://mrdoob.com/
5 */
6
7function Scene() {
8
9 Object3D.call( this );
10
11 this.type = 'Scene';
12
13 this.background = null;
14 this.fog = null;
15 this.overrideMaterial = null;
16
17 this.autoUpdate = true; // checked by the renderer
18
19}
20
21Scene.prototype = Object.assign( Object.create( Object3D.prototype ), {
22
23 constructor: Scene,
24
25 copy: function ( source, recursive ) {
26
27 Object3D.prototype.copy.call( this, source, recursive );
28
29 if ( source.background !== null ) this.background = source.background.clone();
30 if ( source.fog !== null ) this.fog = source.fog.clone();
31 if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
32
33 this.autoUpdate = source.autoUpdate;
34 this.matrixAutoUpdate = source.matrixAutoUpdate;
35
36 return this;
37
38 },
39
40 toJSON: function ( meta ) {
41
42 var data = Object3D.prototype.toJSON.call( this, meta );
43
44 if ( this.background !== null ) data.object.background = this.background.toJSON( meta );
45 if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
46
47 return data;
48
49 }
50
51} );
52
53
54
55export { Scene };