initial commit
This commit is contained in:
38
lib/scenes/Fog.js
Normal file
38
lib/scenes/Fog.js
Normal file
@ -0,0 +1,38 @@
|
||||
import { Color } from '../math/Color.js';
|
||||
|
||||
/**
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
function Fog( color, near, far ) {
|
||||
|
||||
this.name = '';
|
||||
|
||||
this.color = new Color( color );
|
||||
|
||||
this.near = ( near !== undefined ) ? near : 1;
|
||||
this.far = ( far !== undefined ) ? far : 1000;
|
||||
|
||||
}
|
||||
|
||||
Fog.prototype.isFog = true;
|
||||
|
||||
Fog.prototype.clone = function () {
|
||||
|
||||
return new Fog( this.color, this.near, this.far );
|
||||
|
||||
};
|
||||
|
||||
Fog.prototype.toJSON = function ( /* meta */ ) {
|
||||
|
||||
return {
|
||||
type: 'Fog',
|
||||
color: this.color.getHex(),
|
||||
near: this.near,
|
||||
far: this.far
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
export { Fog };
|
35
lib/scenes/FogExp2.js
Normal file
35
lib/scenes/FogExp2.js
Normal file
@ -0,0 +1,35 @@
|
||||
import { Color } from '../math/Color.js';
|
||||
|
||||
/**
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
function FogExp2( color, density ) {
|
||||
|
||||
this.name = '';
|
||||
|
||||
this.color = new Color( color );
|
||||
this.density = ( density !== undefined ) ? density : 0.00025;
|
||||
|
||||
}
|
||||
|
||||
FogExp2.prototype.isFogExp2 = true;
|
||||
|
||||
FogExp2.prototype.clone = function () {
|
||||
|
||||
return new FogExp2( this.color, this.density );
|
||||
|
||||
};
|
||||
|
||||
FogExp2.prototype.toJSON = function ( /* meta */ ) {
|
||||
|
||||
return {
|
||||
type: 'FogExp2',
|
||||
color: this.color.getHex(),
|
||||
density: this.density
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
export { FogExp2 };
|
55
lib/scenes/Scene.js
Normal file
55
lib/scenes/Scene.js
Normal file
@ -0,0 +1,55 @@
|
||||
import { Object3D } from '../core/Object3D.js';
|
||||
|
||||
/**
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
*/
|
||||
|
||||
function Scene() {
|
||||
|
||||
Object3D.call( this );
|
||||
|
||||
this.type = 'Scene';
|
||||
|
||||
this.background = null;
|
||||
this.fog = null;
|
||||
this.overrideMaterial = null;
|
||||
|
||||
this.autoUpdate = true; // checked by the renderer
|
||||
|
||||
}
|
||||
|
||||
Scene.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
||||
|
||||
constructor: Scene,
|
||||
|
||||
copy: function ( source, recursive ) {
|
||||
|
||||
Object3D.prototype.copy.call( this, source, recursive );
|
||||
|
||||
if ( source.background !== null ) this.background = source.background.clone();
|
||||
if ( source.fog !== null ) this.fog = source.fog.clone();
|
||||
if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
|
||||
|
||||
this.autoUpdate = source.autoUpdate;
|
||||
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
toJSON: function ( meta ) {
|
||||
|
||||
var data = Object3D.prototype.toJSON.call( this, meta );
|
||||
|
||||
if ( this.background !== null ) data.object.background = this.background.toJSON( meta );
|
||||
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
|
||||
|
||||
export { Scene };
|
Reference in New Issue
Block a user