#include "graphics_relative.h"#include "../hydro_source/dataFillings.h"Include dependency graph for graphics_main.cpp:

Go to the source code of this file.
Functions | |
| GLuint * | get_texture () |
| bool | getCallibatingPhase () |
| Callibrating phase? | |
| int | my_round (double x) |
| int | nextpoweroftwo (int x) |
| void | SDL_GL_RenderText (char *text, TTF_Font *font, SDL_Color color, SDL_Rect *location) |
| void | glEnable2D () |
| void | glDisable2D () |
| void | setup_opengl (int width, int height) |
| Setup for openGL. | |
| void | load_textures () |
| void | resize_window (int height, int width) |
| Window resize callback. | |
| void | setup_SDL (int width, int height) |
| Setup for openGL. | |
| void | setup_font () |
| On screen display font setup. | |
| void | close_font () |
| On screen display font close. | |
| void | SDL_GL_PrintText (TTF_Font *font, SDL_Color color, SDL_Rect *location, const char *fmt,...) |
| void | draw_panorama () |
| int | DrawGLScene (datas *d) |
| Draws the scene (openGL). | |
| void | process_events (void) |
| Process events. | |
| void | handle_key_down (SDL_keysym *keysym) |
| On key-down event. | |
| void | do_on_keystate (datas *d) |
| On key-down state. | |
| void | pass_joy_parameters (joy_parameters *jP) |
| Copy joystick parameters from MATLAB struct (obsolete (?)). | |
Variables | |
| GLuint | base |
| bool | keys [256] |
| bool | active = TRUE |
| bool | fullscreen = TRUE |
| bool | light |
| GLfloat | viewAngle1 = 0.0 |
| horizontal camera view angle | |
| GLfloat | viewAngle2 = 0.3 |
| vertical camera view angle | |
| GLfloat | dviewAngle = 0.01 |
| GLfloat | viewDist = 50.0 |
| camera view distance | |
| GLfloat | dviewDist = 0.3 |
| GLfloat | LightAmbient [] = { 0.35f, 0.35f, 0.5f, 1.0f } |
| GLfloat | LightDiffuse [] = { 0.6f, 0.6f, 0.6f, 1.0f } |
| GLfloat | LightPosition [] = { -10.0f, 20.0f, 150.0f, 0.0f } |
| bool | done = FALSE |
| bool | doX = TRUE |
| bool | doY = TRUE |
| bool | doZ = TRUE |
| bool | doR = TRUE |
| float | dirX = 1.0f |
| float | dirY = -1.0f |
| float | dirZ = 1.0f |
| float | dirR = 1.0f |
| float | time_before = 0.0 |
| float | time_elapsed |
| float | fps = 0.0 |
| bool | callibratingPhase = TRUE |
| bool | onBoardView = FALSE |
| int | bpp = 0 |
| int | flags = 0 |
| TTF_Font * | font = NULL |
| TTF_Font * | fontBIG = NULL |
| SDL_Surface * | screen |
| SDL_Color | text_color |
| SDL_Rect | text_position |
| GLuint | texture [2] |
Definition in file graphics_main.cpp.
| void close_font | ( | ) |
On screen display font close.
Closes the ttf font
Definition at line 440 of file graphics_main.cpp.
References font.
Referenced by quit_tutorial().
| void do_on_keystate | ( | datas * | d | ) |
On key-down state.
Does what has to be done on keyboard key-down state (long time pressed key)
Definition at line 806 of file graphics_main.cpp.
References datas::angle_girouette, dviewAngle, dviewDist, datas::Hslider_x, datas::max_abs_angle_baume, datas::t, datas::tanAngle_sail, datas::target_x, datas::target_y, time_before, time_elapsed, viewAngle1, viewAngle2, viewDist, datas::Vslider_x, datas::Wave_amp, datas::Wave_amp0, datas::Wave_amp1, datas::Wave_amp2, datas::Wind, datas::Wind_angle, datas::Wind_x, and datas::Wind_y.
Referenced by main().
| void draw_panorama | ( | ) |
Definition at line 476 of file graphics_main.cpp.
References f(), texture, and viewAngle1.
Referenced by DrawGLScene().
| int DrawGLScene | ( | datas * | d | ) |
Draws the scene (openGL).
Draws the scene by appling all necessary geometrical (spacial) transformations and by calling the different element drawing functions (for the boat, the sea, the instruments...). This is not the highest function for drwaing the current scene, see draw_graphics().
Definition at line 529 of file graphics_main.cpp.
References angles_update(), Boat_draw(), callibratingPhase, dirR, dirX, dirY, dirZ, doR, doX, doY, doZ, draw_panorama(), Draw_sea(), datas::dx, datas::dy, f(), font, fontBIG, fps, Girouette_draw(), glDisable2D(), glEnable2D(), HSlider_draw(), datas::Hslider_x, is_there_a_joystick(), joystick_getXYZR(), LightPosition, onBoardView, datas::phi, datas::psi, RelativeWind_draw(), Sail_create_and_draw(), screen, SDL_GL_PrintText(), Target_draw(), datas::target_x, datas::target_y, text_color, text_position, datas::theta, time_elapsed, viewAngle1, viewAngle2, viewDist, VSlider_draw(), datas::Vslider_x, wave_z_compute(), datas::Wind, datas::Wind_x, datas::Wind_y, datas::x, datas::y, and datas::z.
Referenced by main().
| GLuint* get_texture | ( | ) |
Definition at line 76 of file graphics_main.cpp.
References texture.
Referenced by Sail_create_and_draw().
| bool getCallibatingPhase | ( | ) |
Callibrating phase?
Returns true if the program is in the joystick callibrating phase
Definition at line 81 of file graphics_main.cpp.
References callibratingPhase.
Referenced by main().
| void glDisable2D | ( | ) |
| void glEnable2D | ( | ) |
| void handle_key_down | ( | SDL_keysym * | keysym | ) |
On key-down event.
Does what has to be done on keyboard key-down event (on time hit)
Definition at line 760 of file graphics_main.cpp.
References callibratingPhase, dirR, dirX, dirY, dirZ, doR, doX, doY, doZ, onBoardView, and quit_tutorial().
Referenced by process_events().
| void load_textures | ( | ) |
Definition at line 290 of file graphics_main.cpp.
References texture.
Referenced by resize_window(), and setup_SDL().
| int my_round | ( | double | x | ) |
| int nextpoweroftwo | ( | int | x | ) |
Definition at line 92 of file graphics_main.cpp.
References my_round().
Referenced by SDL_GL_RenderText().
| void pass_joy_parameters | ( | joy_parameters * | jP | ) |
Copy joystick parameters from MATLAB struct (obsolete (?)).
Copy the joystick parameters (doX, doY ,doZ ,doR and dirX ,dirY ,diZ ,dirR) from the MATLAB struct *jP to the local joystick parameters variables.
| *jP | : Structure comming from MATLAB or filled with default values defining joystick axes usage and direction. |
Definition at line 881 of file graphics_main.cpp.
References dirR, joy_parameters::dirR, dirX, joy_parameters::dirX, dirY, joy_parameters::dirY, dirZ, joy_parameters::dirZ, doR, joy_parameters::doR, doX, joy_parameters::doX, doY, joy_parameters::doY, doZ, and joy_parameters::doZ.
Referenced by main().
| void process_events | ( | void | ) |
Process events.
Treats events like keyboard event,...
Definition at line 733 of file graphics_main.cpp.
References handle_key_down(), quit_tutorial(), and resize_window().
Referenced by main().
| void resize_window | ( | int | height, | |
| int | width | |||
| ) |
Window resize callback.
This function is called when the user modifies the window size
| height | : height in pixels | |
| width | : width in pixels |
Definition at line 337 of file graphics_main.cpp.
References bpp, flags, load_textures(), quit_tutorial(), screen, and setup_opengl().
Referenced by process_events().
| void SDL_GL_PrintText | ( | TTF_Font * | font, | |
| SDL_Color | color, | |||
| SDL_Rect * | location, | |||
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 454 of file graphics_main.cpp.
References SDL_GL_RenderText().
Referenced by DrawGLScene().
| void SDL_GL_RenderText | ( | char * | text, | |
| TTF_Font * | font, | |||
| SDL_Color | color, | |||
| SDL_Rect * | location | |||
| ) |
Definition at line 101 of file graphics_main.cpp.
References f(), nextpoweroftwo(), and texture.
Referenced by SDL_GL_PrintText().
| void setup_font | ( | ) |
On screen display font setup.
On screen display is done using the SDL_ttf library. This function does the setups for SDL_ttf and load the ttf font from file
Definition at line 423 of file graphics_main.cpp.
Referenced by main().
| void setup_opengl | ( | int | width, | |
| int | height | |||
| ) |
Setup for openGL.
Does all the setup things neede by openGL
| height | : height in pixels | |
| width | : width in pixels |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition at line 256 of file graphics_main.cpp.
References f(), LightAmbient, LightDiffuse, and LightPosition.
Referenced by main(), and resize_window().
| void setup_SDL | ( | int | width, | |
| int | height | |||
| ) |
Setup for openGL.
Does all the setup things neede by SDL
| height | : height in pixels | |
| width | : width in pixels |
Definition at line 356 of file graphics_main.cpp.
References bpp, flags, load_textures(), quit_tutorial(), and screen.
Referenced by main().
| bool active = TRUE |
Definition at line 20 of file graphics_main.cpp.
| GLuint base |
Definition at line 16 of file graphics_main.cpp.
| int bpp = 0 |
| bool callibratingPhase = TRUE |
Definition at line 54 of file graphics_main.cpp.
Referenced by DrawGLScene(), getCallibatingPhase(), and handle_key_down().
| float dirR = 1.0f |
Definition at line 50 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| float dirX = 1.0f |
Definition at line 47 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| float dirY = -1.0f |
Definition at line 48 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| float dirZ = 1.0f |
Definition at line 49 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| bool done = FALSE |
Definition at line 40 of file graphics_main.cpp.
| bool doR = TRUE |
Definition at line 46 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| bool doX = TRUE |
Definition at line 43 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| bool doY = TRUE |
Definition at line 44 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| bool doZ = TRUE |
Definition at line 45 of file graphics_main.cpp.
Referenced by DrawGLScene(), handle_key_down(), and pass_joy_parameters().
| GLfloat dviewAngle = 0.01 |
| GLfloat dviewDist = 0.3 |
| int flags = 0 |
| TTF_Font* font = NULL |
Definition at line 63 of file graphics_main.cpp.
Referenced by close_font(), DrawGLScene(), and setup_font().
| TTF_Font* fontBIG = NULL |
| float fps = 0.0 |
| bool fullscreen = TRUE |
Definition at line 21 of file graphics_main.cpp.
| bool keys[256] |
Definition at line 19 of file graphics_main.cpp.
| bool light |
Definition at line 23 of file graphics_main.cpp.
| GLfloat LightAmbient[] = { 0.35f, 0.35f, 0.5f, 1.0f } |
| GLfloat LightDiffuse[] = { 0.6f, 0.6f, 0.6f, 1.0f } |
| GLfloat LightPosition[] = { -10.0f, 20.0f, 150.0f, 0.0f } |
| bool onBoardView = FALSE |
Definition at line 55 of file graphics_main.cpp.
Referenced by DrawGLScene(), and handle_key_down().
| SDL_Surface* screen |
Definition at line 65 of file graphics_main.cpp.
Referenced by DrawGLScene(), glEnable2D(), resize_window(), and setup_SDL().
| SDL_Color text_color |
| SDL_Rect text_position |
| GLuint texture[2] |
Definition at line 72 of file graphics_main.cpp.
Referenced by draw_panorama(), get_texture(), load_textures(), Sail_create_and_draw(), and SDL_GL_RenderText().
| float time_before = 0.0 |
| float time_elapsed |
| GLfloat viewAngle1 = 0.0 |
horizontal camera view angle
Definition at line 27 of file graphics_main.cpp.
Referenced by do_on_keystate(), draw_panorama(), and DrawGLScene().
| GLfloat viewAngle2 = 0.3 |
vertical camera view angle
Definition at line 28 of file graphics_main.cpp.
Referenced by do_on_keystate(), and DrawGLScene().
| GLfloat viewDist = 50.0 |
camera view distance
Definition at line 30 of file graphics_main.cpp.
Referenced by do_on_keystate(), and DrawGLScene().
1.4.7