Skip to content

Commit

Permalink
r132 ALPHATEST --> USE_ALPHATEST
Browse files Browse the repository at this point in the history
`ALPHATEST` was previously used as a flag and a value in three.js `alphatest_fragment` chunk.
It was superseded by the `USE_ALPHATEST` flag and the `alphaTest` value passed as a uniform.
The declaration of the `alphaTest` uniform is made in the `alphatest_pars_fragment` chunk.
  • Loading branch information
ppillot committed Dec 3, 2023
1 parent 0899733 commit 8627b6c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/buffer/point-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const PointBufferParameterTypes = Object.assign({
pointSize: { uniform: 'size' },
sizeAttenuation: { updateShader: true },
sortParticles: {},
alphaTest: { updateShader: true },
alphaTest: { uniform: true },
useTexture: { updateShader: true },
forceTransparent: {},
edgeBleach: { uniform: true }
Expand Down Expand Up @@ -123,7 +123,8 @@ class PointBuffer extends Buffer {
'size': { value: this.parameters.pointSize },
'canvasHeight': { value: 1.0 },
'pixelRatio': { value: 1.0 },
'map': { value: null }
'map': { value: null },
'alphaTest': {value: this.parameters.alphaTest}
})
}

Expand Down Expand Up @@ -163,7 +164,7 @@ class PointBuffer extends Buffer {
}

if (this.parameters.alphaTest > 0 && this.parameters.alphaTest <= 1) {
defines.ALPHATEST = this.parameters.alphaTest.toPrecision(2)
defines.USE_ALPHATEST = 1
}

return defines
Expand Down
1 change: 1 addition & 0 deletions src/shader/Point.frag
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ uniform float clipRadius;
#include common
#include color_pars_fragment
#include fog_pars_fragment
#include alphatest_pars_fragment
varying vec3 vViewPosition;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/shader/shader-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ShaderRegistry } from '../globals'
export type ShaderDefine = (
'NEAR_CLIP'|'RADIUS_CLIP'|'PICKING'|'NOLIGHT'|'FLAT_SHADED'|'OPAQUE_BACK'|
'DIFFUSE_INTERIOR'|'USE_INTERIOR_COLOR'|
'USE_SIZEATTENUATION'|'USE_MAP'|'ALPHATEST'|'SDF'|'FIXED_SIZE'|
'USE_SIZEATTENUATION'|'USE_MAP'|'USE_ALPHATEST'|'SDF'|'FIXED_SIZE'|
'CUBIC_INTERPOLATION'|'BSPLINE_FILTER'|'CATMULROM_FILTER'|'MITCHELL_FILTER'
)
export type ShaderDefines = {
Expand Down

0 comments on commit 8627b6c

Please sign in to comment.