|
@@ -737,7 +737,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
|
|
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
|
|
|
|
|
|
- const program = setProgram( camera, scene, material, object );
|
|
|
|
|
|
+ const program = setProgram( camera, scene, geometry, material, object );
|
|
|
|
|
|
state.setMaterial( material, frontFaceCW );
|
|
state.setMaterial( material, frontFaceCW );
|
|
|
|
|
|
@@ -769,12 +769,6 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined ) {
|
|
|
|
-
|
|
|
|
- morphtargets.update( object, geometry, material, program );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
bindingStates.setup( object, material, program, geometry, index );
|
|
bindingStates.setup( object, material, program, geometry, index );
|
|
|
|
|
|
let attribute;
|
|
let attribute;
|
|
@@ -1339,7 +1333,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
if ( object.isImmediateRenderObject ) {
|
|
if ( object.isImmediateRenderObject ) {
|
|
|
|
|
|
- const program = setProgram( camera, scene, material, object );
|
|
|
|
|
|
+ const program = setProgram( camera, scene, geometry, material, object );
|
|
|
|
|
|
state.setMaterial( material );
|
|
state.setMaterial( material );
|
|
|
|
|
|
@@ -1504,7 +1498,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- function setProgram( camera, scene, material, object ) {
|
|
|
|
|
|
+ function setProgram( camera, scene, geometry, material, object ) {
|
|
|
|
|
|
if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
|
|
if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
|
|
|
|
|
|
@@ -1514,11 +1508,11 @@ function WebGLRenderer( parameters = {} ) {
|
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
|
|
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
|
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
- const vertexAlphas = material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4;
|
|
|
|
- const vertexTangents = !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent;
|
|
|
|
- const morphTargets = !! object.geometry && !! object.geometry.morphAttributes.position;
|
|
|
|
- const morphNormals = !! object.geometry && !! object.geometry.morphAttributes.normal;
|
|
|
|
- const morphTargetsCount = ( !! object.geometry && !! object.geometry.morphAttributes.position ) ? object.geometry.morphAttributes.position.length : 0;
|
|
|
|
|
|
+ const vertexAlphas = material.vertexColors === true && !! geometry && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
|
|
+ const vertexTangents = !! material.normalMap && !! geometry && !! geometry.attributes.tangent;
|
|
|
|
+ const morphTargets = !! geometry && !! geometry.morphAttributes.position;
|
|
|
|
+ const morphNormals = !! geometry && !! geometry.morphAttributes.normal;
|
|
|
|
+ const morphTargetsCount = ( !! geometry && !! geometry.morphAttributes.position ) ? geometry.morphAttributes.position.length : 0;
|
|
|
|
|
|
const materialProperties = properties.get( material );
|
|
const materialProperties = properties.get( material );
|
|
const lights = currentRenderState.state.lights;
|
|
const lights = currentRenderState.state.lights;
|
|
@@ -1716,9 +1710,9 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // skinning uniforms must be set even if material didn't change
|
|
|
|
- // auto-setting of texture unit for bone texture must go before other textures
|
|
|
|
- // otherwise textures used for skinning can take over texture units reserved for other material textures
|
|
|
|
|
|
+ // skinning and morph target uniforms must be set even if material didn't change
|
|
|
|
+ // auto-setting of texture unit for bone and morph texture must go before other textures
|
|
|
|
+ // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures
|
|
|
|
|
|
if ( object.isSkinnedMesh ) {
|
|
if ( object.isSkinnedMesh ) {
|
|
|
|
|
|
@@ -1746,6 +1740,13 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if ( !! geometry && ( geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined ) ) {
|
|
|
|
+
|
|
|
|
+ morphtargets.update( object, geometry, material, program );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {
|
|
if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {
|
|
|
|
|
|
materialProperties.receiveShadow = object.receiveShadow;
|
|
materialProperties.receiveShadow = object.receiveShadow;
|