//Lew Hill II
// MidiVizTrapezoid

#ifndef _MIDI_VIZ_LIFE_SIM_
#define _MIDI_VIZ_LIFE_SIM_

#include <GL/gl.h>
#include "MidiEvent.h"
#include "NoteColorLookupTable.h"
#include "math.h"

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

#define LS_WALL_WIDTH  (int) 64
#define LS_WALL_HEIGHT (int) 64

using namespace vrj;


class MidiVizLifeSim{

 public:
  MidiVizLifeSim();

  void init();
  void contextInit();
  
  void frame();
  void draw();
 
  void generateTexture();
  
  void processMidiEvent(MidiEvent event);
  
  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:

  GLubyte texture[LS_WALL_HEIGHT][LS_WALL_WIDTH][3];

  int pointsA[LS_WALL_HEIGHT][LS_WALL_WIDTH];
  int pointsB[LS_WALL_HEIGHT][LS_WALL_WIDTH];

  int pointAge[LS_WALL_HEIGHT][LS_WALL_WIDTH];

  int drawPoints; // this is a toggle like flag

  float noteValues[12];

  float position[3];
  float rotation[3];
  float scale[3];

  GLuint wallTextureIndex;

  GlContextData<MidiVizLifeSimContextData>  contextData;

  NoteColorLookupTable color_table;  

  int doUpdate;
};

#endif



