package com.haxademic.app.haxmapper.textures;

import com.haxademic.core.app.P;

public class TextureEQGrid 
extends BaseTexture {

	protected int _numLines;
	protected boolean _is3D = false;
	
	protected float _cols = 32;
	protected float _rows = 32;
	protected float _amp = 20;
	protected float _spectrumInterval = 512f / (_cols * _rows);	// 256 keeps it in the bottom half of the spectrum since the high ends is so overrun
	protected float _cellW;
	protected float _cellH;


	public TextureEQGrid( int width, int height ) {
		super();

		buildGraphics( width, height );
		
		_cellW = P.ceil( _texture.width/_cols );
		_cellH = P.ceil( _texture.height/_rows );
	}
	
	public void update() {
		super.update();
		
		_texture.beginDraw();
		_texture.clear();
		
		// draw grid
		float startX = 0;
		float startY = 0;
		int spectrumIndex = 0;
		_texture.noStroke();
		for (int i = 0; i < _cols; i++) {
			for (int j = 0; j < _rows; j++) {
				float alphaVal = P.p.audioIn.getEqBand( P.floor(_spectrumInterval * spectrumIndex) );
				_texture.fill( _colorEase.colorInt(), P.constrain( alphaVal * 255f, 0, 255 ) );
				_texture.rect( startX + i*_cellW, startY + j*_cellH, _cellW, _cellH );	
				spectrumIndex++;
			}
		}
		
		_texture.endDraw();
	}
}

@@ -72,16 +72,57 @@
 e.app.P;
+%0Aimport com.haxademic.core.math.MathUtil;
 %0A%0Apublic
@@ -170,70 +170,8 @@
  %7B%0A%0A
-%09protected int _numLines;%0A%09protected boolean _is3D = false;%0A%09%0A
 %09pro
@@ -228,36 +228,8 @@
 32;%0A
-%09protected float _amp = 20;%0A
 %09pro
@@ -420,16 +420,55 @@
 _cellH;%0A
+%09protected boolean _boxesGrow = false;%0A
 %0A%0A%09publi
@@ -651,16 +651,91 @@
 );%0A%09%7D%0A%09%0A
+%09public void newLineMode() %7B%0A%09%09_boxesGrow = MathUtil.randBoolean(P.p);%0A%09%7D%0A%0A
 %09public 
@@ -994,16 +994,462 @@
  j++) %7B%0A
+%09%09%09%09if( _boxesGrow ) %7B%0A%09%09%09%09%09float scaleVal = P.constrain( 0.1f * P.p.audioIn.getEqBand( P.floor(_spectrumInterval * spectrumIndex) ), 0, 1 );%0A%09%09%09%09%09_texture.fill( _colorEase.colorInt() );%0A%09%09%09%09%09_texture.rect( %0A%09%09%09%09%09%09startX + i*_cellW + _cellW * 0.5f - (_cellW * scaleVal * 0.5f), %0A%09%09%09%09%09%09startY + j*_cellH + _cellH * 0.5f - (_cellH * scaleVal * 0.5f), %0A%09%09%09%09%09%09_cellW * scaleVal, %0A%09%09%09%09%09%09_cellH * scaleVal %0A%09%09%09%09%09);%09%0A%09%09%09%09%09spectrumIndex++;%0A%09%09%09%09%7D else %7B%0A%09
 %09%09%09%09floa
@@ -1526,24 +1526,25 @@
 umIndex) );%0A
+%09
 %09%09%09%09_texture
@@ -1611,24 +1611,25 @@
 0, 255 ) );%0A
+%09
 %09%09%09%09_texture
@@ -1692,24 +1692,25 @@
 llH );%09%0A%09%09%09%09
+%09
 spectrumInde
@@ -1714,16 +1714,22 @@
 ndex++;%0A
+%09%09%09%09%7D%0A
 %09%09%09%7D%0A%09%09%7D

Add another drawing mode