Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Materials: Revert static types of builtins materials #29789

Merged
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
8 changes: 1 addition & 7 deletions examples/jsm/lines/LineMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,11 @@ ShaderLib[ 'line' ] = {

class LineMaterial extends ShaderMaterial {


static get type() {

return 'LineMaterial';

}

constructor( parameters ) {

super( {

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

vertexShader: ShaderLib[ 'line' ].vertexShader,
Expand Down
8 changes: 2 additions & 6 deletions examples/jsm/loaders/MMDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2131,18 +2131,14 @@ class CubicBezierInterpolation extends Interpolant {

class MMDToonMaterial extends ShaderMaterial {

static get type() {

return 'MMDToonMaterial';

}

constructor( parameters ) {

super();

this.isMMDToonMaterial = true;

this.type = 'MMDToonMaterial';

this._matcapCombine = AddOperation;
this.emissiveIntensity = 1.0;
this.normalMapType = TangentSpaceNormalMap;
Expand Down
8 changes: 2 additions & 6 deletions examples/jsm/materials/MeshGouraudMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,14 @@ const GouraudShader = {

class MeshGouraudMaterial extends ShaderMaterial {

static get type() {

return 'MeshGouraudMaterial';

}

constructor( parameters ) {

super();

this.isMeshGouraudMaterial = true;

this.type = 'MeshGouraudMaterial';

//this.color = new THREE.Color( 0xffffff ); // diffuse

//this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/LineBasicMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ import { Color } from '../math/Color.js';

class LineBasicMaterial extends Material {

static get type() {

return 'LineBasicMaterial';

}

constructor( parameters ) {

super();

this.isLineBasicMaterial = true;

this.type = 'LineBasicMaterial';

this.color = new Color( 0xffffff );

this.map = null;
Expand Down
7 changes: 1 addition & 6 deletions src/materials/LineDashedMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import { LineBasicMaterial } from './LineBasicMaterial.js';

class LineDashedMaterial extends LineBasicMaterial {

static get type() {

return 'LineDashedMaterial';

}

constructor( parameters ) {

super();

this.isLineDashedMaterial = true;
this.type = 'LineDashedMaterial';

this.scale = 1;
this.dashSize = 3;
Expand Down
15 changes: 1 addition & 14 deletions src/materials/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ let _materialId = 0;

class Material extends EventDispatcher {

static get type() {

return 'Material';

}

get type() {

return this.constructor.type;

}

set type( _value ) { /* */ }

constructor() {

super();
Expand All @@ -32,6 +18,7 @@ class Material extends EventDispatcher {
this.uuid = MathUtils.generateUUID();

this.name = '';
this.type = 'Material';

this.blending = NormalBlending;
this.side = FrontSide;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshBasicMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ import { Euler } from '../math/Euler.js';

class MeshBasicMaterial extends Material {

static get type() {

return 'MeshBasicMaterial';

}

constructor( parameters ) {

super();

this.isMeshBasicMaterial = true;

this.type = 'MeshBasicMaterial';

this.color = new Color( 0xffffff ); // emissive

this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshDepthMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ import { BasicDepthPacking } from '../constants.js';

class MeshDepthMaterial extends Material {

static get type() {

return 'MeshDepthMaterial';

}

constructor( parameters ) {

super();

this.isMeshDepthMaterial = true;

this.type = 'MeshDepthMaterial';

this.depthPacking = BasicDepthPacking;

this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshDistanceMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ import { Material } from './Material.js';

class MeshDistanceMaterial extends Material {

static get type() {

return 'MeshDistanceMaterial';

}

constructor( parameters ) {

super();

this.isMeshDistanceMaterial = true;

this.type = 'MeshDistanceMaterial';

this.map = null;

this.alphaMap = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshLambertMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ import { Euler } from '../math/Euler.js';

class MeshLambertMaterial extends Material {

static get type() {

return 'MeshLambertMaterial';

}

constructor( parameters ) {

super();

this.isMeshLambertMaterial = true;

this.type = 'MeshLambertMaterial';

this.color = new Color( 0xffffff ); // diffuse

this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshMatcapMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import { Color } from '../math/Color.js';

class MeshMatcapMaterial extends Material {

static get type() {

return 'MeshMatcapMaterial';

}

constructor( parameters ) {

super();
Expand All @@ -19,6 +13,8 @@ class MeshMatcapMaterial extends Material {

this.defines = { 'MATCAP': '' };

this.type = 'MeshMatcapMaterial';

this.color = new Color( 0xffffff ); // diffuse

this.matcap = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshNormalMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import { Vector2 } from '../math/Vector2.js';

class MeshNormalMaterial extends Material {

static get type() {

return 'MeshNormalMaterial';

}

constructor( parameters ) {

super();

this.isMeshNormalMaterial = true;

this.type = 'MeshNormalMaterial';

this.bumpMap = null;
this.bumpScale = 1;

Expand Down
10 changes: 3 additions & 7 deletions src/materials/MeshPhongMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ import { Material } from './Material.js';
import { Vector2 } from '../math/Vector2.js';
import { Color } from '../math/Color.js';
import { Euler } from '../math/Euler.js';

class MeshPhongMaterial extends Material {

static get type() {

return 'MeshPhongMaterial';

}

constructor( parameters ) {

super();

this.isMeshPhongMaterial = true;

this.type = 'MeshPhongMaterial';

this.color = new Color( 0xffffff ); // diffuse
this.specular = new Color( 0x111111 );
this.shininess = 30;
Expand Down Expand Up @@ -51,6 +46,7 @@ class MeshPhongMaterial extends Material {

this.envMap = null;
this.envMapRotation = new Euler();

this.combine = MultiplyOperation;
this.reflectivity = 1;
this.refractionRatio = 0.98;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshPhysicalMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import * as MathUtils from '../math/MathUtils.js';

class MeshPhysicalMaterial extends MeshStandardMaterial {

static get type() {

return 'MeshPhysicalMaterial';

}

constructor( parameters ) {

super();
Expand All @@ -24,6 +18,8 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {

};

this.type = 'MeshPhysicalMaterial';

this.anisotropyRotation = 0;
this.anisotropyMap = null;

Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshStandardMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ import { Euler } from '../math/Euler.js';

class MeshStandardMaterial extends Material {

static get type() {

return 'MeshStandardMaterial';

}

constructor( parameters ) {

super();

this.isMeshStandardMaterial = true;

this.type = 'MeshStandardMaterial';

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

this.color = new Color( 0xffffff ); // diffuse
Expand Down
8 changes: 2 additions & 6 deletions src/materials/MeshToonMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import { Color } from '../math/Color.js';

class MeshToonMaterial extends Material {

static get type() {

return 'MeshToonMaterial';

}

constructor( parameters ) {

super();
Expand All @@ -19,6 +13,8 @@ class MeshToonMaterial extends Material {

this.defines = { 'TOON': '' };

this.type = 'MeshToonMaterial';

this.color = new Color( 0xffffff );

this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/PointsMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ import { Color } from '../math/Color.js';

class PointsMaterial extends Material {

static get type() {

return 'PointsMaterial';

}

constructor( parameters ) {

super();

this.isPointsMaterial = true;

this.type = 'PointsMaterial';

this.color = new Color( 0xffffff );

this.map = null;
Expand Down
8 changes: 2 additions & 6 deletions src/materials/RawShaderMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ import { ShaderMaterial } from './ShaderMaterial.js';

class RawShaderMaterial extends ShaderMaterial {

static get type() {

return 'RawShaderMaterial';

}

constructor( parameters ) {

super( parameters );

this.isRawShaderMaterial = true;

this.type = 'RawShaderMaterial';

}

}
Expand Down
Loading