MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / setupMorphTargets

Function setupMorphTargets

Three.js/js/Three66.js:23334–23477  ·  view source on GitHub ↗
( material, geometryGroup, object )

Source from the content-addressed store, hash-verified

23332 };
23333
23334 function setupMorphTargets ( material, geometryGroup, object ) {
23335
23336 // set base
23337
23338 var attributes = material.program.attributes;
23339
23340 if ( object.morphTargetBase !== -1 && attributes.position >= 0 ) {
23341
23342 _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ object.morphTargetBase ] );
23343 enableAttribute( attributes.position );
23344 _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );
23345
23346 } else if ( attributes.position >= 0 ) {
23347
23348 _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer );
23349 enableAttribute( attributes.position );
23350 _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );
23351
23352 }
23353
23354 if ( object.morphTargetForcedOrder.length ) {
23355
23356 // set forced order
23357
23358 var m = 0;
23359 var order = object.morphTargetForcedOrder;
23360 var influences = object.morphTargetInfluences;
23361
23362 while ( m < material.numSupportedMorphTargets && m < order.length ) {
23363
23364 if ( attributes[ "morphTarget" + m ] >= 0 ) {
23365
23366 _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ order[ m ] ] );
23367 enableAttribute( attributes[ "morphTarget" + m ] );
23368 _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 );
23369
23370 }
23371
23372 if ( attributes[ "morphNormal" + m ] >= 0 && material.morphNormals ) {
23373
23374 _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ order[ m ] ] );
23375 enableAttribute( attributes[ "morphNormal" + m ] );
23376 _gl.vertexAttribPointer( attributes[ "morphNormal" + m ], 3, _gl.FLOAT, false, 0, 0 );
23377
23378 }
23379
23380 object.__webglMorphTargetInfluences[ m ] = influences[ order[ m ] ];
23381
23382 m ++;
23383 }
23384
23385 } else {
23386
23387 // find the most influencing
23388
23389 var influence, activeInfluenceIndices = [];
23390 var influences = object.morphTargetInfluences;
23391 var i, il = influences.length;

Callers 1

Three66.jsFile · 0.70

Calls 1

enableAttributeFunction · 0.70

Tested by

no test coverage detected