From 9345d3090eea8d48bdedd60e382d66f7ce398b89 Mon Sep 17 00:00:00 2001 From: Wilrik de Loose Date: Fri, 11 Jan 2008 01:32:55 +0000 Subject: 'streamtubes' ongeveer geimplementeerd --- Smoke/Week 2.suo | Bin 78848 -> 78848 bytes Smoke/gtk_streamlines.c | 24 +++++++++++ Smoke/renderer_gl.c | 42 +++++++++++++++++-- Smoke/report/2IV35-Report.log | 92 +++++++++++++++++++++--------------------- Smoke/report/2IV35-Report.pdf | Bin 855419 -> 855426 bytes Smoke/seedpoint.c | 3 +- Smoke/streamlines.c | 11 +++++ Smoke/streamlines.h | 6 +++ 8 files changed, 126 insertions(+), 52 deletions(-) diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo index d9d8c23..f751865 100644 Binary files a/Smoke/Week 2.suo and b/Smoke/Week 2.suo differ diff --git a/Smoke/gtk_streamlines.c b/Smoke/gtk_streamlines.c index 0f1e3c8..d207684 100644 --- a/Smoke/gtk_streamlines.c +++ b/Smoke/gtk_streamlines.c @@ -36,6 +36,13 @@ static gboolean reset_seedpoints(GtkWidget *button, gpointer data) { return TRUE; } +static gboolean select_sort(GtkComboBox *combo, gpointer data) +{ + streamlines_set_sort(gtk_combo_box_get_active(combo)); + + return TRUE; +} + GtkWidget *create_streamlines_page(void) { @@ -124,6 +131,23 @@ GtkWidget *create_streamlines_page(void) gtk_widget_show(frame); + label = gtk_label_new("Select your traceline"); + + gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0); + gtk_widget_show(label); + + combo = gtk_combo_box_new_text(); + + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Streamlines"); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Streamtubes"); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Stream-spheres"); + + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), streamlines_get_sort()); + g_signal_connect(combo, "changed", G_CALLBACK(select_sort), (gpointer)NULL); + + gtk_box_pack_start(GTK_BOX(box), combo, FALSE, TRUE, 0); + gtk_widget_show(combo); + return page; } diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index eccf8b1..e0df386 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -764,7 +764,28 @@ static void render_streamlines(void) struct point p; struct fftw_real_xy *frame_history; fftw_real cell_x, cell_y; - float scale = 10.0f; + float scale = 10.0f; + GLuint lid = glGenLists(1); + GLUquadricObj *qobj = gluNewQuadric(); + + gluQuadricDrawStyle(qobj, GLU_FILL); + gluQuadricNormals(qobj, GLU_FLAT); + gluQuadricOrientation(qobj, GLU_OUTSIDE); + + glDisable(GL_BLEND); + + if (streamlines_get_sort() == STREAMLINES_SORT_TUBES) + { + glNewList(lid, GL_COMPILE); + gluCylinder(qobj, 6.0, 6.0, 16.0, 8, 8); + glEndList(); + } + else if (streamlines_get_sort() == STREAMLINES_SORT_SPHERES) + { + glNewList(lid, GL_COMPILE); + gluSphere(qobj, 10.0f, 8, 8); + glEndList(); + } glLineWidth(2.5f); @@ -775,7 +796,9 @@ static void render_streamlines(void) p = get_seedpoint(i); p.y = winHeight - p.y; - glBegin(GL_LINE_STRIP); + if (streamlines_get_sort() == STREAMLINES_SORT_LINES) { + glBegin(GL_LINE_STRIP); + } for (j = 0; j < HISTORY_SIZE; j++) { @@ -795,9 +818,20 @@ static void render_streamlines(void) p.x += vx * cell_x * scale; p.y += vy * cell_y * scale; - glVertex3f(p.x, p.y, j * cell_x); + if (streamlines_get_sort() == STREAMLINES_SORT_LINES) { + glVertex3f(p.x, p.y, j * cell_x); + } + else { + glPushMatrix(); + glTranslatef(p.x, p.y, j * cell_x); + glCallList(lid); + glPopMatrix(); + } + } + + if (streamlines_get_sort() == STREAMLINES_SORT_LINES) { + glEnd(); } - glEnd(); } glLineWidth(1.0f); } diff --git a/Smoke/report/2IV35-Report.log b/Smoke/report/2IV35-Report.log index 26a2a31..676dd4e 100644 --- a/Smoke/report/2IV35-Report.log +++ b/Smoke/report/2IV35-Report.log @@ -1,4 +1,4 @@ -This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 2007.9.5) 10 JAN 2008 10:48 +This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 2007.9.5) 11 JAN 2008 01:59 entering extended mode **2IV35-Report.tex (2IV35-Report.tex @@ -203,14 +203,14 @@ File: umsb.fd 2002/01/19 v2.2g AMS font definitions ) [2] (chapter1.tex Chapter 1. -Underfull \hbox (badness 10000) in paragraph at lines 3--5 +Underfull \hbox (badness 10000) in paragraph at lines 3--4 [] File: practical.png Graphic file (type png) -Underfull \hbox (badness 10000) in paragraph at lines 11--13 +Underfull \hbox (badness 10000) in paragraph at lines 10--11 [] @@ -219,34 +219,34 @@ Underfull \hbox (badness 10000) in paragraph at lines 11--13 ] -Underfull \hbox (badness 10000) in paragraph at lines 14--16 +Underfull \hbox (badness 10000) in paragraph at lines 12--13 [] -Underfull \hbox (badness 10000) in paragraph at lines 17--19 +Underfull \hbox (badness 10000) in paragraph at lines 14--16 [] ) -Underfull \hbox (badness 10000) in paragraph at lines 20--19 +Underfull \hbox (badness 10000) in paragraph at lines 17--19 [] [4] (chapter2.tex Chapter 2. -Underfull \hbox (badness 10000) in paragraph at lines 3--6 +Underfull \hbox (badness 10000) in paragraph at lines 3--4 [] -Underfull \hbox (badness 10000) in paragraph at lines 9--12 +Underfull \hbox (badness 10000) in paragraph at lines 7--9 [] -Underfull \hbox (badness 10000) in paragraph at lines 13--15 +Underfull \hbox (badness 10000) in paragraph at lines 10--11 [] @@ -257,84 +257,84 @@ File: flow_vis.png Graphic file (type png) ] -Underfull \hbox (badness 10000) in paragraph at lines 21--22 +Underfull \hbox (badness 10000) in paragraph at lines 17--18 [] -Underfull \hbox (badness 10000) in paragraph at lines 25--28 +Underfull \hbox (badness 10000) in paragraph at lines 21--22 [] ) -Underfull \hbox (badness 10000) in paragraph at lines 29--20 +Underfull \hbox (badness 10000) in paragraph at lines 23--20 [] [6 ] (chapter3.tex Chapter 3. -Underfull \hbox (badness 10000) in paragraph at lines 7--10 +Underfull \hbox (badness 10000) in paragraph at lines 7--8 [] -Underfull \hbox (badness 10000) in paragraph at lines 16--18 +Underfull \hbox (badness 10000) in paragraph at lines 15--16 [] -Underfull \hbox (badness 10000) in paragraph at lines 19--21 +Underfull \hbox (badness 10000) in paragraph at lines 17--18 [] +[7 -Underfull \hbox (badness 10000) in paragraph at lines 24--27 - - [] -[7 +] +Underfull \hbox (badness 10000) in paragraph at lines 21--22 + [] -] + File: wilrik.png Graphic file (type png) -Underfull \hbox (badness 10000) in paragraph at lines 37--39 +Underfull \hbox (badness 10000) in paragraph at lines 32--33 [] -Underfull \hbox (badness 10000) in paragraph at lines 44--46 +Underfull \hbox (badness 10000) in paragraph at lines 38--39 [] - -Underfull \hbox (badness 10000) in paragraph at lines 49--52 +[8 ] +Underfull \hbox (badness 10000) in paragraph at lines 42--43 [] -[8 ]) -Underfull \hbox (badness 10000) in paragraph at lines 53--21 +) +Underfull \hbox (badness 10000) in paragraph at lines 44--21 [] [9] (chapter4.tex Chapter 4. -Underfull \hbox (badness 10000) in paragraph at lines 3--5 +Underfull \hbox (badness 10000) in paragraph at lines 3--4 [] -Underfull \hbox (badness 10000) in paragraph at lines 8--9 +Underfull \hbox (badness 10000) in paragraph at lines 7--8 [] File: glyphs.png Graphic file (type png) -Underfull \hbox (badness 10000) in paragraph at lines 15--18 +Underfull \hbox (badness 10000) in paragraph at lines 14--15 [] @@ -343,72 +343,72 @@ Underfull \hbox (badness 10000) in paragraph at lines 15--18 ] -Underfull \hbox (badness 10000) in paragraph at lines 19--21 +Underfull \hbox (badness 10000) in paragraph at lines 16--17 [] -LaTeX Font Info: Try loading font information for OMS+cmr on input line 28. +LaTeX Font Info: Try loading font information for OMS+cmr on input line 23. (C:\MiKTeX\texmf\tex\latex\base\omscmr.fd File: omscmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions ) LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <12> not available -(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 28. +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 23. -Underfull \hbox (badness 10000) in paragraph at lines 30--31 +Underfull \hbox (badness 10000) in paragraph at lines 25--26 [] -Underfull \hbox (badness 10000) in paragraph at lines 39--40 +Underfull \hbox (badness 10000) in paragraph at lines 34--35 [] File: glyphs2.png Graphic file (type png) [11] -Underfull \hbox (badness 10000) in paragraph at lines 46--48 +Underfull \hbox (badness 10000) in paragraph at lines 41--42 [] -Underfull \hbox (badness 10000) in paragraph at lines 51--53 +Underfull \hbox (badness 10000) in paragraph at lines 45--46 [] -Underfull \hbox (badness 10000) in paragraph at lines 56--58 +Underfull \hbox (badness 10000) in paragraph at lines 49--50 [] -Underfull \hbox (badness 10000) in paragraph at lines 59--62 +Underfull \hbox (badness 10000) in paragraph at lines 51--52 [] [12 ] -Underfull \hbox (badness 10000) in paragraph at lines 63--64 +Underfull \hbox (badness 10000) in paragraph at lines 53--54 [] ) [13] (chapter5.tex Chapter 5. -Underfull \hbox (badness 10000) in paragraph at lines 3--5 +Underfull \hbox (badness 10000) in paragraph at lines 3--4 [] -Underfull \hbox (badness 10000) in paragraph at lines 8--10 +Underfull \hbox (badness 10000) in paragraph at lines 7--8 [] -Underfull \hbox (badness 10000) in paragraph at lines 18--20 +Underfull \hbox (badness 10000) in paragraph at lines 16--17 [] -Underfull \hbox (badness 10000) in paragraph at lines 21--23 +Underfull \hbox (badness 10000) in paragraph at lines 18--19 [] @@ -417,7 +417,7 @@ Underfull \hbox (badness 10000) in paragraph at lines 21--23 ]) -Underfull \hbox (badness 10000) in paragraph at lines 26--23 +Underfull \hbox (badness 10000) in paragraph at lines 22--23 [] @@ -732,7 +732,7 @@ Here is how much of TeX's memory you used: 4887 multiletter control sequences out of 60000 13870 words of font info for 54 fonts, out of 500000 for 1000 54 hyphenation exceptions out of 4999 - 27i,6n,22p,229b,203s stack positions out of 1500i,500n,5000p,200000b,32768s + 27i,6n,22p,573b,203s stack positions out of 1500i,500n,5000p,200000b,32768s PDF statistics: 140 PDF objects out of 300000 0 named destinations out of 300000 @@ -745,4 +745,4 @@ esky\cm\cmtt12.pfb> -Output written on 2IV35-Report.pdf (30 pages, 855419 bytes). +Output written on 2IV35-Report.pdf (30 pages, 855426 bytes). diff --git a/Smoke/report/2IV35-Report.pdf b/Smoke/report/2IV35-Report.pdf index 67a504b..09e9680 100644 Binary files a/Smoke/report/2IV35-Report.pdf and b/Smoke/report/2IV35-Report.pdf differ diff --git a/Smoke/seedpoint.c b/Smoke/seedpoint.c index 98a7aff..2342318 100644 --- a/Smoke/seedpoint.c +++ b/Smoke/seedpoint.c @@ -114,8 +114,7 @@ void render_seedpoints(void) gluQuadricDrawStyle(qobj, GLU_FILL); gluQuadricNormals(qobj, GLU_SMOOTH); - gluQuadricOrientation(qobj, GLU_INSIDE); - gluQuadricTexture(qobj, GL_TRUE); + gluQuadricOrientation(qobj, GLU_OUTSIDE); glDisable(GL_BLEND); diff --git a/Smoke/streamlines.c b/Smoke/streamlines.c index 4f28b83..1edfe7d 100644 --- a/Smoke/streamlines.c +++ b/Smoke/streamlines.c @@ -18,6 +18,7 @@ static int streamlines_num_colors = PALETTE_MAXCOLORS; static int streamlines_colormap = PALETTE_BLACKWHITE; static int streamlines_dataset = DATASET_RHO; static float streamlines_alpha = 1.0f; +static int streamlines_sort = STREAMLINES_SORT_LINES; static fftw_real *streamlines_frame; struct fftw_real_xy **streamlines_history_scalars; @@ -52,6 +53,16 @@ int streamlines_get_colormap(void) return streamlines_colormap; } +void streamlines_set_sort(int sort) +{ + streamlines_sort = sort; +} + +int streamlines_get_sort(void) +{ + return streamlines_sort; +} + void streamlines_set_alpha(float alpha) { streamlines_alpha = alpha; diff --git a/Smoke/streamlines.h b/Smoke/streamlines.h index 3e96fd2..f071e41 100644 --- a/Smoke/streamlines.h +++ b/Smoke/streamlines.h @@ -1,6 +1,10 @@ #ifndef _STREAMLINES_H #define _STREAMLINES_H +#define STREAMLINES_SORT_LINES 0 +#define STREAMLINES_SORT_TUBES 1 +#define STREAMLINES_SORT_SPHERES 2 + void streamlines_set_render(int render_streamlines); int streamlines_get_render(void); @@ -22,6 +26,8 @@ fftw_real *streamlines_get_frame(void); void streamlines_set_history_scalars(struct fftw_real_xy **history); struct fftw_real_xy *streamlines_get_history_scalars(int hisdex); +void streamlines_set_sort(int sort); +int streamlines_get_sort(void); struct color4f streamlines_get_color(float value); -- cgit v0.12