Skip to content

Commit

Permalink
WebGLShadowMap: Reworked useMorphing check code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 24, 2016
1 parent 1a984f9 commit 74b3522
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/renderers/webgl/WebGLShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,19 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {

if ( ! customMaterial ) {

var useMorphing, morphTargets;
var useMorphing = false;

if ( material.morphTargets ) {

if ( geometry instanceof THREE.Geometry ) morphTargets = geometry.morphTargets;
if ( geometry instanceof THREE.BufferGeometry ) {

if ( geometry instanceof THREE.BufferGeometry && geometry.morphAttributes !== undefined ) morphTargets = geometry.morphAttributes.position;
useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0;

if ( morphTargets !== undefined && morphTargets.length > 0 ) useMorphing = true;
} else if ( geometry instanceof THREE.Geometry ) {

useMorphing = geometry.morphTargets && geometry.morphTargets.length > 0;

}

}

Expand Down

3 comments on commit 74b3522

@mrdoob
Copy link
Owner Author

@mrdoob mrdoob commented on 74b3522 Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Astrak do you mind checking that I didn't break anything? 😇

@Astrak
Copy link
Contributor

@Astrak Astrak commented on 74b3522 Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks perfect :)

@mrdoob
Copy link
Owner Author

@mrdoob mrdoob commented on 74b3522 Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Thanks!

Please sign in to comment.