Skip to content

Commit 931a303

Browse files
committed
WebGLMorphTargets: Add flag for opt-out data texture.
1 parent 1b1876c commit 931a303

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/renderers/webgl/WebGLCapabilities.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ function WebGLCapabilities( gl, extensions, parameters ) {
8787

8888
const maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
8989

90+
const morphTargetTexture = isWebGL2 && parameters.disableMorphTargetTexture !== true;
91+
9092
return {
9193

9294
isWebGL2: isWebGL2,
@@ -113,7 +115,9 @@ function WebGLCapabilities( gl, extensions, parameters ) {
113115
floatFragmentTextures: floatFragmentTextures,
114116
floatVertexTextures: floatVertexTextures,
115117

116-
maxSamples: maxSamples
118+
maxSamples: maxSamples,
119+
120+
morphTargetTexture: morphTargetTexture
117121

118122
};
119123

src/renderers/webgl/WebGLMorphtargets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
3333

3434
const objectInfluences = object.morphTargetInfluences;
3535

36-
if ( capabilities.isWebGL2 ) {
36+
if ( capabilities.morphTargetTexture === true ) {
3737

3838
// instead of using attributes, the WebGL 2 code path encodes morph targets
3939
// into an array of data textures. Each layer represents a single morph target.

src/renderers/webgl/WebGLProgram.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
487487

488488
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
489489
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
490-
( parameters.morphTargets && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
491-
( parameters.morphTargets && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
490+
( parameters.morphTargets && parameters.useMorphTargetTexture ) ? '#define MORPHTARGETS_TEXTURE' : '',
491+
( parameters.morphTargets && parameters.useMorphTargetTexture ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
492492
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
493493
parameters.flipSided ? '#define FLIP_SIDED' : '',
494494

src/renderers/webgl/WebGLPrograms.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
1212
const floatVertexTextures = capabilities.floatVertexTextures;
1313
const maxVertexUniforms = capabilities.maxVertexUniforms;
1414
const vertexTextures = capabilities.vertexTextures;
15+
const morphTargetTexture = capabilities.morphTargetTexture;
1516

1617
let precision = capabilities.precision;
1718

@@ -234,6 +235,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
234235
morphTargets: !! object.geometry && !! object.geometry.morphAttributes.position,
235236
morphNormals: !! object.geometry && !! object.geometry.morphAttributes.normal,
236237
morphTargetsCount: ( !! object.geometry && !! object.geometry.morphAttributes.position ) ? object.geometry.morphAttributes.position.length : 0,
238+
useMorphTargetTexture: morphTargetTexture,
237239

238240
numDirLights: lights.directional.length,
239241
numPointLights: lights.point.length,

0 commit comments

Comments
 (0)