Skip to content

Commit 7b31083

Browse files
cmhhelgesonMugen87
andauthored
NodeBuilder - Fix Interpolation (#31222)
* init branch * fix * remove comment * Update GLSLNodeBuilder.js Clean up. --------- Co-authored-by: Michael Herzog <[email protected]>
1 parent 7b8e83f commit 7b31083

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

examples/webgpu_centroid_sampling.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158

159159
};
160160

161-
const withFlatFirstShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FLAT_FIRST );
162-
const withFlatEitherShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FLAT_EITHER );
161+
const withFlatFirstShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FIRST );
162+
const withFlatEitherShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.EITHER );
163163

164164
const withSampleShader = Fn( () => {
165165

@@ -235,16 +235,16 @@
235235
THREE.InterpolationSamplingMode.NORMAL,
236236
THREE.InterpolationSamplingMode.CENTROID,
237237
THREE.InterpolationSamplingMode.SAMPLE,
238-
THREE.InterpolationSamplingMode.FLAT_FIRST,
239-
THREE.InterpolationSamplingMode.FLAT_EITHER
238+
'flat first',
239+
'flat either'
240240
] ).onChange( () => {
241241

242242
const interpolationShaderLib = {
243243
[ THREE.InterpolationSamplingMode.NORMAL ]: withoutInterpolationShader,
244244
[ THREE.InterpolationSamplingMode.CENTROID ]: withInterpolationShader,
245245
[ THREE.InterpolationSamplingMode.SAMPLE ]: withSampleShader,
246-
[ THREE.InterpolationSamplingMode.FLAT_FIRST ]: withFlatFirstShader,
247-
[ THREE.InterpolationSamplingMode.FLAT_EITHER ]: withFlatEitherShader
246+
[ 'flat first' ]: withFlatFirstShader,
247+
[ 'flat either' ]: withFlatEitherShader
248248
};
249249

250250
const shader = interpolationShaderLib[ effectController.sampling ];

src/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,8 @@ export const InterpolationSamplingMode = {
16121612
NORMAL: 'normal',
16131613
CENTROID: 'centroid',
16141614
SAMPLE: 'sample',
1615-
FLAT_FIRST: 'flat first',
1616-
FLAT_EITHER: 'flat either'
1615+
FIRST: 'first',
1616+
EITHER: 'either'
16171617
};
16181618

16191619
/**

src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ const interpolationTypeMap = {
3030
};
3131

3232
const interpolationModeMap = {
33-
'centroid': 'centroid',
34-
'flat first': 'flat',
35-
'flat either': 'flat'
33+
'centroid': 'centroid'
3634
};
3735

3836
const defaultPrecisions = `

0 commit comments

Comments
 (0)