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 "listnode.h"
#include "locmath.h"
#include "vector.h"
#include "vertex.h"
#include "quat.h"
#include "matrix.h"
#include "texture.h"
#include "polygon.h"
#include "tll.h"
#include "plane.h"
#include "object.h"
#include "camera.h"
#include "light.h"
#include "collision.h"
#include "glfont.h"
#include "bspline.h"
#include "bsp.h"
#include "portal.h"
#include "pvs.h"
#include "tga.h"
#include "lightmap.h"
#include "winfuncs.h"
#include "console.h"
#include "log.h"
#include "bass.h"
#include "sound.h"
#include "mmgr.h"
#include "resource.rh"

Go to the source code of this file.

Functions

int 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

ConsoleWindow Console
HGLRC hRC
HDC hDC
HWND hWnd
HINSTANCE g_hInst
RECT screen
PAINTSTRUCT ps
char AppDirectory [MAX_PATH]
float ApplicationStartTime
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 = 30.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
PLANE frustum [6]
int numVertices = 37
VERTEXvertex = new VERTEX[numVertices]
int numPolygons = 58
POLYGONpolygon = new POLYGON[numPolygons]
POLYGONbsppolygon = new POLYGON[numPolygons]
TEXTUREtexture = new TEXTURE[4]
CAMERAcamera = new CAMERA[numCameras + 1]
CAMERA LastCam
LIGHTlight = new LIGHT[numLights + 1]
float lightColor [3] = {1.0, 1.0, 1.0}
HWND hWndStartDlg
int DialogInUse = 0
char szText [BUFFER_SIZE]
GLFONT myFont
float Min_X
float Min_Y
float Min_Z
float Max_X
float Max_Y
float Max_Z
int numleavesvisible = 0
int showportals = 0
int numlistleaves = 0
int numlistpartitions = 0
int numcurrentportals = 0
int device
BOOL lowqual
int SphereSector
VECTOR SpherePosition
int numSamples = 0
int numChannels = 0
LinkedList< SOUND_SAMPLESampleList
LinkedList< SOUND_CHANNELChannelList
int numleaves = 0
int currentleaf = 0
int numpartitions = 0
bool BuiltBSP = false
BSP_noderoot = new BSP_node
LinkedList< PORTALPortalList
int numportals = 0
PORTALportal
int numStaticLights = 9
StaticLightstaticlight = new StaticLight[numStaticLights]
int numLightmaps = 0
Lightmaplightmap = new Lightmap[numPolygons]
int visible = 0
int numSplines = 0
int cameraMode = 2
int currentSpline = 0
int lookAtPath = 0
char SplineFileName [MAX_PATH]
SPLINEspline
LinkedList< SPLINESplineList
LinkedList< ListNodeLeafList
LinkedList< ListNodePartitionList
ListNodelistnode


Function Documentation

void DrawGLScene void   
 

Definition at line 253 of file main.cpp.

References LIGHT::Apply(), bsplinepoint(), CalculatePVS(), channel_carhorn, channel_engine, CheckForCollision(), CountVisibleLeaves(), currentCamera, currentleaf, DrawMyText(), DrawSplines(), DrawWorld(), CollisionPacket::eRadius, ExtractFrustum(), FindCurrentLeaf(), LinkedList< T >::Get(), numleavesvisible, numLights, OBJECT::Position, CollisionPacket::sourcePoint, SphereSector, UpdateChannel(), UpdateListener(), CollisionPacket::velocity, VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by WinMain(), and WndProc().

00254 {
00255     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00256 
00257     LastCam = camera[currentCamera];
00258     camera[currentCamera].Update();
00259 
00260     CollisionPacket cp;
00261     cp.eRadius.x = 1.0;
00262     cp.eRadius.y = 1.0;
00263     cp.eRadius.z = 1.0;
00264     cp.sourcePoint.x = LastCam.Position.x;
00265     cp.sourcePoint.y = LastCam.Position.y;
00266     cp.sourcePoint.z = LastCam.Position.z;
00267     cp.velocity.x = camera[currentCamera].Position.x - LastCam.Position.x;
00268     cp.velocity.y = camera[currentCamera].Position.y - LastCam.Position.y;
00269     cp.velocity.z = camera[currentCamera].Position.z - LastCam.Position.z;
00270     CheckForCollision(polygon, &camera[currentCamera].Position, &cp);
00271 
00272     camera[currentCamera].Apply();
00273 
00274     for(int loop = 0; loop <= numLights; loop++)
00275         light[loop].Apply();
00276 
00277     currentleaf = FindCurrentLeaf(camera[currentCamera].Position, root);
00278 
00279     ExtractFrustum();
00280     CalculatePVS(currentleaf);
00281     numleavesvisible = CountVisibleLeaves();
00282 
00283     UpdateListener();                              // Update the listener's position, etc
00284 
00285     VECTOR LastSpherePosition = SpherePosition;
00286     VECTOR SphereVelocity;
00287     spline = SplineList.Get(1);                    // Get the spline from the linked list
00288     SpherePosition = bsplinepoint(spline);         // Set the sphere (sound source) position
00289     SphereSector = FindCurrentLeaf(SpherePosition, root); // Find the spheres sector for rendering
00290     SphereVelocity.x = SpherePosition.x - LastSpherePosition.x; // Find the velocity
00291     SphereVelocity.y = SpherePosition.y - LastSpherePosition.y;
00292     SphereVelocity.z = SpherePosition.z - LastSpherePosition.z;
00293 
00294     UpdateChannel(channel_engine, &SpherePosition, NULL, &SphereVelocity);  // Update the engine sound
00295     UpdateChannel(channel_carhorn, &camera[currentCamera].Position, NULL, NULL);  // Update the car horn sound
00296 
00297     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
00298     DrawWorld(root);
00299     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
00300 
00301     DrawSplines(SplineList);           // Required to update the sphere position
00302 
00303     DrawMyText();              // Draw text last
00304 }

int InitGL int    Width,
int    Height
 

Definition at line 165 of file main.cpp.

References AddPortalsToLeaves(), ApplicationStartTime, BuildBSP(), BuiltBSP, cameraMode, CreateBSPLightmaps(), CreateSounds(), FindTruePortals(), glFontCreate(), InitializeBASS(), BSP_node::leaf, LoadBSPLightmaps(), MakeNodeLists(), MakePortalList(), Max_X, Max_Y, Max_Z, Min_X, Min_Y, Min_Z, BSP_node::nodeid, BSP_node::nodelightmaplist, BSP_node::nodepolylist, numPolygons, BSP_node::numpolys, SetGLCamera(), SetGLLighting(), SetGLMaterial(), SetGLProperties(), SetGLTexture(), SetGLWorld(), SetSplines(), SetStaticLights(), POLYGON::Vertex, BSP_node::visible, VERTEX::x, VERTEX::y, and VERTEX::z.

Referenced by WinMain().

00166 {
00167     int ReturnValue;
00168 
00169     InitializeBASS();             // Initialize the BASS sound system
00170     CreateSounds();               // Load the samples and create the channels
00171 
00172     ApplicationStartTime = (float)GetTickCount();
00173     cameraMode = 0;
00174 
00175     SetGLProperties();
00176     SetGLMaterial();
00177     SetGLLighting(light);
00178     SetGLCamera(camera);
00179     SetSplines(SplineList);
00180 
00181     // Load the textures
00182     if (!SetGLTexture(texture))
00183         ReturnValue = 0;
00184     else
00185         ReturnValue = 1;
00186 
00187     // Create the font texture
00188     glFontCreate(&myFont, "roman.glf", 600);
00189 
00190     // Initialize world data
00191     SetGLWorld(polygon, texture, vertex);
00192 
00193     // Find the bounding box of the data set
00194     Min_X = polygon[0].Vertex[0].x;
00195     Min_Y = polygon[0].Vertex[0].y;
00196     Min_Z = polygon[0].Vertex[0].z;
00197     Max_X = polygon[0].Vertex[0].x;
00198     Max_Y = polygon[0].Vertex[0].y;
00199     Max_Z = polygon[0].Vertex[0].z;
00200     for (int loop = 0; loop < numPolygons; loop++)
00201     {
00202         for (int i = 0; i < 3; i++)
00203         {
00204             if (polygon[loop].Vertex[i].x < Min_X )
00205                 Min_X = polygon[loop].Vertex[i].x;
00206             if (polygon[loop].Vertex[i].y < Min_Y )
00207                 Min_Y = polygon[loop].Vertex[i].y;
00208             if (polygon[loop].Vertex[i].z < Min_Z )
00209                 Min_Z = polygon[loop].Vertex[i].z;
00210             if (polygon[loop].Vertex[i].x > Max_X )
00211                 Max_X = polygon[loop].Vertex[i].x;
00212             if (polygon[loop].Vertex[i].y > Max_Y )
00213                 Max_Y = polygon[loop].Vertex[i].y;
00214             if (polygon[loop].Vertex[i].z > Max_Z )
00215                 Max_Z = polygon[loop].Vertex[i].z;
00216         }
00217     }
00218 
00219     // BSP initialization
00220     for (int i = 0; i < numPolygons; i++)
00221         bsppolygon[i] = polygon[i];
00222 
00223     root->nodeid = 0;
00224     root->leaf = 0;
00225     root->visible = 0;
00226     root->numpolys = numPolygons;
00227     root->nodepolylist = bsppolygon;
00228     root->nodelightmaplist = lightmap;
00229     BuildBSP(root);
00230     BuiltBSP = true;
00231 
00232     // Portal Creation
00233     MakeNodeLists(root);
00234     MakePortalList();
00235     AddPortalsToLeaves(root);
00236     FindTruePortals(root);
00237 
00238     // Initialize static lights
00239     SetStaticLights(staticlight);
00240 
00241     // Create the lightmaps
00242     CreateBSPLightmaps(root);
00243     LoadBSPLightmaps(root);
00244 
00245     return ReturnValue;
00246 }

void ReSizeGLScene int    Width,
int    Height
 

Definition at line 248 of file main.cpp.

References SetGLView().

Referenced by WndProc().

00249 {
00250     SetGLView(Width, Height);
00251 }

int WINAPI WinMain HINSTANCE    hInstance,
HINSTANCE   ,
LPSTR   ,
int   
 

Definition at line 480 of file main.cpp.

References AppDirectory, average, cameraMode, channel_carhorn, Console, currentCamera, currentLight, DialogInUse, DrawGLScene(), FALSE, g_hInst, GetTimePassed(), hDC, hRC, hWnd, InitGL(), key, lastmultiplier, lasttime, multiplier, numCameras, numLights, PlayChannel(), released_key, screen, showportals, step, TRUE, and WndProc().

00484 {
00485     MSG        msg;
00486     g_hInst = hInstance;
00487     GetWindowRect(GetDesktopWindow(), &screen);
00488 
00489     WNDCLASSEX    wc;
00490     wc.cbSize = sizeof(WNDCLASSEX);
00491     wc.style            = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_SAVEBITS;
00492     wc.lpfnWndProc        = (WNDPROC) WndProc;
00493     wc.cbClsExtra        = 0;
00494     wc.cbWndExtra        = 0;
00495     wc.hInstance        = hInstance;
00496     wc.hIcon            = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
00497     wc.hIconSm          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
00498     wc.hCursor            = LoadCursor(NULL, IDC_ARROW);
00499     wc.hbrBackground    = NULL;
00500     wc.lpszMenuName        = NULL;
00501     wc.lpszClassName    = "OpenGL WinClass";
00502 
00503 
00504     if(!RegisterClassEx(&wc))
00505     {
00506         MessageBox(NULL,"Failed To Register The Window Class.","Error",MB_OK|MB_ICONERROR);
00507         return FALSE;
00508     }
00509 
00510     hWnd = CreateWindowEx(
00511     WS_EX_LEFT,
00512     "OpenGL WinClass",
00513     "OpenGL & Win32 Tutorial No.15",
00514     WS_MAXIMIZE |
00515     WS_CLIPCHILDREN |
00516     WS_CLIPSIBLINGS |
00517     WS_POPUPWINDOW |
00518     WS_VISIBLE,
00519     0, 0,
00520     screen.right, screen.bottom,
00521     NULL,
00522     NULL,
00523     hInstance,
00524     NULL);
00525 
00526     if(!hWnd)
00527     {
00528         MessageBox(NULL,"Window Creation Error.","Error",MB_OK|MB_ICONERROR);
00529         return FALSE;
00530     }
00531 
00532     DEVMODE dmScreenSettings;
00533     memset(&dmScreenSettings, 0, sizeof(DEVMODE));
00534     dmScreenSettings.dmSize        = sizeof(DEVMODE);
00535     dmScreenSettings.dmPelsWidth    = screen.right;
00536     dmScreenSettings.dmPelsHeight    = screen.bottom;
00537     dmScreenSettings.dmFields    = DM_PELSWIDTH | DM_PELSHEIGHT;
00538     ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
00539 
00540     ShowWindow(hWnd, SW_HIDE);
00541     GetCurrentDirectory(MAX_PATH, AppDirectory);
00542 
00543     // Show sound device selection dialog
00544     DialogBox(hInstance, "DEVICE", hWnd, (DLGPROC)devicedialogproc);
00545 
00546         Console.Open();
00547 
00548     if(DialogBox(hInstance, "STARTDLG", hWnd, (DLGPROC)StartProc) == IDOK)
00549     {
00550         if (!InitGL(screen.right, screen.bottom))
00551         {
00552             SendMessage(hWnd, WM_CLOSE, 0, 0);
00553         }
00554         else
00555         {
00556             ShowWindow(hWnd, SW_SHOW);
00557             UpdateWindow(hWnd);
00558             SetFocus(hWnd);
00559             wglMakeCurrent(hDC,hRC);
00560             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00561             ShowCursor(0);
00562         }
00563     }
00564     else
00565     {
00566         delete[] lightmap;
00567         delete[] staticlight;
00568         delete[] texture;
00569         delete[] vertex;
00570         delete[] camera;
00571         delete[] light;
00572         delete[] polygon;
00573         delete[] bsppolygon;
00574         delete root;
00575         PostQuitMessage(0);            
00576     }
00577 
00578     while (1)
00579     {
00580         while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
00581         {
00582             if (GetMessage(&msg, NULL, 0, 0))
00583             {
00584                 TranslateMessage(&msg);
00585                 DispatchMessage(&msg);
00586             }
00587             else
00588             {
00589                 return TRUE;
00590             }
00591         }
00592 
00593         if(!DialogInUse)
00594         {
00595             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00596             DrawGLScene();
00597             glFlush();
00598               SwapBuffers(hDC);
00599         }
00600 
00601         multiplier = GetTimePassed(lasttime, average, lastmultiplier);
00602         camera[currentCamera].Multiplier = multiplier;
00603         light[currentLight].Multiplier = multiplier;
00604 
00605         if (key['C'] && released_key['C'] == 0)
00606         {
00607             if (currentCamera < numCameras)
00608                 currentCamera++;
00609             else
00610                 currentCamera = 0;
00611             released_key['C'] = 1;
00612         }
00613 
00614         if (!key['C'])
00615             released_key['C'] = 0;
00616 
00617         if (key['L'] && released_key['L'] == 0)
00618         {
00619             if (currentLight < numLights)
00620                 currentLight++;
00621             else
00622                 currentLight = 0;
00623             released_key['L'] = 1;
00624         }
00625 
00626         if (!key['L'])
00627             released_key['L'] = 0;
00628 
00629         if (key['P'] && released_key['P'] == 0)
00630         {
00631             if (showportals)
00632                 showportals = 0;
00633             else
00634                 showportals = 1;
00635             released_key['P'] = 1;
00636         }
00637 
00638         if (!key['P'])
00639             released_key['P'] = 0;
00640 
00641         if (key['M'] && released_key['M'] == 0)
00642         {
00643             if (cameraMode == 2)
00644                 cameraMode = 0;
00645             else
00646                 cameraMode = 2;
00647             released_key['M'] = 1;
00648         }
00649 
00650         if (!key['M'])
00651             released_key['M'] = 0;
00652 
00653         if (key[VK_RETURN] && released_key[VK_RETURN] == 0)
00654         {
00655             PlayChannel(channel_carhorn);                  // Play the sound on Enter keypress
00656             released_key[VK_RETURN] = 1;
00657         }
00658 
00659         if (!key[VK_RETURN])
00660             released_key[VK_RETURN] = 0;
00661 
00662         if (key[49])
00663         {
00664             step = 10.0;
00665         }
00666 
00667         if (key[50])
00668         {
00669             step = 20.0;
00670         }
00671 
00672         if (key[51])
00673         {
00674             step = 30.0;
00675         }
00676 
00677         if (key[52])
00678         {
00679             step = 40.0;
00680         }
00681 
00682         if (key[53])
00683         {
00684             step = 50.0;
00685         }
00686 
00687         if (key[54])
00688         {
00689             step = 60.0;
00690         }
00691 
00692         if (key[55])
00693         {
00694             step = 70.0;
00695         }
00696 
00697         if (key[56])
00698         {
00699             step = 80.0;
00700         }
00701 
00702         if (key[57])
00703         {
00704             step = 90.0;
00705         }
00706 
00707         if (key[VK_NUMPAD6])
00708         {
00709             light[currentLight].Movement_x += step;
00710         }
00711 
00712         if (key[VK_NUMPAD4])
00713         {
00714             light[currentLight].Movement_x -= step;
00715         }
00716 
00717         if (key[VK_NUMPAD2])
00718         {
00719             light[currentLight].Movement_z += step;
00720         }
00721 
00722         if (key[VK_NUMPAD8])
00723         {
00724             light[currentLight].Movement_z -= step;
00725         }
00726 
00727         if (key[VK_NUMPAD7])
00728         {
00729             light[currentLight].Movement_y += step;
00730         }
00731 
00732         if (key[VK_NUMPAD9])
00733         {
00734             light[currentLight].Movement_y -= step;
00735         }
00736 
00737         if (key[VK_NUMPAD5] && released_key[VK_NUMPAD5] == 0)
00738         {
00739             if (light[currentLight].Positional == FALSE)
00740                 light[currentLight].Positional = TRUE;
00741             else
00742                 light[currentLight].Positional = FALSE;
00743             released_key[VK_NUMPAD5] = 1;
00744         }
00745 
00746         if (!key[VK_NUMPAD5])
00747             released_key[VK_NUMPAD5] = 0;
00748 
00749         if (key[VK_RIGHT])
00750         {
00751             camera[currentCamera].Movement_x += step;
00752         }
00753 
00754         if (key[VK_LEFT])
00755         {
00756             camera[currentCamera].Movement_x -= step;
00757         }
00758 
00759         if (key[VK_DOWN])
00760         {
00761             camera[currentCamera].Movement_z += step;
00762         }
00763 
00764         if (key[VK_UP])
00765         {
00766             camera[currentCamera].Movement_z -= step;
00767         }
00768 
00769         if (key[VK_PRIOR])
00770         {
00771             camera[currentCamera].Movement_y += step;
00772         }
00773 
00774         if (key[VK_NEXT])
00775         {
00776             camera[currentCamera].Movement_y -= step;
00777         }
00778 
00779         if (key[VK_SPACE])
00780         {
00781             camera[currentCamera].Reset();
00782         }
00783 
00784         if (key[VK_ESCAPE] || key['Q'])
00785             SendMessage(hWnd,WM_CLOSE,0,0);
00786     }
00787 }

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

Definition at line 306 of file main.cpp.

References cameraMode, Console, currentCamera, DeleteBSP(), DeleteSpline(), DrawGLScene(), FALSE, LinkedList< T >::Get(), glFontDestroy(), hDC, hRC, hWnd, key, numportals, numSplines, ps, ReSizeGLScene(), screen, TRUE, and PORTAL::Vertex.

Referenced by WinMain().

00310 {
00311     GLuint    PixelFormat;
00312     static    PIXELFORMATDESCRIPTOR pfd=
00313     {
00314            sizeof(PIXELFORMATDESCRIPTOR),
00315         1,
00316         PFD_DRAW_TO_WINDOW |
00317         PFD_SUPPORT_OPENGL |
00318         PFD_DOUBLEBUFFER,
00319         PFD_TYPE_RGBA,
00320         16,
00321         0, 0, 0, 0, 0, 0,
00322         0,
00323         0,
00324         0,
00325         0, 0, 0, 0,
00326         16,
00327         0,
00328         0,
00329         PFD_MAIN_PLANE,
00330         0,
00331         0, 0, 0
00332     };
00333 
00334 
00335     switch (message)
00336     {
00337         case WM_CREATE:
00338             hDC = GetDC(hWnd);
00339 
00340             PixelFormat = ChoosePixelFormat(hDC, &pfd);
00341 
00342             if (!PixelFormat)
00343             {
00344                    MessageBox(NULL,"Can't find a suitable PixelFormat.","Error",MB_OK|MB_ICONERROR);
00345                 PostQuitMessage(0);
00346                 break;
00347             }
00348 
00349             if(!SetPixelFormat(hDC,PixelFormat,&pfd))
00350             {
00351                 MessageBox(NULL,"Can't set the PixelFormat.","Error",MB_OK|MB_ICONERROR);
00352                 PostQuitMessage(0);
00353                 break;
00354             }
00355 
00356             hRC = wglCreateContext(hDC);
00357             if(!hRC)
00358             {
00359                 MessageBox(NULL,"Can't create a GL Rendering Context.","Error",MB_OK|MB_ICONERROR);
00360                 PostQuitMessage(0);
00361                 break;
00362             }
00363 
00364             if(!wglMakeCurrent(hDC, hRC))
00365             {
00366                 MessageBox(NULL,"Can't activate the GL Rendering Context.","Error",MB_OK|MB_ICONERROR);
00367                 PostQuitMessage(0);
00368                 break;
00369             }
00370         break;
00371 
00372         case WM_SYSCOMMAND:
00373         {
00374             switch (wParam)
00375             {
00376                 case SC_SCREENSAVE:
00377                 case SC_MONITORPOWER:
00378                     return 0;
00379             }
00380             break;
00381         }
00382 
00383         if (DialogInUse)
00384         {
00385             case WM_PAINT:
00386                 BeginPaint(hWnd,&ps);
00387                 DrawGLScene();
00388                 glFlush();
00389                 SwapBuffers(hDC);
00390                 EndPaint(hWnd,&ps);
00391             break;
00392         }
00393 
00394         case WM_CLOSE:
00395             delete[] lightmap;
00396             delete[] staticlight;
00397             delete[] texture;
00398             delete[] vertex;
00399             delete[] camera;
00400             delete[] light;
00401             delete[] polygon;
00402 
00403             for (int i = numSplines - 1; i >= 0; i--)
00404                 DeleteSpline(i, SplineList);
00405 
00406             if (BuiltBSP)
00407                 DeleteBSP(root);
00408             delete root;
00409 
00410             for (int i = numportals; i > 0; i--)
00411             {
00412                 portal = PortalList.Get(i);
00413                 delete[] portal->Vertex;
00414             }
00415             
00416             glFontDestroy(&myFont);
00417             
00418             BASS_Stop();             // Stop all samples playing
00419             BASS_Free();             // Free the BASS resources
00420 
00421             CLog::addLine("--- End of Program ---");
00422             Console.Close();
00423 
00424             ChangeDisplaySettings(NULL, 0);
00425             wglMakeCurrent(hDC,NULL);
00426             wglDeleteContext(hRC);
00427             ReleaseDC(hWnd,hDC);
00428             DestroyWindow(hWnd);
00429         break;
00430 
00431         case WM_DESTROY:
00432             PostQuitMessage(0);
00433         break;
00434 
00435         case WM_KEYDOWN:
00436             key[wParam] = TRUE;
00437         break;
00438 
00439         case WM_KEYUP:
00440             key[wParam] = FALSE;
00441         break;
00442 
00443         case WM_SIZE:
00444             SetCursorPos((int)(screen.right * 0.5), (int)(screen.bottom * 0.5));
00445             ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
00446         break;
00447 
00448         case WM_MOUSEMOVE:
00449             if (cameraMode == 0)
00450             {
00451                 camera[currentCamera].Delta_x = float(HIWORD(lParam) - screen.bottom * 0.5) * 10;
00452                 camera[currentCamera].Delta_y = float(LOWORD(lParam) - screen.right * 0.5) * 10;
00453             }
00454         break;
00455 
00456         case WM_LBUTTONDOWN:
00457             camera[currentCamera].Delta_z = -120.0;
00458         break;
00459 
00460         case WM_RBUTTONDOWN:
00461             camera[currentCamera].Delta_z = 120.0;
00462         break;
00463 
00464         case WM_LBUTTONUP:
00465             if (wParam != MK_RBUTTON)
00466                 camera[currentCamera].Delta_z = 0.0;
00467         break;
00468 
00469         case WM_RBUTTONUP:
00470             if (wParam != MK_LBUTTON)
00471                 camera[currentCamera].Delta_z = 0.0;
00472         break;
00473 
00474         default:
00475             return (DefWindowProc(hWnd, message, wParam, lParam));
00476     }
00477     return (0);
00478 }


Variable Documentation

char AppDirectory[MAX_PATH]
 

Definition at line 50 of file main.cpp.

Referenced by StartProc(), and WinMain().

float ApplicationStartTime
 

Definition at line 51 of file main.cpp.

Referenced by bsplinepoint(), and InitGL().

const int average = 10
 

Definition at line 70 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

POLYGON* bsppolygon = new POLYGON[numPolygons]
 

Definition at line 89 of file main.cpp.

bool BuiltBSP = false
 

Definition at line 134 of file main.cpp.

Referenced by InitGL().

CAMERA* camera = new CAMERA[numCameras + 1]
 

Definition at line 95 of file main.cpp.

int cameraMode = 2
 

Definition at line 153 of file main.cpp.

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

LinkedList<SOUND_CHANNEL> ChannelList
 

Definition at line 128 of file main.cpp.

ConsoleWindow Console
 

Definition at line 41 of file main.cpp.

Referenced by WinMain(), and WndProc().

int currentCamera = 0
 

Definition at line 63 of file main.cpp.

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

int currentleaf = 0
 

Definition at line 132 of file main.cpp.

Referenced by DrawGLScene().

int currentLight = 0
 

Definition at line 76 of file main.cpp.

Referenced by DrawHalo(), and WinMain().

int currentSpline = 0
 

Definition at line 154 of file main.cpp.

Referenced by LoadSplines().

int device
 

Definition at line 121 of file main.cpp.

Referenced by devicedialogproc(), and InitializeBASS().

int DialogInUse = 0
 

Definition at line 104 of file main.cpp.

Referenced by ColorDialogHook(), and WinMain().

float epsilon = 0.05
 

Definition at line 56 of file main.cpp.

int fps
 

Definition at line 72 of file main.cpp.

Referenced by DrawMyText(), and GetTimePassed().

PLANE frustum[6]
 

Definition at line 80 of file main.cpp.

HINSTANCE g_hInst
 

Definition at line 47 of file main.cpp.

Referenced by WinMain().

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

Definition at line 75 of file main.cpp.

HDC hDC [static]
 

Definition at line 45 of file main.cpp.

Referenced by WinMain(), and WndProc().

HGLRC hRC [static]
 

Definition at line 44 of file main.cpp.

Referenced by WinMain(), and WndProc().

HWND hWnd
 

Definition at line 46 of file main.cpp.

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

HWND hWndStartDlg
 

Definition at line 103 of file main.cpp.

Referenced by StartProc().

bool key[256]
 

Definition at line 59 of file main.cpp.

Referenced by WinMain(), and WndProc().

CAMERA LastCam
 

Definition at line 96 of file main.cpp.

float lastmultiplier[average]
 

Definition at line 71 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

float lasttime
 

Definition at line 68 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

LinkedList<ListNode> LeafList
 

Definition at line 161 of file main.cpp.

LIGHT* light = new LIGHT[numLights + 1]
 

Definition at line 99 of file main.cpp.

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

Definition at line 100 of file main.cpp.

Referenced by GetLightColor().

Lightmap* lightmap = new Lightmap[numPolygons]
 

Definition at line 148 of file main.cpp.

Referenced by CreateLightmaps().

ListNode* listnode
 

Definition at line 163 of file main.cpp.

int lookAtPath = 0
 

Definition at line 155 of file main.cpp.

Referenced by LoadSplines().

BOOL lowqual
 

Definition at line 122 of file main.cpp.

Referenced by devicedialogproc(), and InitializeBASS().

float Max_X
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float Max_Y
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float Max_Z
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float Min_X
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float Min_Y
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float Min_Z
 

Definition at line 111 of file main.cpp.

Referenced by CreateLargePortal(), and InitGL().

float multiplier
 

Definition at line 69 of file main.cpp.

Referenced by GetTimePassed(), and WinMain().

GLFONT myFont
 

Definition at line 108 of file main.cpp.

int numCameras = 4
 

Definition at line 64 of file main.cpp.

Referenced by SetGLCamera(), and WinMain().

int numChannels = 0
 

Definition at line 126 of file main.cpp.

Referenced by CreateChannel().

int numcurrentportals = 0
 

Definition at line 118 of file main.cpp.

int numleaves = 0
 

Definition at line 131 of file main.cpp.

Referenced by CountVisibleLeaves().

int numleavesvisible = 0
 

Definition at line 114 of file main.cpp.

Referenced by DrawGLScene().

int numLightmaps = 0
 

Definition at line 147 of file main.cpp.

Referenced by CreateLightmaps().

int numLights = 0
 

Definition at line 77 of file main.cpp.

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

int numlistleaves = 0
 

Definition at line 116 of file main.cpp.

Referenced by MakeNodeLists().

int numlistpartitions = 0
 

Definition at line 117 of file main.cpp.

Referenced by MakeNodeLists().

int numpartitions = 0
 

Definition at line 133 of file main.cpp.

Referenced by MakePortalList().

int numPolygons = 58
 

Definition at line 87 of file main.cpp.

Referenced by InitGL(), and SetGLWorld().

int numportals = 0
 

Definition at line 139 of file main.cpp.

Referenced by AddPortalsToLeaves(), MakePortalList(), and WndProc().

int numSamples = 0
 

Definition at line 125 of file main.cpp.

Referenced by LoadSample().

int numSplines = 0
 

Definition at line 152 of file main.cpp.

Referenced by LoadSplines(), SetSplines(), and WndProc().

int numStaticLights = 9
 

Definition at line 143 of file main.cpp.

Referenced by CreateLightmaps().

int numVertices = 37
 

Definition at line 83 of file main.cpp.

Referenced by POLYGON::POLYGON(), and VERTEX::VERTEX().

LinkedList<ListNode> PartitionList
 

Definition at line 162 of file main.cpp.

float pi = 3.141592
 

Definition at line 54 of file main.cpp.

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

POLYGON* polygon = new POLYGON[numPolygons]
 

Definition at line 88 of file main.cpp.

Referenced by CheckForCollision(), ClipPortalToBackLeaf(), ClipPortalToFrontLeaf(), InvertPortals(), and SetGLWorld().

PORTAL* portal
 

Definition at line 140 of file main.cpp.

LinkedList<PORTAL> PortalList
 

Definition at line 138 of file main.cpp.

PAINTSTRUCT ps
 

Definition at line 49 of file main.cpp.

Referenced by WndProc().

float radian = pi / 180
 

Definition at line 55 of file main.cpp.

Referenced by OBJECT::Rotate().

bool released_key[256]
 

Definition at line 60 of file main.cpp.

Referenced by WinMain().

BSP_node* root = new BSP_node
 

Definition at line 135 of file main.cpp.

LinkedList<SOUND_SAMPLE> SampleList
 

Definition at line 127 of file main.cpp.

RECT screen
 

Definition at line 48 of file main.cpp.

Referenced by WinMain(), and WndProc().

int showportals = 0
 

Definition at line 115 of file main.cpp.

Referenced by WinMain().

VECTOR SpherePosition
 

Definition at line 124 of file main.cpp.

int SphereSector
 

Definition at line 123 of file main.cpp.

Referenced by DrawGLScene().

SPLINE* spline
 

Definition at line 157 of file main.cpp.

char SplineFileName[MAX_PATH]
 

Definition at line 156 of file main.cpp.

Referenced by StartProc().

LinkedList<SPLINE> SplineList
 

Definition at line 158 of file main.cpp.

Referenced by AddSpline(), DeleteSpline(), DrawSplines(), LoadSplines(), and SetSplines().

StaticLight* staticlight = new StaticLight[numStaticLights]
 

Definition at line 144 of file main.cpp.

float step = 30.0
 

Definition at line 65 of file main.cpp.

Referenced by WinMain().

char szText[BUFFER_SIZE]
 

Definition at line 105 of file main.cpp.

Referenced by StartProc().

TEXTURE* texture = new TEXTURE[4]
 

Definition at line 92 of file main.cpp.

Referenced by DrawBillboards(), DrawFire(), DrawHalo(), SetGLTexture(), and SetGLWorld().

VERTEX* vertex = new VERTEX[numVertices]
 

Definition at line 84 of file main.cpp.

Referenced by SetGLVertices(), and SetGLWorld().

int visible = 0
 

Definition at line 151 of file main.cpp.


Generated on Fri Dec 23 05:21:41 2005 for Sound by doxygen1.2.15