/*
*     ___                       ____ ___
*    / _ \___ _    _____ ____  |_  // _ \
*   / ___/ _ \ |/|/ / -_) __/ _/_ </ // /
*  /_/   \___/__,__/\__/_/   /____/____/
*
*
*   Original Code by John Garrison
*   Written September 3, 1999
*   To be released under the LGPL
*
*   Drawing of Objects and Cameras
*
*   See LICENSE.TXT for more LGPL info
*/

#ifdef USE_P3D

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

#include "power3d.h"
#include "render.h"


///////////////////////////////////////
//          CAMERA ROUTINES          //
///////////////////////////////////////

P3D_Object P3D_CreateCamera()
{
   P3D_Object temp;

   temp.posx = 0;
   temp.posy = 0;
   temp.posz = 0;
   temp.rotx = 0;
   temp.roty = 0;
   temp.rotz = 0;

   return temp;
}



int P3D_ShowCamera(P3D_Object Camera)
{
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   glTranslatef(-Camera.posx, -Camera.posy, -Camera.posz);
   glRotatef(-Camera.rotz, 0.0, 0.0, 1.0);
   glRotatef(-Camera.rotx, 1.0, 0.0, 0.0);
   glRotatef(-Camera.roty, 0.0, 1.0, 0.0);

   return 0;
}



///////////////////////////////////////
//          OBJECT ROUTINES          //
///////////////////////////////////////

int P3D_ShowObject(P3D_Object Object)
{
   glPushMatrix();
   glColor4f(Object.color.r, Object.color.g, Object.color.b, Object.color.a);
   glTranslatef(Object.posx, Object.posy, Object.posz);
   glRotatef(Object.rotx, 1.0, 0.0, 0.0);
   glRotatef(Object.roty, 0.0, 1.0, 0.0);
   glRotatef(Object.rotz, 0.0, 0.0, 1.0);

   glCallList(Object.list);
   glPopMatrix();

   return 0;
}

#endif