Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/scenes/Fog.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import { Color } from '../math/Color.js';

function Fog( color, near, far ) {
class Fog {

this.name = '';
constructor( color, near, far ) {

this.color = new Color( color );
this.name = '';

this.near = ( near !== undefined ) ? near : 1;
this.far = ( far !== undefined ) ? far : 1000;
this.color = new Color( color );

}

Object.assign( Fog.prototype, {
this.near = ( near !== undefined ) ? near : 1;
this.far = ( far !== undefined ) ? far : 1000;

isFog: true,
}

clone: function () {
clone() {

return new Fog( this.color, this.near, this.far );

},
}

toJSON: function ( /* meta */ ) {
toJSON( /* meta */ ) {

return {
type: 'Fog',
Expand All @@ -32,6 +30,8 @@ Object.assign( Fog.prototype, {

}

} );
}

Fog.prototype.isFog = true;

export { Fog };
24 changes: 12 additions & 12 deletions src/scenes/FogExp2.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { Color } from '../math/Color.js';

function FogExp2( color, density ) {
class FogExp2 {

this.name = '';
constructor( color, density ) {

this.color = new Color( color );
this.density = ( density !== undefined ) ? density : 0.00025;
this.name = '';

}

Object.assign( FogExp2.prototype, {
this.color = new Color( color );
this.density = ( density !== undefined ) ? density : 0.00025;

isFogExp2: true,
}

clone: function () {
clone() {

return new FogExp2( this.color, this.density );

},
}

toJSON: function ( /* meta */ ) {
toJSON( /* meta */ ) {

return {
type: 'FogExp2',
Expand All @@ -29,6 +27,8 @@ Object.assign( FogExp2.prototype, {

}

} );
}

FogExp2.prototype.isFogExp2 = true;

export { FogExp2 };
45 changes: 20 additions & 25 deletions src/scenes/Scene.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
import { Object3D } from '../core/Object3D.js';

function Scene() {
class Scene extends Object3D {

Object3D.call( this );
constructor() {

this.type = 'Scene';
super();
this.type = 'Scene';

this.background = null;
this.environment = null;
this.fog = null;
this.background = null;
this.environment = null;
this.fog = null;

this.overrideMaterial = null;
this.overrideMaterial = null;

this.autoUpdate = true; // checked by the renderer
this.autoUpdate = true; // checked by the renderer

if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {

__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef

}

}

Scene.prototype = Object.assign( Object.create( Object3D.prototype ), {

constructor: Scene,
}

isScene: true,
}

copy: function ( source, recursive ) {
copy( source, recursive ) {

Object3D.prototype.copy.call( this, source, recursive );
super.copy( source, recursive );

if ( source.background !== null ) this.background = source.background.clone();
if ( source.environment !== null ) this.environment = source.environment.clone();
Expand All @@ -43,11 +38,11 @@ Scene.prototype = Object.assign( Object.create( Object3D.prototype ), {

return this;

},
}

toJSON: function ( meta ) {
toJSON( meta ) {

const data = Object3D.prototype.toJSON.call( this, meta );
const data = super.toJSON( meta );

if ( this.background !== null ) data.object.background = this.background.toJSON( meta );
if ( this.environment !== null ) data.object.environment = this.environment.toJSON( meta );
Expand All @@ -57,8 +52,8 @@ Scene.prototype = Object.assign( Object.create( Object3D.prototype ), {

}

} );

}

Scene.prototype.isScene = true;

export { Scene };