/*
 * ExNihilo 3D Engine
 * 
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Please read AUTHORS file !!!
 * 
 * $Id: ExCGizmoRectangle.cpp,v 1.5 2002/08/14 15:40:05 data Exp $
 *
 */

#include "ExCGizmoRectangle.h"

ExCGizmoRectangle::ExCGizmoRectangle(void)
{
Guard(ExCGizmoRectangle::ExCGizmoRectangle(void))
	SetName("ExCGizmoRectangle");
	SetType(typeid(this).name());
	m_Vertex[0]=ExCVec3D(-10.0f,-10.0f,-10.0f);
	m_Vertex[1]=ExCVec3D(-10.0f,-10.0f,10.0f);
	m_Vertex[2]=ExCVec3D(-10.0f,10.0f,10.0f);
	m_Vertex[3]=ExCVec3D(-10.0f,10.0f,-10.0f);
	m_Vertex[4]=ExCVec3D(10.0f,10.0f,-10.0f);
	m_Vertex[5]=ExCVec3D(10.0f,10.0f,10.0f);
	m_Vertex[6]=ExCVec3D(10.0f,-10.0f,10.0f);
	m_Vertex[7]=ExCVec3D(10.0f,-10.0f,-10.0f);
UnGuard
}

ExCGizmoRectangle::~ExCGizmoRectangle(void)
{
Guard(ExCGizmoRectangle::~ExCGizmoRectangle(void))
UnGuard
}

void ExCGizmoRectangle::Draw(void)
{
Guard(void ExCGizmoRectangle::Draw(void))
	
 	glDisable(GL_LIGHTING);
	glBegin(GL_LINE_LOOP);
		//upper face
		glVertex3f(m_Vertex[0].GetX(),m_Vertex[0].GetY(),m_Vertex[0].GetZ());
		glVertex3f(m_Vertex[1].GetX(),m_Vertex[1].GetY(),m_Vertex[1].GetZ());
		glVertex3f(m_Vertex[2].GetX(),m_Vertex[2].GetY(),m_Vertex[2].GetZ());
		glVertex3f(m_Vertex[3].GetX(),m_Vertex[3].GetY(),m_Vertex[3].GetZ());
	glEnd();
	glBegin(GL_LINE_LOOP);
		//down face
	    glVertex3f(m_Vertex[4].GetX(),m_Vertex[4].GetY(),m_Vertex[4].GetZ());
		glVertex3f(m_Vertex[5].GetX(),m_Vertex[5].GetY(),m_Vertex[5].GetZ());
		glVertex3f(m_Vertex[6].GetX(),m_Vertex[6].GetY(),m_Vertex[6].GetZ());
		glVertex3f(m_Vertex[7].GetX(),m_Vertex[7].GetY(),m_Vertex[7].GetZ());
	glEnd();
	glBegin(GL_LINES);
		//4 line for 4 face
		glVertex3f(m_Vertex[1].GetX(),m_Vertex[1].GetY(),m_Vertex[1].GetZ());
		glVertex3f(m_Vertex[6].GetX(),m_Vertex[6].GetY(),m_Vertex[6].GetZ());
		glVertex3f(m_Vertex[2].GetX(),m_Vertex[2].GetY(),m_Vertex[2].GetZ());
		glVertex3f(m_Vertex[5].GetX(),m_Vertex[5].GetY(),m_Vertex[5].GetZ());
		
		glVertex3f(m_Vertex[0].GetX(),m_Vertex[0].GetY(),m_Vertex[0].GetZ());
		glVertex3f(m_Vertex[7].GetX(),m_Vertex[7].GetY(),m_Vertex[7].GetZ());
		glVertex3f(m_Vertex[3].GetX(),m_Vertex[3].GetY(),m_Vertex[3].GetZ());
		glVertex3f(m_Vertex[4].GetX(),m_Vertex[4].GetY(),m_Vertex[4].GetZ());
	glEnd();
UnGuard
}
