/*
*	GL World.cpp
*	----------------------------------------
*	A part of "Intelligent AI"
*	© 2001 SCC Team 064
*	----------------------------------------
*
*	This file:
*		€ Initilizes the GL viewing angle and updates the window apperance as 
*		directed by the code.
*/


#include "MacInput.h"

/*											InitGL											*/
/*------------------------------------------------------------------------------------------*/
int InitGL(GLvoid)									// All Setup For OpenGL Goes Here
{
	SetupObjcts();

	return true;									// Initialization Went OK
}


/*											UpdateWorld										*/
/*------------------------------------------------------------------------------------------*/
void UpdateWorld (WindowPtr pWindow)
{
	if ((pWindow == gpWindow) && aglContext)
	{
		ResumeGL ((CGrafPtr) gpWindow, aglContext);

	//Update Camera Position
		glMatrixMode(GL_PROJECTION);	
		glLoadIdentity();							// Reset The Projection Matrix
		gluPerspective( 60.0f, ( (GLfloat) (rectWin.right - rectWin.left) / 
			(GLfloat) (rectWin.bottom - rectWin.top)), .1f,  1000.f);

		glRotatef(Azimuth * RAD_TO_DEG, 0.0, 0.0, 1.0); /* yaw */
		glTranslatef(0, 0, -55);
		glTranslatef(-cameraX, -cameraY, cameraZ);
		glRotatef(90, 1.0, 0.0, 0.0); /* pitch */

		DrawGLScene (gpWindow, aglContext, gFontList);
	}
}


/*											CleanUp											*/
/*------------------------------------------------------------------------------------------*/
void CleanUp (void)
{
	DestroyGLFromWindow (&aglContext, &glInfo);

	DisposeWindow ((WindowPtr)gpWindow);
	gpWindow = NULL;
}