Changeset 5271
- Timestamp:
- May 2, 2008, 2:19:54 PM (17 years ago)
- Location:
- anuga_work/development/anugavis/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anugavis/src/anugavis_simple.c
r5267 r5271 14 14 return 1; 15 15 } 16 printf("%d\n", anugavis.number_of_timesteps); 17 if(AnugaVis_DefineHeightQuantity("elevation", 0, 1, 128, 128, 128) == -1){ 16 if(AnugaVis_DefineHeightQuantity("elevation", 0, 1, 0.5, 0.5, 0.5) == -1){ 18 17 printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError()); 19 18 return 1; 20 19 } 21 if(AnugaVis_DefineHeightQuantity("stage", 0, 1, 0 , 0, 128) == -1){20 if(AnugaVis_DefineHeightQuantity("stage", 0, 1, 0.0, 0.0, 0.5) == -1){ 22 21 printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError()); 23 22 return 1; -
anuga_work/development/anugavis/src/error.h
r5267 r5271 14 14 /* Set the error message with a printf-style format string. 15 15 */ 16 void AnugaVis_SetError(const char *format, ...);16 extern void AnugaVis_SetError(const char *format, ...); 17 17 /* Report a SDL error. 18 18 */ 19 void AnugaVis_SDLError(void);19 extern void AnugaVis_SDLError(void); 20 20 /* Report a NetCDF error. 21 21 */ 22 void AnugaVis_NetCDFError(int ncerr);22 extern void AnugaVis_NetCDFError(int ncerr); 23 23 /* Report an OpenGL error. 24 24 */ 25 void AnugaVis_OpenGLError(GLenum errorCode);25 extern void AnugaVis_OpenGLError(GLenum errorCode); 26 26 27 27 /* Get detailed error information. The returned string should not be -
anuga_work/development/anugavis/src/events.c
r5261 r5271 8 8 # include <OpenGL/gl.h> 9 9 #endif 10 #ifdef HAVE_GL_GLU_H 11 # include <GL/glu.h> 12 #elif HAVE_OPENGL_GLU_H 13 # include <OpenGL/glu.h> 14 #endif 10 15 #include <SDL.h> 11 16 #include "events.h" 12 17 #include "globals.h" 18 #include "height_quantity.h" 13 19 14 20 int AnugaVis_Step(void){ 15 21 SDL_Event event; 16 22 int more = 1; 23 struct height_quantity_simple *height; 17 24 18 25 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 26 glMatrixMode(GL_MODELVIEW); 27 glLoadIdentity(); 28 gluLookAt(anugavis.eye[0], anugavis.eye[1], anugavis.eye[2], 29 anugavis.focus[0], anugavis.focus[1], anugavis.focus[2], 30 0, 0, 1); 31 for(height = anugavis.heights ; height != NULL ; height = height->next) 32 AnugaVis_DrawHeightQuantity(height); 19 33 SDL_GL_SwapBuffers(); 20 34 … … 22 36 switch(event.type){ 23 37 case SDL_KEYDOWN: 24 if(event.key.keysym.sym == SDLK_ESCAPE) more = 0; 38 switch(event.key.keysym.sym){ 39 case SDLK_ESCAPE: 40 more = 0; 41 break; 42 default: 43 break; 44 } 45 break; 46 case SDL_KEYUP: 47 switch(event.key.keysym.sym){ 48 default: 49 break; 50 } 25 51 break; 26 52 } -
anuga_work/development/anugavis/src/events.h
r5261 r5271 1 1 #ifndef EVENTS_H 2 2 #define EVENTS_H 3 4 typedef enum {KEY_FORWARD = 0, 5 KEY_BACKWARD, 6 KEY_STRAFE_LEFT, 7 KEY_STRAFE_RIGHT, 8 KEY_MAX} KEYS; 3 9 4 10 /* Execute a single step of the visualiser. Provided for situations -
anuga_work/development/anugavis/src/globals.h
r5267 r5271 2 2 #define GLOBALS_H 3 3 4 #ifdef HAVE_CONFIG_H 5 # include "config.h" 6 #endif 7 8 #if HAVE_STDINT_H 9 # include <stdint.h> 10 #endif 11 #ifdef HAVE_GL_GL_H 12 # include <GL/gl.h> 13 #elif HAVE_OPENGL_GL_H 14 # include <OpenGL/gl.h> 15 #endif 4 16 #include <SDL.h> 17 #include "events.h" 5 18 #include "height_quantity.h" 6 19 … … 16 29 float *y; 17 30 int *volumes; 31 32 GLfloat eye[3]; 33 GLfloat focus[3]; 34 uint8_t keys[KEY_MAX]; 35 18 36 struct height_quantity_simple *heights; 19 37 } ANUGAVIS; -
anuga_work/development/anugavis/src/height_quantity.c
r5270 r5271 77 77 int AnugaVis_DefineHeightQuantity(const char *name, 78 78 double offset, double scale, 79 int red, int green, int blue){79 GLfloat red, GLfloat green, GLfloat blue){ 80 80 struct height_quantity_simple *height; 81 81 int ncstatus; … … 134 134 height->offset = offset; 135 135 height->scale = scale; 136 height->color = SDL_MapRGB(anugavis.screen->format, red, green, blue); 136 height->red = red; 137 height->green = green; 138 height->blue = blue; 137 139 return 0; 140 } 141 142 void AnugaVis_DrawHeightQuantity(struct height_quantity_simple *height){ 143 glPushMatrix(); 144 /* glScalef(0, 0, height->scale); 145 glTranslatef(0, 0, height->offset); */ 146 glColor3f(height->red, height->green, height->blue); 147 glCallList(height->displayLists); 148 glPopMatrix(); 138 149 } 139 150 -
anuga_work/development/anugavis/src/height_quantity.h
r5270 r5271 6 6 #endif 7 7 8 #if HAVE_STDINT_H 9 # include <stdint.h> 10 #endif 8 11 #ifdef HAVE_GL_GL_H 9 12 # include <GL/gl.h> … … 11 14 # include <OpenGL/gl.h> 12 15 #endif 13 #include <SDL.h> 14 15 struct height_quantity_simple{ 16 struct height_quantity_simple { 16 17 char *name; 17 18 uint8_t frames; 18 19 double offset; 19 20 double scale; 20 Uint32 color; 21 GLfloat red; 22 GLfloat green; 23 GLfloat blue; 21 24 GLuint displayLists; 22 25 struct height_quantity_simple *next; … … 28 31 extern int AnugaVis_DefineHeightQuantity(const char *name, 29 32 double offset, double scale, 30 int red, int green, int blue); 33 GLfloat red, GLfloat green, 34 GLfloat blue); 35 /* Draw a height quantity. 36 */ 37 extern void AnugaVis_DrawHeightQuantity(struct height_quantity_simple *height); 31 38 /* Undefine a given simple height quantity. 32 39 */ -
anuga_work/development/anugavis/src/init.c
r5267 r5271 31 31 anugavis.y = NULL; 32 32 anugavis.volumes = NULL; 33 /* FIXME derive this from the dataset? */ 34 anugavis.eye[0] = 5.0; 35 anugavis.eye[1] = 5.0; 36 anugavis.eye[2] = 20.0; 37 anugavis.focus[0] = 0.0; 38 anugavis.focus[1] = 0.0; 39 anugavis.focus[2] = 0.0; 33 40 anugavis.heights = NULL; 34 41 if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
Note: See TracChangeset
for help on using the changeset viewer.