Exemple #1
0
Walls::Walls(ofColor frontColor, ofColor sideColor, ofColor topColor, int boxWidth, int boxHeight, int boxDepth){
    this->frontColor = frontColor;
    this->sideColor = sideColor;
    this->topColor = topColor;
    this->boxWidth = boxWidth;
    this->boxHeight = boxHeight;
    this->boxDepth = boxDepth;
    
    speedOfRotation = 4.0;
    faceFront = *new ofMesh();
    faceBack = *new ofMesh();
    faceTop = *new ofMesh();
    faceLeft = *new ofMesh();
    faceRight = *new ofMesh();
    faceLeft = *new ofMesh();
    
    linesFront = *new ofMesh();
    linesBack = *new ofMesh();
    linesTop = *new ofMesh();
    linesLeft = *new ofMesh();
    linesRight = *new ofMesh();
    linesLeft = *new ofMesh();
    
    linesFront.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBack.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesLeft.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesRight.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesTop.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBot.setMode(OF_PRIMITIVE_LINE_STRIP);
    
    ofVec3f frontTopLeft (-boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontTopRight (boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontBotLeft (-boxWidth/2, boxHeight/2, boxDepth/2);
    ofVec3f frontBotRight (boxWidth/2, boxHeight/2, boxDepth/2);
    
    ofVec3f backBotRight(boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backBotLeft(-boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backTopLeft(- boxWidth/2, -boxHeight/2, -boxDepth/2);
    ofVec3f backTopRight(boxWidth/2, -boxHeight/2, -boxDepth/2);
    
    //    mesh.addVertex(frontTopLeft);
    //    mesh.addVertex(frontTopRight);
    //    mesh.addVertex(frontBotRight);
    //    mesh.addVertex(frontBotLeft);
    //    mesh.addVertex(frontTopLeft);
    //    mesh.addVertex(backTopLeft);
    //    mesh.addVertex(backBotLeft);
    //    mesh.addVertex(frontBotLeft);
    //    mesh.addVertex(frontBotRight);
    //    mesh.addVertex(backBotRight);
    //    mesh.addVertex(backBotLeft);
    //    mesh.addVertex(backTopLeft);
    //    mesh.addVertex(backTopRight);
    //    mesh.addVertex(backBotRight);
    //    mesh.addVertex(backTopRight);
    //    mesh.addVertex(frontTopRight);
    
    //front face
    faceFront.addVertex(frontTopLeft);
    faceFront.addVertex(frontBotLeft);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotRight);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotLeft);
    
    linesFront.addVertex(frontTopLeft);
    linesFront.addVertex(frontTopRight);
    linesFront.addVertex(frontBotRight);
    linesFront.addVertex(frontBotLeft);
    linesFront.addVertex(frontTopLeft);
    //top face
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(frontTopRight);
    faceTop.addVertex(backTopRight);
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(backTopLeft);
    faceTop.addVertex(backTopRight);
    
    linesTop.addVertex(frontTopLeft);
    linesTop.addVertex(frontTopRight);
    linesTop.addVertex(backTopRight);
    linesTop.addVertex(backTopLeft);
    linesTop.addVertex(frontTopLeft);
    //bot face
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(frontBotRight);
    faceBot.addVertex(backBotRight);
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(backBotLeft);
    faceBot.addVertex(backBotRight);
    
    linesBot.addVertex(frontBotRight);
    linesBot.addVertex(frontBotLeft);
    linesBot.addVertex(backBotLeft);
    linesBot.addVertex(backBotRight);
    linesBot.addVertex(frontBotRight);
    
    //back face
    faceBack.addVertex(backTopLeft);
    faceBack.addVertex(backBotLeft);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotRight);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotLeft);
    
    linesBack.addVertex(backBotRight);
    linesBack.addVertex(backBotLeft);
    linesBack.addVertex(backTopLeft);
    linesBack.addVertex(backTopRight);
    linesBack.addVertex(backBotRight);
    //right face
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(frontBotRight);
    faceRight.addVertex(backBotRight);
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(backTopRight);
    faceRight.addVertex(backBotRight);
    linesRight.addVertex(backBotRight);
    linesRight.addVertex(backTopRight);
    linesRight.addVertex(frontTopRight);
    linesRight.addVertex(frontBotRight);
    linesRight.addVertex(backBotRight);
    //left face
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(frontBotLeft);
    faceLeft.addVertex(backBotLeft);
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(backTopLeft);
    faceLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backTopLeft);
    linesLeft.addVertex(frontTopLeft);
    linesLeft.addVertex(frontBotLeft);
    linesLeft.addVertex(backBotLeft);
    
    // 1 is shown on left wall
    this->firstPainting = new Painting(-boxWidth/2,-boxWidth/2 + 50, -boxHeight/2 + 100, boxHeight/2 - 100, -boxDepth/2 +100, boxDepth/2 - 100, 1);
    
    // 4 is shown on right wall
    this->fourthPainting = new Painting(boxWidth/2 -50, boxWidth/2, -boxHeight/2 + 150, boxHeight/2 - 150, -boxDepth/2 +150, boxDepth/2 - 150, 4);
    
    // 2 & 3 are shown on back wall
    this->secPainting = new Painting(-boxWidth/2+ 100, boxWidth/2- 100 -800, -boxHeight/2 + 150, boxHeight/2 - 150, -boxDepth/2 + 50, -boxDepth/2, 2);
    this->thirdPainting = new Painting(boxWidth/2 - 800, boxWidth/2- 100, -boxHeight/2 + 100, boxHeight/2 - 100, -boxDepth/2 + 50, -boxDepth/2, 3);
    // 5 is on front wall
    this->fifthPainting = new Painting(- boxWidth/2 + 300, boxWidth/2 - 300, -boxHeight/2 + 100, boxHeight/2 - 100, boxDepth/2 - 50, boxDepth/2, 5);
    this->fifthDynamic = new Painting(- boxWidth/2 + 300, boxWidth/2 - 300, -boxHeight/2 + 100, boxHeight/2 - 100, boxDepth/2 - 50, boxDepth/2, -5);

    this->floor = new Painting(-boxWidth/2, boxWidth/2, boxHeight/2, boxHeight/2, -boxDepth/2, boxDepth/2, 10);
}
Frame::Frame(ofColor frontColor, ofColor sideColor, ofColor topColor, int boxWidth, int boxHeight, int boxDepth, float marginX, float marginY, int perspectiveMode){
    this->frontColor = frontColor;
    this->sideColor = sideColor;
    this->topColor = topColor;
    this->boxWidth = boxWidth;
    this->boxHeight = boxHeight;
    this->boxDepth = boxDepth;
    this->marginX = marginX;
    this->marginY = marginY;
    this->perspectiveMode = perspectiveMode;
    
    speedOfRotation = 4.0;
    faceFront = *new ofMesh();
    faceBack = *new ofMesh();
    faceTop = *new ofMesh();
    faceLeft = *new ofMesh();
    faceRight = *new ofMesh();
    faceLeft = *new ofMesh();

    linesFront = *new ofMesh();
    linesBack = *new ofMesh();
    linesTop = *new ofMesh();
    linesLeft = *new ofMesh();
    linesRight = *new ofMesh();
    linesLeft = *new ofMesh();

    linesFront.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBack.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesLeft.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesRight.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesTop.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBot.setMode(OF_PRIMITIVE_LINE_STRIP);
    
    ofVec3f frontTopLeft (-boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontTopRight (boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontBotLeft (-boxWidth/2, boxHeight/2, boxDepth/2);
    ofVec3f frontBotRight (boxWidth/2, boxHeight/2, boxDepth/2);
    
    ofVec3f backBotRight(boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backBotLeft(-boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backTopLeft(- boxWidth/2, -boxHeight/2, -boxDepth/2);
    ofVec3f backTopRight(boxWidth/2, -boxHeight/2, -boxDepth/2);
    
    //    mesh.addVertex(frontTopLeft);
    //    mesh.addVertex(frontTopRight);
    //    mesh.addVertex(frontBotRight);
    //    mesh.addVertex(frontBotLeft);
    //    mesh.addVertex(frontTopLeft);
    //    mesh.addVertex(backTopLeft);
    //    mesh.addVertex(backBotLeft);
    //    mesh.addVertex(frontBotLeft);
    //    mesh.addVertex(frontBotRight);
    //    mesh.addVertex(backBotRight);
    //    mesh.addVertex(backBotLeft);
    //    mesh.addVertex(backTopLeft);
    //    mesh.addVertex(backTopRight);
    //    mesh.addVertex(backBotRight);
    //    mesh.addVertex(backTopRight);
    //    mesh.addVertex(frontTopRight);
    
    //front face
    faceFront.addVertex(frontTopLeft);
    faceFront.addVertex(frontBotLeft);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotRight);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotLeft);
    
    linesFront.addVertex(frontTopLeft);
    linesFront.addVertex(frontTopRight);
    linesFront.addVertex(frontBotRight);
    linesFront.addVertex(frontBotLeft);
    linesFront.addVertex(frontTopLeft);
    //top face
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(frontTopRight);
    faceTop.addVertex(backTopRight);
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(backTopLeft);
    faceTop.addVertex(backTopRight);
    
    linesTop.addVertex(frontTopLeft);
    linesTop.addVertex(frontTopRight);
    linesTop.addVertex(backTopRight);
    linesTop.addVertex(backTopLeft);
    linesTop.addVertex(frontTopLeft);
    //bot face
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(frontBotRight);
    faceBot.addVertex(backBotRight);
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(backBotLeft);
    faceBot.addVertex(backBotRight);
    
    linesBot.addVertex(frontBotRight);
    linesBot.addVertex(frontBotLeft);
    linesBot.addVertex(backBotLeft);
    linesBot.addVertex(backBotRight);
    linesBot.addVertex(frontBotRight);
    
    //back face
    faceBack.addVertex(backTopLeft);
    faceBack.addVertex(backBotLeft);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotRight);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotLeft);
    
    linesBack.addVertex(backBotRight);
    linesBack.addVertex(backBotLeft);
    linesBack.addVertex(backTopLeft);
    linesBack.addVertex(backTopRight);
    linesBack.addVertex(backBotRight);
    //right face
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(frontBotRight);
    faceRight.addVertex(backBotRight);
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(backTopRight);
    faceRight.addVertex(backBotRight);
    linesRight.addVertex(backBotRight);
    linesRight.addVertex(backTopRight);
    linesRight.addVertex(frontTopRight);
    linesRight.addVertex(frontBotRight);
    linesRight.addVertex(backBotRight);
    //left face
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(frontBotLeft);
    faceLeft.addVertex(backBotLeft);
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(backTopLeft);
    faceLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backTopLeft);
    linesLeft.addVertex(frontTopLeft);
    linesLeft.addVertex(frontBotLeft);
    linesLeft.addVertex(backBotLeft);

}
Exemple #3
0
void Box::createBox()
{
	Vect frontBottomLeft(-0.5f, -0.5f, 0.5f);
	Vect frontBottomRight(0.5f, -0.5f, 0.5f);
	Vect frontTopLeft(-0.5f, 0.5f, 0.5f);
	Vect frontTopRight(0.5f, 0.5f, 0.5f);

	Vect backBottomLeft(-0.5f, -0.5f, -0.5f);
	Vect backBottomRight(0.5f, -0.5f, -0.5f);
	Vect backTopLeft(-0.5f, 0.5f, -0.5f);
	Vect backTopRight(0.5f, 0.5f, -0.5f);

	Vect frontLeftNormal = (frontBottomLeft - frontTopLeft).cross(frontBottomRight - frontBottomLeft);
	Vect frontRightNormal = (frontTopRight - frontBottomRight).cross(frontTopLeft - frontTopRight);

	Vect rightSideLeftNormal = (frontBottomRight - frontTopRight).cross(backBottomRight - frontBottomRight);
	Vect rightSideRightNormal = (backTopRight - backBottomRight).cross(frontTopRight - backTopRight);

	Vect backLeftNormal = (backBottomRight - backTopRight).cross(backBottomLeft - backBottomRight);
	Vect backRightNormal = (backTopLeft - backBottomLeft).cross(backTopRight - backTopLeft);

	Vect leftSideLeftNormal = (backBottomLeft - backTopLeft).cross(frontBottomLeft - backBottomLeft);
	Vect leftSideRightNormal = (frontTopLeft - frontBottomLeft).cross(backTopLeft - frontTopLeft);

	Vect topLeftNormal = (frontTopLeft - backTopLeft).cross(frontTopRight - frontTopLeft);
	Vect topRightNormal = (backTopRight - frontTopRight).cross(backTopLeft - backTopRight);

	Vect bottomLeftNormal = (backBottomLeft - frontBottomLeft).cross(backBottomRight - backBottomLeft);
	Vect bottomRightNormal = (frontBottomRight - backBottomRight).cross(frontBottomLeft - frontBottomRight);

	frontLeftNormal.norm();
	frontRightNormal.norm();
	rightSideLeftNormal.norm();
	rightSideLeftNormal.norm();
	backLeftNormal.norm();
	backRightNormal.norm();
	leftSideLeftNormal.norm();
	leftSideRightNormal.norm();
	topLeftNormal.norm();
	topRightNormal.norm();
	bottomLeftNormal.norm();
	bottomRightNormal.norm();

	boxBatch.Begin(GL_TRIANGLES, 36, 1);

#if 1

	//Test - Vertex Normals - No break angle - Need to work on this more - possibly when I hook in models from 3DSMax
	Vect ftl = frontRightNormal + leftSideRightNormal + topLeftNormal;
	Vect ftr = frontRightNormal + rightSideLeftNormal + topLeftNormal;
	Vect fbl = frontLeftNormal + leftSideLeftNormal  + bottomLeftNormal;
	Vect fbr = frontLeftNormal + rightSideLeftNormal + bottomRightNormal;

	Vect btl = backRightNormal + leftSideLeftNormal + topLeftNormal;
	Vect btr = backLeftNormal + rightSideRightNormal + topRightNormal;
	Vect bbl = backLeftNormal + leftSideLeftNormal + bottomLeftNormal;
	Vect bbr = backLeftNormal + rightSideRightNormal + bottomLeftNormal;

	ftl.norm();
	ftr.norm();
	fbl.norm();
	fbr.norm();
	btl.norm();
	btr.norm();
	bbl.norm();
	bbr.norm();

	//Front
	//Left triangle
	//Top left
	boxBatch.Normal3f(ftl[x], ftl[y], ftl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(fbl[x], fbl[y], fbl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(fbr[x], fbr[y], fbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(fbr[x], fbr[y], fbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Top right
	boxBatch.Normal3f(ftr[x], ftr[y], ftr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Top left
	boxBatch.Normal3f(ftl[x], ftl[y], ftl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Right Side
	//Left triangle
	//Top left
	boxBatch.Normal3f(ftr[x], ftr[y], ftr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Bottom left
	boxBatch.Normal3f(fbr[x], fbr[y], fbr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Bottom right
	boxBatch.Normal3f(bbr[x], bbr[y], bbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(bbr[x], bbr[y], bbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Top right
	boxBatch.Normal3f(btr[x], btr[y], btr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Top left
	boxBatch.Normal3f(ftr[x], ftr[y], ftr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Back
	//Left triangle
	//Top left
	boxBatch.Normal3f(btr[x], btr[y], btr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Bottom left
	boxBatch.Normal3f(bbr[x], bbr[y], bbr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Bottom right
	boxBatch.Normal3f(bbl[x], bbl[y], bbl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(bbl[x], bbl[y], bbl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Top right
	boxBatch.Normal3f(btl[x], btl[y], btl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Top left
	boxBatch.Normal3f(btr[x], btr[y], btr[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Left Side
	//Left triangle
	//Top left
	boxBatch.Normal3f(btl[x], btl[y], btl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(bbl[x], bbl[y], bbl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(fbl[x], fbl[y], fbl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(fbl[x], fbl[y], fbl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Top right
	boxBatch.Normal3f(ftl[x], ftl[y], ftl[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Top left
	boxBatch.Normal3f(btl[x], btl[y], btl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Top
	//Left triangle
	//Top left
	boxBatch.Normal3f(btl[x], btl[y], btl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(ftl[x], ftl[y], ftl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Bottom right
	boxBatch.Normal3f(ftr[x], ftr[y], ftr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(ftr[x], ftr[y], ftr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Top right
	boxBatch.Normal3f(btr[x], btr[y], btr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Top left
	boxBatch.Normal3f(btl[x], btl[y], btl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom
	//Left triangle
	//Top left
	boxBatch.Normal3f(fbl[x], fbl[y], fbl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Bottom left
	boxBatch.Normal3f(bbl[x], bbl[y], bbl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(bbr[x], bbr[y], bbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(bbr[x], bbr[y], bbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Top right
	boxBatch.Normal3f(fbr[x], fbr[y], fbr[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Top left
	boxBatch.Normal3f(fbl[x], fbl[y], fbl[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

#else

	//Front
	//Left triangle
	//Top left
	boxBatch.Normal3f(frontLeftNormal[x], frontLeftNormal[y], frontLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(frontLeftNormal[x], frontLeftNormal[y], frontLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(frontLeftNormal[x], frontLeftNormal[y], frontLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(frontRightNormal[x], frontRightNormal[y], frontRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Top right
	boxBatch.Normal3f(frontRightNormal[x], frontRightNormal[y], frontRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Top left
	boxBatch.Normal3f(frontRightNormal[x], frontRightNormal[y], frontRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Right Side
	//Left triangle
	//Top left
	boxBatch.Normal3f(rightSideLeftNormal[x], rightSideLeftNormal[y], rightSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Bottom left
	boxBatch.Normal3f(rightSideLeftNormal[x], rightSideLeftNormal[y], rightSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Bottom right
	boxBatch.Normal3f(rightSideLeftNormal[x], rightSideLeftNormal[y], rightSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(rightSideRightNormal[x], rightSideRightNormal[y], rightSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Top right
	boxBatch.Normal3f(rightSideRightNormal[x], rightSideRightNormal[y], rightSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Top left
	boxBatch.Normal3f(rightSideRightNormal[x], rightSideRightNormal[y], rightSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Back
	//Left triangle
	//Top left
	boxBatch.Normal3f(backLeftNormal[x], backLeftNormal[y], backLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Bottom left
	boxBatch.Normal3f(backLeftNormal[x], backLeftNormal[y], backLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Bottom right
	boxBatch.Normal3f(backLeftNormal[x], backLeftNormal[y], backLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(backRightNormal[x], backRightNormal[y], backRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Top right
	boxBatch.Normal3f(backRightNormal[x], backRightNormal[y], backRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Top left
	boxBatch.Normal3f(backRightNormal[x], backRightNormal[y], backRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Left Side
	//Left triangle
	//Top left
	boxBatch.Normal3f(leftSideLeftNormal[x], leftSideLeftNormal[y], leftSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(leftSideLeftNormal[x], leftSideLeftNormal[y], leftSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(leftSideLeftNormal[x], leftSideLeftNormal[y], leftSideLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(leftSideRightNormal[x], leftSideRightNormal[y], leftSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Top right
	boxBatch.Normal3f(leftSideRightNormal[x], leftSideRightNormal[y], leftSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Top left
	boxBatch.Normal3f(leftSideRightNormal[x], leftSideRightNormal[y], leftSideRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Top
	//Left triangle
	//Top left
	boxBatch.Normal3f(topLeftNormal[x], topLeftNormal[y], topLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom left
	boxBatch.Normal3f(topLeftNormal[x], topLeftNormal[y], topLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(frontTopLeft[x], frontTopLeft[y], frontTopLeft[z]);

	//Bottom right
	boxBatch.Normal3f(topLeftNormal[x], topLeftNormal[y], topLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(topRightNormal[x], topRightNormal[y], topRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(frontTopRight[x], frontTopRight[y], frontTopRight[z]);

	//Top right
	boxBatch.Normal3f(topRightNormal[x], topRightNormal[y], topRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(backTopRight[x], backTopRight[y], backTopRight[z]);

	//Top left
	boxBatch.Normal3f(topRightNormal[x], topRightNormal[y], topRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(backTopLeft[x], backTopLeft[y], backTopLeft[z]);

	//Bottom
	//Left triangle
	//Top left
	boxBatch.Normal3f(bottomLeftNormal[x], bottomLeftNormal[y], bottomLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

	//Bottom left
	boxBatch.Normal3f(bottomLeftNormal[x], bottomLeftNormal[y], bottomLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
	boxBatch.Vertex3f(backBottomLeft[x], backBottomLeft[y], backBottomLeft[z]);

	//Bottom right
	boxBatch.Normal3f(bottomLeftNormal[x], bottomLeftNormal[y], bottomLeftNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Right triangle
	//Bottom right
	boxBatch.Normal3f(bottomRightNormal[x], bottomRightNormal[y], bottomRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 0.0f);
	boxBatch.Vertex3f(backBottomRight[x], backBottomRight[y], backBottomRight[z]);

	//Top right
	boxBatch.Normal3f(bottomRightNormal[x], bottomRightNormal[y], bottomRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 1.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomRight[x], frontBottomRight[y], frontBottomRight[z]);

	//Top left
	boxBatch.Normal3f(bottomRightNormal[x], bottomRightNormal[y], bottomRightNormal[z]);
	boxBatch.MultiTexCoord2f(0, 0.0f, 1.0f);
	boxBatch.Vertex3f(frontBottomLeft[x], frontBottomLeft[y], frontBottomLeft[z]);

#endif
	
	boxBatch.End();
}
FrameShapes::FrameShapes(float xCenter, float yCenter, float zCenter, int frameNum, ofColor frontColor, ofColor sideColor, ofColor topColor, int boxWidth, int boxHeight, int boxDepth, bool rotatable){
    this->frontColor = frontColor;
    this->sideColor = sideColor;
    this->topColor = topColor;
    this->boxWidth = boxWidth;
    this->boxHeight = boxHeight;
    this->boxDepth = boxDepth;
    
    this->xCenter = xCenter;
    this->yCenter = yCenter;
    this->frameNum = frameNum;
    speedOfRotation = 3.0;
    faceFront = *new ofMesh();
    faceBack = *new ofMesh();
    faceTop = *new ofMesh();
    faceLeft = *new ofMesh();
    faceRight = *new ofMesh();
    faceLeft = *new ofMesh();
    
    linesFront = *new ofMesh();
    linesBack = *new ofMesh();
    linesTop = *new ofMesh();
    linesLeft = *new ofMesh();
    linesRight = *new ofMesh();
    linesLeft = *new ofMesh();
    
    linesFront.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBack.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesLeft.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesRight.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesTop.setMode(OF_PRIMITIVE_LINE_STRIP);
    linesBot.setMode(OF_PRIMITIVE_LINE_STRIP);
    
    ofVec3f frontTopLeft (-boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontTopRight (boxWidth/2,-boxHeight/2, boxDepth/2);
    ofVec3f frontBotLeft (-boxWidth/2, boxHeight/2, boxDepth/2);
    ofVec3f frontBotRight (boxWidth/2, boxHeight/2, boxDepth/2);
    
    ofVec3f backBotRight(boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backBotLeft(-boxWidth/2, boxHeight/2, -boxDepth/2);
    ofVec3f backTopLeft(- boxWidth/2, -boxHeight/2, -boxDepth/2);
    ofVec3f backTopRight(boxWidth/2, -boxHeight/2, -boxDepth/2);
    faceFront.addVertex(frontTopLeft);
    faceFront.addVertex(frontBotLeft);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotRight);
    faceFront.addVertex(frontTopRight);
    faceFront.addVertex(frontBotLeft);
    
    linesFront.addVertex(frontTopLeft);
    linesFront.addVertex(frontTopRight);
    linesFront.addVertex(frontBotRight);
    linesFront.addVertex(frontBotLeft);
    linesFront.addVertex(frontTopLeft);
    //top face
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(frontTopRight);
    faceTop.addVertex(backTopRight);
    faceTop.addVertex(frontTopLeft);
    faceTop.addVertex(backTopLeft);
    faceTop.addVertex(backTopRight);
    
    linesTop.addVertex(frontTopLeft);
    linesTop.addVertex(frontTopRight);
    linesTop.addVertex(backTopRight);
    linesTop.addVertex(backTopLeft);
    linesTop.addVertex(frontTopLeft);
    //bot face
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(frontBotRight);
    faceBot.addVertex(backBotRight);
    faceBot.addVertex(frontBotLeft);
    faceBot.addVertex(backBotLeft);
    faceBot.addVertex(backBotRight);
    
    linesBot.addVertex(frontBotRight);
    linesBot.addVertex(frontBotLeft);
    linesBot.addVertex(backBotLeft);
    linesBot.addVertex(backBotRight);
    linesBot.addVertex(frontBotRight);
    
    //back face
    faceBack.addVertex(backTopLeft);
    faceBack.addVertex(backBotLeft);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotRight);
    faceBack.addVertex(backTopRight);
    faceBack.addVertex(backBotLeft);
    
    linesBack.addVertex(backBotRight);
    linesBack.addVertex(backBotLeft);
    linesBack.addVertex(backTopLeft);
    linesBack.addVertex(backTopRight);
    linesBack.addVertex(backBotRight);
    //right face
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(frontBotRight);
    faceRight.addVertex(backBotRight);
    faceRight.addVertex(frontTopRight);
    faceRight.addVertex(backTopRight);
    faceRight.addVertex(backBotRight);
    linesRight.addVertex(backBotRight);
    linesRight.addVertex(backTopRight);
    linesRight.addVertex(frontTopRight);
    linesRight.addVertex(frontBotRight);
    linesRight.addVertex(backBotRight);
    //left face
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(frontBotLeft);
    faceLeft.addVertex(backBotLeft);
    faceLeft.addVertex(frontTopLeft);
    faceLeft.addVertex(backTopLeft);
    faceLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backBotLeft);
    linesLeft.addVertex(backTopLeft);
    linesLeft.addVertex(frontTopLeft);
    linesLeft.addVertex(frontBotLeft);
    linesLeft.addVertex(backBotLeft);

    if(frameNum ==1){
        this->frontFace = new glitchSurface(-boxWidth/2, boxWidth/2, -boxHeight/2, boxHeight/2, boxDepth/2, -boxDepth/2, 1);
    } else if(frameNum ==2){
        this->frontFace = new glitchSurface(-boxWidth/2, boxWidth/2, -boxHeight/2, boxHeight/2, boxDepth/2, -boxDepth/2, 2);
    }
    else if(frameNum ==3){
        this->frontFace = new glitchSurface(-boxWidth/2, boxWidth/2, -boxHeight/2, boxHeight/2, boxDepth/2, -boxDepth/2, 3);
    } else if(frameNum ==4){
       this->frontFace = new glitchSurface(-boxWidth/2, boxWidth/2, -boxHeight/2, boxHeight/2, boxDepth/2, -boxDepth/2, 4);
    } else if(frameNum ==100){
        this->frontFace = new glitchSurface(-boxWidth/2, boxWidth/2, -boxHeight/2, boxHeight/2, boxDepth/2, -boxDepth/2, 100);
    }
}