/*
 *  VolumePainter.h
 *  lsystems_one
 *
 *  Created by lewhill2 on Fri Mar 12 2004.
 *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef _MIDI_VIZ_VOLUME_PAINTER_H_
#define _MIDI_VIZ_VOLUME_PAINTER_H_

#include "MidiVizVolumePainterCell.h"
#include "MidiVizVolumePainterContextData.h"
#include <vrj/Draw/OGL/GlContextData.h>

#include "NoteColorLookupTable.h"
#include <iostream>
#include "MidiEvent.h"

#define VOLUME_SIZE 50

using namespace vrj;

class MidiVizVolumePainter{

public:
	
	MidiVizVolumePainter(); // constructed with size as a parameter.

	void frame(){
	}
	
	void contextInit();

	void setCursorPosition(int x, int y, int z);
	void moveCursorX(int distance);
	void moveCursorY(int distance);
	void moveCursorZ(int distance);
	void moveCursor(int axis, int distance);
	
	void setColor(float r, float g, float b);

	void fillCell();
	void fillCell(int x, int y, int z, int filled);
	/// filled = 0 ... erase cell
	/// filled = 1 ... fill cell
	
	void emptyCell();
	
	void draw();
	void drawCellObject(int x, int y, int z);

	void doAutomation(int note, float intensity);
	void setAutopilot(int state);

	void processMidiEvent(MidiEvent event);

	void updateColor();

	void drawbox(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1, GLdouble z0, GLdouble z1, GLenum type);
	
        void setPosition(float x, float y, float z ){
          position[0] = x;
          position[1] = y;
          position[2] = z;
        }
        
        void setRotation(float x, float y, float z){
          rotation[0] = x;
          rotation[1] = y;
          rotation[2] = z;
        }
        
        void setScale(float x, float y, float z){
          scale[0] = x;
          scale[1] = y;
          scale[2] = z;
        }
		

private:
	
	MidiVizVolumePainterCell*** data;
	int cursor[3];
	int size[3];
	float color[3];
	float noteValues[12];

	GlContextData<MidiVizVolumePainterContextData>  contextData;	
	
	NoteColorLookupTable note_color_table;				
	int autopilot;
	
	float position[3];
        float rotation[3];
	float scale[3];
	
};

#endif


