void DrawLuas()
{
	for (int i = 0; i < numeroLuas; i++){

		applymaterial(0);

		glPushMatrix();

		luas[i].Draw(mysolid);

		glPopMatrix();

		glColor3f(1.0, 1.0, 1.0);

		Vec3<float> posicaoPlaneta = Vec3<float>(
			sistemasolar[luas[i].GetPlaneta()].GetX(),
			sistemasolar[luas[i].GetPlaneta()].GetY(),
			sistemasolar[luas[i].GetPlaneta()].GetZ()
			);

		glDisable(GL_TEXTURE_2D);
		if (drawOrbits){
			draworbit(
				posicaoPlaneta.getX(),
				posicaoPlaneta.getY(),
				posicaoPlaneta.getZ(),
				luas[i].GetRaioOrbita()
				);
		}
		glEnable(GL_TEXTURE_2D);

	}
}
void DrawPlanetas(bool minimap){
	for (int i = numeroPlanetas; i > -1; i--){

		//Se é o sol, material emissive
		if (i == 0){
			applymaterial(3);
			if (!minimap) glDisable(GL_FOG);
		}
		else{
			applymaterial(0);
			if (!minimap) glEnable(GL_FOG);
		}

		glPushMatrix();

		sistemasolar[i].Draw(mysolid, minimap);

		glPopMatrix();

		if ((drawOrbits && !minimap) || minimap){
			glCallList(displayListIndex + 1);
		}
	}
}
Beispiel #3
0
void createFloorToDL(void)
{
	int x, z;

	myDL = glGenLists(1);

	glNewList(myDL,GL_COMPILE);
	// Floor
	for(x=-100; x<=100; x+=2)
	{
		for(z=-100; z<=100; z+=2)
		{
			applymaterial(4);
			glBegin(GL_QUADS);
				glNormal3f(0.0, 1.0, 0.0);
				glVertex3f(x, 0.0f, z);				// Top Left
				glVertex3f(x+1.0f, 0.0f, z);		// Top Right
				glVertex3f(x+1.0f, 0.0f, z-1.0f);	// Bottom Right
				glVertex3f(x, 0.0f, z-1.0f);		// Bottom Left
			glEnd();
		}
		for(z=-99; z<=100; z+=2)
		{
			applymaterial(4);
			glBegin(GL_QUADS);
				glNormal3f(0.0f, 1.0f, 0.0f);
				glVertex3f(x, 0.0f, z);				// Top Left
				glVertex3f(x+1.0f, 0.0f, z);		// Top Right
				glVertex3f(x+1.0f, 0.0f, z-1.0f);	// Bottom Right
				glVertex3f(x, 0.0f, z-1.0f);		// Bottom Left
			glEnd();

		}
	}
	for(x=-99; x<=100; x+=2)
	{
		for(z=-99; z<=100; z+=2)
		{
			applymaterial(4);
		
			glBegin(GL_QUADS);
				glNormal3f(0.0, 1.0, 0.0);
				glVertex3f(x, 0.0f, z);				// Top Left
				glVertex3f(x+1.0f, 0.0f, z);		// Top Right
				glVertex3f(x+1.0f, 0.0f, z-1.0f);	// Bottom Right
				glVertex3f(x, 0.0f, z-1.0f);		// Bottom Left
			glEnd();
		}
		for(z=-100; z<=100; z+=2)
		{
			applymaterial(4);
			
			glBegin(GL_QUADS);
				glNormal3f(0.0f, 1.0f, 0.0f);
				glVertex3f(x, 0.0f, z);				// Top Left
				glVertex3f(x+1.0f, 0.0f, z);		// Top Right
				glVertex3f(x+1.0f, 0.0f, z-1.0f);	// Bottom Right
				glVertex3f(x, 0.0f, z-1.0f);		// Bottom Left
			glEnd();
		}
	}
	glEndList();
}