Skip to content

Commit

Permalink
MeshStandardMaterial: Revert class change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Feb 20, 2021
1 parent 7368c7d commit 1630c94
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 136 deletions.
106 changes: 52 additions & 54 deletions src/materials/MeshPhysicalMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,92 +22,90 @@ import { MathUtils } from '../math/MathUtils.js';
* }
*/

class MeshPhysicalMaterial extends MeshStandardMaterial {
function MeshPhysicalMaterial( parameters ) {

constructor( parameters ) {
MeshStandardMaterial.call( this );

super();
this.defines = {

this.defines = {
'STANDARD': '',
'PHYSICAL': ''

'STANDARD': '',
'PHYSICAL': ''
};

};
this.type = 'MeshPhysicalMaterial';

this.type = 'MeshPhysicalMaterial';
this.clearcoat = 0.0;
this.clearcoatMap = null;
this.clearcoatRoughness = 0.0;
this.clearcoatRoughnessMap = null;
this.clearcoatNormalScale = new Vector2( 1, 1 );
this.clearcoatNormalMap = null;

this.clearcoat = 0.0;
this.clearcoatMap = null;
this.clearcoatRoughness = 0.0;
this.clearcoatRoughnessMap = null;
this.clearcoatNormalScale = new Vector2( 1, 1 );
this.clearcoatNormalMap = null;
this.reflectivity = 0.5; // maps to F0 = 0.04

this.reflectivity = 0.5; // maps to F0 = 0.04
Object.defineProperty( this, 'ior', {
get: function () {

Object.defineProperty( this, 'ior', {
get: function () {
return ( 1 + 0.4 * this.reflectivity ) / ( 1 - 0.4 * this.reflectivity );

return ( 1 + 0.4 * this.reflectivity ) / ( 1 - 0.4 * this.reflectivity );
},
set: function ( ior ) {

},
set: function ( ior ) {
this.reflectivity = MathUtils.clamp( 2.5 * ( ior - 1 ) / ( ior + 1 ), 0, 1 );

this.reflectivity = MathUtils.clamp( 2.5 * ( ior - 1 ) / ( ior + 1 ), 0, 1 );

}
} );


this.sheen = null; // null will disable sheen bsdf
}
} );

this.transmission = 0.0;
this.transmissionMap = null;
this.sheen = null; // null will disable sheen bsdf

this.setValues( parameters );
this.transmission = 0.0;
this.transmissionMap = null;

}
this.setValues( parameters );

copy( source ) {
}

super.copy( source );
MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype );
MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;

this.defines = {
MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;

'STANDARD': '',
'PHYSICAL': ''
MeshPhysicalMaterial.prototype.copy = function ( source ) {

};
MeshStandardMaterial.prototype.copy.call( this, source );

this.clearcoat = source.clearcoat;
this.clearcoatMap = source.clearcoatMap;
this.clearcoatRoughness = source.clearcoatRoughness;
this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
this.clearcoatNormalMap = source.clearcoatNormalMap;
this.clearcoatNormalScale.copy( source.clearcoatNormalScale );
this.defines = {

this.reflectivity = source.reflectivity;
'STANDARD': '',
'PHYSICAL': ''

if ( source.sheen ) {
};

this.sheen = ( this.sheen || new Color() ).copy( source.sheen );
this.clearcoat = source.clearcoat;
this.clearcoatMap = source.clearcoatMap;
this.clearcoatRoughness = source.clearcoatRoughness;
this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
this.clearcoatNormalMap = source.clearcoatNormalMap;
this.clearcoatNormalScale.copy( source.clearcoatNormalScale );

} else {
this.reflectivity = source.reflectivity;

this.sheen = null;
if ( source.sheen ) {

}
this.sheen = ( this.sheen || new Color() ).copy( source.sheen );

this.transmission = source.transmission;
this.transmissionMap = source.transmissionMap;
} else {

return this;
this.sheen = null;

}

}
this.transmission = source.transmission;
this.transmissionMap = source.transmissionMap;

MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
return this;

};

export { MeshPhysicalMaterial };
164 changes: 82 additions & 82 deletions src/materials/MeshStandardMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,134 +55,134 @@ import { Color } from '../math/Color.js';
* }
*/

class MeshStandardMaterial extends Material {
function MeshStandardMaterial( parameters ) {

constructor( parameters ) {
Material.call( this );

super();
this.defines = { 'STANDARD': '' };

this.defines = { 'STANDARD': '' };
this.type = 'MeshStandardMaterial';

this.type = 'MeshStandardMaterial';
this.color = new Color( 0xffffff ); // diffuse
this.roughness = 1.0;
this.metalness = 0.0;

this.color = new Color( 0xffffff ); // diffuse
this.roughness = 1.0;
this.metalness = 0.0;
this.map = null;

this.map = null;
this.lightMap = null;
this.lightMapIntensity = 1.0;

this.lightMap = null;
this.lightMapIntensity = 1.0;
this.aoMap = null;
this.aoMapIntensity = 1.0;

this.aoMap = null;
this.aoMapIntensity = 1.0;
this.emissive = new Color( 0x000000 );
this.emissiveIntensity = 1.0;
this.emissiveMap = null;

this.emissive = new Color( 0x000000 );
this.emissiveIntensity = 1.0;
this.emissiveMap = null;
this.bumpMap = null;
this.bumpScale = 1;

this.bumpMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalMapType = TangentSpaceNormalMap;
this.normalScale = new Vector2( 1, 1 );

this.normalMap = null;
this.normalMapType = TangentSpaceNormalMap;
this.normalScale = new Vector2( 1, 1 );
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;

this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.roughnessMap = null;

this.roughnessMap = null;
this.metalnessMap = null;

this.metalnessMap = null;
this.alphaMap = null;

this.alphaMap = null;
this.envMap = null;
this.envMapIntensity = 1.0;

this.envMap = null;
this.envMapIntensity = 1.0;
this.refractionRatio = 0.98;

this.refractionRatio = 0.98;
this.wireframe = false;
this.wireframeLinewidth = 1;
this.wireframeLinecap = 'round';
this.wireframeLinejoin = 'round';

this.wireframe = false;
this.wireframeLinewidth = 1;
this.wireframeLinecap = 'round';
this.wireframeLinejoin = 'round';
this.skinning = false;
this.morphTargets = false;
this.morphNormals = false;

this.skinning = false;
this.morphTargets = false;
this.morphNormals = false;
this.flatShading = false;

this.flatShading = false;
this.vertexTangents = false;

this.vertexTangents = false;
this.setValues( parameters );

this.setValues( parameters );
}

}
MeshStandardMaterial.prototype = Object.create( Material.prototype );
MeshStandardMaterial.prototype.constructor = MeshStandardMaterial;

copy( source ) {
MeshStandardMaterial.prototype.isMeshStandardMaterial = true;

super.copy( source );
MeshStandardMaterial.prototype.copy = function ( source ) {

this.defines = { 'STANDARD': '' };
Material.prototype.copy.call( this, source );

this.color.copy( source.color );
this.roughness = source.roughness;
this.metalness = source.metalness;
this.defines = { 'STANDARD': '' };

this.map = source.map;
this.color.copy( source.color );
this.roughness = source.roughness;
this.metalness = source.metalness;

this.lightMap = source.lightMap;
this.lightMapIntensity = source.lightMapIntensity;
this.map = source.map;

this.aoMap = source.aoMap;
this.aoMapIntensity = source.aoMapIntensity;
this.lightMap = source.lightMap;
this.lightMapIntensity = source.lightMapIntensity;

this.emissive.copy( source.emissive );
this.emissiveMap = source.emissiveMap;
this.emissiveIntensity = source.emissiveIntensity;
this.aoMap = source.aoMap;
this.aoMapIntensity = source.aoMapIntensity;

this.bumpMap = source.bumpMap;
this.bumpScale = source.bumpScale;
this.emissive.copy( source.emissive );
this.emissiveMap = source.emissiveMap;
this.emissiveIntensity = source.emissiveIntensity;

this.normalMap = source.normalMap;
this.normalMapType = source.normalMapType;
this.normalScale.copy( source.normalScale );
this.bumpMap = source.bumpMap;
this.bumpScale = source.bumpScale;

this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;
this.normalMap = source.normalMap;
this.normalMapType = source.normalMapType;
this.normalScale.copy( source.normalScale );

this.roughnessMap = source.roughnessMap;
this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;

this.metalnessMap = source.metalnessMap;
this.roughnessMap = source.roughnessMap;

this.alphaMap = source.alphaMap;
this.metalnessMap = source.metalnessMap;

this.envMap = source.envMap;
this.envMapIntensity = source.envMapIntensity;
this.alphaMap = source.alphaMap;

this.refractionRatio = source.refractionRatio;
this.envMap = source.envMap;
this.envMapIntensity = source.envMapIntensity;

this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
this.wireframeLinecap = source.wireframeLinecap;
this.wireframeLinejoin = source.wireframeLinejoin;
this.refractionRatio = source.refractionRatio;

this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;
this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
this.wireframeLinecap = source.wireframeLinecap;
this.wireframeLinejoin = source.wireframeLinejoin;

this.flatShading = source.flatShading;
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;

this.vertexTangents = source.vertexTangents;
this.flatShading = source.flatShading;

return this;
this.vertexTangents = source.vertexTangents;

}
return this;

}
};

MeshStandardMaterial.prototype.isMeshStandardMaterial = true;

export { MeshStandardMaterial };

0 comments on commit 1630c94

Please sign in to comment.