void SvgGraph::draw_body(ostream& in_stream) { for (auto i : all_thing_to_draw) { in_stream << i.current_circle;//draw circle vector<band> all_bands_on_circle; for (auto j : i.all_bands) { all_bands_on_circle.push_back(j.current_band); } draw_band(in_stream, i.current_circle, all_bands_on_circle);//draw bands for (auto j : i.all_bands)//draw onbands { draw_onbands(in_stream, i.current_circle, j.all_fill_onbands); draw_onbands(in_stream, i.current_circle, j.all_heatmap_onbands); draw_onbands(in_stream, i.current_circle, j.all_histogram_onbands); draw_onbands(in_stream, i.current_circle, j.all_label_onbands); draw_onbands(in_stream, i.current_circle, j.all_tick_onbands); draw_onbands(in_stream, i.current_circle, j.all_linechart_onbands); } for (auto j : i.all_links)//draw links { in_stream << j; } for (auto j : i.all_tracks)//draw tracks { in_stream << j; } } }
void lemuria_background_draw(lemuria_background_t * b, float coords[4][3], int texture_size_x, int texture_size_y, float * texture_offset_y, float texture_advance_y, int * flip_y) { int i; float texture_y_1; float texture_y_2; float band_coords[4][3]; float y_fac; float anti_y_fac; *texture_offset_y += texture_advance_y; if(*texture_offset_y > 1.0) { *texture_offset_y -= 1.0; (*flip_y) = !(*flip_y); } else if(*texture_offset_y < 0.0) { *texture_offset_y += 1.0; (*flip_y) = !(*flip_y); } // fprintf(stderr, "%f\n", *texture_offset_y); /* interpol_y_2 - interpol_y_1 = delta_interpol */ switch(b->config->texture_mode) { case LEMURIA_TEXTURE_GOOM: case LEMURIA_TEXTURE_XAOS: /* Draw first partial band */ if(!*flip_y) { texture_y_1 = 1.0 - *texture_offset_y - TEXTURE_BORDER; texture_y_2 = 1.0 - TEXTURE_BORDER; } else { texture_y_1 = *texture_offset_y + TEXTURE_BORDER; texture_y_2 = TEXTURE_BORDER; } band_coords[0][0] = coords[0][0]; band_coords[0][1] = coords[0][1]; band_coords[0][2] = coords[0][2]; band_coords[1][0] = coords[1][0]; band_coords[1][1] = coords[1][1]; band_coords[1][2] = coords[1][2]; y_fac = *texture_offset_y/(float)texture_size_y; anti_y_fac = 1.0 - y_fac; band_coords[2][0] = coords[1][0] * anti_y_fac + coords[2][0] * y_fac; band_coords[2][1] = coords[1][1] * anti_y_fac + coords[2][1] * y_fac; band_coords[2][2] = coords[1][2] * anti_y_fac + coords[2][2] * y_fac; band_coords[3][0] = coords[0][0] * anti_y_fac + coords[3][0] * y_fac; band_coords[3][1] = coords[0][1] * anti_y_fac + coords[3][1] * y_fac; band_coords[3][2] = coords[0][2] * anti_y_fac + coords[3][2] * y_fac; // fprintf(stderr, "flip_y: %d\n", *flip_y); draw_band(band_coords, texture_y_1, texture_y_2, texture_size_x); /* Draw main part */ for(i = 0; i < texture_size_y - 1; i++) { texture_y_1 = texture_y_2; texture_y_2 = 1.0 - texture_y_2; /* Old top coords -> new bottom coords */ band_coords[0][0] = band_coords[3][0]; band_coords[0][1] = band_coords[3][1]; band_coords[0][2] = band_coords[3][2]; band_coords[1][0] = band_coords[2][0]; band_coords[1][1] = band_coords[2][1]; band_coords[1][2] = band_coords[2][2]; /* New top coords */ y_fac = (*texture_offset_y + (float)(i+1))/(float)texture_size_y; anti_y_fac = 1.0 - y_fac; band_coords[3][0] = coords[0][0] * anti_y_fac + coords[3][0] * y_fac; band_coords[3][1] = coords[0][1] * anti_y_fac + coords[3][1] * y_fac; band_coords[3][2] = coords[0][2] * anti_y_fac + coords[3][2] * y_fac; band_coords[2][0] = coords[1][0] * anti_y_fac + coords[2][0] * y_fac; band_coords[2][1] = coords[1][1] * anti_y_fac + coords[2][1] * y_fac; band_coords[2][2] = coords[1][2] * anti_y_fac + coords[2][2] * y_fac; draw_band(band_coords, texture_y_1, texture_y_2, texture_size_x); } /* Draw final band */ /* Old top coords -> new bottom coords */ band_coords[0][0] = band_coords[3][0]; band_coords[0][1] = band_coords[3][1]; band_coords[0][2] = band_coords[3][2]; band_coords[1][0] = band_coords[2][0]; band_coords[1][1] = band_coords[2][1]; band_coords[1][2] = band_coords[2][2]; band_coords[3][0] = coords[3][0]; band_coords[3][1] = coords[3][1]; band_coords[3][2] = coords[3][2]; band_coords[2][0] = coords[2][0]; band_coords[2][1] = coords[2][1]; band_coords[2][2] = coords[2][2]; texture_y_1 = texture_y_2; if(texture_y_1 > 0.5) { texture_y_2 = 1.0 - (1.0 - *texture_offset_y); } else { texture_y_2 = (1.0 - *texture_offset_y); } draw_band(band_coords, texture_y_1, texture_y_2, texture_size_x); break; case LEMURIA_TEXTURE_CLOUDS: case LEMURIA_TEXTURE_CLOUDS_ROTATE: glBegin(GL_QUADS); glTexCoord2f(0.0, *texture_offset_y); glVertex3f(coords[0][0], coords[0][1], coords[0][2]); glTexCoord2f((float)texture_size_x, *texture_offset_y); glVertex3f(coords[1][0], coords[1][1], coords[1][2]); glTexCoord2f((float)texture_size_x, (float)texture_size_y + *texture_offset_y); glVertex3f(coords[2][0], coords[2][1], coords[2][2]); glTexCoord2f(0.0, (float)texture_size_y + *texture_offset_y); glVertex3f(coords[3][0], coords[3][1], coords[3][2]); glEnd(); break; case LEMURIA_TEXTURE_LEMURIA: glMatrixMode(GL_COLOR); glPushMatrix(); glMultMatrixf(color_matrix); if(glGetError()) fprintf(stderr, "Oops\n"); glBegin(GL_QUADS); glTexCoord2f(0.0, *texture_offset_y); glVertex3f(coords[0][0], coords[0][1], coords[0][2]); glTexCoord2f((float)texture_size_x, *texture_offset_y); glVertex3f(coords[1][0], coords[1][1], coords[1][2]); glTexCoord2f((float)texture_size_x, (float)texture_size_y + *texture_offset_y); glVertex3f(coords[2][0], coords[2][1], coords[2][2]); glTexCoord2f(0.0, (float)texture_size_y + *texture_offset_y); glVertex3f(coords[3][0], coords[3][1], coords[3][2]); glEnd(); glPopMatrix(); break; } }