From 91f06a00a710267c4d4fc708ff88d63cc42c46fb Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Thu, 10 Jan 2008 23:15:08 +0000 Subject: raw quake logo loader --- Smoke/Makefile | 2 +- Smoke/glut.c | 157 ---------------------------------------------------- Smoke/glyphs.c | 4 +- Smoke/renderer_gl.c | 33 ++++++++++- Smoke/renderer_gl.h | 3 +- Smoke/smoke.bin | Bin 652385 -> 651186 bytes 6 files changed, 37 insertions(+), 162 deletions(-) delete mode 100644 Smoke/glut.c diff --git a/Smoke/Makefile b/Smoke/Makefile index 035cdcb..16a6559 100644 --- a/Smoke/Makefile +++ b/Smoke/Makefile @@ -2,7 +2,7 @@ # Makefile created by Dev-C++ 4.9.9.2 CPP = g++ -CC = colorgcc -Wall +CC = gcc -Wall OBJ_GTK = funcs.o interact.o fluids.o normals.o smoke.o colormap.o glyphs.o divergence.o isolines.o heightplots.o seedpoint.o streamlines.o flowvis.o palette.o gtk_main.o gtk_colormap.o gtk_glyphs.o gtk_divergence.o gtk_isolines.o gtk_heightplots.o gtk_streamlines.o gtk_flowvis.o gtk.o renderer_gl.o fftw-2.1.3/fftw/config.o fftw-2.1.3/fftw/executor.o fftw-2.1.3/fftw/fftwf77.o fftw-2.1.3/fftw/fftwnd.o fftw-2.1.3/fftw/fn_1.o fftw-2.1.3/fftw/fn_2.o fftw-2.1.3/fftw/fn_3.o fftw-2.1.3/fftw/fn_4.o fftw-2.1.3/fftw/fn_5.o fftw-2.1.3/fftw/fn_6.o fftw-2.1.3/fftw/fn_7.o fftw-2.1.3/fftw/fn_8.o fftw-2.1.3/fftw/fn_9.o fftw-2.1.3/fftw/fn_10.o fftw-2.1.3/fftw/fn_11.o fftw-2.1.3/fftw/fn_12.o fftw-2.1.3/fftw/fn_13.o fftw-2.1.3/fftw/fn_14.o fftw-2.1.3/fftw/fn_15.o fftw-2.1.3/fftw/fn_16.o fftw-2.1.3/fftw/fn_32.o fftw-2.1.3/fftw/fn_64.o fftw-2.1.3/fftw/fni_1.o fftw-2.1.3/fftw/fni_2.o fftw-2.1.3/fftw/fni_3.o fftw-2.1.3/fftw/fni_4.o fftw-2.1.3/fftw/fni_5.o fftw-2.1.3/fftw/fni_6.o fftw-2.1.3/fftw/fni_7.o fftw-2.1.3/fftw/fni_8.o fftw-2.1.3/fftw/fni_9.o fftw-2.1.3/fftw/fni_10.o fftw-2.1.3/fftw/fni_11.o fftw-2.1.3/fftw/fni_12.o fftw-2.1.3/fftw/fni_13.o fftw-2.1.3/fftw/fni_14.o fftw-2.1.3/fftw/fni_15.o fftw-2.1.3/fftw/fni_16.o fftw-2.1.3/fftw/fni_32.o fftw-2.1.3/fftw/fni_64.o fftw-2.1.3/fftw/ftw_2.o fftw-2.1.3/fftw/ftw_3.o fftw-2.1.3/fftw/ftw_4.o fftw-2.1.3/fftw/ftw_5.o fftw-2.1.3/fftw/ftw_6.o fftw-2.1.3/fftw/ftw_7.o fftw-2.1.3/fftw/ftw_8.o fftw-2.1.3/fftw/ftw_9.o fftw-2.1.3/fftw/ftw_10.o fftw-2.1.3/fftw/ftw_16.o fftw-2.1.3/fftw/ftw_32.o fftw-2.1.3/fftw/ftw_64.o fftw-2.1.3/fftw/ftwi_2.o fftw-2.1.3/fftw/ftwi_3.o fftw-2.1.3/fftw/ftwi_4.o fftw-2.1.3/fftw/ftwi_5.o fftw-2.1.3/fftw/ftwi_6.o fftw-2.1.3/fftw/ftwi_7.o fftw-2.1.3/fftw/ftwi_8.o fftw-2.1.3/fftw/ftwi_9.o fftw-2.1.3/fftw/ftwi_10.o fftw-2.1.3/fftw/ftwi_16.o fftw-2.1.3/fftw/ftwi_32.o fftw-2.1.3/fftw/ftwi_64.o fftw-2.1.3/fftw/generic.o fftw-2.1.3/fftw/malloc.o fftw-2.1.3/fftw/planner.o fftw-2.1.3/fftw/putils.o fftw-2.1.3/fftw/rader.o fftw-2.1.3/fftw/timer.o fftw-2.1.3/fftw/twiddle.o fftw-2.1.3/fftw/wisdom.o fftw-2.1.3/fftw/wisdomio.o fftw-2.1.3/rfftw/fcr_1.o fftw-2.1.3/rfftw/fcr_2.o fftw-2.1.3/rfftw/fcr_3.o fftw-2.1.3/rfftw/fcr_4.o fftw-2.1.3/rfftw/fcr_5.o fftw-2.1.3/rfftw/fcr_6.o fftw-2.1.3/rfftw/fcr_7.o fftw-2.1.3/rfftw/fcr_8.o fftw-2.1.3/rfftw/fcr_9.o fftw-2.1.3/rfftw/fcr_10.o fftw-2.1.3/rfftw/fcr_11.o fftw-2.1.3/rfftw/fcr_12.o fftw-2.1.3/rfftw/fcr_13.o fftw-2.1.3/rfftw/fcr_14.o fftw-2.1.3/rfftw/fcr_15.o fftw-2.1.3/rfftw/fcr_16.o fftw-2.1.3/rfftw/fcr_32.o fftw-2.1.3/rfftw/fcr_64.o fftw-2.1.3/rfftw/fcr_128.o fftw-2.1.3/rfftw/fhb_2.o fftw-2.1.3/rfftw/fhb_3.o fftw-2.1.3/rfftw/fhb_4.o fftw-2.1.3/rfftw/fhb_5.o fftw-2.1.3/rfftw/fhb_6.o fftw-2.1.3/rfftw/fhb_7.o fftw-2.1.3/rfftw/fhb_8.o fftw-2.1.3/rfftw/fhb_9.o fftw-2.1.3/rfftw/fhb_10.o fftw-2.1.3/rfftw/fhb_16.o fftw-2.1.3/rfftw/fhb_32.o fftw-2.1.3/rfftw/fhf_2.o fftw-2.1.3/rfftw/fhf_3.o fftw-2.1.3/rfftw/fhf_4.o fftw-2.1.3/rfftw/fhf_5.o fftw-2.1.3/rfftw/fhf_6.o fftw-2.1.3/rfftw/fhf_7.o fftw-2.1.3/rfftw/fhf_8.o fftw-2.1.3/rfftw/fhf_9.o fftw-2.1.3/rfftw/fhf_10.o fftw-2.1.3/rfftw/fhf_16.o fftw-2.1.3/rfftw/fhf_32.o fftw-2.1.3/rfftw/frc_1.o fftw-2.1.3/rfftw/frc_2.o fftw-2.1.3/rfftw/frc_3.o fftw-2.1.3/rfftw/frc_4.o fftw-2.1.3/rfftw/frc_5.o fftw-2.1.3/rfftw/frc_6.o fftw-2.1.3/rfftw/frc_7.o fftw-2.1.3/rfftw/frc_8.o fftw-2.1.3/rfftw/frc_9.o fftw-2.1.3/rfftw/frc_10.o fftw-2.1.3/rfftw/frc_11.o fftw-2.1.3/rfftw/frc_12.o fftw-2.1.3/rfftw/frc_13.o fftw-2.1.3/rfftw/frc_14.o fftw-2.1.3/rfftw/frc_15.o fftw-2.1.3/rfftw/frc_16.o fftw-2.1.3/rfftw/frc_32.o fftw-2.1.3/rfftw/frc_64.o fftw-2.1.3/rfftw/frc_128.o fftw-2.1.3/rfftw/rconfig.o fftw-2.1.3/rfftw/rexec2.o fftw-2.1.3/rfftw/rexec.o fftw-2.1.3/rfftw/rfftwf77.o fftw-2.1.3/rfftw/rfftwnd.o fftw-2.1.3/rfftw/rgeneric.o fftw-2.1.3/rfftw/rplanner.o $(RES) OBJ_GLUT = glut.o fluids.o colormap.o glyphs.o seedpoint.o streamlines.o palette.o funcs.o interact.o fftw-2.1.3/fftw/config.o fftw-2.1.3/fftw/executor.o fftw-2.1.3/fftw/fftwf77.o fftw-2.1.3/fftw/fftwnd.o fftw-2.1.3/fftw/fn_1.o fftw-2.1.3/fftw/fn_2.o fftw-2.1.3/fftw/fn_3.o fftw-2.1.3/fftw/fn_4.o fftw-2.1.3/fftw/fn_5.o fftw-2.1.3/fftw/fn_6.o fftw-2.1.3/fftw/fn_7.o fftw-2.1.3/fftw/fn_8.o fftw-2.1.3/fftw/fn_9.o fftw-2.1.3/fftw/fn_10.o fftw-2.1.3/fftw/fn_11.o fftw-2.1.3/fftw/fn_12.o fftw-2.1.3/fftw/fn_13.o fftw-2.1.3/fftw/fn_14.o fftw-2.1.3/fftw/fn_15.o fftw-2.1.3/fftw/fn_16.o fftw-2.1.3/fftw/fn_32.o fftw-2.1.3/fftw/fn_64.o fftw-2.1.3/fftw/fni_1.o fftw-2.1.3/fftw/fni_2.o fftw-2.1.3/fftw/fni_3.o fftw-2.1.3/fftw/fni_4.o fftw-2.1.3/fftw/fni_5.o fftw-2.1.3/fftw/fni_6.o fftw-2.1.3/fftw/fni_7.o fftw-2.1.3/fftw/fni_8.o fftw-2.1.3/fftw/fni_9.o fftw-2.1.3/fftw/fni_10.o fftw-2.1.3/fftw/fni_11.o fftw-2.1.3/fftw/fni_12.o fftw-2.1.3/fftw/fni_13.o fftw-2.1.3/fftw/fni_14.o fftw-2.1.3/fftw/fni_15.o fftw-2.1.3/fftw/fni_16.o fftw-2.1.3/fftw/fni_32.o fftw-2.1.3/fftw/fni_64.o fftw-2.1.3/fftw/ftw_2.o fftw-2.1.3/fftw/ftw_3.o fftw-2.1.3/fftw/ftw_4.o fftw-2.1.3/fftw/ftw_5.o fftw-2.1.3/fftw/ftw_6.o fftw-2.1.3/fftw/ftw_7.o fftw-2.1.3/fftw/ftw_8.o fftw-2.1.3/fftw/ftw_9.o fftw-2.1.3/fftw/ftw_10.o fftw-2.1.3/fftw/ftw_16.o fftw-2.1.3/fftw/ftw_32.o fftw-2.1.3/fftw/ftw_64.o fftw-2.1.3/fftw/ftwi_2.o fftw-2.1.3/fftw/ftwi_3.o fftw-2.1.3/fftw/ftwi_4.o fftw-2.1.3/fftw/ftwi_5.o fftw-2.1.3/fftw/ftwi_6.o fftw-2.1.3/fftw/ftwi_7.o fftw-2.1.3/fftw/ftwi_8.o fftw-2.1.3/fftw/ftwi_9.o fftw-2.1.3/fftw/ftwi_10.o fftw-2.1.3/fftw/ftwi_16.o fftw-2.1.3/fftw/ftwi_32.o fftw-2.1.3/fftw/ftwi_64.o fftw-2.1.3/fftw/generic.o fftw-2.1.3/fftw/malloc.o fftw-2.1.3/fftw/planner.o fftw-2.1.3/fftw/putils.o fftw-2.1.3/fftw/rader.o fftw-2.1.3/fftw/timer.o fftw-2.1.3/fftw/twiddle.o fftw-2.1.3/fftw/wisdom.o fftw-2.1.3/fftw/wisdomio.o fftw-2.1.3/rfftw/fcr_1.o fftw-2.1.3/rfftw/fcr_2.o fftw-2.1.3/rfftw/fcr_3.o fftw-2.1.3/rfftw/fcr_4.o fftw-2.1.3/rfftw/fcr_5.o fftw-2.1.3/rfftw/fcr_6.o fftw-2.1.3/rfftw/fcr_7.o fftw-2.1.3/rfftw/fcr_8.o fftw-2.1.3/rfftw/fcr_9.o fftw-2.1.3/rfftw/fcr_10.o fftw-2.1.3/rfftw/fcr_11.o fftw-2.1.3/rfftw/fcr_12.o fftw-2.1.3/rfftw/fcr_13.o fftw-2.1.3/rfftw/fcr_14.o fftw-2.1.3/rfftw/fcr_15.o fftw-2.1.3/rfftw/fcr_16.o fftw-2.1.3/rfftw/fcr_32.o fftw-2.1.3/rfftw/fcr_64.o fftw-2.1.3/rfftw/fcr_128.o fftw-2.1.3/rfftw/fhb_2.o fftw-2.1.3/rfftw/fhb_3.o fftw-2.1.3/rfftw/fhb_4.o fftw-2.1.3/rfftw/fhb_5.o fftw-2.1.3/rfftw/fhb_6.o fftw-2.1.3/rfftw/fhb_7.o fftw-2.1.3/rfftw/fhb_8.o fftw-2.1.3/rfftw/fhb_9.o fftw-2.1.3/rfftw/fhb_10.o fftw-2.1.3/rfftw/fhb_16.o fftw-2.1.3/rfftw/fhb_32.o fftw-2.1.3/rfftw/fhf_2.o fftw-2.1.3/rfftw/fhf_3.o fftw-2.1.3/rfftw/fhf_4.o fftw-2.1.3/rfftw/fhf_5.o fftw-2.1.3/rfftw/fhf_6.o fftw-2.1.3/rfftw/fhf_7.o fftw-2.1.3/rfftw/fhf_8.o fftw-2.1.3/rfftw/fhf_9.o fftw-2.1.3/rfftw/fhf_10.o fftw-2.1.3/rfftw/fhf_16.o fftw-2.1.3/rfftw/fhf_32.o fftw-2.1.3/rfftw/frc_1.o fftw-2.1.3/rfftw/frc_2.o fftw-2.1.3/rfftw/frc_3.o fftw-2.1.3/rfftw/frc_4.o fftw-2.1.3/rfftw/frc_5.o fftw-2.1.3/rfftw/frc_6.o fftw-2.1.3/rfftw/frc_7.o fftw-2.1.3/rfftw/frc_8.o fftw-2.1.3/rfftw/frc_9.o fftw-2.1.3/rfftw/frc_10.o fftw-2.1.3/rfftw/frc_11.o fftw-2.1.3/rfftw/frc_12.o fftw-2.1.3/rfftw/frc_13.o fftw-2.1.3/rfftw/frc_14.o fftw-2.1.3/rfftw/frc_15.o fftw-2.1.3/rfftw/frc_16.o fftw-2.1.3/rfftw/frc_32.o fftw-2.1.3/rfftw/frc_64.o fftw-2.1.3/rfftw/frc_128.o fftw-2.1.3/rfftw/rconfig.o fftw-2.1.3/rfftw/rexec2.o fftw-2.1.3/rfftw/rexec.o fftw-2.1.3/rfftw/rfftwf77.o fftw-2.1.3/rfftw/rfftwnd.o fftw-2.1.3/rfftw/rgeneric.o fftw-2.1.3/rfftw/rplanner.o $(RES) LINKOBJ_GLUT = fluids.o colormap.o glyphs.o seedpoint.o streamlines.o palette.o funcs.o interact.o glut.o fftw-2.1.3/fftw/config.o fftw-2.1.3/fftw/executor.o fftw-2.1.3/fftw/fftwf77.o fftw-2.1.3/fftw/fftwnd.o fftw-2.1.3/fftw/fn_1.o fftw-2.1.3/fftw/fn_2.o fftw-2.1.3/fftw/fn_3.o fftw-2.1.3/fftw/fn_4.o fftw-2.1.3/fftw/fn_5.o fftw-2.1.3/fftw/fn_6.o fftw-2.1.3/fftw/fn_7.o fftw-2.1.3/fftw/fn_8.o fftw-2.1.3/fftw/fn_9.o fftw-2.1.3/fftw/fn_10.o fftw-2.1.3/fftw/fn_11.o fftw-2.1.3/fftw/fn_12.o fftw-2.1.3/fftw/fn_13.o fftw-2.1.3/fftw/fn_14.o fftw-2.1.3/fftw/fn_15.o fftw-2.1.3/fftw/fn_16.o fftw-2.1.3/fftw/fn_32.o fftw-2.1.3/fftw/fn_64.o fftw-2.1.3/fftw/fni_1.o fftw-2.1.3/fftw/fni_2.o fftw-2.1.3/fftw/fni_3.o fftw-2.1.3/fftw/fni_4.o fftw-2.1.3/fftw/fni_5.o fftw-2.1.3/fftw/fni_6.o fftw-2.1.3/fftw/fni_7.o fftw-2.1.3/fftw/fni_8.o fftw-2.1.3/fftw/fni_9.o fftw-2.1.3/fftw/fni_10.o fftw-2.1.3/fftw/fni_11.o fftw-2.1.3/fftw/fni_12.o fftw-2.1.3/fftw/fni_13.o fftw-2.1.3/fftw/fni_14.o fftw-2.1.3/fftw/fni_15.o fftw-2.1.3/fftw/fni_16.o fftw-2.1.3/fftw/fni_32.o fftw-2.1.3/fftw/fni_64.o fftw-2.1.3/fftw/ftw_2.o fftw-2.1.3/fftw/ftw_3.o fftw-2.1.3/fftw/ftw_4.o fftw-2.1.3/fftw/ftw_5.o fftw-2.1.3/fftw/ftw_6.o fftw-2.1.3/fftw/ftw_7.o fftw-2.1.3/fftw/ftw_8.o fftw-2.1.3/fftw/ftw_9.o fftw-2.1.3/fftw/ftw_10.o fftw-2.1.3/fftw/ftw_16.o fftw-2.1.3/fftw/ftw_32.o fftw-2.1.3/fftw/ftw_64.o fftw-2.1.3/fftw/ftwi_2.o fftw-2.1.3/fftw/ftwi_3.o fftw-2.1.3/fftw/ftwi_4.o fftw-2.1.3/fftw/ftwi_5.o fftw-2.1.3/fftw/ftwi_6.o fftw-2.1.3/fftw/ftwi_7.o fftw-2.1.3/fftw/ftwi_8.o fftw-2.1.3/fftw/ftwi_9.o fftw-2.1.3/fftw/ftwi_10.o fftw-2.1.3/fftw/ftwi_16.o fftw-2.1.3/fftw/ftwi_32.o fftw-2.1.3/fftw/ftwi_64.o fftw-2.1.3/fftw/generic.o fftw-2.1.3/fftw/malloc.o fftw-2.1.3/fftw/planner.o fftw-2.1.3/fftw/putils.o fftw-2.1.3/fftw/rader.o fftw-2.1.3/fftw/timer.o fftw-2.1.3/fftw/twiddle.o fftw-2.1.3/fftw/wisdom.o fftw-2.1.3/fftw/wisdomio.o fftw-2.1.3/rfftw/fcr_1.o fftw-2.1.3/rfftw/fcr_2.o fftw-2.1.3/rfftw/fcr_3.o fftw-2.1.3/rfftw/fcr_4.o fftw-2.1.3/rfftw/fcr_5.o fftw-2.1.3/rfftw/fcr_6.o fftw-2.1.3/rfftw/fcr_7.o fftw-2.1.3/rfftw/fcr_8.o fftw-2.1.3/rfftw/fcr_9.o fftw-2.1.3/rfftw/fcr_10.o fftw-2.1.3/rfftw/fcr_11.o fftw-2.1.3/rfftw/fcr_12.o fftw-2.1.3/rfftw/fcr_13.o fftw-2.1.3/rfftw/fcr_14.o fftw-2.1.3/rfftw/fcr_15.o fftw-2.1.3/rfftw/fcr_16.o fftw-2.1.3/rfftw/fcr_32.o fftw-2.1.3/rfftw/fcr_64.o fftw-2.1.3/rfftw/fcr_128.o fftw-2.1.3/rfftw/fhb_2.o fftw-2.1.3/rfftw/fhb_3.o fftw-2.1.3/rfftw/fhb_4.o fftw-2.1.3/rfftw/fhb_5.o fftw-2.1.3/rfftw/fhb_6.o fftw-2.1.3/rfftw/fhb_7.o fftw-2.1.3/rfftw/fhb_8.o fftw-2.1.3/rfftw/fhb_9.o fftw-2.1.3/rfftw/fhb_10.o fftw-2.1.3/rfftw/fhb_16.o fftw-2.1.3/rfftw/fhb_32.o fftw-2.1.3/rfftw/fhf_2.o fftw-2.1.3/rfftw/fhf_3.o fftw-2.1.3/rfftw/fhf_4.o fftw-2.1.3/rfftw/fhf_5.o fftw-2.1.3/rfftw/fhf_6.o fftw-2.1.3/rfftw/fhf_7.o fftw-2.1.3/rfftw/fhf_8.o fftw-2.1.3/rfftw/fhf_9.o fftw-2.1.3/rfftw/fhf_10.o fftw-2.1.3/rfftw/fhf_16.o fftw-2.1.3/rfftw/fhf_32.o fftw-2.1.3/rfftw/frc_1.o fftw-2.1.3/rfftw/frc_2.o fftw-2.1.3/rfftw/frc_3.o fftw-2.1.3/rfftw/frc_4.o fftw-2.1.3/rfftw/frc_5.o fftw-2.1.3/rfftw/frc_6.o fftw-2.1.3/rfftw/frc_7.o fftw-2.1.3/rfftw/frc_8.o fftw-2.1.3/rfftw/frc_9.o fftw-2.1.3/rfftw/frc_10.o fftw-2.1.3/rfftw/frc_11.o fftw-2.1.3/rfftw/frc_12.o fftw-2.1.3/rfftw/frc_13.o fftw-2.1.3/rfftw/frc_14.o fftw-2.1.3/rfftw/frc_15.o fftw-2.1.3/rfftw/frc_16.o fftw-2.1.3/rfftw/frc_32.o fftw-2.1.3/rfftw/frc_64.o fftw-2.1.3/rfftw/frc_128.o fftw-2.1.3/rfftw/rconfig.o fftw-2.1.3/rfftw/rexec2.o fftw-2.1.3/rfftw/rexec.o fftw-2.1.3/rfftw/rfftwf77.o fftw-2.1.3/rfftw/rfftwnd.o fftw-2.1.3/rfftw/rgeneric.o fftw-2.1.3/rfftw/rplanner.o $(RES) diff --git a/Smoke/glut.c b/Smoke/glut.c deleted file mode 100644 index fcdaadd..0000000 --- a/Smoke/glut.c +++ /dev/null @@ -1,157 +0,0 @@ -#include - -#include //the GLUT graphics library - -#include //the numerical simulation FFTW library - -#include "fluids.h" -#include "palette.h" -#include "colormap.h" - -#define FALSE 0 -#define TRUE !FALSE - -void do_one_simulation_step(void) -{ - if (!frozen) - { - calculate_one_simulation_step(); - glutPostRedisplay(); - } -} - -//reshape: Handle window resizing (reshaping) events -void reshape(int w, int h) -{ - glViewport(0.0f, 0.0f, (GLfloat)w, (GLfloat)h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45.0f, (GLfloat)w / (GLfloat)h, 0.1, 5000.0f); - //glOrtho(0.0, (GLdouble)w, 0.0, (GLdouble)h, -100, 100); - //glFrustum(-1.0, 1.0, -1.0, 1.0, 0.1, 1000.0); - winWidth = w; winHeight = h; -} - -//display: Handle window redrawing events. Simply delegates to visualize(). -void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - visualize(); - glFlush(); - glutSwapBuffers(); -} - -void setup_menu(void) { - int submenu_color, submenu_oliverscolor, submenu_clamp, submenu_scale, submenu_glyphs, submenu_glyphs_usage, submenu_glyphs_scalar,submenu_glyphs_vector; - - submenu_color = glutCreateMenu(selectColor); - glutAddMenuEntry("Greyscale", COLOR_BLACKWHITE); - glutAddMenuEntry("Rainbow", COLOR_RAINBOW); - glutAddMenuEntry("Band", COLOR_BANDS); - glutAddMenuEntry("Wilrik", COLOR_WILRIK); - glutAddMenuEntry("Oliver", COLOR_OLIVER); - - submenu_glyphs_usage = glutCreateMenu(toggle_glyph_usage); - glutAddMenuEntry("Glyphs", NULL); - - submenu_glyphs_scalar = glutCreateMenu(set_glyph_scalar); - glutAddMenuEntry("Density", SCALAR_RHO); - glutAddMenuEntry("Velocity", SCALAR_VEL); - glutAddMenuEntry("Force", SCALAR_FORCE); - - submenu_glyphs_vector = glutCreateMenu(set_glyph_vector); - glutAddMenuEntry("Velocity", VECTOR_VEL); - glutAddMenuEntry("Force", VECTOR_FORCE); - - submenu_glyphs = glutCreateMenu(NULL); - glutAddSubMenu("Use glyphs", submenu_glyphs_usage); - glutAddSubMenu("Choose scalar field", submenu_glyphs_scalar); - glutAddSubMenu("Choose vector field", submenu_glyphs_vector); - - submenu_oliverscolor = glutCreateMenu(colormap_set_num_colors); - glutAddMenuEntry("0", 0); - glutAddMenuEntry("1", 1); - glutAddMenuEntry("2", 2); - glutAddMenuEntry("4", 4); - glutAddMenuEntry("8", 8); - glutAddMenuEntry("16", 16); - glutAddMenuEntry("32", 32); - glutAddMenuEntry("256", 256); - - submenu_clamp = glutCreateMenu(select_dataset); - glutAddMenuEntry("Rho", DATASET_RHO); - glutAddMenuEntry("Vel", DATASET_VEL); - glutAddMenuEntry("Force", DATASET_FORCE); - glutAddMenuEntry("Velocity divergence", DATASET_DIVV); - glutAddMenuEntry("Force divergence", DATASET_DIVF); - - submenu_scale = glutCreateMenu(toggle_autoscale); - glutAddMenuEntry("Autoscale", NULL); - - glutCreateMenu(NULL); - glutAddSubMenu("Colormap", submenu_color); - glutAddSubMenu("Select Color", submenu_oliverscolor); - glutAddSubMenu("Dataset", submenu_clamp); - glutAddSubMenu("Autoscaling", submenu_scale); - glutAddSubMenu("Glyphs", submenu_glyphs); - glutAttachMenu(GLUT_RIGHT_BUTTON); -} - -//keyboard: Handle key presses -void keyboard(unsigned char key, int x, int y) -{ - switch (key) - { - case 't': dt -= 0.001; break; - case 'T': dt += 0.001; break; - case 'c': color_dir = (color_dir +1) %3; break; - case 'S': vec_scale *= 1.2f; break; - case 's': vec_scale *= 0.8f; break; - case 'V': visc *= 5.0f; break; - case 'v': visc *= 0.2f; break; - case 'y': toggle_glyph_usage(); break; - case 'x': toggle_smoke_usage(); break; - case 'm': scalar_col++; if (scalar_col>COLOR_OLIVER) scalar_col=COLOR_BLACKWHITE; break; - case 'a': frozen = 1-frozen; break; - case 'q': exit(0); break; - case 'r': toggle_mouse_rotate(); break; - case 'e': toggle_seed_insert(); break; - default: break; - } -} - -//main: The main program -int main(int argc, char **argv) -{ - printf("Fluid Flow Simulation and Visualization\n"); - printf("=======================================\n"); - printf("Click and drag the mouse to steer the flow!\n"); - printf("T/t: increase/decrease simulation timestep\n"); - printf("S/s: increase/decrease hedgehog scaling\n"); - printf("c: toggle direction coloring on/off\n"); - printf("V/vy: increase decrease fluid viscosity\n"); - printf("x: toggle drawing matter on/off\n"); - printf("y: toggle drawing hedgehogs on/off\n"); - printf("m: toggle thru scalar coloring\n"); - printf("a: toggle the animation on/off\n"); - printf("q: quit\n\n"); - - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); - glutInitWindowSize(600, 600); - glutCreateWindow("Real-time smoke simulation and visualization"); - glutDisplayFunc(display); - glutReshapeFunc(reshape); - glutIdleFunc(do_one_simulation_step); - glutKeyboardFunc(keyboard); - glutMotionFunc(drag); - glutMouseFunc(click); - - setup_menu(); - - init_simulation(DIM); //initialize the simulation data structures - glutMainLoop(); //calls do_one_simulation_step, keyboard, display, drag, reshape - return 0; -} diff --git a/Smoke/glyphs.c b/Smoke/glyphs.c index c93f9fa..46af00a 100644 --- a/Smoke/glyphs.c +++ b/Smoke/glyphs.c @@ -92,11 +92,11 @@ void glyphs_set_sort(int sort) switch (glyphs_sort) { case GLYPH_ARROWS: - renderer_load_texture("arrow.bmp"); + renderer_load_bmp_texture("arrow.bmp"); break; case GLYPH_QUAKE: - renderer_load_texture("quake.bmp"); + renderer_load_raw_texture("quake.raw"); break; default: diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index 0f91404..9bbd754 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -62,7 +62,37 @@ static int grid_cell_size = 50; -void renderer_load_texture(char *filename) +void renderer_load_raw_texture(char *filename) +{ + FILE *bitmap; + + + bitmap = fopen(filename, "rb"); + if (bitmap > 0) { + unsigned int filesize; + GLsizei width, height; + unsigned char *imagedata; + + fseek(bitmap, 0, SEEK_END); + filesize = ftell(bitmap); + imagedata = (unsigned char *)malloc((size_t)(filesize) /* *(char *) */); + + fseek(bitmap, 0, SEEK_SET); + fread(imagedata, (size_t)(filesize), 1, bitmap); + + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, 120, 120, GL_RGBA, GL_UNSIGNED_BYTE, imagedata); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + free(imagedata); + fclose(bitmap); + } +} + + +void renderer_load_bmp_texture(char *filename) { FILE *bitmap; @@ -251,6 +281,7 @@ static void render_normals(void) glDisable(GL_LIGHTING); glBegin(GL_LINES); glColor3f(0.2f, 1.0f, 0.0f); + glLineWidth(1.0f); for (j = 0; j < DIM - 1; j++) { diff --git a/Smoke/renderer_gl.h b/Smoke/renderer_gl.h index d5afd16..8fc463f 100644 --- a/Smoke/renderer_gl.h +++ b/Smoke/renderer_gl.h @@ -22,7 +22,8 @@ void renderer_reset_roll(void); int renderer_get_grid_cell_size(void); void renderer_set_grid_cell_size(int cell_size); -void renderer_load_texture(char *filename); +void renderer_load_bmp_texture(char *filename); +void renderer_load_raw_texture(char *filename); extern float x_rot; extern float y_rot; diff --git a/Smoke/smoke.bin b/Smoke/smoke.bin index d818e11..0ee48a7 100755 Binary files a/Smoke/smoke.bin and b/Smoke/smoke.bin differ -- cgit v0.12