dataarts / webgl-globe

WebGL Globe is a platform for visualizing latitude longitude based information using WebGL.
https://experiments.withgoogle.com/chrome/globe
Other
3.61k stars 1.16k forks source link

Why create morphPadding elements inside morphTargets??? #57

Closed Javingka closed 8 years ago

Javingka commented 8 years ago

Hello,

I have this doubt, Why is necessary include this padding to the morphTargets array? and less than 8?

        if (this._baseGeometry.morphTargets.length < 8) {
          console.log('t l',this._baseGeometry.morphTargets.length);
          var padding = 8-this._baseGeometry.morphTargets.length;
          console.log('padding', padding);
          for(var i=0; i<=padding; i++) {
            console.log('padding',i);
            this._baseGeometry.morphTargets.push({'name': 'morphPadding'+i, vertices: this._baseGeometry.vertices});
          }
        }

(snippet from function createPoints()... within Globe.js)

if latter in the this.defineSetter function we do this, using only the MorphTarget:

    var morphDict = this.points.morphTargetDictionary;
    for(var k in morphDict) {
      if(k.indexOf('morphPadding') < 0) {
        validMorphs.push(morphDict[k]);
      }
    }

(snippet from this.defineSetter('time', function(t)... within Globe.js)

So. when are the morphPadding useful?

Thanks so much for your help, I am trying to understand all the code

mrdoob commented 8 years ago

three.js currently needs morphTargets to be 8.