|
@@ -2514,6 +2514,7 @@ class WebGLRenderTarget extends EventDispatcher {
|
|
this.viewport.copy( source.viewport );
|
|
this.viewport.copy( source.viewport );
|
|
|
|
|
|
this.texture = source.texture.clone();
|
|
this.texture = source.texture.clone();
|
|
|
|
+ this.texture.image = { ...this.texture.image }; // See #20328.
|
|
|
|
|
|
this.depthBuffer = source.depthBuffer;
|
|
this.depthBuffer = source.depthBuffer;
|
|
this.stencilBuffer = source.stencilBuffer;
|
|
this.stencilBuffer = source.stencilBuffer;
|
|
@@ -7999,91 +8000,89 @@ class Triangle {
|
|
|
|
|
|
let materialId = 0;
|
|
let materialId = 0;
|
|
|
|
|
|
-function Material() {
|
|
|
|
|
|
+class Material extends EventDispatcher {
|
|
|
|
|
|
- Object.defineProperty( this, 'id', { value: materialId ++ } );
|
|
|
|
-
|
|
|
|
- this.uuid = generateUUID();
|
|
|
|
|
|
+ constructor() {
|
|
|
|
|
|
- this.name = '';
|
|
|
|
- this.type = 'Material';
|
|
|
|
|
|
+ super();
|
|
|
|
|
|
- this.fog = true;
|
|
|
|
|
|
+ Object.defineProperty( this, 'id', { value: materialId ++ } );
|
|
|
|
|
|
- this.blending = NormalBlending;
|
|
|
|
- this.side = FrontSide;
|
|
|
|
- this.vertexColors = false;
|
|
|
|
|
|
+ this.uuid = generateUUID();
|
|
|
|
|
|
- this.opacity = 1;
|
|
|
|
- this.transparent = false;
|
|
|
|
|
|
+ this.name = '';
|
|
|
|
+ this.type = 'Material';
|
|
|
|
|
|
- this.blendSrc = SrcAlphaFactor;
|
|
|
|
- this.blendDst = OneMinusSrcAlphaFactor;
|
|
|
|
- this.blendEquation = AddEquation;
|
|
|
|
- this.blendSrcAlpha = null;
|
|
|
|
- this.blendDstAlpha = null;
|
|
|
|
- this.blendEquationAlpha = null;
|
|
|
|
|
|
+ this.fog = true;
|
|
|
|
|
|
- this.depthFunc = LessEqualDepth;
|
|
|
|
- this.depthTest = true;
|
|
|
|
- this.depthWrite = true;
|
|
|
|
|
|
+ this.blending = NormalBlending;
|
|
|
|
+ this.side = FrontSide;
|
|
|
|
+ this.vertexColors = false;
|
|
|
|
|
|
- this.stencilWriteMask = 0xff;
|
|
|
|
- this.stencilFunc = AlwaysStencilFunc;
|
|
|
|
- this.stencilRef = 0;
|
|
|
|
- this.stencilFuncMask = 0xff;
|
|
|
|
- this.stencilFail = KeepStencilOp;
|
|
|
|
- this.stencilZFail = KeepStencilOp;
|
|
|
|
- this.stencilZPass = KeepStencilOp;
|
|
|
|
- this.stencilWrite = false;
|
|
|
|
|
|
+ this.opacity = 1;
|
|
|
|
+ this.transparent = false;
|
|
|
|
|
|
- this.clippingPlanes = null;
|
|
|
|
- this.clipIntersection = false;
|
|
|
|
- this.clipShadows = false;
|
|
|
|
|
|
+ this.blendSrc = SrcAlphaFactor;
|
|
|
|
+ this.blendDst = OneMinusSrcAlphaFactor;
|
|
|
|
+ this.blendEquation = AddEquation;
|
|
|
|
+ this.blendSrcAlpha = null;
|
|
|
|
+ this.blendDstAlpha = null;
|
|
|
|
+ this.blendEquationAlpha = null;
|
|
|
|
|
|
- this.shadowSide = null;
|
|
|
|
|
|
+ this.depthFunc = LessEqualDepth;
|
|
|
|
+ this.depthTest = true;
|
|
|
|
+ this.depthWrite = true;
|
|
|
|
|
|
- this.colorWrite = true;
|
|
|
|
|
|
+ this.stencilWriteMask = 0xff;
|
|
|
|
+ this.stencilFunc = AlwaysStencilFunc;
|
|
|
|
+ this.stencilRef = 0;
|
|
|
|
+ this.stencilFuncMask = 0xff;
|
|
|
|
+ this.stencilFail = KeepStencilOp;
|
|
|
|
+ this.stencilZFail = KeepStencilOp;
|
|
|
|
+ this.stencilZPass = KeepStencilOp;
|
|
|
|
+ this.stencilWrite = false;
|
|
|
|
|
|
- this.precision = null; // override the renderer's default precision for this material
|
|
|
|
|
|
+ this.clippingPlanes = null;
|
|
|
|
+ this.clipIntersection = false;
|
|
|
|
+ this.clipShadows = false;
|
|
|
|
|
|
- this.polygonOffset = false;
|
|
|
|
- this.polygonOffsetFactor = 0;
|
|
|
|
- this.polygonOffsetUnits = 0;
|
|
|
|
|
|
+ this.shadowSide = null;
|
|
|
|
|
|
- this.dithering = false;
|
|
|
|
|
|
+ this.colorWrite = true;
|
|
|
|
|
|
- this.alphaTest = 0;
|
|
|
|
- this.alphaToCoverage = false;
|
|
|
|
- this.premultipliedAlpha = false;
|
|
|
|
|
|
+ this.precision = null; // override the renderer's default precision for this material
|
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
|
+ this.polygonOffset = false;
|
|
|
|
+ this.polygonOffsetFactor = 0;
|
|
|
|
+ this.polygonOffsetUnits = 0;
|
|
|
|
|
|
- this.toneMapped = true;
|
|
|
|
|
|
+ this.dithering = false;
|
|
|
|
|
|
- this.userData = {};
|
|
|
|
|
|
+ this.alphaTest = 0;
|
|
|
|
+ this.alphaToCoverage = false;
|
|
|
|
+ this.premultipliedAlpha = false;
|
|
|
|
|
|
- this.version = 0;
|
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ this.toneMapped = true;
|
|
|
|
|
|
-Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
|
|
|
|
|
|
+ this.userData = {};
|
|
|
|
|
|
- constructor: Material,
|
|
|
|
|
|
+ this.version = 0;
|
|
|
|
|
|
- isMaterial: true,
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- onBuild: function ( /* shaderobject, renderer */ ) {},
|
|
|
|
|
|
+ onBuild( /* shaderobject, renderer */ ) {}
|
|
|
|
|
|
- onBeforeCompile: function ( /* shaderobject, renderer */ ) {},
|
|
|
|
|
|
+ onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
|
|
|
|
- customProgramCacheKey: function () {
|
|
|
|
|
|
+ customProgramCacheKey() {
|
|
|
|
|
|
return this.onBeforeCompile.toString();
|
|
return this.onBeforeCompile.toString();
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- setValues: function ( values ) {
|
|
|
|
|
|
+ setValues( values ) {
|
|
|
|
|
|
if ( values === undefined ) return;
|
|
if ( values === undefined ) return;
|
|
|
|
|
|
@@ -8132,9 +8131,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- toJSON: function ( meta ) {
|
|
|
|
|
|
+ toJSON( meta ) {
|
|
|
|
|
|
const isRoot = ( meta === undefined || typeof meta === 'string' );
|
|
const isRoot = ( meta === undefined || typeof meta === 'string' );
|
|
|
|
|
|
@@ -8348,15 +8347,15 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
return data;
|
|
return data;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- clone: function () {
|
|
|
|
|
|
+ clone() {
|
|
|
|
|
|
return new this.constructor().copy( this );
|
|
return new this.constructor().copy( this );
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- copy: function ( source ) {
|
|
|
|
|
|
+ copy( source ) {
|
|
|
|
|
|
this.name = source.name;
|
|
this.name = source.name;
|
|
|
|
|
|
@@ -8433,25 +8432,23 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- dispose: function () {
|
|
|
|
|
|
+ dispose() {
|
|
|
|
|
|
this.dispatchEvent( { type: 'dispose' } );
|
|
this.dispatchEvent( { type: 'dispose' } );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-} );
|
|
|
|
-
|
|
|
|
-Object.defineProperty( Material.prototype, 'needsUpdate', {
|
|
|
|
-
|
|
|
|
- set: function ( value ) {
|
|
|
|
|
|
+ set needsUpdate( value ) {
|
|
|
|
|
|
if ( value === true ) this.version ++;
|
|
if ( value === true ) this.version ++;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-} );
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+Material.prototype.isMaterial = true;
|
|
|
|
|
|
const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,
|
|
const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,
|
|
'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,
|
|
'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,
|
|
@@ -13145,7 +13142,7 @@ const UniformsLib = {
|
|
|
|
|
|
common: {
|
|
common: {
|
|
|
|
|
|
- diffuse: { value: new Color( 0xeeeeee ) },
|
|
|
|
|
|
+ diffuse: { value: new Color( 0xffffff ) },
|
|
opacity: { value: 1.0 },
|
|
opacity: { value: 1.0 },
|
|
|
|
|
|
map: { value: null },
|
|
map: { value: null },
|
|
@@ -13322,7 +13319,7 @@ const UniformsLib = {
|
|
|
|
|
|
points: {
|
|
points: {
|
|
|
|
|
|
- diffuse: { value: new Color( 0xeeeeee ) },
|
|
|
|
|
|
+ diffuse: { value: new Color( 0xffffff ) },
|
|
opacity: { value: 1.0 },
|
|
opacity: { value: 1.0 },
|
|
size: { value: 1.0 },
|
|
size: { value: 1.0 },
|
|
scale: { value: 1.0 },
|
|
scale: { value: 1.0 },
|
|
@@ -13334,7 +13331,7 @@ const UniformsLib = {
|
|
|
|
|
|
sprite: {
|
|
sprite: {
|
|
|
|
|
|
- diffuse: { value: new Color( 0xeeeeee ) },
|
|
|
|
|
|
+ diffuse: { value: new Color( 0xffffff ) },
|
|
opacity: { value: 1.0 },
|
|
opacity: { value: 1.0 },
|
|
center: { value: new Vector2( 0.5, 0.5 ) },
|
|
center: { value: new Vector2( 0.5, 0.5 ) },
|
|
rotation: { value: 0.0 },
|
|
rotation: { value: 0.0 },
|