Al's Programming Resource Homepage  Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

main.cpp File Reference

#include <windows.h>
#include "shared.h"
#include "general.h"
#include "object.h"
#include "camera.h"
#include "vector.h"
#include "vertex.h"
#include "quat.h"
#include "matrix.h"
#include "texture.h"
#include "locmath.h"
#include "polygon.h"
#include "collision.h"
#include "glfont.h"
#include "flare.h"
#include "console.h"
#include "mmgr.h"
#include "log.h"
#include "selection.h"
#include "resource.rh"

Go to the source code of this file.

Functions

void InitGL (int Width, int Height)
void ReSizeGLScene (int Width, int Height)
void DrawGLScene (void)
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int)

Variables

int selectedPolygon = -1
int MouseX
int MouseY
int g_iMouseLastX
int g_iMouseLastY
int g_iMouseDeltaX
int g_iMouseDeltaY
int g_bLeftMouseDrag
int g_bRightMouseDrag
HGLRC hRC
HDC hDC
HWND hWnd
RECT screen
PAINTSTRUCT ps
float pi = 3.141592
float radian = pi / 180
float epsilon = 0.05
bool key [256]
bool released_key [256]
int currentCamera = 0
int numCameras = 4
float step = 5.0
float lasttime
float multiplier
const int average = 10
float lastmultiplier [average]
int fps
int GL_LIGHT [8] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7}
int currentLight = 0
int numLights = 0
POLYGONpolygon = new POLYGON[12]
TEXTUREtexture = new TEXTURE[8]
CAMERAcamera = new CAMERA[numCameras + 1]
CAMERA LastCam
LIGHTlight = new LIGHT[numLights + 1]
float lightColor [3] = {1.0, 1.0, 1.0}
int DialogInUse = 0
int testint
float testfloat
char teststring [64]
GLFONT myFont
float SunPosition [3]


Function Documentation

void DrawGLScene void   
 

Definition at line 116 of file main.cpp.

References LIGHT::Apply(), CheckForCollision(), currentCamera, DrawCone(), DrawCube(), DrawLensFlare(), DrawSkybox(), DrawSphere(), DrawTerrain(), CollisionPacket::eRadius, fps, glFontBegin(), glFontEnd(), glFontTextOut(), numLights, OBJECT::Position, selectedPolygon, CollisionPacket::sourcePoint, CollisionPacket::velocity, VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by WinMain().

00117 {
00118     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00119 
00120     LastCam = camera[currentCamera];
00121     camera[currentCamera].Update();
00122 
00123     CollisionPacket cp;
00124     cp.eRadius.x = 1.0;
00125     cp.eRadius.y = 1.0;
00126     cp.eRadius.z = 1.0;
00127     cp.sourcePoint.x = LastCam.Position.x;
00128     cp.sourcePoint.y = LastCam.Position.y;
00129     cp.sourcePoint.z = LastCam.Position.z;
00130     cp.velocity.x = camera[currentCamera].Position.x - LastCam.Position.x;
00131     cp.velocity.y = camera[currentCamera].Position.y - LastCam.Position.y;
00132     cp.velocity.z = camera[currentCamera].Position.z - LastCam.Position.z;
00133 
00134     CheckForCollision(polygon, &camera[currentCamera].Position, &cp);
00135 
00136     camera[currentCamera].Apply();
00137     camera[currentCamera].Delta_x = 0.0;                   // Clear camera rotation deltas
00138     camera[currentCamera].Delta_y = 0.0;
00139     camera[currentCamera].Delta_z = 0.0;
00140 
00141     int loop;
00142     for(loop = 0; loop <= numLights; loop++)
00143         light[loop].Apply();
00144 
00145     DrawSkybox(camera, texture);
00146     DrawCube(polygon, texture);
00147     DrawCone();
00148     DrawSphere();
00149     DrawTerrain(texture);     
00150     DrawLensFlare();   // Draw the lens flare after all other objects
00151 
00152 // Draw text
00153     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00154     glDisable(GL_LIGHTING);
00155     glColor3f(0.0, 1.0, 0.0);
00156     glEnable(GL_BLEND);
00157     glDisable(GL_DEPTH_TEST);
00158     glPushMatrix();
00159     glLoadIdentity();
00160     glFontBegin(&myFont);
00161     char text[256];
00162 
00163     glFontTextOut("Tutorial #22", -37, 27, -70);
00164 
00165     sprintf(text, "FPS = %d", fps);
00166     glFontTextOut(text, -52, 34, -100);
00167 
00168     glFontTextOut("Press R to change the lens flare", -52, 30, -100);
00169     glFontTextOut("Click and hold left mouse button to rotate the camera", -52, 26, -100);
00170     glFontTextOut("Double click the left mouse button on the cube to select a polygon", -52, 22, -100);
00171     sprintf(text, "Currently selected polygon = %d", selectedPolygon);
00172     glFontTextOut(text, -52, 18, -100);
00173 
00174     glFontEnd();
00175     glPopMatrix();
00176     glEnable(GL_DEPTH_TEST);
00177     glDisable(GL_BLEND);
00178     glEnable(GL_LIGHTING);
00179 }

void InitGL int    Width,
int    Height
 

Definition at line 97 of file main.cpp.

References glFontCreate(), InitializeLensFlare(), SetGLCamera(), SetGLLighting(), SetGLMaterial(), SetGLProperties(), SetGLTexture(), SetGLView(), SetGLWorld(), and SunPosition.

Referenced by WndProc().

00098 {
00099     glFeedbackBuffer(4, GL_3D, SunPosition);
00100     SetGLProperties();
00101     SetGLMaterial();
00102     SetGLView(Width, Height);
00103     SetGLLighting();
00104     SetGLWorld(polygon);
00105     SetGLTexture(texture);
00106     SetGLCamera(camera);
00107     glFontCreate(&myFont, "roman.glf", 200);
00108     InitializeLensFlare();            
00109 }

void ReSizeGLScene int    Width,
int    Height
 

Definition at line 111 of file main.cpp.

References SetGLView().

Referenced by WndProc().

00112 {
00113     SetGLView(Width, Height);
00114 }

int WINAPI WinMain HINSTANCE    hInstance,
HINSTANCE   ,
LPSTR   ,
int   
 

Definition at line 373 of file main.cpp.

References average, currentCamera, currentLight, DialogInUse, DrawGLScene(), FALSE, GetTimePassed(), hDC, hRC, hWnd, key, lastmultiplier, lasttime, multiplier, numCameras, numLights, released_key, ResetLensFlare(), screen, step, TRUE, and WndProc().

00377 {
00378     MSG        msg;
00379     WNDCLASSEX    wc;
00380 
00381     GetWindowRect(GetDesktopWindow(), &screen);
00382     wc.cbSize = sizeof(WNDCLASSEX);
00383     wc.style            = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_SAVEBITS;
00384     wc.lpfnWndProc        = (WNDPROC) WndProc;
00385     wc.cbClsExtra        = 0;
00386     wc.cbWndExtra        = 0;
00387     wc.hInstance        = hInstance;
00388     wc.hIcon            = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
00389     wc.hIconSm          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
00390     wc.hCursor            = LoadCursor(NULL, IDC_ARROW);
00391     wc.hbrBackground    = NULL;
00392     wc.lpszMenuName        = NULL;
00393     wc.lpszClassName    = "OpenGL WinClass";
00394 
00395 
00396     if(!RegisterClassEx(&wc))
00397     {
00398         MessageBox(NULL,"Failed To Register The Window Class.","Error",MB_OK|MB_ICONERROR);
00399         return FALSE;
00400     }
00401 
00402     hWnd = CreateWindowEx(
00403     WS_EX_LEFT,
00404     "OpenGL WinClass",
00405     "OpenGL & Win32 Tutorial No.7",
00406     WS_MAXIMIZE |
00407     WS_CLIPCHILDREN |
00408     WS_CLIPSIBLINGS |
00409     WS_POPUPWINDOW |
00410     WS_VISIBLE,
00411     0, 0,
00412     screen.right, screen.bottom,
00413     NULL,
00414     NULL,
00415     hInstance,
00416     NULL);
00417 
00418     if(!hWnd)
00419     {
00420         MessageBox(NULL,"Window Creation Error.","Error",MB_OK|MB_ICONERROR);
00421         return FALSE;
00422     }
00423 
00424     DEVMODE dmScreenSettings;
00425     memset(&dmScreenSettings, 0, sizeof(DEVMODE));
00426     dmScreenSettings.dmSize        = sizeof(DEVMODE);
00427     dmScreenSettings.dmPelsWidth    = screen.right;
00428     dmScreenSettings.dmPelsHeight    = screen.bottom;
00429     dmScreenSettings.dmFields    = DM_PELSWIDTH | DM_PELSHEIGHT;
00430     ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
00431 
00432 //    ShowWindow(hWnd, SW_HIDE);
00433 //    if(DialogBox(hInstance, "NAMEOFDLG", hWnd, (DLGPROC)NameOfProc) == IDOK) // calls the initialization dialog
00434 //    {
00435         ShowWindow(hWnd, SW_SHOW);
00436         UpdateWindow(hWnd);
00437         SetFocus(hWnd);
00438         wglMakeCurrent(hDC,hRC);
00439         SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00440 //        ShowCursor(0);
00441 //    }
00442 //    else
00443 //        SendMessage(hWnd, WM_CLOSE, 0, 0);
00444 
00445     while (1)
00446     {
00447         while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
00448         {
00449             if (GetMessage(&msg, NULL, 0, 0))
00450             {
00451                 TranslateMessage(&msg);
00452                 DispatchMessage(&msg);
00453             }
00454             else
00455             {
00456                 return TRUE;
00457             }
00458         }
00459 
00460         if(!DialogInUse)
00461         {
00462             DrawGLScene();
00463             glFlush();
00464             SwapBuffers(hDC);
00465         }
00466 
00467         multiplier = GetTimePassed(lasttime, average, lastmultiplier);
00468         camera[currentCamera].Multiplier = multiplier;
00469         light[currentLight].Multiplier = multiplier;
00470 
00471         if (key['C'] && released_key['C'] == 0)
00472         {
00473             if (currentCamera < numCameras)
00474                 currentCamera++;
00475             else
00476                 currentCamera = 0;
00477             released_key['C'] = 1;
00478         }
00479 
00480         if (!key['C'])
00481             released_key['C'] = 0;
00482 
00483         if (key['R'] && released_key['R'] == 0)
00484         {
00485             ResetLensFlare();
00486             released_key['R'] = 1;
00487         }
00488 
00489         if (!key['R'])
00490             released_key['R'] = 0;
00491 
00492         if (key['L'] && released_key['L'] == 0)
00493         {
00494             if (currentLight < numLights)
00495                 currentLight++;
00496             else
00497                 currentLight = 0;
00498             released_key['L'] = 1;
00499         }
00500 
00501         if (!key['L'])
00502             released_key['L'] = 0;
00503 /*
00504         if (key['I'] && released_key['I'] == 0)
00505         {
00506             DialogInUse = 1;
00507             lightColor[0] = light[currentLight].Ambient[0];
00508             lightColor[1] = light[currentLight].Ambient[1];
00509             lightColor[2] = light[currentLight].Ambient[2];
00510             ShowCursor(1);
00511             GetLightColor();
00512             key['I'] = 0;
00513             ShowCursor(0);
00514             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00515             light[currentLight].Ambient[0] = lightColor[0];
00516             light[currentLight].Ambient[1] = lightColor[1];
00517             light[currentLight].Ambient[2] = lightColor[2];
00518             light[currentLight].Update();
00519             DialogInUse = 0;
00520         }
00521 
00522         if (!key['I'])
00523             released_key['I'] = 0;
00524 
00525         if (key['O'] && released_key['O'] == 0)
00526         {
00527             DialogInUse = 2;
00528             lightColor[0] = light[currentLight].Diffuse[0];
00529             lightColor[1] = light[currentLight].Diffuse[1];
00530             lightColor[2] = light[currentLight].Diffuse[2];
00531             ShowCursor(1);
00532             GetLightColor();
00533             key['O'] = 0;
00534             ShowCursor(0);
00535             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00536             light[currentLight].Diffuse[0] = lightColor[0];
00537             light[currentLight].Diffuse[1] = lightColor[1];
00538             light[currentLight].Diffuse[2] = lightColor[2];
00539             light[currentLight].Update();
00540             DialogInUse = 0;
00541         }
00542 
00543         if (!key['O'])
00544             released_key['O'] = 0;
00545 
00546         if (key['P'] && released_key['P'] == 0)
00547         {
00548             DialogInUse = 3;
00549             lightColor[0] = light[currentLight].Specular[0];
00550             lightColor[1] = light[currentLight].Specular[1];
00551             lightColor[2] = light[currentLight].Specular[2];
00552             ShowCursor(1);
00553             GetLightColor();
00554             key['P'] = 0;
00555             ShowCursor(0);
00556             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00557             light[currentLight].Specular[0] = lightColor[0];
00558             light[currentLight].Specular[1] = lightColor[1];
00559             light[currentLight].Specular[2] = lightColor[2];
00560             light[currentLight].Update();
00561             DialogInUse = 0;
00562         }
00563 */
00564         if (!key['P'])
00565             released_key['P'] = 0;
00566 
00567         if (key['1'])
00568         {
00569             step = 1.0;
00570         }
00571 
00572         if (key['2'])
00573         {
00574             step = 2.0;
00575         }
00576 
00577         if (key['3'])
00578         {
00579             step = 3.0;
00580         }
00581 
00582         if (key['4'])
00583         {
00584             step = 4.0;
00585         }
00586 
00587         if (key['5'])
00588         {
00589             step = 5.0;
00590         }
00591 
00592         if (key['6'])
00593         {
00594             step = 6.0;
00595         }
00596 
00597         if (key['7'])
00598         {
00599             step = 7.0;
00600         }
00601 
00602         if (key['8'])
00603         {
00604             step = 8.0;
00605         }
00606 
00607         if (key['9'])
00608         {
00609             step = 9.0;
00610         }
00611 
00612         if (key['0'])
00613         {
00614             step = 10.0;
00615         }
00616 
00617         if (key[VK_NUMPAD6])
00618         {
00619             light[currentLight].Movement_x += step;
00620         }
00621 
00622         if (key[VK_NUMPAD4])
00623         {
00624             light[currentLight].Movement_x -= step;
00625         }
00626 
00627         if (key[VK_NUMPAD2])
00628         {
00629             light[currentLight].Movement_z += step;
00630         }
00631 
00632         if (key[VK_NUMPAD8])
00633         {
00634             light[currentLight].Movement_z -= step;
00635         }
00636 
00637         if (key[VK_NUMPAD7])
00638         {
00639             light[currentLight].Movement_y += step;
00640         }
00641 
00642         if (key[VK_NUMPAD9])
00643         {
00644             light[currentLight].Movement_y -= step;
00645         }
00646 
00647         if (key[VK_NUMPAD5] && released_key[VK_NUMPAD5] == 0)
00648         {
00649             if (light[currentLight].Positional == FALSE)
00650                 light[currentLight].Positional = TRUE;
00651             else
00652                 light[currentLight].Positional = FALSE;
00653             released_key[VK_NUMPAD5] = 1;
00654         }
00655 
00656         if (!key[VK_NUMPAD5])
00657             released_key[VK_NUMPAD5] = 0;
00658 
00659         if (key[VK_RIGHT])
00660         {
00661             camera[currentCamera].Movement_x += step;
00662         }
00663 
00664         if (key[VK_LEFT])
00665         {
00666             camera[currentCamera].Movement_x -= step;
00667         }
00668 
00669         if (key[VK_DOWN])
00670         {
00671             camera[currentCamera].Movement_z += step;
00672         }
00673 
00674         if (key[VK_UP])
00675         {
00676             camera[currentCamera].Movement_z -= step;
00677         }
00678 
00679         if (key[VK_PRIOR])
00680         {
00681             camera[currentCamera].Movement_y += step;
00682         }
00683 
00684         if (key[VK_NEXT])
00685         {
00686             camera[currentCamera].Movement_y -= step;
00687         }
00688 
00689         if (key[VK_SPACE])
00690         {
00691             camera[currentCamera].Reset();
00692         }
00693 
00694         if (key[VK_ESCAPE] || key['Q'])
00695             SendMessage(hWnd,WM_CLOSE,0,0);
00696     }
00697 }

LRESULT CALLBACK WndProc HWND    hWnd,
UINT    message,
WPARAM    wParam,
LPARAM    lParam
 

Definition at line 181 of file main.cpp.

References CleanupLensFlare(), currentCamera, FALSE, g_bLeftMouseDrag, g_bRightMouseDrag, g_iMouseDeltaX, g_iMouseDeltaY, g_iMouseLastX, g_iMouseLastY, hDC, hRC, hWnd, InitGL(), key, MouseX, MouseY, ReSizeGLScene(), screen, selectedPolygon, SelectPolygon(), step, and TRUE.

Referenced by WinMain().

00185 {
00186     GLuint    PixelFormat;
00187     static    PIXELFORMATDESCRIPTOR pfd=
00188     {
00189            sizeof(PIXELFORMATDESCRIPTOR),
00190         1,
00191         PFD_DRAW_TO_WINDOW |
00192         PFD_SUPPORT_OPENGL |
00193         PFD_DOUBLEBUFFER,
00194         PFD_TYPE_RGBA,
00195         16,
00196         0, 0, 0, 0, 0, 0,
00197         0,
00198         0,
00199         0,
00200         0, 0, 0, 0,
00201         16,
00202         0,
00203         0,
00204         PFD_MAIN_PLANE,
00205         0,
00206         0, 0, 0
00207     };
00208 
00209 
00210     switch (message)
00211     {
00212         // (NEW) SelectPolygon function added to selection.cpp
00213         case WM_LBUTTONDBLCLK:
00214         {
00215             int result;
00216             result = SelectPolygon(hWnd, polygon, 12, LOWORD(lParam), HIWORD(lParam));
00217             if (result > -1)
00218                 selectedPolygon = result;
00219         }
00220         break;
00221 
00222         case WM_CREATE:
00223             hDC = GetDC(hWnd);
00224 
00225             PixelFormat = ChoosePixelFormat(hDC, &pfd);
00226 
00227             if (!PixelFormat)
00228             {
00229                    MessageBox(NULL,"Can't find a suitable PixelFormat.","Error",MB_OK|MB_ICONERROR);
00230                 PostQuitMessage(0);
00231                 break;
00232             }
00233 
00234             if(!SetPixelFormat(hDC,PixelFormat,&pfd))
00235             {
00236                 MessageBox(NULL,"Can't set the PixelFormat.","Error",MB_OK|MB_ICONERROR);
00237                 PostQuitMessage(0);
00238                 break;
00239             }
00240 
00241             hRC = wglCreateContext(hDC);
00242             if(!hRC)
00243             {
00244                 MessageBox(NULL,"Can't create a GL Rendering Context.","Error",MB_OK|MB_ICONERROR);
00245                 PostQuitMessage(0);
00246                 break;
00247             }
00248 
00249             if(!wglMakeCurrent(hDC, hRC))
00250             {
00251                 MessageBox(NULL,"Can't activate the GL Rendering Context.","Error",MB_OK|MB_ICONERROR);
00252                 PostQuitMessage(0);
00253                 break;
00254             }
00255             InitGL(screen.right, screen.bottom);
00256         break;
00257 
00258         case WM_SYSCOMMAND:
00259         {
00260             switch (wParam)
00261             {
00262                 case SC_SCREENSAVE:
00263                 case SC_MONITORPOWER:
00264                     return 0;
00265             }
00266             break;
00267         }
00268 /*
00269         if (DialogInUse)
00270         {
00271             case WM_PAINT:
00272                 BeginPaint(hWnd,&ps);
00273                 DrawGLScene();
00274                 glFlush();
00275                 SwapBuffers(hDC);
00276                 EndPaint(hWnd,&ps);
00277             break;
00278         }
00279 */
00280         case WM_DESTROY:
00281         case WM_CLOSE:
00282             delete[] texture;
00283             delete[] polygon;
00284             delete[] camera;
00285             delete[] light;
00286             CleanupLensFlare();
00287 
00288             ChangeDisplaySettings(NULL, 0);
00289             wglMakeCurrent(hDC,NULL);
00290             wglDeleteContext(hRC);
00291             ReleaseDC(hWnd,hDC);
00292 
00293             PostQuitMessage(0);
00294         break;
00295 
00296         case WM_KEYDOWN:
00297             key[wParam] = TRUE;
00298         break;
00299 
00300         case WM_KEYUP:
00301             key[wParam] = FALSE;
00302         break;
00303 
00304         case WM_SIZE:
00305             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00306             ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
00307         break;
00308 
00309         case WM_MOUSEMOVE:
00310         {
00311             MouseX = LOWORD(lParam);
00312             MouseY = HIWORD(lParam);
00313             g_iMouseDeltaX = MouseX - g_iMouseLastX;          // Get mouse deltas
00314             g_iMouseDeltaY = MouseY - g_iMouseLastY;          // Get mouse deltas
00315             g_iMouseLastX = MouseX;                           // Set new last mouse position
00316             g_iMouseLastY = MouseY;                           // Set new last mouse position
00317             if(g_bLeftMouseDrag)                                  // If mouse flag set
00318             {
00319                 camera[currentCamera].Delta_x = (float)g_iMouseDeltaY * 15.0;
00320                 camera[currentCamera].Delta_y = (float)g_iMouseDeltaX * 15.0;
00321             }
00322             if(g_bRightMouseDrag)                                 // If mouse flag set
00323             {
00324                 if (fabs(g_iMouseDeltaX) > fabs(g_iMouseDeltaY))
00325                     camera[currentCamera].Delta_z += (float)g_iMouseDeltaX * 10.0;
00326                 else
00327                     camera[currentCamera].Movement_z += (float)g_iMouseDeltaY * step;
00328             }
00329         }
00330         break;
00331 
00332         case WM_LBUTTONDOWN:
00333         {
00334             g_bLeftMouseDrag = 1;                                 // Set mouse flag
00335             g_iMouseLastX = LOWORD(lParam);
00336             g_iMouseLastY = HIWORD(lParam);
00337             SetCapture(hWnd);                                     // Capture the mouse
00338         }
00339         break;
00340 
00341         case WM_RBUTTONDOWN:
00342         {
00343             g_bRightMouseDrag = 1;                                // Set mouse flag
00344             g_iMouseLastX = LOWORD(lParam);                       // Get mouse position
00345             g_iMouseLastY = HIWORD(lParam);
00346             SetCapture(hWnd);                                     // Capture the mouse
00347         }
00348         break;
00349 
00350         case WM_LBUTTONUP:
00351         {
00352             g_bLeftMouseDrag = 0;                                 // Clear mouse flag
00353             ReleaseCapture();                                     // Release the mouse capture
00354             camera[currentCamera].Delta_x = 0.0;                  // Clear camera rotation deltas
00355             camera[currentCamera].Delta_y = 0.0;
00356         }
00357         break;
00358 
00359         case WM_RBUTTONUP:
00360         {
00361             g_bRightMouseDrag = 0;                                // Clear mouse flag
00362             ReleaseCapture();                                     // Release the mouse capture
00363             camera[currentCamera].Delta_z = 0.0;                  // Clear camera rotation deltas
00364         }
00365         break;
00366 
00367         default:
00368             return (DefWindowProc(hWnd, message, wParam, lParam));
00369     }
00370 return (0);
00371 }


Variable Documentation

const int average = 10
 

Definition at line 62 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

CAMERA* camera = new CAMERA[numCameras + 1]
 

Definition at line 78 of file main.cpp.

int currentCamera = 0
 

Definition at line 55 of file main.cpp.

Referenced by DrawGLScene(), SelectPolygon(), WinMain(), and WndProc().

int currentLight = 0
 

Definition at line 68 of file main.cpp.

Referenced by DrawLightSphere(), and WinMain().

int DialogInUse = 0
 

Definition at line 86 of file main.cpp.

Referenced by ColorDialogHook(), and WinMain().

float epsilon = 0.05
 

Definition at line 48 of file main.cpp.

int fps
 

Definition at line 64 of file main.cpp.

Referenced by DrawGLScene(), and GetTimePassed().

int g_bLeftMouseDrag
 

Definition at line 35 of file main.cpp.

Referenced by WndProc().

int g_bRightMouseDrag
 

Definition at line 36 of file main.cpp.

Referenced by WndProc().

int g_iMouseDeltaX
 

Definition at line 33 of file main.cpp.

Referenced by WndProc().

int g_iMouseDeltaY
 

Definition at line 34 of file main.cpp.

Referenced by WndProc().

int g_iMouseLastX
 

Definition at line 31 of file main.cpp.

Referenced by WndProc().

int g_iMouseLastY
 

Definition at line 32 of file main.cpp.

Referenced by WndProc().

int GL_LIGHT[8] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7}
 

Definition at line 67 of file main.cpp.

HDC hDC [static]
 

Definition at line 40 of file main.cpp.

Referenced by WinMain(), and WndProc().

HGLRC hRC [static]
 

Definition at line 39 of file main.cpp.

Referenced by WinMain(), and WndProc().

HWND hWnd
 

Definition at line 41 of file main.cpp.

Referenced by GetLightColor(), WinMain(), and WndProc().

bool key[256]
 

Definition at line 51 of file main.cpp.

Referenced by WinMain(), and WndProc().

CAMERA LastCam
 

Definition at line 79 of file main.cpp.

float lastmultiplier[average]
 

Definition at line 63 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

float lasttime
 

Definition at line 60 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

LIGHT* light = new LIGHT[numLights + 1]
 

Definition at line 82 of file main.cpp.

float lightColor[3] = {1.0, 1.0, 1.0}
 

Definition at line 83 of file main.cpp.

Referenced by GetLightColor().

int MouseX
 

Definition at line 29 of file main.cpp.

Referenced by SelectPolygon(), and WndProc().

int MouseY
 

Definition at line 30 of file main.cpp.

Referenced by SelectPolygon(), and WndProc().

float multiplier
 

Definition at line 61 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

GLFONT myFont
 

Definition at line 92 of file main.cpp.

int numCameras = 4
 

Definition at line 56 of file main.cpp.

Referenced by SetGLCamera(), and WinMain().

int numLights = 0
 

Definition at line 69 of file main.cpp.

Referenced by DrawGLScene(), SetGLLighting(), and WinMain().

float pi = 3.141592
 

Definition at line 46 of file main.cpp.

Referenced by OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::MoveX(), and OBJECT::MoveY().

POLYGON* polygon = new POLYGON[12]
 

Definition at line 72 of file main.cpp.

Referenced by CheckForCollision(), DrawCube(), and SetGLWorld().

PAINTSTRUCT ps
 

Definition at line 43 of file main.cpp.

float radian = pi / 180
 

Definition at line 47 of file main.cpp.

Referenced by OBJECT::Rotate().

bool released_key[256]
 

Definition at line 52 of file main.cpp.

Referenced by WinMain().

RECT screen
 

Definition at line 42 of file main.cpp.

Referenced by DrawLensFlare(), InitializeLensFlare(), WinMain(), and WndProc().

int selectedPolygon = -1
 

Definition at line 26 of file main.cpp.

Referenced by DrawCube(), DrawGLScene(), and WndProc().

float step = 5.0
 

Definition at line 57 of file main.cpp.

Referenced by WinMain(), and WndProc().

float SunPosition[3]
 

Definition at line 95 of file main.cpp.

Referenced by DrawLensFlare(), InitGL(), and InitializeLensFlare().

float testfloat
 

Definition at line 88 of file main.cpp.

int testint
 

Definition at line 87 of file main.cpp.

char teststring[64]
 

Definition at line 89 of file main.cpp.

TEXTURE* texture = new TEXTURE[8]
 

Definition at line 75 of file main.cpp.


Generated on Fri Dec 23 05:21:00 2005 for Polygon Selection by doxygen1.2.15