Changeset 5339
- Timestamp:
- May 16, 2008, 4:17:15 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
r5292 r5339 14 14 return 1; 15 15 } 16 /* if(AnugaVis_DefineHeightQuantity("elevation", 0.0, 1.0, 0.5, 0.5, 0.5) == -1){ */ 17 /* printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError()); */ 18 /* return 1; */ 19 /* } */ 20 if(AnugaVis_DefineHeightQuantity(" stage", -0.01, 1.0, 0.0, 0.0, 0.5) == -1){16 if(AnugaVis_DefineHeightQuantity("stage", 0.0, 1.0, 0.0, 0.0, 0.5) == -1){ 17 printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError()); 18 return 1; 19 } 20 if(AnugaVis_DefineHeightQuantity("elevation", 0.0, 1.0, 0.5, 0.5, 0.5) == -1){ 21 21 printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError()); 22 22 return 1; -
anuga_work/development/anugavis/src/camera.c
r5330 r5339 70 70 vadd(anugavis.focus, dir, anugavis.focus); 71 71 } 72 73 void camera_strafe(float dist){ 74 vector releye; 75 vector dir; 76 vsub(anugavis.eye, anugavis.focus, releye); 77 vcross(releye, up, dir); 78 vscale(dir, dist/vlen(dir), dir); 79 vadd(anugavis.eye, dir, anugavis.eye); 80 vadd(anugavis.focus, dir, anugavis.focus); 81 } -
anuga_work/development/anugavis/src/camera.h
r5330 r5339 4 4 #define CAMERA_YAW_STEP 0.1 5 5 #define CAMERA_PITCH_STEP 0.1 6 #define CAMERA_TRACK_STEP 1.07 #define CAMERA_STRAFE_STEP 0.16 #define CAMERA_TRACK_STEP 2.0 7 #define CAMERA_STRAFE_STEP 2.0 8 8 9 void camera_pitch(float theta); 10 void camera_yaw(float theta); 11 void camera_track(float dist); 9 extern void camera_pitch(float theta); 10 extern void camera_yaw(float theta); 11 extern void camera_track(float dist); 12 extern void camera_strafe(float dist); 12 13 13 14 #endif -
anuga_work/development/anugavis/src/events.c
r5330 r5339 19 19 #include "height_quantity.h" 20 20 21 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 22 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 23 21 24 int AnugaVis_Step(void){ 25 static Uint32 ticks = 0; 26 static Uint32 lastframe; 22 27 GLfloat lightpos[4]; 23 28 int i; … … 25 30 int more = 1; 26 31 struct height_quantity_simple *height; 32 33 /* Animation. */ 34 /* FIXME needs to respect pause. */ 35 if(ticks == 0) lastframe = ticks = SDL_GetTicks(); 36 else ticks = SDL_GetTicks(); 37 if(ticks - lastframe >= FRAME_INTERVAL){ 38 lastframe = ticks; 39 if(anugavis.current_frame < (signed int)anugavis.number_of_timesteps - 1){ 40 if(!anugavis.paused) anugavis.current_frame++; 41 }else 42 anugavis.paused = 1; 43 } 27 44 28 45 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); … … 35 52 if(anugavis.keys[KEY_FORWARD]) camera_track(-CAMERA_TRACK_STEP); 36 53 if(anugavis.keys[KEY_BACKWARD]) camera_track(CAMERA_TRACK_STEP); 54 if(anugavis.keys[KEY_STRAFE_LEFT]) camera_strafe(CAMERA_STRAFE_STEP); 55 if(anugavis.keys[KEY_STRAFE_RIGHT]) camera_strafe(-CAMERA_STRAFE_STEP); 37 56 gluLookAt(anugavis.eye[0], anugavis.eye[1], anugavis.eye[2], 38 57 anugavis.focus[0], anugavis.focus[1], anugavis.focus[2], … … 57 76 } 58 77 else switch(event.key.keysym.sym){ 59 case SDLK_b: 78 case SDLK_z: 79 anugavis.current_frame = MAX(anugavis.current_frame - 10, 0); 80 break; 81 case SDLK_x: 60 82 if(anugavis.current_frame > 0) anugavis.current_frame--; 61 83 break; 62 case SDLK_f: 63 if(anugavis.current_frame < anugavis.number_of_timesteps - 1) 84 case SDLK_c: 85 case SDLK_SPACE: anugavis.paused = !anugavis.paused; break; 86 case SDLK_v: 87 if(anugavis.current_frame < 88 (signed int)anugavis.number_of_timesteps - 1) 64 89 anugavis.current_frame++; 90 break; 91 case SDLK_b: 92 anugavis.current_frame = MIN(anugavis.current_frame + 10, 93 (signed int)anugavis.number_of_timesteps 94 - 1); 65 95 break; 66 96 case SDLK_ESCAPE: more = 0; break; -
anuga_work/development/anugavis/src/events.h
r5330 r5339 1 1 #ifndef EVENTS_H 2 2 #define EVENTS_H 3 4 #define FRAME_INTERVAL 100 3 5 4 6 typedef enum {KEY_FORWARD = 0, -
anuga_work/development/anugavis/src/globals.h
r5330 r5339 26 26 size_t number_of_volumes; 27 27 size_t number_of_timesteps; 28 size_t current_frame; 28 Sint32 current_frame; 29 uint8_t paused; 29 30 float *x; 30 31 float *y; -
anuga_work/development/anugavis/src/init.c
r5330 r5339 29 29 GLfloat lightDiffuse[] = {1.0, 1.0, 1.0, 1.0}; 30 30 anugavis.current_frame = 0; 31 anugavis.paused = 0; 31 32 anugavis.x = NULL; 32 33 anugavis.y = NULL; -
anuga_work/development/anugavis/src/vector.h
r5330 r5339 4 4 typedef float vector[3]; 5 5 /* Useful vector operations. */ 6 void vadd(const vector v1, const vector v2, vector result);7 float vlen(const vector v);8 void vscale(const vector v, const float scale, vector result);9 void vsub(const vector v1, const vector v2, vector result);10 float vdot(const vector v1, const vector v2);11 void vcross(const vector v1, const vector v2, vector result);6 extern void vadd(const vector v1, const vector v2, vector result); 7 extern float vlen(const vector v); 8 extern void vscale(const vector v, const float scale, vector result); 9 extern void vsub(const vector v1, const vector v2, vector result); 10 extern float vdot(const vector v1, const vector v2); 11 extern void vcross(const vector v1, const vector v2, vector result); 12 12 13 13 #endif
Note: See TracChangeset
for help on using the changeset viewer.