MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / parseMorphing

Function parseMorphing

webgl/js/three.min.js:7915–7970  ·  view source on GitHub ↗
( scale )

Source from the content-addressed store, hash-verified

7913 };
7914
7915 function parseMorphing( scale ) {
7916
7917 if ( json.morphTargets !== undefined ) {
7918
7919 var i, l, v, vl, dstVertices, srcVertices;
7920
7921 for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {
7922
7923 geometry.morphTargets[ i ] = {};
7924 geometry.morphTargets[ i ].name = json.morphTargets[ i ].name;
7925 geometry.morphTargets[ i ].vertices = [];
7926
7927 dstVertices = geometry.morphTargets[ i ].vertices;
7928 srcVertices = json.morphTargets [ i ].vertices;
7929
7930 for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
7931
7932 var vertex = new THREE.Vector3();
7933 vertex.x = srcVertices[ v ] * scale;
7934 vertex.y = srcVertices[ v + 1 ] * scale;
7935 vertex.z = srcVertices[ v + 2 ] * scale;
7936
7937 dstVertices.push( vertex );
7938
7939 }
7940
7941 }
7942
7943 }
7944
7945 if ( json.morphColors !== undefined ) {
7946
7947 var i, l, c, cl, dstColors, srcColors, color;
7948
7949 for ( i = 0, l = json.morphColors.length; i < l; i++ ) {
7950
7951 geometry.morphColors[ i ] = {};
7952 geometry.morphColors[ i ].name = json.morphColors[ i ].name;
7953 geometry.morphColors[ i ].colors = [];
7954
7955 dstColors = geometry.morphColors[ i ].colors;
7956 srcColors = json.morphColors [ i ].colors;
7957
7958 for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
7959
7960 color = new THREE.Color( 0xffaa00 );
7961 color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );
7962 dstColors.push( color );
7963
7964 }
7965
7966 }
7967
7968 }
7969
7970 };
7971
7972 callback( geometry );

Callers 1

three.min.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected