FlowVisFramework/src/main.cpp File Reference
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <windows.h>
#include <glew.h>
#include <il.h>
#include <GL/glui.h>
#include <io.h>
#include <fcntl.h>
#include "common.h"
#include "FlowData.h"
#include "Transfer.h"
#include "FlowChannel.h"
#include "Streamlines.h"
Go to the source code of this file.
Functions |
void | glutClose (int control) |
void | drawTransferFunction (void) |
void | drawPoints (void) |
void | drawStreamlines (std::vector< float * >) |
void | renderText (float x, float y, void *font, char *string) |
int | initTextures (std::string) |
void | theGame (void) |
void | drawBall (float x, float y, float size) |
void | drawRacket (float x, float y, float size) |
void | drawGates (float gap) |
void | drawBorders (void) |
void | glutIdle (void) |
void | glutDisplay (void) |
void | glutReshape (int x, int y) |
void | glutMouse (int button, int state, int x, int y) |
void | glutMotion (int x, int y) |
void | glutSpecialKey (int key, int x, int y) |
void | glutKeyboard (unsigned char key, int x, int y) |
char * | textFileRead (char *fn) |
void | setShaders () |
void | openFile (int control) |
void | openColor (int control) |
void | saveColor (int control) |
void | startGame (int control) |
void | colorCoding (int control) |
int | main (int argc, char **argv) |
Variables |
int | main_window |
int | g_iWidth = 900 |
int | g_iHeight = 600 |
int | controlsWidth = 160 |
float | xyRatio |
float | winRatio |
int | chX |
int | chY |
int | vel |
int | pre |
int | vor |
FlowData * | dataset |
Transfer * | tf |
int | num |
int | counter |
int | dividedBy = 200 |
int | draggingPoint = -1 |
float * | colorf |
float * | grid |
bool | active = false |
float | shiftRacket = 0 |
float | ballX = .0f |
float | ballY = .0f |
float | ballXSpeed = .0f |
float | ballYSpeed = -0.02f |
float | racketX = .0f |
float | racketY = -.75f |
float | gateGap = .0f |
float | ballSize = .05f |
bool | playGame = false |
bool | lost = false |
bool | won = false |
int | racketHit = 0 |
float | streamlineInfluence = 10000.0f |
const int | sizeX = 64 |
const int | sizeY = 64 |
float * | xyz = new float[sizeX*sizeY*3] |
Streamlines * | sl |
int | streamLineDist = 30 |
float | streamLineStep = 0.01 |
int | maxStreamLineSteps = 50 |
int | drawArrows = 0 |
int | drawEuler = 0 |
int | drawRK = 0 |
int | arrow_distance = 20 |
int | hurricane = 0 |
int | adaptPt = 0 |
int | arrow_size = 10 |
bool | streamLineEChanged = true |
bool | streamLineRKChanged = true |
std::vector< float * > | euler |
std::vector< float * > | rungeKutta |
GLUI * | glui |
GLUI_RadioGroup * | group1 |
GLUI_Scrollbar * | slider |
GLuint | vertex |
GLuint | fragment |
GLuint | p |
GLuint | g_newTexture |
GLuint | g_uExampleTexture |
GLuint | g_PointTexture |
GLuint | g_ArrowTexture |
GLuint | g_BallTexture |
GLuint | velTexture |
GLint | doShade |
GLint | useData |
GLint | plotArrows |
GLint | plotBall |
GLint | arrowSize |
GLint | arrowAngle |
GLint | drawHurricane |
GLint | adaptPtSize |
Function Documentation
void colorCoding |
( |
int |
control |
) |
|
Callback function for GUI. This function takes the values from the radiobox selection. The data selected is displayed and color coded. Also the slider is updated, which lets you set the size of the arrows.
- Parameters:
-
Definition at line 1021 of file main.cpp.
void drawBall |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
size | |
|
) |
| | |
Draw ball for game. A point is drawn at the balls current location and a texture is put on it using point sprites.
- Parameters:
-
| float | x |
| float | y |
| float | size |
Definition at line 600 of file main.cpp.
Draw Borders for Game. Borders are drawn around the image, which th ball cannot cross.
Definition at line 686 of file main.cpp.
void drawGates |
( |
float |
gap |
) |
|
Draw Gates for Game. The gates form the top border of the image. At first this border is closed, but slowly the gates open, creating a gap through which the ball can go through.
- Parameters:
-
Definition at line 656 of file main.cpp.
Draw points on transfer function. When points are saved and loaded, they need to be drawn on the transfer function UI with this method.
Definition at line 447 of file main.cpp.
void drawRacket |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
size | |
|
) |
| | |
Draw Racket for Game. The racket is a red block at the bottom of the playing field, which can be moved with the arrow keys. The racket is used to make the ball bounce back and prevent it from falling down.
- Parameters:
-
| float | x |
| float | y |
| float | size |
Definition at line 637 of file main.cpp.
void drawStreamlines |
( |
std::vector< float * > |
lines |
) |
|
Draw streamlines from data. This function draws the streamlines which were calculated from a given dataset and saved in the vector 'lines'.
- Parameters:
-
| std::vector<float*> | lines |
Definition at line 1034 of file main.cpp.
void drawTransferFunction |
( |
|
) |
|
Draw transfer function on GUI. The transfer function is represented on the GUI by a color flow. The colors are selected by the user. The transfer function is then used for color coding of data.
Definition at line 408 of file main.cpp.
void glutClose |
( |
int |
control |
) |
|
void glutDisplay |
( |
void |
|
) |
|
void glutKeyboard |
( |
unsigned char |
key, |
|
|
int |
x, |
|
|
int |
y | |
|
) |
| | |
void glutMotion |
( |
int |
x, |
|
|
int |
y | |
|
) |
| | |
void glutMouse |
( |
int |
button, |
|
|
int |
state, |
|
|
int |
x, |
|
|
int |
y | |
|
) |
| | |
void glutReshape |
( |
int |
x, |
|
|
int |
y | |
|
) |
| | |
void glutSpecialKey |
( |
int |
key, |
|
|
int |
x, |
|
|
int |
y | |
|
) |
| | |
int initTextures |
( |
std::string |
fname |
) |
|
Initialize all textures and buffers. Creates all textures and buffers needed and perform all actions necessary to display newly loaded data.
- Returns:
- int result
Definition at line 1072 of file main.cpp.
int main |
( |
int |
argc, |
|
|
char ** |
argv | |
|
) |
| | |
void openColor |
( |
int |
control |
) |
|
Open color for transfer function. Opens a dialog to load saved color for the transfer function from a .pts file.
- Parameters:
-
Definition at line 864 of file main.cpp.
void openFile |
( |
int |
control |
) |
|
Load new flow data. Opens a dialog to load a different data file and display its flow data.
- Parameters:
-
Definition at line 803 of file main.cpp.
void renderText |
( |
float |
x, |
|
|
float |
y, |
|
|
void * |
font, |
|
|
char * |
string | |
|
) |
| | |
Render text on a glut window at a given position.
- Parameters:
-
| float | x |
| float | y |
| void* | font |
| char* | string |
Definition at line 503 of file main.cpp.
void saveColor |
( |
int |
control |
) |
|
Save collor from transfer function. Opens a dialog to save the created color from the transfer function to a .pts file.
- Parameters:
-
Definition at line 942 of file main.cpp.
Set shaders for rendering textures. Here all shaders are initialized and settings made to ensure a functioning rendering of textures.
Definition at line 757 of file main.cpp.
void startGame |
( |
int |
control |
) |
|
Start Game. Callback function for the GLUI button which starts the game.
- Parameters:
-
Definition at line 994 of file main.cpp.
char* textFileRead |
( |
char * |
fn |
) |
|
Reads a textfile.
- Parameters:
-
- Returns:
- char text
Definition at line 721 of file main.cpp.
The Game. This function contains all functionality of the game. The ball position is updated and the collision detection with the racket takes place here.
Definition at line 521 of file main.cpp.
Variable Documentation
std::vector<float*> euler |