Exemplo n.º 1
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawX() {
	glPushMatrix();

	glPushMatrix();
	glRotatef(20, 0, 0, 1);
	drawI();
	glPopMatrix();

	glPushMatrix();
	glRotatef(-20, 0, 0, 1);
	drawI();
	glPopMatrix();

	glPopMatrix();
}
void legPart6(float colours1[], float colours2[]) {
    glPushMatrix();

    glScalef(-0.1,0.1,0.1);
    drawI(colours1,colours2);
    glPopMatrix();
}
Exemplo n.º 3
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawIII() {
	glPushMatrix();

	glPushMatrix();
	glTranslatef(-0.2, 0, 0);
	drawI();
	glPopMatrix();

	drawI();

	glPushMatrix();
	glTranslatef(0.2, 0, 0);
	drawI();
	glPopMatrix();

	glPopMatrix();
}
Exemplo n.º 4
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawXII() {
	glPushMatrix();
	glTranslatef(0.14, 0.0, 0.0);

	glPushMatrix();
	glTranslatef(-0.35, 0, 0);
	drawX();
	glPopMatrix();

	drawI();

	glPushMatrix();
	glTranslatef(0.2, 0, 0);
	drawI();
	glPopMatrix();

	glPopMatrix();
}
Exemplo n.º 5
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawV() {
	glPushMatrix();

	glPushMatrix();
	glTranslatef(0, -0.5, 0);
	glRotatef(18, 0, 0, 1);
	glTranslatef(0, 0.5, 0);
	drawI();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0, -0.5, 0);
	glRotatef(-18, 0, 0, 1);
	glTranslatef(0, 0.5, 0);
	drawI();
	glPopMatrix();

	glPopMatrix();
}
Exemplo n.º 6
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawVI() {
	glPushMatrix();
	glTranslatef(0.4, 0.0, 0.0);

	glPushMatrix();
	glTranslatef(-0.525, 0.05, 0);
	drawV();
	glPopMatrix();

	drawI();

	glPopMatrix();
}
//======================================================
//DRAW INITIALS (Calls external funcs drawJ drawK drawR)
//DRAWING OTHER PARTS OF THE ANIMAL
//======================================================
void drawInitials()
{
    
    //draw initial J
    glPushMatrix();
    glTranslatef(-0.6,0.0,0.0);
    glScalef(0.1,0.1,0.1);
	//draw J now needs parameters
    drawJ(breatheJCurve,bodyColour1,bodyColour2);
    glPopMatrix();
    
    //draw intial K
    glPushMatrix();
    glTranslatef(-0.4,0.0,0.0);
    glScalef(0.1,0.1,0.1);
    drawK(bodyColour1,bodyColour2);
    glPopMatrix();
    
    //draw initial R
    glPushMatrix();
    glTranslatef(-0.2,-0.01,0.0);
    glScalef(0.1,0.1,0.1);
    //draw R now needs parameters
    drawR(breatheRCurve,breatheRDiag,bodyColour1,bodyColour2);
    glPopMatrix();
    
    //draw initial L
    glPushMatrix();
    glTranslatef(0.2,0.0,0.0);
    glScalef(0.1,0.1,0.1);
    drawL(bodyColour1,bodyColour2);
    glPopMatrix();
    
    //draw initial I
    glPushMatrix();
    glTranslatef(0.0,0.0,0.0);
    glScalef(0.1,0.1,0.1);
    drawI(bodyColour1,bodyColour2);
    glPopMatrix();
    
    //draw initial M
    glPushMatrix();
    glTranslatef(0.5,-0.25,0.0);
    glRotatef(90,0.0,0.0,1.0);
    glScalef(0.1,0.1,0.1);
    drawM(bodyColour1,bodyColour2);
    glPopMatrix();
     
}
Exemplo n.º 8
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void updateScene() {
	static bool changeColor = true;
	static double rotation1 = 0;
	static double rotation2 = 0;
	static double rotationSpeed = 30; // Grados por segundo
	static float rotS = 0;
	static float lastSecond = 0;


	// Esfera 1
	rotation1 += timer.getDeltaTime() * rotationSpeed;
	rotation1 = std::fmod(rotation1, 360);
	if (fabs(rotation1 - 90) < 1e-1) {
		rotation1 += 180;
	}

	glPushMatrix(); {
		glRotated(rotation1, 0, 1, 0);
		glColor3f(0, fabs(sin(timer.getElapsedTime() / 10.0)), fabs(cos(timer.getElapsedTime() / 10.0)));
		drawRing(0.98, 0.97, 40);
		drawRing(0.73, 0.72, 40);

		if (changeColor) {
			glColor3f(0.5, 0.5, 0.5);
		}
		else {
			glColor3f(0, 0, 0);
		}
		glCallList(clockList);
	}
	glPopMatrix();

	// Esfera 2
	rotation2 += timer.getDeltaTime() * rotationSpeed;
	rotation2 = std::fmod(rotation2, 360);
	if (fabs(rotation2 - 180) < 1e-1) {
		rotation2 += 180;
	}

	glPushMatrix(); {
		glRotated(rotation2, 0, 1, 0);
		glRotatef(-90, 0, 1, 0);
		glColor3f(0, fabs(cos(timer.getElapsedTime() / 10.0)), fabs(sin(timer.getElapsedTime() / 10.0)));
		drawRing(0.98, 0.97, 40);
		drawRing(0.73, 0.72, 40);

		if (changeColor) {
			glColor3f(0.5, 0.5, 0.5);
		}
		else {
			glColor3f(0, 0, 0);
		}
		glCallList(clockList);
	}
	glPopMatrix();

	// Leer hora actual
	std::time_t now = std::time(nullptr);
	struct tm t;
	time(&now);
	localtime_s(&t, &now);

	// Actualizar rotacion del segundero
	if (t.tm_sec == lastSecond) {
		rotS += 360 / 60 * timer.getDeltaTime();
	}
	else {
		rotS = rotationSeconds(t);
		lastSecond = t.tm_sec;
	}
	// Dibujar segundero
	glPushMatrix();
	glColor3f(1, 0, 0);
	glRotatef(rotS, 0, 0, -1);
	glTranslatef(0, 0.35, 0);
	glScalef(0.1, 0.7, 0);
	drawI();
	glPopMatrix();

	// Dibujar minutero
	glColor3f(0.0f, 0.0f, 0.0f);
	glPushMatrix();
	glRotatef(rotationMinutes(t), 0, 0, -1);
	glTranslatef(0, 0.35, 0);
	glScalef(0.8, 0.7, 0);
	drawI();
	glPopMatrix();

	// Controlar cuando se cambia de hora para actualizar un objeto cada hora
	static int lastHour = 0;
	if (t.tm_hour != lastHour) {
		lastHour = t.tm_hour;
		changeColor = !changeColor;
	}
	// Dibujar saeta de las horas
	glPushMatrix();
	glRotatef(rotationHours(t), 0, 0, -1);
	glTranslatef(0, 0.175, 0);
	glScalef(0.8, 0.35, 0);
	drawI();
	glPopMatrix();

}
Exemplo n.º 9
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void initClockList() {

	int xiiList = glGenLists(1);
	glNewList(xiiList, GL_COMPILE); {
		drawXII();
	}
	glEndList();

	int iiiList = glGenLists(1);
	glNewList(iiiList, GL_COMPILE); {
		drawIII();
	}
	glEndList();

	int viList = glGenLists(1);
	glNewList(viList, GL_COMPILE); {
		drawVI();
	}
	glEndList();

	int ixList = glGenLists(1);
	glNewList(ixList, GL_COMPILE); {
		drawIX();
	}
	glEndList();

	clockList = glGenLists(1);
	glNewList(clockList, GL_COMPILE); {
		// Dibujar Anillo exterior
		drawRing(1, 0.98, 40);
		drawRing(0.97, 0.95, 40);

		// Dibujar Anillo interior
		drawRing(0.75, 0.73, 40);
		drawRing(0.72, 0.7, 40);


		// Dibujar Numeros (12, 3, 6, 9)
		glPushMatrix();
		glTranslatef(0, 0.845, 0);
		glScalef(0.24, 0.24, 0);
		glCallList(xiiList);
		glPopMatrix();

		glPushMatrix();
		glTranslatef(0.845, 0, 0);
		glRotatef(90, 0, 0, 1);
		glScalef(0.24, 0.24, 0);
		glCallList(iiiList);
		glPopMatrix();

		glPushMatrix();
		glTranslatef(0, -0.845, 0);
		glRotatef(180, 0, 0, 1);
		glScalef(0.24, 0.24, 0);
		glCallList(viList);
		glPopMatrix();

		glPushMatrix();
		glTranslatef(-0.845, 0, 0);
		glRotatef(90, 0, 0, 1);
		glScalef(0.24, 0.24, 0);
		glCallList(ixList);
		glPopMatrix();


		// Dibujar marcadores de horas adicionales
		glPushMatrix();
		glRotatef(30, 0, 0, 1);
		glTranslatef(0, 0.845, 0);
		glScalef(0.24, 0.24, 0);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(60, 0, 0, 1);
		glTranslatef(0, 0.845, 0);
		glScalef(0.24, 0.24, 0);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(30, 0, 0, 1);
		glTranslatef(-0.845, 0, 0);
		glScalef(0.24, 0.24, 0);
		glRotatef(90, 0, 0, 1);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(60, 0, 0, 1);
		glTranslatef(-0.845, 0, 0);
		glScalef(0.24, 0.24, 0);
		glRotatef(90, 0, 0, 1);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(30, 0, 0, 1);
		glTranslatef(0, -0.845, 0);
		glScalef(0.24, 0.24, 0);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(60, 0, 0, 1);
		glTranslatef(0, -0.845, 0);
		glScalef(0.24, 0.24, 0);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(30, 0, 0, 1);
		glTranslatef(0.845, 0, 0);
		glScalef(0.24, 0.24, 0);
		glRotatef(90, 0, 0, 1);
		drawI();
		glPopMatrix();

		glPushMatrix();
		glRotatef(60, 0, 0, 1);
		glTranslatef(0.845, 0, 0);
		glScalef(0.24, 0.24, 0);
		glRotatef(90, 0, 0, 1);
		drawI();
		glPopMatrix();
	}
	glEndList();
}