downsample() {
		let new_length = (this.data.length / 2) | 0;
		let data = new Float32Array(new_length);
		let min = new Float32Array(new_length);
		let max = new Float32Array(new_length);
		for (let i = 0; i < new_length; i++) {
			let i1 = i * 2;
			let i2 = i1 + 1
			data[i] = (this.data[i1] + this.data[i2]) / 2.0;
			min[i] = Math.min(this.min[i1], this.min[i2]);
			max[i] = Math.max(this.max[i1], this.max[i2]);
		}
		return new MipMapLevel(data, min, max, this.scale * 2);
	}
// Uses box filter to downsample. Guassian may be an improvement.
Uses box filter to downsample. Guassian may be an improvement.
Uses box filter to downsample . Guassian may be an improvement .
downsample() {
		let new_length = (this.data.length / 2) | 0;
		let data = new Float32Array(new_length);
		let min = new Float32Array(new_length);
		let max = new Float32Array(new_length);
		for (let i = 0; i < new_length; i++) {
			let i1 = i * 2;
			let i2 = i1 + 1
			data[i] = (this.data[i1] + this.data[i2]) / 2.0;
			min[i] = Math.min(this.min[i1], this.min[i2]);
			max[i] = Math.max(this.max[i1], this.max[i2]);
		}
		return new MipMapLevel(data, min, max, this.scale * 2);
	}
downsample ( ) { let new_length = ( this . data . length / 2 ) | 0 ; let data = new Float32Array ( new_length ) ; let min = new Float32Array ( new_length ) ; let max = new Float32Array ( new_length ) ; for ( let i = 0 ; i < new_length ; i ++ ) { let i1 = i * 2 ; let i2 = i1 + 1 data [ i ] = ( this . data [ i1 ] + this . data [ i2 ] ) / 2.0 ; min [ i ] = Math . min ( this . min [ i1 ] , this . min [ i2 ] ) ; max [ i ] = Math . max ( this . max [ i1 ] , this . max [ i2 ] ) ; } return new MipMapLevel ( data , min , max , this . scale * 2 ) ; }
Uses box filter to downsample.
Uses box filter to downsample .