home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.hitl.washington.edu
/
ftp.hitl.washington.edu.tar
/
ftp.hitl.washington.edu
/
pub
/
people
/
habib
/
kodak
/
variables.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-04-18
|
20KB
|
583 lines
#include "frame_rate.h"
// #include <mmsystem.h> // WinUnix
// #include <winbase.h>
// #include <dsound.h>
#include "define.h"
#define FLAG int
#define html //
double zero1 = 0.0;
double zero2 = 0.0;
double NaN = 999999999;
/* Create checkerboard texture */
#define checkImageWidth 64
#define checkImageHeight 64
static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
static GLuint texName[10];
extern void add_quats (double, double, double);
extern void add_quats (double *, double *, double *);
struct point {float x,y,z;} ;
struct car_location {
float x,y,z;
float quat[4];
};
#define vector point
struct vector vx,vy,vz; // those are fixed vectors defined in initialize_some_var
int number_of_mirrors=0;
float EYE_DISP = 1.0;
struct mirror {
struct point cr, // center of the mirror.
c1, c2, c3, c4, // Those are the 4 corners in the Absolute World coordinate system (lk, up, side) (001, 010, 100)
cc1,cc2,cc3,cc4; // Those are the 4 corners of the mirror in the camera coordinate system. (lk_rt, up_rt, side_rt).
struct vector nl; // normal vector, should have a lenght of 1.
struct vector up; // up vector
struct vector side; // side vector
double width; // this is the width /2
double height; } m1[100]; // this is the height /2
typedef enum {
RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE,
LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE, DINOSAUR
} displayLists;
double angle = -150; /* in degrees */
GLboolean doubleBuffer = GL_TRUE, iconic = GL_FALSE, keepAspect = GL_FALSE;
int beginx, beginy;
double curquat[4];
double curquatc[4]; // curquat for the Car.
double curquat_mirror[4];
double curquat_top_view[4];
double curquat_light0[4];
double curquat_light1[4];
double curquat_Geye[4];
double lastquat_Geye[4];
double lastquat[4];
double lastquat_mirror[4];
double lastquat_top_view[4];
double lastquat_light0[4];
double lastquat_light1[4];
GLdouble bodyWidth = 2.0;
int newModel = 1;
double scalefactor = 1.0;
GLdouble TOP = 5; /* it is the limits of the bounding box */
GLdouble BOTTOM = -5; // -100; /* it is the limits of the bounding box */
GLdouble LEFT = -3; //-1300.8/10.5; /* it is the limits of the bounding box */
GLdouble RIGHT = 3; // 1300.8/10.5; /* it is the limits of the bounding box */
GLdouble TRANSLATE_X = 0; // because when we translate we want the rotation to be in the middle of the
GLdouble TRANSLATE_Y = 0; // screen.
GLdouble TRANSLATE_Z = 5000.0;
GLdouble TRANSLATE_H = 0.0;
GLdouble NEAR2 = 0;
GLdouble FAR2 = 3;
/* *INDENT-OFF* */
GLdouble body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5},
{11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16},
{8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2},
{1, 2} };
GLdouble arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9},
{15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10},
{13, 9}, {11, 11}, {9, 11} };
GLdouble leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0},
{12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} };
GLdouble eyezz[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15},
{9.6, 15.25}, {9, 15.25} };
GLdouble skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0};
char *vrml_city_filename, *vrml_vehicle_filename, *vrml_sensors_filename, *vrml_vehicle_filenames[6][6];
char *vrml_sphere_filename, *texture_directory;
// Structures --------------------------------------------------------------------------- Structures
// Structures -------------------------------------------------------------------------- Structures
// Structures -------------------------------------------------------------------------- Structures
struct bmm {
double bar; /*pr calc xmin xbar xmax ymin... */
double min; /*sans parcourir a chaque fois */
double max; /*trois fois l'array xc, yc, zc. */
} ;
struct color {
char r;
char g;
char b;
};
struct scr_bar
{
// corner of the green square
int x_g_min, x_g_max, y_g_min, y_g_max;
// corner of the red square
int x_r_min, x_r_max, y_r_min, y_r_max;
// corners of the middle square.
int x_m_min, x_m_max, y_m_min, y_m_max;
// corners of the higher triangle
int x_ht_min, x_ht_max, y_ht_min, y_ht_max;
// corners of the lower triangle
int x_lt_min, x_lt_max, y_lt_min, y_lt_max;
};
struct rect
{
int xmin, xmax, ymin, ymax;
};
// Joystick Variables
double myjoyinfoDwPreviousButtons;
FLAG FLAG_MOVE_CAR = 1;
FLAG FLAG_MOVE_SCENE = 1;
FLAG WALK_SLOWLY = 0;
FLAG FLAG_STEREO = 0;
FLAG FLAG_STEREO_NATT = 0;
// Variables of my data (The Cloud of points) ------------------------- Variables of my data (The Cloud of points)
// Variables of my data (The Cloud of points) ------------------------- Variables of my data (The Cloud of points)
// Variables of my data (The Cloud of points) ------------------------- Variables of my data (The Cloud of points)
float *var[100]; // Contains all the variables at hand.
float *var_animation;
double var_animation_min;
double var_animation_max;
char var_name[100][40];
int nbr_of_col = 0;
float *zc; // Contain the z value 4th column (cloud of pts)
float *yc; // Contain the y value 3rd column (cloud of pts)
float *xc; // Contain the x value 2nd column (cloud of pts)
int *col1; // I have 5 column in my data this is the first one
int *col4; // I have 5 column in my data this is the 5th one
double *czz; /* arrays containg the color information of the 3D pts */
double *cyy; /* arrays containg the color information of the 3D pts */
double *cxx; /* arrays containg the color information of the 3D pts */
double xmin,xmin_e ;
double xmax,xmax_e ;
double ymin,ymin_e ;
double ymax,ymax_e ;
double zmin,zmin_e ;
double zmax,zmax_e ;
double delta_min;
double sig_min;
double deltax =1000; // abs (xmax-xmin)
double deltay =1000 ; // abs (ymax-ymin)
double deltaz =1000; // abs (zmax-zmin)
double deltax_n = 500 ; // abs (xmax-xmin) after normalization to have normalized scaling
double deltay_n = 400; // abs (ymax-ymin) after normalization to have normalized scaling
double deltaz_n = 400; // abs (zmax-zmin) after normalization to have normalized scaling
double xbar = 1; /* Ce sont les coordonnes du */
double ybar = 2; /* centre du gravite de la */
double zbar = 3; /* carte de profondeur */
double sigx; // sigmax
double sigy; // sigmay
double sigz; // sigmaz
double sig_x_n; // sigmax after normalization to have normalized scaling
double sig_y_n; // sigmay after normalization to have normalized scaling
double sig_z_n; // sigmaz after normalization to have normalized scaling
int dim[1]; // Number of 3D points => dim[0]-1 is the last indice. [of the point with the Nans].
// Variables for my camera -------------------------------------------- Variables for my camera
// Variables for my camera -------------------------------------------- Variables for my camera
// Variables for my camera -------------------------------------------- Variables for my camera
double transX, transY, transZ;
double baseline = -1.14; // 0.2;
struct point CRot; // it's the center arround which the car is rotating, in the car coordinate system.
// this center is placed by putting the eye at the desired location and clicking on 'a'
// if I am not mistaken (to come).
float GeyeHIGHT = 3;
struct point DriverPos ; //It's the relative position of the eye in the car.
struct point eye,eye1,eye2, eye_mirror,
eyec, // It's where the car is in the scene.
eyeP, // It's the Projection of eye in the car coordinate system:
// that's (lkc_rt, upc_rt, horc_rt.
Geye, // God's eye in the absolute coordinate system (000, 001, 010, 100)
Geye_V, // God's eye in the vehicle coord system (eyec, lkc_rt, upc_rt, horc_rt)
Gup_V, // God's up direction in the vehicle coord system (eyec, lkc_rt, upc_rt, horc_rt)
Glk, Gup, Ghor, // God's lk, up and hor.
lk, up, hor,
lk_rt, up_rt, hor_rt,
lkc_rt,upc_rt, horc_rt,
lkP ,upP, horP, // it's the eye(lk_rt, up_rt, hor_rt) projected in
// lkc_rt, upc_rt, horc_rt;
meye, MEM_POINT, pos_light0, pos_light1, *ScenePts;
// meye is the mirror eye.
// eye is (0,20,-500) eye is the eye after the quaternion rotation
// up is (0,1,0) up_rt is up after the quaternion rotation.
// hor is (1,0,0) hor_rt is hor after the quaternion rotation.
// lk is (0,0,1)
double z,teta=3.1415 ,phi=0,teta2;
double cam_angle = 157;
double aspect_ratio = 1.333;
GLdouble m[4][4],invm [4][4];
GLdouble mc[4][4];
GLfloat mf[4][4],invmf[4][4];
// So that I can draw on memory directly.
// PIXELFORMATDESCRIPTOR pfd ;
// Flags ------------------------------------------------------------------------------------------------ Flags
// Flags ------------------------------------------------------------------------------------------------ Flags
// Flags ------------------------------------------------------------------------------------------------ Flags
FLAG FLAG_DISTORTION_WITH_TEXTURE = 0;
FLAG FLAG_DISTORTION_WITHOUT_TEXTURE = 0;
FLAG FLAG_TEXTURE_MAP_SPHERE = 0;
FLAG FLAG_MOVE_GODS_EYE = 0;
FLAG viewport = 1; // initially no command bar. viewport is the readish command bar
FLAG FLAG_TOP_VIEW = 0;
FLAG FLAG_SELECTED_MIRROR = 0;
FLAG FLAG_TOGGLE_MIRROR[100];
FLAG FLAG_FRONT_VIEW=0;
FLAG FLAG_TOGGLE_MENU1 = 1;
FLAG FLAG_TOGGLE_TEXTURE_MAP;
FLAG DRAW_CARRE1 = 0;
FLAG DRAW_CARRE2 = 0;
FLAG DRAW_CARRE3 = 0;
FLAG FLAG_DROP_MENU= 0;
FLAG TOGGLE_BOX = 0;
FLAG TRANSLATE_TO_GRAVITY=0;
FLAG TRANSLATE_TO_MIDDLE =1;
FLAG displayListInited = 0;
FLAG Draw_relative_axe = 0;
FLAG Draw_light_position = 0;
FLAG spinning = 0;
FLAG expand_carre1 = 0;
FLAG expand_carre2 = 0;
FLAG expand_carre3 = 0;
FLAG APPLY_MOUSE_MOTION = 0;
FLAG FLAG_ORTHO_PERSP = 1; // 0 FOR ORTHO.
FLAG FLAG_FIX_MIRROR = 0;
FLAG FLAG_HORIZ = 0;
FLAG SHOW_LOCATION_DIRECTION_OF_LIGHTS = 0; // show direction or location of lights
FLAG LIGHTS_FIX_WITH_CAMERA = 0;
enum {lights, lights_translate, lights_rotate, walk_slowly, configurations,
save_configuration, other, empty, load_car_num, recordCarMvmt} FLAG_WHICH_KEY_NEXT;
enum {baseline_zoom, rotating, translating, scaling, motion_carre1, motion_carre2, motion_carre3,
vertical_adj,mirror_translate, mirror_translateZ, top_view_com, big_win_com,translatingz,flag_mirror_rotate,
flag_expand_mirror1_x,flag_expand_mirror1_y,flag_expand_mirror1_xy,flag_top_expand_xy,
flag_move_light1, flag_move_light0, flag_rotate_light1, flag_rotate_light0,flag_zoom_y,
rotating_Geye, flag_change_light_intensity }
flag_motion, flag_motion_command,flag_motion_win;
FLAG VIRGULE = 0;
FLAG VIRGULE_AT_END_OF_LINE = 0;
enum {upp, down, bandflag}
flag_elevator;
// int SCALE_DEFAULT = 1 ; not necessary since by default it's 1!!!
int SCALE_SIGMA = 0 ;
int SCALE_MIDDLE = 0 ;
// OpenGl Variables. --------------------------------------------------------------------- OpenGl Variables.
double pt_size = 1.0;
int fraction =1 ; // the fraction of the points displayed.
double fogDensity = 0.02;
// LIGHT Variables.
point Center_Of_Rot_Of_Lights;
GLfloat lightZeroPosition[4] = { 1.0f, 1.0f, 1.0f, 0.0f}; // x,y,z,pos (pos=0 => directional)
GLfloat lightOnePosition[4] = { 1.0f, 1.0f , -1.0f, 0.0f}; // x,y,z,pos (pos=0 => directional)
GLfloat light2Position[4] = { 1.0f, -1.0f, -1.0f, 0.0f}; // x,y,z,pos (pos=0 => directional)
GLfloat light3Position[4] = { 1.0f, -1.0f , 1.0f, 0.0f}; // x,y,z,pos (pos=0 => directional)
GLfloat ambi[] = {0.1f, 0.1f, 0.1f, 0.1f};
GLfloat lightZeroColor[4] = {0.5f, 0.5f, 0.5f, 0.1f};
GLfloat lightOneColor[4] = {0.5f, 0.5f, 0.5f, 0.1f};
GLfloat lightZeroColor_Car[4] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat lightOneColor_Car[4] = {1.0f, 1.0f, 1.0f, 1.0f};
// strings strings -----------------------------------------------------------------strings
char string1[40]; // Z Blue.
char string2[40]; // Y Green.
char string3[40]; // X RED.
char string4[]="Stereo_zoom";
char string5[]="Zoom";
char string6[]="Animation";
char string7[]="Vert_adj.";
char string8[]="Color.";
char string9[]="Pt_Size";
char string10[] = "Mirror_trXY";
char string11[] = "Mirror_tr Z";
char string12[] = "TopView Com";
char string13[] = "Big Win Com";
char string14[] = "Mirror ROT" ;
char string15[] = "Zoom Y" ;
// Variables for the viewport -------------------------------------- Variables for the viewport
struct scr_bar
m1_expand[1], top_expand[1], sb_c3[1];
struct rect
stereo_zoom_rect[1],scaling_rect[1],animation_rect[1],vertical_adj_rect[1], color_rect[1], pt_size_rect[1],
mirror_translate_rect[1], mirror_translateZ_rect[1], big_win_comm[1], top_view_comm[1],mirror_rotate_rect[1],
zoom_y_rect[1];
// Variables for the elevator------------------------------------- Variables for the elevator
struct rect
up_rect[1], down_rect[1],band_rect[1];
double band; //determins the band width of highlight points.
double thresh; // threshhold for window2 (the elevator) (The line).
// GLUT Variables ---------------------------------------------- GLUT Variables
int Menu1_id,Menu2_id,Menu3_id;
int X,Y;
int W = 930, H = 350; // Width / Height of the window.
int CDW = 90; // CDW is the Command De Bord Width.
int W2 = 400, H2 = 150;
int TOP_W=924;//200; // It's the Width of the TOP_VIEW_WINDOW
int TOP_H=340; //200; // It's the Height of the TOP_VIEW_WINDOW
int TOP_V_X = CDW; // It's the lower left corner of the TOP_VIEW_WINDOW
int TOP_V_Y= H-TOP_H; // It's the lower left corner of the TOP_VIEW_WINDOW
int vav = 33; // vav = vertical adjustment value.
int mz[9];
int win; // identifier of the big big windoooooow...
GLubyte TEX_BUF[4][TEX_WIDTH][TEX_HEIGHT][3]; //[TEX_WIDTH][TEX_HEIGHT][3];
GLubyte Distortion_buffer [DistWidth][DistHeight][3];
GLubyte Distortion_buffer_corrected [DistWidth][DistHeight][3];
unsigned char *image;
int im_width[1];
int im_height[1];
// Variables -------------------------------------------------------------------- Variables
double carre1 = 30;
double carre2 = 0;
double carre3 = 0;
double carre1_trans=0.5;
double carre2_trans=0.5;
double carre3_trans=0.5;
double lUPt[16][3] = { 1 , 0 , 0 ,
0 , 1 , 0 ,
0 , 0 , 1 ,
1 , 0.8, 0.3,
0.8, 1 , 0.3,
0.8, 0.3, 1,
1 , 1 , 0 ,
1 , 0 , 1 ,
0 , 1 , 1 ,
1 , 0.3, 0.8,
0.3, 1 , 0.8,
0.3, 0.8, 1,
0.5 , 0.5 , 1,
0.5 , 1 , 0.5,
1 , 0.5, 0.5,
1 , 1 , 1} ;
// Dummy Variables
int i,iti;
int ii,jj,kk,jj1;
double scalair;
float xx,yy,zz;
float xf,yf,zf;
// Variable to calculate the frame rate so that I know my frame rate change depending on the complexity of
// the scene or some other factors such that the hardware acceleration card...
ClassFrameRate FrameRate;
float GS = 1; //12.5; // 12. 5 graphics units / meter.
// Vehicle Variables:
float MaxAccel = 4 ; // meters / second.
float MaxDecel = 8 ; // meters / second.
float Friction_coef = 0.08; // Maximum Speed is = MaxAccel / Friction_coef = 50m/s
float DTime = 0.05;
double car_scale_factor = 1.0;
float HauteurEye = 3.0;
float Masse = 1;
float AccelScalar = 0; // initial acceleration scalar of the eye.
float Speed = 0; // initial velocity of the car.
int Throttle = 0; // This is the digital 6 bits precision for gaz and break.
float Gazf = 0;
int CRISIS = 0;
// LPDIRECTSOUND * ppDS; // DirectSound pointer for use with throttle.
// float teta; // direction.
struct point vecttt;
struct point Gravity;
struct point Force;
struct point Velocity;
struct point Acceleration;
struct point Friction;
struct point Gaz;
struct point Collision;
double SlowIt=1.0; // Slows the walking, Flying, Driving Rate.
// In Draw Vrml new (put here in order to define external variables).
typedef enum { Top_Scene ,n_Transform, n_Shape, n_AccO, n_AccF, n_translation,
n_children, n_Appearance, n_Material, n_shininess, n_transparency, n_diffuseColor,
n_geometry, n_point, n_coordIndex, f_solid, f_colorIndex, f_color, f_texCoordIndex,
f_TextureCoordinate, f_texCoord, f_Coordinate, f_texture, nothing, n_material,nappearance,f_coord,
n_USE, n_DEF, n_IndexedFaceSet, nccw, n_solid, n_TRUE, n_FALSE,n_CroO, n_CroF, n_appearance,n_ccw,
n_TimeSensor} Node_type;
typedef GLfloat SFFloat;
// typedef __int32 SFInt32 ; //WinUnix
#define SFInt32 int;
#define SFVec3f struct point
#define SFNode struct
#define SFBool bool
typedef struct
{
SFFloat *pElements;
int NumElements;
} MFFloat;
typedef struct
{
int *pElements;
int num_el;
} MFInt32;
typedef struct Hab_MFVec3f { SFVec3f *pt;
int num_el;
} MFVec3f;
typedef struct TypeRotation { float x;
float y;
float z;
float teta;
} Type_Rotation;
typedef struct Hab_SFColor { float r;
float g;
float b;
} SFColor;
typedef struct Hab_MFColor {SFColor *pt;
int col_el;
} MFColor;
typedef struct TypeMaterial {
/*exposedField*/ SFFloat ambientIntensity; //0.2 // #á[0,1]
/*exposedField*/ SFColor diffuseColor; //0.8 0.8 0.8 #á[0,1]
/*exposedField*/ SFColor emissiveColor; //0 0 0 #á[0,1]
/*exposedField*/ float shininess; //0.2 #á[0,1]
/*exposedField*/ SFColor specularColor; //0 0 0 #á[0,1]
/*exposedField*/ SFFloat transparency; //0 #á[0,1]
} Material;
typedef struct TypeTexture {
unsigned char *image;
int im_width[1];
int im_height[1];
unsigned int tex_name[10];
char tex_blk[40];
} Type_Texture;
typedef struct TypeAppearance { Material material;
//TextrueTransform textureTransform;
} Type_Appearance;
typedef struct Hab_Pixel {
float x,y;
} Pixel;
typedef struct TypeIndexedFaceSet {
/*exposedField*/ MFColor color;
/*eventIn*/ MFInt32 colorIndex;
/*exposedField*/ MFVec3f coord; //NULL
/*eventIn*/ MFInt32 coordIndex;
/*exposedField*/ Pixel *texCoord; //NULL
/*eventIn*/ MFInt32 texCoordIndex;
/*field*/ SFBool ccw; //TRUE
/*field*/ SFBool solid; //TRUE
int num_el;
} Type_IndexedFaceSet;
typedef struct TypeGeometry {
Type_IndexedFaceSet IndexedFaceSet;
} Type_Geometry;
typedef struct TypeShape {
//Type_Transform *FatherTransform;
Type_Appearance Appearance;
Type_Texture Texture;
Type_Geometry Geometry;
int Acc;
int Cro;
int Id;
} Type_Shape;
typedef struct TypeTransform {
SFVec3f translation;
Type_Rotation rotation;
struct TypeTransform *FatherTransform;
struct TypeTransform **ChildrenTransform;
int numChildTrans; // this is the total number of sons.
int indChildTrans; // this is the actual indice of sons.
Type_Shape **ChildrenShape;
int numChildShape; // this is the total number of sons.
int indChildShape; // this is the actual indice of sons.
int FlagChildren;
Type_Shape *Shape;
int ShapeLeave; // To say if This node has a Shape Leave or not.
Node_type node_type;
int Acc;
int Cro;
} Type_Transform;
extern Type_Transform *CNV, *CNC, *CNSe, *CNVo[6][6], *CNSphere;
double axisup[3] ;
// Other cars moving.
FLAG RECORD_CAR_MVMT; // Flag saying wether we are recording or not.
struct car_location *CarLocationRec[10]; // Used to record the Car Location
int IndexCarLocRec[10]; // Used to Index the Car Location when Recording it.
int CarLocAllocated[10]; // How many are currently allocated.
int MaxIndexCarLocRec[10]; // The maximum number of steps for the car.
char RouteNum[10]; // if RouteNum[i] ==1 => car i is running in the environment.
int RecRouteNum; // The RecRouteNum is the Route Number that is being Recorde.
// If RecRouteNum == 999 => we are not recording any route...
struct point sensors_V[8], sensors_W[8];