setMorphAt method

void setMorphAt(
  1. int index,
  2. Object3D object
)

Implementation

void setMorphAt(int index, Object3D object ) {
	final objectInfluences = object.morphTargetInfluences;
	final len = objectInfluences.length + 1; // morphBaseInfluence + all influences

	morphTexture ??= DataTexture( Float32Array(len * count!), len, count, RedFormat, FloatType );
	final Float32Array array = morphTexture!.source.data.data;

	double morphInfluencesSum = 0;
	for (int i = 0; i < objectInfluences.length; i ++ ) {
		morphInfluencesSum += objectInfluences[ i ];
	}

	final morphBaseInfluence = geometry!.morphTargetsRelative ? 1.0 : 1 - morphInfluencesSum;
	final dataIndex = len * index;

	array[dataIndex] = morphBaseInfluence;
	array.set(objectInfluences, dataIndex + 1);
}