Пример #1
0
int main()
{

	GLFWwindow* window = myCreateWindow();

	GLchar* earth = "Model/earth/earth.obj";
	GLchar* moon = "Model/moon/moon.obj";

	vector<const GLchar*> faces;
	faces.push_back("Texture/sky/purplenebula_rt.tga");
	faces.push_back("Texture/sky/purplenebula_lf.tga");
	faces.push_back("Texture/sky/purplenebula_up.tga");
	faces.push_back("Texture/sky/purplenebula_dn.tga");
	faces.push_back("Texture/sky/purplenebula_bk.tga");
	faces.push_back("Texture/sky/purplenebula_ft.tga");

	//GLuint skyID = loadCubemap(faces);

	Star Earth(0.001,45.0f);
	Earth.init(earth);

	Star Moon(0.002, 45.0f,glm::vec3(0.0f,0.0f,0.0f), 2.0f);
	Moon.init(moon);

	while (!glfwWindowShouldClose(window))
	{
		GLfloat currentFrame = glfwGetTime();
		deltaTime = currentFrame - lastFrame;
		lastFrame = currentFrame;
		Do_Movement();
		glfwPollEvents();

		glClearColor(0.05f, 0.05f, 0.05f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		Earth.drawStar();
		Moon.drawStar();

		glfwSwapBuffers(window);
	}

	glfwTerminate();
	return 0;
}
Пример #2
0
int main(int argc, char** argv)
{
	// Starting game window size.

	height = 960;
	width = 1000;

	//Initialize Object Data

	srand(time(NULL));

	// Initialize Tank
	float randomAngle = (float)random(0, 200) / 10;

	artillery = tank(random(-width * 24, width * 24), random(-height * 24, height * 24), 1500, 15, randomAngle);

	player = Rocket(0,0, 100, 0.8f, 10);
	player.follow(artillery); //Sets initial Position to tank

	UI = new UIManager();

	moonLand = random(0, numMoons-1);
	seed = random(-123456, 123456); // Level seed to randomize each level creation between min and max value. 
	int sizeOfMoonLoc = -1; 
	artillery.colRadius = artillery.radius * distanceFromStartMult;
	for (int i = 0; i < numMoons; i++)
	{
		sizeOfMoonLoc++;
		moonLocation[i] = vector(random(-width * 24, width * 24), random(-height * 24, height * 24));
		float moonRadius = random(300, 500);
		moons[i] = Moon(moonLocation[i], moonRadius, 0, 0, 0, 60);

		for (int z = 0; z < sizeOfMoonLoc; z++)
		{
			if (z != i)
			{
				while (moons[i].checkCollision(moons[z]) || moons[i].checkCollision(artillery))
				{
					moonLocation[i] = vector(random(-width * 24, width * 24), random(-height * 24, height * 24));
					moons[i] = Moon(moonLocation[i], moonRadius, 0, 0, 0, round(moonRadius / 10));
				}
				
			}
		}
	}
	artillery.colRadius = artillery.radius;
	for (int i = 0; i < numStars; i++)
	{
		star[i] = new Star(vector(random(-width*24,width*24), random(-height*24,height*24)), vector(0.8f, 0.8f, 0.0f), random(3, 15), random(0,100));
	}

	//End of Initialization

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(0,0);
	glutInitWindowSize(width, height);
	glutCreateWindow("IchyMoo the LunarLunar");
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glClearColor(0.05, 0.05, 0.05, 0.0);
	glutReshapeFunc(reshape);
	glutDisplayFunc(renderScene);
	glutKeyboardFunc(keyDown);
	glutKeyboardUpFunc(keyUp);
	glutTimerFunc(41,idle,0);
	glutMainLoop();
}
Пример #3
0
// adiciona a lua ao planeta
void Planet::addMoon(float distanciaPlaneta, float orbitTime, float tempoRotacao, float raio, GLuint textureHandle)
{
	moons.push_back(Moon(distanciaPlaneta, orbitTime, tempoRotacao, raio, textureHandle));
}
Пример #4
0
// add a moon to this planet
void Planet::addMoon(float distanceFromPlanet, float orbitTime, float rotationTime, float radius, GLuint textureHandle)
{
	moons.push_back(Moon(distanceFromPlanet, orbitTime, rotationTime, radius, textureHandle));
}
Пример #5
0
    std::string toString();
    
    bool equals(Moon other);
    
    double getLongitudeOfPericenter();
    double getPericenter();
    bool isRetrograde();
    
private:
    double longitudeOfPericenter; //meters (m)
    double pericenter; //meters (m)
    
    bool retrograde;
};

const Moon GANYMEDE =   Moon();
const Moon TITAN =      Moon();
const Moon CALLISTO =   Moon();
const Moon IO =         Moon();
const Moon MOON =       Moon();
const Moon EUROPA =     Moon();
const Moon TRITAN =     Moon();
const Moon TITANIA =    Moon();
const Moon RHEA =       Moon();
const Moon OBERON =     Moon();
const Moon IAPETUS =    Moon();
const Moon CHARON =     Moon();
const Moon UMBRIEL =    Moon();
const Moon ARIEL =      Moon();
const Moon DIONE =      Moon();
const Moon TETHYS =     Moon();