#include "szescian.h"

void szescian::create(float x, float y, float z, float KRAWEDZ) {

	this->c_x = x;
	this->c_y = y;
	this->c_z = z;

		// Parametry wierzcholkow

		GLfloat sa[3] = { x + 0.0f,    y + 0.0f,    z + 0.0f };
		GLfloat sb[3] = { x + KRAWEDZ, y + 0.0f,    z + 0.0f };
		GLfloat sc[3] = { x + KRAWEDZ, y + KRAWEDZ, z + 0.0f };
		GLfloat sd[3] = { x + 0.0f,    y + KRAWEDZ, z + 0.0f };
		GLfloat se[3] = { x + 0.0f,    y + 0.0f,    z - KRAWEDZ };
		GLfloat sf[3] = { x + KRAWEDZ, y + 0.0f,    z - KRAWEDZ };
		GLfloat sg[3] = { x + KRAWEDZ, y + KRAWEDZ, z - KRAWEDZ };
		GLfloat sh[3] = { x + 0.0f,    y + KRAWEDZ, z - KRAWEDZ };

		// Sciany skladowe

		glColor3f(1.0f, 0.0f, 0.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(sa);
		glVertex3fv(sb);
		glVertex3fv(sc);
		glVertex3fv(sd);
		glEnd();


		glColor3f(0.0f, 1.0f, 0.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(sb);
		glVertex3fv(sf);
		glVertex3fv(sg);
		glVertex3fv(sc);
		glEnd();

		glColor3f(0.0f, 0.0f, 1.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(sf);
		glVertex3fv(se);
		glVertex3fv(sh);
		glVertex3fv(sg);
		glEnd();

		glColor3f(1.0f, 1.0f, 0.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(se);
		glVertex3fv(sa);
		glVertex3fv(sd);
		glVertex3fv(sh);
		glEnd();

		glColor3f(0.0f, 1.0f, 1.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(sd);
		glVertex3fv(sc);
		glVertex3fv(sg);
		glVertex3fv(sh);
		glEnd();

		glColor3f(1.0f, 0.0f, 1.0f);
		glBegin(GL_POLYGON);
		glVertex3fv(sa);
		glVertex3fv(sb);
		glVertex3fv(sf);
		glVertex3fv(se);
		glEnd();

}