drawingBand(false)
{
// Hack in loading an analysis
- //mussaAnalysis.load_mupa_file( "examples/mck3test.mupa" );
- //mussaAnalysis.analyze();
- mussaAnalysis.load("mck3test_w30_t20");
+ mussaAnalysis.load_mupa_file( "examples/mck3test.mupa" );
+ mussaAnalysis.analyze(0, 0, Mussa::TransitiveNway, 0.0);
+ //mussaAnalysis.load("mck3test_w30_t20");
updateAnalysis();
}
}
}
+void PathScene::setSoftThreshold(int threshold)
+{
+ if (mussaAnalysis.get_threshold() != threshold) {
+ mussaAnalysis.set_soft_thres(threshold);
+ mussaAnalysis.nway();
+ update();
+ }
+}
+
void PathScene::initializeGL()
{
glEnable(GL_DEPTH_TEST|GL_BLEND);
previousBand.right(), previousBand.bottom());
}
glTranslatef(-X*1000, 0.0, 0.0);
- mussaesque(fragsize, length);
+ mussaesque();
glPopMatrix();
glFlush();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- mussaesque(fragsize, length);
+ mussaesque();
glFlush();
glPopMatrix();
//////
// openGl rendering code
-static void seq_track(long length, long height)
-{
- glLineWidth(5);
- glColor3f(0.9, 0.6, 0.9);
- glBegin(GL_LINES);
- glVertex3f(0.0, (GLfloat)height, -1.0);
- glVertex3f((GLfloat)length, (GLfloat)height, -1.0);
- glEnd();
-}
-
-void PathScene::draw_tracks()
+void PathScene::draw_tracks() const
{
glPushMatrix();
for (vector<GlSequence>::size_type i = 0; i != tracks.size(); ++i )
glPopMatrix();
}
-static void draw_lines(int fragsize, int length)
+void PathScene::draw_lines() const
{
- float depth = 30;
-
- glColor3f(0.3, 0.9, 0.3);
- glLineWidth(0.001);
GLfloat x;
- GLfloat z;
- const long short_sequence_len = 1800000;
- long blocks = short_sequence_len / fragsize;
- for (long base_block=0; base_block < blocks; ++base_block)
+ GLfloat y;
+ const Nway_Paths& nway = mussaAnalysis.paths();
+
+ glLineWidth(0.1);
+ glColor3f(0.9, 0.0, 0.0);
+ vector<GlSequence>::const_iterator track_itor;
+ // To use the refined_pathz, change pathz to refined_pathz, and
+ // change path_itor->begin() to path_itor->begin()+1
+ for(list<vector<int> >::const_iterator path_itor = nway.pathz.begin();
+ path_itor != nway.pathz.end();
+ ++path_itor)
{
- for (long base_offset=0; base_offset < length; ++base_offset)
+ track_itor = tracks.begin();
+ glBegin(GL_LINE_STRIP);
+ for (vector<int>::const_iterator sp_itor = path_itor->begin();
+ sp_itor != path_itor->end();
+ ++sp_itor, ++track_itor)
{
- glBegin(GL_LINE_STRIP);
- x = (GLfloat)(base_block * fragsize +base_offset);
-
- depth -= 0.1;
- if (depth < 20.0) depth = 30.0;
-
- z = -22.0 - (30-ceil(depth));
-
- //std::cout << "Z: " << z << "\n";
-
- glVertex3f(x, 0.0, z );
- glVertex3f(x+200000.0, 100, z );
- glVertex3f(x+100.0, 200, z );
- glEnd();
+ x = *sp_itor;
+ y = track_itor->y();
+ // at some point when we modify the pathz data structure to keep
+ // track of the score we can put grab the depth here.
+ if (x >= 0) {
+ glColor3f(0.9, 0.0, 0.0);
+ } else {
+ x *= -1;
+ glColor3f(0.0, 0.0, 0.9);
+ }
+ glVertex3f(x, y, -1.0);
}
+ glEnd();
}
}
-static GLuint make_line_list(int fragsize, int length)
+GLuint PathScene::make_line_list()
{
GLuint line_list = glGenLists(1);
glNewList(line_list, GL_COMPILE);
- draw_lines(fragsize, length);
+ draw_lines();
glEndList();
return line_list;
}
-void PathScene::mussaesque(int fragments, int length)
+void PathScene::mussaesque()
{
- static GLuint theLines = make_line_list(fragments, length);
+ //static GLuint theLines = make_line_list();
glInitNames();
glPushName(0);
draw_tracks();
glLoadName(10);
//glCallList(theLines);
+ draw_lines();
glPopName();
- //draw_lines();
}