Skip to content

Commit

Permalink
Material: Remove alphaWrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jan 27, 2022
1 parent 216f045 commit dfca2bd
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2885,7 +2885,6 @@
} else {

materialParams.transparent = false;
materialParams.alphaWrite = false;

if ( alphaMode === ALPHA_MODES.MASK ) {

Expand Down
1 change: 0 additions & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,6 @@ class GLTFParser {
} else {

materialParams.transparent = false;
materialParams.alphaWrite = false;

if ( alphaMode === ALPHA_MODES.MASK ) {

Expand Down
1 change: 0 additions & 1 deletion src/loaders/MaterialLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class MaterialLoader extends Loader {
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
if ( json.alphaWrite !== undefined ) material.alphaWrite = json.alphaWrite;

if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
Expand Down
3 changes: 0 additions & 3 deletions src/materials/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Material extends EventDispatcher {
this.shadowSide = null;

this.colorWrite = true;
this.alphaWrite = true;

this.precision = null; // override the renderer's default precision for this material

Expand Down Expand Up @@ -312,7 +311,6 @@ class Material extends EventDispatcher {
data.depthTest = this.depthTest;
data.depthWrite = this.depthWrite;
data.colorWrite = this.colorWrite;
data.alphaWrite = this.alphaWrite;

data.stencilWrite = this.stencilWrite;
data.stencilWriteMask = this.stencilWriteMask;
Expand Down Expand Up @@ -448,7 +446,6 @@ class Material extends EventDispatcher {
this.shadowSide = source.shadowSide;

this.colorWrite = source.colorWrite;
this.alphaWrite = source.alphaWrite;

this.precision = source.precision;

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgl/WebGLProgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',

parameters.dithering ? '#define DITHERING' : '',
parameters.alphaWrite ? '' : '#define OPAQUE',
parameters.transparent ? '' : '#define OPAQUE',

ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ),
Expand Down
6 changes: 4 additions & 2 deletions src/renderers/webgl/WebGLPrograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
specularIntensityMap: !! material.specularIntensityMap,
specularColorMap: !! material.specularColorMap,

transparent: material.transparent,

alphaMap: !! material.alphaMap,
alphaTest: useAlphaTest,
alphaWrite: material.alphaWrite || material.transparent,

gradientMap: !! material.gradientMap,

Expand Down Expand Up @@ -325,7 +326,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
array.push( parameters.toneMapping );
array.push( parameters.numClippingPlanes );
array.push( parameters.numClipIntersection );
array.push( parameters.alphaWrite );

}

Expand Down Expand Up @@ -447,6 +447,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
_programLayers.enable( 21 );
if ( parameters.decodeVideoTexture )
_programLayers.enable( 22 );
if ( parameters.transparent )
_programLayers.enable( 23 );

array.push( _programLayers.mask );

Expand Down

0 comments on commit dfca2bd

Please sign in to comment.