示例#1
0
void SceneSkyBox::Render()
{
	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//These will be replaced by matrix stack soon
	Mtx44 model;
	Mtx44 view;
	Mtx44 projection;

	model.SetToIdentity();
	//Set view matrix using camera settings
	view.SetToLookAt(
		camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z
		);

	//Set projection matrix to perspective mode
	projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane


	viewStack.LoadIdentity();
	viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z);
	modelStack.LoadIdentity();

	Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
	glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);


	RenderMesh(meshList[GEO_AXES], false);

	modelStack.PushMatrix();
	modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
	RenderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();

	/*modelStack.PushMatrix();
	modelStack.Scale(10, 10, 10);
	RenderMesh(meshList[GEO_QUAD], false);
	modelStack.PopMatrix();*/
	//Loads the Skybox
	RenderSkyBox();
	//Mario
	modelStack.PushMatrix();
	modelStack.Scale(10, 10, 10);
	modelStack.Translate(0.0f, 1.f, -0.4f);
	modelStack.Rotate(90, 0.f, 1.f, 0.f);
	modelStack.Rotate(90, 0.f, 0.f, 1.f);
	RenderMesh(meshList[GEO_MARIO], false);
	modelStack.PopMatrix();


}
示例#2
0
void PLANET3::Render()
{
	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//These will be replaced by matrix stack soon
	Mtx44 model;
	Mtx44 view;
	Mtx44 projection;

	model.SetToIdentity();
	//Set view matrix using camera settings
	view.SetToLookAt(
		camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z
		);

	//Set projection matrix to perspective mode
	projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane


	viewStack.LoadIdentity();
	viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z);
	modelStack.LoadIdentity();

	Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
	glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
	Vector3 lightDirection_cameraspace2 = viewStack.Top() * lightDir;
	glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace2.x);


	RenderMesh(meshList[GEO_AXES], false);

	modelStack.PushMatrix();
	modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
	RenderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();

	RenderSkyBox();
}
示例#3
0
void PLANET5::Render()
{
	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//These will be replaced by matrix stack soon
	Mtx44 model;
	Mtx44 view;
	Mtx44 projection;

	model.SetToIdentity();
	//Set view matrix using camera settings
	view.SetToLookAt(
		camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z
		);

	//Set projection matrix to perspective mode
	projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane


	viewStack.LoadIdentity();
	viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
		camera.target.x, camera.target.y, camera.target.z,
		camera.up.x, camera.up.y, camera.up.z);
	modelStack.LoadIdentity();

	Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
	glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
	Vector3 lightDirection_cameraspace2 = viewStack.Top() * lightDir;
	glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace2.x);


	RenderMesh(meshList[GEO_AXES], false);

	/*modelStack.PushMatrix();
	modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
	RenderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();

	/*	modelStack.PushMatrix();
	modelStack.Translate(0.f, 0.f, 0.f);
	RenderMesh(meshList[ASTEROID], false);
	modelStack.PopMatrix();*/

	std::ostringstream fps;
	fps << camera.position.x << " " << camera.position.y << " " << camera.position.z;
	std::ostringstream fpss;
	fpss << camera.target.x << " " << camera.target.y << " " << camera.target.z;
	RenderSkyBox();

	modelStack.PushMatrix();
	modelStack.Translate(0.0f, -35.0f, 0.f);
	modelStack.Rotate(rotatespin - 45, 0, 1, 0);
	modelStack.Scale(22.0f, 24.0f, 22.0f);
	RenderMesh(meshList[SPIN], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(0.0f, 8.0f, 0.f);
	modelStack.Scale(10.0f, 10.f, 10.f);
	RenderMesh(meshList[SPINCAP], false);
	modelStack.PopMatrix();


	modelStack.PushMatrix();
	modelStack.Translate(5.0f, translateButton - 6.f, 43.5f);
	modelStack.Rotate(25.0f, 1, 0, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[BUTTON], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(5.0f, -6.0f, 45.0f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(2.0f, 2.0f, 2.0f);
	RenderMesh(meshList[BUTTONSTAND], false);
	modelStack.PopMatrix();

	//////////////////////GEMS ARE OUTRAGREOUS//////////////////////////


	modelStack.PushMatrix();
	modelStack.Translate(-50.0f, translategem1 - 5.7f, -81.5f);
	modelStack.Rotate(22.0f, 1, 0, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[BUTTON], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-50.0f, -6.0f, -80.0f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(2.0f, 2.0f, 2.0f);
	RenderMesh(meshList[BUTTONSTAND], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-50.0f, flygem1, -90.0f);
	modelStack.Rotate(rotategem1, 0, 1, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[GEM], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-50.0f, -5.0f, -90.0f);
	modelStack.Scale(2.f, 2.0f, 2.f);
	RenderMesh(meshList[GEMCASE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-25.0f, translategem2 - 5.7f, -81.5f);
	modelStack.Rotate(22.0f, 1, 0, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[BUTTON], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-25.0f, -6.0f, -80.0f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(2.0f, 2.0f, 2.0f);
	RenderMesh(meshList[BUTTONSTAND], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-25.0f, flygem2, -90.0f);
	modelStack.Rotate(rotategem2, 0, 1, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[GEM2], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-25.0f, -5.0f, -90.0f);
	modelStack.Scale(2.f, 2.0f, 2.f);
	RenderMesh(meshList[GEMCASE], true);
	modelStack.PopMatrix();



	modelStack.PushMatrix();
	modelStack.Translate(0.0f, translategem3 - 5.7f, -81.5f);
	modelStack.Rotate(22.0f, 1, 0, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[BUTTON], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(0.0f, -6.0f, -80.0f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(2.0f, 2.0f, 2.0f);
	RenderMesh(meshList[BUTTONSTAND], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(0.0f, flygem3, -90.0f);
	modelStack.Rotate(rotategem3, 0, 1, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[GEM3], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(0.0f, -5.0f, -90.0f);
	modelStack.Scale(2.f, 2.0f, 2.f);
	RenderMesh(meshList[GEMCASE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(25.0f, translategem4 - 5.7f, -81.5f);
	modelStack.Rotate(22.0f, 1, 0, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[BUTTON], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(25.0f, -6.0f, -80.0f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(2.0f, 2.0f, 2.0f);
	RenderMesh(meshList[BUTTONSTAND], false);
	modelStack.PopMatrix();


	modelStack.PushMatrix();
	modelStack.Translate(25.0f, flygem4, -90.0f);
	modelStack.Rotate(rotategem4, 0, 2, 0);
	modelStack.Scale(2.f, 3.0f, 2.f);
	RenderMesh(meshList[GEM4], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(25.0f, -5.0f, -90.0f);
	modelStack.Scale(2.f, 2.0f, 2.f);
	RenderMesh(meshList[GEMCASE], true);
	modelStack.PopMatrix();
	//////////////////////THEY ARE TRULY, TRULY, TRULY OUTRAGREOUS//////////////////////////


	modelStack.PushMatrix();
	modelStack.Translate(-10.0f, translateEND, -123.0f);
	modelStack.Scale(scaleFinish, scaleFinish, scaleFinish);
	RenderMesh(meshList[END], true);
	modelStack.PopMatrix();


	modelStack.PushMatrix();
	modelStack.Translate(124.0f, 12.0f, -40.f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(10.0f, 10.0f, 3.0f);
	RenderMesh(meshList[PICFRAME], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(124.0f, 12.0f, 40.f);
	modelStack.Rotate(-90.0f, 0, 1, 0);
	modelStack.Scale(10.0f, 10.0f, 3.0f);
	RenderMesh(meshList[PICFRAME], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-124.0f, 12.0f, -40.f);
	modelStack.Rotate(90.0f, 0, 1, 0);
	modelStack.Scale(10.0f, 10.0f, 3.0f);
	RenderMesh(meshList[PICFRAME], false);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(-124.0f, 12.0f, 40.f);
	modelStack.Rotate(90.0f, 0, 1, 0);
	modelStack.Scale(10.0f, 10.0f, 3.0f);
	RenderMesh(meshList[PICFRAME], false);
	modelStack.PopMatrix();

	RenderHandOnScreen();

	RenderTextOnScreen(meshList[POSITION], fps.str(), Color(0, 1, 1), 3, 10, 10);
	RenderTextOnScreen(meshList[POSITION], fpss.str(), Color(0, 1, 1), 3, 10, 7);

}