update method

void update()

Implementation

void update() {
	final audio = this.audio;
	final range = this.range;
	final divisionsInnerAngle = this.divisionsInnerAngle;
	final divisionsOuterAngle = this.divisionsOuterAngle;

	final coneInnerAngle = MathUtils.degToRad( audio.coneInnerAngle );
	final coneOuterAngle = MathUtils.degToRad( audio.coneOuterAngle );

	final halfConeInnerAngle = coneInnerAngle / 2;
	final halfConeOuterAngle = coneOuterAngle / 2;

	int start = 0;
	int count = 0;
	double i;
	int stride;

	final geometry = this.geometry;
	final positionAttribute = geometry?.attributes['position'];

	geometry?.clearGroups();

	void generateSegment(double from,double to,int divisions,int materialIndex ) {
		final double step = ( to - from ) / divisions;

		(positionAttribute as Float32BufferAttribute).setXYZ( start, 0, 0, 0 );
		count ++;

		for ( i = from; i < to; i += step ) {
			stride = start + count;
			positionAttribute.setXYZ( stride, math.sin( i ) * range, 0, math.cos( i ) * range );
			positionAttribute.setXYZ( stride + 1, math.sin( math.min( i + step, to ) ) * range, 0, math.cos( math.min( i + step, to ) ) * range );
			positionAttribute.setXYZ( stride + 2, 0, 0, 0 );

			count += 3;
		}

		geometry?.addGroup( start, count, materialIndex );

		start += count;
		count = 0;
	}

	//

	generateSegment( - halfConeOuterAngle, - halfConeInnerAngle, divisionsOuterAngle, 0 );
	generateSegment( - halfConeInnerAngle, halfConeInnerAngle, divisionsInnerAngle, 1 );
	generateSegment( halfConeInnerAngle, halfConeOuterAngle, divisionsOuterAngle, 0 );

	//

	positionAttribute.needsUpdate = true;

	if ( coneInnerAngle == coneOuterAngle ) (material as GroupMaterial).children[ 0 ].visible = false;

}