Skip to content

Commit

Permalink
materials: Covert to es6.
Browse files Browse the repository at this point in the history
  • Loading branch information
linbingquan committed Aug 17, 2020
1 parent 7a879a0 commit a21b664
Show file tree
Hide file tree
Showing 24 changed files with 1,041 additions and 1,043 deletions.
151 changes: 76 additions & 75 deletions examples/jsm/lines/LineMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,159 +243,160 @@ ShaderLib[ 'line' ] = {
`
};

var LineMaterial = function ( parameters ) {
class LineMaterial extends ShaderMaterial {

ShaderMaterial.call( this, {
constructor( parameters ) {

type: 'LineMaterial',
super( {

uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),
type: 'LineMaterial',

vertexShader: ShaderLib[ 'line' ].vertexShader,
fragmentShader: ShaderLib[ 'line' ].fragmentShader,
uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),

clipping: true // required for clipping support
vertexShader: ShaderLib[ 'line' ].vertexShader,
fragmentShader: ShaderLib[ 'line' ].fragmentShader,

} );
clipping: true // required for clipping support

this.dashed = false;
} );

Object.defineProperties( this, {
this.dashed = false;

color: {
Object.defineProperties( this, {

enumerable: true,
color: {

get: function () {
enumerable: true,

return this.uniforms.diffuse.value;
get: function () {

return this.uniforms.diffuse.value;

},

set: function ( value ) {

this.uniforms.diffuse.value = value;

}

},

set: function ( value ) {
linewidth: {

this.uniforms.diffuse.value = value;
enumerable: true,

}
get: function () {

},
return this.uniforms.linewidth.value;

linewidth: {
},

enumerable: true,
set: function ( value ) {

get: function () {
this.uniforms.linewidth.value = value;

return this.uniforms.linewidth.value;
}

},

set: function ( value ) {
dashScale: {

this.uniforms.linewidth.value = value;
enumerable: true,

}
get: function () {

},
return this.uniforms.dashScale.value;

dashScale: {
},

enumerable: true,
set: function ( value ) {

get: function () {
this.uniforms.dashScale.value = value;

return this.uniforms.dashScale.value;
}

},

set: function ( value ) {
dashSize: {

this.uniforms.dashScale.value = value;
enumerable: true,

}
get: function () {

},
return this.uniforms.dashSize.value;

dashSize: {
},

enumerable: true,
set: function ( value ) {

get: function () {
this.uniforms.dashSize.value = value;

return this.uniforms.dashSize.value;
}

},

set: function ( value ) {
gapSize: {

this.uniforms.dashSize.value = value;
enumerable: true,

}
get: function () {

},
return this.uniforms.gapSize.value;

gapSize: {
},

enumerable: true,
set: function ( value ) {

get: function () {
this.uniforms.gapSize.value = value;

return this.uniforms.gapSize.value;
}

},

set: function ( value ) {
opacity: {

this.uniforms.gapSize.value = value;
enumerable: true,

}
get: function () {

},
return this.uniforms.opacity.value;

opacity: {
},

enumerable: true,
set: function ( value ) {

get: function () {
this.uniforms.opacity.value = value;

return this.uniforms.opacity.value;
}

},

set: function ( value ) {

this.uniforms.opacity.value = value;

}

},
resolution: {

resolution: {
enumerable: true,

enumerable: true,
get: function () {

get: function () {
return this.uniforms.resolution.value;

return this.uniforms.resolution.value;
},

},
set: function ( value ) {

set: function ( value ) {
this.uniforms.resolution.value.copy( value );

this.uniforms.resolution.value.copy( value );
}

}

}

} );
} );

this.setValues( parameters );
this.setValues( parameters );

};
}

LineMaterial.prototype = Object.create( ShaderMaterial.prototype );
LineMaterial.prototype.constructor = LineMaterial;
}

LineMaterial.prototype.isLineMaterial = true;

Expand Down
15 changes: 8 additions & 7 deletions examples/jsm/nodes/materials/MeshStandardNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import { MeshStandardNode } from './nodes/MeshStandardNode.js';
import { NodeMaterial } from './NodeMaterial.js';
import { NodeUtils } from '../core/NodeUtils.js';

function MeshStandardNodeMaterial() {
class MeshStandardNodeMaterial extends NodeMaterial {

var node = new MeshStandardNode();
constructor() {

NodeMaterial.call( this, node, node );
var node = new MeshStandardNode();

this.type = "MeshStandardNodeMaterial";
super( node, node );

}
this.type = "MeshStandardNodeMaterial";

}

MeshStandardNodeMaterial.prototype = Object.create( NodeMaterial.prototype );
MeshStandardNodeMaterial.prototype.constructor = MeshStandardNodeMaterial;
}

NodeUtils.addShortcuts( MeshStandardNodeMaterial.prototype, 'properties', [
"color",
Expand Down
Loading

0 comments on commit a21b664

Please sign in to comment.