void SceneCredits::Render()
{

	// Render SceneBase
	SceneBase::Render();

	RenderGameObject(m_menu->GetCurrentMenu()->GetBackground(), m_lightEnabled, true);

	vector<Menu*> m_menuList = m_menu->GetMenuList();
	for (vector<Menu*>::iterator it = m_menuList.begin(); it != m_menuList.end(); ++it)
	{
		Menu* menu = *it;
		vector<UIButton*> m_buttonList = menu->GetButtonList();
		for (vector<UIButton*>::iterator it2 = m_buttonList.begin(); it2 != m_buttonList.end(); ++it2)
		{
			UIButton* button = *it2;
			RenderGameObject(button, m_lightEnabled, true);
		}
	}
	
	ostringstream text;
	text << "Done by me";
	RenderTextOnScreen(m_meshList[MESH_TEXT], text.str(), Color(1, 0, 0), 40, m_window_width * 0.5f - (text.str().length() * 0.5f * 40.f), m_window_height * 0.5f);

	ostringstream soundCredits;
	soundCredits << "BGM by Holfix";
	RenderTextOnScreen(m_meshList[MESH_TEXT], soundCredits.str(), Color(1, 0, 0), 40, m_window_width * 0.5f - (soundCredits.str().length() * 0.5f * 40.f), m_window_height * 0.5f - 40.f);

	// Not supposed to have any other rendering codes here as Scenebase handles it
	// Alternative solution is to render scenegraph here instead as render list does not take into account parent and child nodes
}
void SceneGalaxy::Render()
{
    // Render VBO here
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //Temp variables
    Mtx44 translate, rotate, scale;
    Mtx44 MVP;

    //These will be replaced by matrix stack soon
    Mtx44 model;
    Mtx44 view;
    Mtx44 projection;

    //Set all matrices to identity
    translate.SetToIdentity();
    rotate.SetToIdentity();
    scale.SetToIdentity();
    model.SetToIdentity();

    //Set view matrix using camera settings
    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
    );

    //Set projection matrix to perspective mode
    projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 10000.0f); //FOV, Aspect Ratio, Near plane, Far plane
    modelStack.PushMatrix();
    modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
    modelStack.Scale(0.1f, 0.1f, 0.1f);
    renderMesh(meshList[GEO_LIGHTBALL], false);
    modelStack.PopMatrix();


    /*modelStack.PushMatrix();
    renderMesh(meshList[GEO_AXES], false);
    modelStack.PopMatrix();*/

    modelStack.PushMatrix();
    modelStack.Translate(0, 496.9f, 0);
    RenderSkybox();
    modelStack.PopMatrix();

    RenderXwing();
    RenderAsteroid();
    RenderMissile();
    QuestDetail();

    RenderTextOnScreen(meshList[GEO_TEXT], "+", Color(0, 1, 0), 3, 13.1, 9);
    std::stringstream playerPos;
    playerPos << "X = " << camPosX << " Y = " << camPosY << " Z = " << camPosz;
    //RenderTextOnScreen(meshList[GEO_TEXT], playerPos.str(), Color(1, 0, 0), 2, 0, 18);
    std::stringstream ss;
    ss << "FPS:" << fps << "         " << playerPos.str();
    RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 3, 0, 19);

}
void OpeningCutScene2::RenderTextWord()
{
	if (text1)
	{
		modelStack.PushMatrix();
		RenderTextOnScreen(meshList[GEO_TEXT], "...ugh...Where am....i??", Color(0, 1, 0), 4, 4, 1);
		modelStack.PopMatrix();
	}
	if (text2)
	{
		modelStack.PushMatrix();
		RenderTextOnScreen(meshList[GEO_TEXT], ".....Why are there dead bodies?!?!", Color(0, 1, 0), 4, 1, 1);
		modelStack.PopMatrix();
	}
}
void Credits::RenderCredits()
{

	if (first)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "GAME", Color(1, 1, 1), 15, 6.6f+firstcredits, 2);
		RenderTextOnScreen(meshList[GEO_TEXT], "COMPLETED", Color(1, 1, 1), 15, 5.5f+firstcredits, 1);
	}

	if (second)
	{
		modelStack.PushMatrix();
		RenderModelOnScreen(meshList[GEO_NAME1], 70.f, 70.f, 10.f, 90, 1, 0, 0, 1.56f+secondcredits, 0.4f, 1.0f, false);
		modelStack.PopMatrix();

	}

	if (third)
	{
		modelStack.PushMatrix();
		RenderModelOnScreen(meshList[GEO_NAME2], 70.f, 70.f, 10.f, 90, 1, 0, 0, 1.56f+thirdcredits, 0.4f, 1.0f, false);
		modelStack.PopMatrix();
	}

	if (fourth)
	{
		modelStack.PushMatrix();
		RenderModelOnScreen(meshList[GEO_NAME3], 70.f, 70.f, 10.f, 90, 1, 0, 0, 1.56f+fourthcredits, 0.4f, 1.0f, false);
		modelStack.PopMatrix();
	}


	if (fifth)
	{
		modelStack.PushMatrix();
		RenderModelOnScreen(meshList[GEO_NAME4], 70.f, 70.f, 10.f, 90, 1, 0, 0, 1.56f+fifthcredits, 0.4f, 1.0f, false);
		modelStack.PopMatrix();
	}

	if (last)
	{
		modelStack.PushMatrix();
		RenderModelOnScreen(meshList[GEO_TITLE], 70.f, 15.f, 10.f, 90, 1, 0, 0, 1.7f +lastcredits, 2.f, 1.0f, false);
		modelStack.PopMatrix();

	}

}
Beispiel #5
0
void SceneManagerCMPlay::RenderGUI()
{
	static Color textCol = resourceManager.retrieveColor("Black");

	std::ostringstream ss;
	ss.precision(5);
	ss << "FPS: " << fps;
	RenderTextOnScreen(textMesh, ss.str(), textCol, 30, 0, sceneHeight- 30);
}
Beispiel #6
0
void MAINMENU::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();
	float i = 3;
	for (st = menuList.rbegin(); st != menuList.rend(); ++st)
	{ 
		RenderTextOnScreen(meshList[TEXT], *st, Color(1, 1, 1), 3, 3, i ++);
	}
	if (c_UserInterface::GetEnum()->UI == START)
	{
		RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 5);
	}
	if (c_UserInterface::GetEnum()->UI == OPTIONS)
	{
		RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 4);
	}
	if (c_UserInterface::GetEnum()->UI == EXIT)
	{
		RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 3);
	}
}
Beispiel #7
0
void SHIPDTP::RenderWave()
{
	RenderTextOnScreen(meshList[BNM_TEXT], "Wave: ", Color(0, 1, 0), 3, 0, 19);

	if (!w1)
	{
		RenderTextOnScreen(meshList[BNM_TEXT], "1", Color(0, 1, 0), 3, 5, 19);
	}
	else if (w1 && !w2)
	{
		RenderTextOnScreen(meshList[BNM_TEXT], "2", Color(0, 1, 0), 3, 5, 19);
	}
	else if (w1 && w2 && !w3)
	{
		RenderTextOnScreen(meshList[BNM_TEXT], "3", Color(0, 1, 0), 3, 5, 19);
	}
	else if (w1 && w2 && w3 && !w4)
	{
		RenderTextOnScreen(meshList[BNM_TEXT], "4", Color(0, 1, 0), 3, 5, 19);
	}
	else
	{
		if (w1 && w2 && w3 && w4 && !w5)
		{
			RenderTextOnScreen(meshList[BNM_TEXT], "5", Color(0, 1, 0), 3, 5, 19);
		}
	}
}
Beispiel #8
0
/********************************************************************************
 Render this scene
 ********************************************************************************/
void CSceneManager2D::Render()
{
	glClear(GL_COLOR_BUFFER_BIT);
	Mtx44 perspective;
	perspective.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 10000.0f);
	//perspective.SetToOrtho(-80, 80, -60, 60, -1000, 1000);
	projectionStack.LoadMatrix(perspective);
	
	// Camera matrix
	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
					);
	// Model matrix : an identity matrix (model will be at the origin)
	modelStack.LoadIdentity();

	modelStack.PushMatrix();
	Render2DMesh(meshList[GEO_SPRITE_ANIMATION], false,50,400,300);
	modelStack.PopMatrix();
	/*
	// Render the background image
	RenderBackground();
	// Render the rear tile map
	RenderRearTileMap();
	// Render the tile map
	RenderTileMap();
	// Render the goodies
	RenderGoodies();
	*/

	//render the grid system and the corresponding image for the each grid
	RenderGridSystem();

	//On screen text
	/*
	std::ostringstream ss;
	ss.precision(5);
	ss << "theEnemy: " << theEnemy->GetPos_x() << ", " << theEnemy->GetPos_y();
	RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 30, 0, 6);
	std::ostringstream sss;
	sss.precision(5);
	sss << "mapOffset_x: "<<theHero->GetMapOffset_x();
	RenderTextOnScreen(meshList[GEO_TEXT], sss.str(), Color(0, 1, 0), 30, 0, 30);
	*/

	std::ostringstream ss;
	ss.precision(5);
	ss << "test text: " << " 9999999 ";
	RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 30, 0, 6);
}
void HighscoreScene::Render()
{
	SceneBase::Render();
	modelStack.PushMatrix();
	modelStack.Scale(m_window_width, m_window_height, 1);
	RenderMeshIn2D(meshList[GEO_HIGHSCORE], false);
	modelStack.PopMatrix();

	std::ostringstream ss;
	ss << CGameStateManager::highscore;
	RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 10, 35, 8);
	
}
Beispiel #10
0
void View::RenderGui(Gui * gui, Mesh * textMesh)
{
	Color color;
	if (gui->getHighlighted() == true)
	{
		color = Color(0.f, 0.f, 1.f);
	}
	else
	{
		color = Color(1.f, 0.f, 0.f);
	}
	//Render2DMesh(gui->getMesh(), false, false, 1.f, 1.f, gui->getX(), (m_iWindow_Height - gui->getY())); //Convert to screen coordinates (Bottom Left to Top Right)
	RenderTextOnScreen(textMesh, gui->getText(), color , gui->getSize(), m_iWindow_Width * gui->getWidthOffset() - (gui->getTextOffset()), m_iWindow_Height * (1.f - gui->getHeightOffset()) - (gui->getSize() * 0.5f));
}
Beispiel #11
0
void SP3::Render()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



    // Projection matrix : Orthographic Projection
    Mtx44 projection;
    projection.SetToOrtho(0, m_worldWidth, 0, m_worldHeight, -10, 10);
    projectionStack.LoadMatrix(projection);

    // Camera matrix
    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
        );
    // Model matrix : an identity matrix (model will be at the origin)
    modelStack.LoadIdentity();

    RenderMesh(meshList[GEO_AXES], false);


    for (std::vector<GameObject *>::iterator it = m_goList.begin(); it != m_goList.end(); ++it)
    {
        GameObject *go = (GameObject *)*it;
        if (go->active)
        {
            RenderGO(go);
        }
    }

    std::ostringstream ss;
    ss.str(string());
    ss.precision(5);
    ss << "FPS: " << fps;
    RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 3, 0, 0);

	if (gameState == Menu)
	{
		modelStack.PushMatrix();
		modelStack.Translate(65.f, 50.f, 0.f);
		modelStack.Scale(115, 90, 0);
		RenderMesh(meshList[GEO_UI], false);
		modelStack.PopMatrix();

		modelStack.PushMatrix();
		RenderTextOnScreen(meshList[GEO_TEXT], "Welcome", Color(0, 0, 1), 4, 25, 50);
		RenderTextOnScreen(meshList[GEO_TEXT], "To", Color(0, 0, 1), 4, 35, 45);
		RenderTextOnScreen(meshList[GEO_TEXT], "Suk Malcolm Deek", Color(0, 0, 1), 4, 8, 40);
		RenderTextOnScreen(meshList[GEO_TEXT], "Start Game", Color(1, 0, 0), 4, 20, 20);
		RenderTextOnScreen(meshList[GEO_TEXT], "Quit Game", Color(1, 0, 0), 4, 22, 15);
		modelStack.PopMatrix();
	}

}
Beispiel #12
0
void View::RenderBuffer(CharBuffer * buffer, Mesh * textMesh)
{
	Color color;
	if (buffer->getHighlighted() == true)
	{
		glLineWidth(2.f);
		color = Color(1.f, 0.f, 0.f);
	}
	else
	{
		glLineWidth(1.f);
		color = Color(1.f, 1.f, 1.f);
	}
	RenderTextOnScreen(textMesh, buffer->toString(), color, buffer->getFontSize(), m_iWindow_Width * buffer->getWidthOffset() - (buffer->getTextOffset()), m_iWindow_Height * (1.f - buffer->getHeightOffset()) - (buffer->getFontSize() * 0.5f));
}
Beispiel #13
0
void CSceneManager2D::RenderHighscore()
{
	modelStack.PushMatrix();
	Render2DMesh(meshList[GEO_HIGHSCORE], false);

	std::ostringstream ss;
	const int size = 5;
	for (int i = 0; i < size; i++)
	{
		ss.str(std::string());
		ss << i + 1 << ". " << theScore[i].GetAllHighscores(i);
		RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 0, 1), 60, 300, 300 - (i * 40));
	}
	modelStack.PopMatrix();
}
Beispiel #14
0
void SceneWin::Render()
{
	std::ostringstream enemyOSS;
	enemyOSS << "Enemies killed: " << SharedData::GetInstance()->enemycounter/2;
	string enemy = enemyOSS.str();

	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Set view matrix using camera settings
	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();

	RenderQuadOnScreen(meshList[GEO_PATH], 6, 6.5, 6, 90, 1, 0, 0, -1);
	enemy.resize(20);
	RenderTextOnScreen(meshList[GEO_TEXT], enemy, Color(1, 1, 0), 3, 7.5, 10);
}
void SceneManagerCMPlay::RenderPlayerStats()
{
	float m_BillBoard;
	Mesh* drawMesh = resourceManager.retrieveMesh("FONT");
	drawMesh->textureID = resourceManager.retrieveTexture("STATUSFONT");

	string count = "Total Entities:" + to_string(TOTAL_COUNT);
	string FPS = "FPS: " + to_string(fps);
	RenderTextOnScreen(drawMesh, FPS, resourceManager.retrieveColor("White"), 25.f, 1500, 1050, 0);
	RenderTextOnScreen(drawMesh, count, resourceManager.retrieveColor("White"), 25.f, 1500, 1020, 0);
	RenderTextOnScreen(drawMesh, "F1 - To spawn tank", resourceManager.retrieveColor("White"), 25.f, 10, 1050, 0);
	RenderTextOnScreen(drawMesh, "F2 - To spawn mage", resourceManager.retrieveColor("White"), 25.f, 10, 1020, 0);
	RenderTextOnScreen(drawMesh, "F3 - To spawn healer", resourceManager.retrieveColor("White"), 25.f, 10, 990, 0);
	RenderTextOnScreen(drawMesh, "F4 - To spawn boss", resourceManager.retrieveColor("White"), 25.f, 10, 960, 0);
	RenderTextOnScreen(drawMesh, "F5 - Warrior hp = 10%", resourceManager.retrieveColor("White"), 25.f, 10, 930, 0);
	RenderTextOnScreen(drawMesh, "F6 - Kill warrior", resourceManager.retrieveColor("White"), 25.f, 10, 900, 0);
	RenderTextOnScreen(drawMesh, "F7 - Healer hp = 10%", resourceManager.retrieveColor("White"), 25.f, 10, 870, 0);
	RenderTextOnScreen(drawMesh, "F8 - Restore health", resourceManager.retrieveColor("White"), 25.f, 10, 840, 0);
	RenderTextOnScreen(drawMesh, "W & S - Cycle Camera", resourceManager.retrieveColor("White"), 25.f, 10, 810, 0);
	RenderTextOnScreen(drawMesh, "3 & 4 - Toggle status render", resourceManager.retrieveColor("White"), 25.f, 10, 780, 0);
	
	if (toggleStatusAndParticles)
	{
		for (int i = 0; i < ListOfCharacters.size(); ++i)
		{
			Vector2 CopyVector;
			Vector2 CopyVector2;

			CopyVector.Set(tpCamera.getPosition().x, tpCamera.getPosition().z);
			CopyVector2.Set(ListOfCharacters[i]->GetPosition().x, ListOfCharacters[i]->GetPosition().z);

			Vector2 Direction = (CopyVector - CopyVector2).Normalized();

			if (!Direction.IsZero())
			{
				m_BillBoard = Math::RadianToDegree(atan2(Direction.x, Direction.y));
			}

			modelStack.PushMatrix();
			modelStack.Translate(ListOfCharacters[i]->GetPosition().x, ListOfCharacters[i]->GetPosition().y + 15.f, ListOfCharacters[i]->GetPosition().z);
			modelStack.Rotate(m_BillBoard, 0, 1, 0);
			modelStack.Scale(2.f, 2.f, 2.f);
			modelStack.PushMatrix();
			modelStack.Translate(-2.5f, 0.f, 0.f);
			RenderText(drawMesh, ListOfCharacters[i]->PrintState(), resourceManager.retrieveColor("White"));
			modelStack.PopMatrix();

			float HPBARSCALE = 5.f;

			modelStack.PushMatrix();
			float newScale = (ListOfCharacters[i]->GetHpPercent() / 100) * HPBARSCALE;

			float theTranslate = 5.0f - (ListOfCharacters[i]->GetHpPercent() / 100) * HPBARSCALE;

			modelStack.Translate(-theTranslate * 0.5f, 2.f, 0.01f);
			modelStack.Scale(newScale, 1, 1);
			Render3DMesh(resourceManager.retrieveMesh("HPCURRENT"), true);
			modelStack.PopMatrix();

			modelStack.PushMatrix();
			modelStack.Translate(0.f, 2.f, 0.f);
			modelStack.Scale(HPBARSCALE, 1, 1);
			Render3DMesh(resourceManager.retrieveMesh("HPMAX"), true);
			modelStack.PopMatrix();

			modelStack.PopMatrix();


		}
	}
}
void SceneText::Render()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	Mtx44 perspective;
	perspective.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 10000.0f);
	//perspective.SetToOrtho(-80, 80, -60, 60, -1000, 1000);
	projectionStack.LoadMatrix(perspective);
	
	// Camera matrix
	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
					);
	// Model matrix : an identity matrix (model will be at the origin)
	modelStack.LoadIdentity();

	if(lights[0].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(lights[0].position.x, lights[0].position.y, lights[0].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if(lights[0].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * lights[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * lights[0].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT0_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * lights[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	}
	if(lights[1].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(lights[1].position.x, lights[1].position.y, lights[1].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if(lights[1].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * lights[1].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * lights[1].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT1_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * lights[1].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
	}
	
	RenderMesh(meshList[GEO_AXES], false);
	
	modelStack.PushMatrix();
	modelStack.Translate(lights[0].position.x, lights[0].position.y, lights[0].position.z);
	RenderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();

	RenderSkybox();

	// perspective;
	////perspective.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 10000.0f);
	//perspective.SetToOrtho(-80, 80, -60, 60, -1000, 1000);
	//projectionStack.LoadMatrix(perspective);
	//viewStack.LoadIdentity();
	//
	//modelStack.PushMatrix();
	////modelStack.Translate(20, 0, -20);
	////modelStack.Scale(0.1f, 0.1f, 0.1f);
	//modelStack.Scale(50, 50, 50);
	////RenderMesh(meshList[GEO_QUAD], false);
	//RenderText(meshList[GEO_TEXT], "HelloWorld", Color(0, 1, 0));
	//modelStack.PopMatrix();
	modelStack.PushMatrix();
	modelStack.Translate(-20, 0, -20);
	RenderMesh(meshList[GEO_OBJECT], false);
	modelStack.PopMatrix();
	
	modelStack.PushMatrix();
	modelStack.Translate(20, 0, -20);
	RenderMesh(meshList[GEO_OBJECT], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Scale(10, 10, 10);
	//RenderText(meshList[GEO_TEXT], "Hello World", Color(0, 1, 0));
	RenderText(meshList[GEO_TEXT], "Hello World", Color(0, 1, 0));
	modelStack.PopMatrix();

	//On screen text
	std::ostringstream ss;
	ss.precision(5);
	ss << "FPS: " << fps;
	RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 3, 0, 6);
	
	std::ostringstream ss1;
	ss1.precision(4);
	ss1 << "Light(" << lights[0].position.x << ", " << lights[0].position.y << ", " << lights[0].position.z << ")";
	RenderTextOnScreen(meshList[GEO_TEXT], ss1.str(), Color(0, 1, 0), 3, 0, 3);

	RenderTextOnScreen(meshList[GEO_TEXT], "Hello Screen", Color(0, 1, 0), 3, 0, 0);

	RenderMeshIn2D(meshList[GEO_CROSSHAIR], false,1,1,1);
}
Beispiel #17
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);

}
Beispiel #18
0
void Assignment3::Render()
{
	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Temp variables
	Mtx44 translate, rotate, scale;
	Mtx44 MVP;

	//These will be replaced by matrix stack soon
	Mtx44 model;
	Mtx44 view;
	Mtx44 projection;

	//Set all matrices to identity
	translate.SetToIdentity();
	rotate.SetToIdentity();
	scale.SetToIdentity();
	model.SetToIdentity();

	//Set view matrix using camera settings
	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
		);

	//Set projection matrix to perspective mode
	projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 10000.0f); //FOV, Aspect Ratio, Near plane, Far plane
	lighting();
	lighting2();
	modelStack.PushMatrix();
	modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
	modelStack.Scale(0.1f, 0.1f, 0.1f);
	renderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();
	

	/*modelStack.PushMatrix();
	renderMesh(meshList[GEO_AXES], false);
	modelStack.PopMatrix();*/

	modelStack.PushMatrix();
	modelStack.Translate(boxX, 496.9, boxZ);
	RenderSkybox();
	modelStack.PopMatrix();


	modelStack.PushMatrix();
	modelStack.Translate(snowWallCoord.x, 0, snowWallCoord.z);
	modelStack.Rotate(-90, 0, 1, 0);
	//modelStack.Scale(10, 10, 10);
	renderMesh(meshList[GEO_SNOWWALL], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(snowBallCoord.x, snowBallCoord.y, snowBallCoord.z);
	modelStack.Scale(0.2, 0.2, 0.2);
	renderMesh(meshList[GEO_SNOWBALLPILE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(snowBallCoord1.x, snowBallCoord1.y, snowBallCoord1.z);
	modelStack.Scale(0.2, 0.2, 0.2);
	renderMesh(meshList[GEO_SNOWBALLPILE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(snowBallCoord2.x, snowBallCoord2.y, snowBallCoord2.z);
	modelStack.Scale(0.2, 0.2, 0.2);
	renderMesh(meshList[GEO_SNOWBALLPILE], true);
	modelStack.PopMatrix();


	modelStack.PushMatrix();
	modelStack.Translate(snowBallCoord5.x, snowBallCoord5.y, snowBallCoord5.z);
	modelStack.Scale(0.2, 0.2, 0.2);
	renderMesh(meshList[GEO_SNOWBALLPILE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(snowBallCoord6.x, snowBallCoord6.y, snowBallCoord6.z);
	modelStack.Scale(0.2, 0.2, 0.2);
	renderMesh(meshList[GEO_SNOWBALLPILE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(robbyCoord.x, robbyCoord.y, robbyCoord.z);
	modelStack.Scale(0.5, 0.5, 0.5);
	modelStack.Rotate(robbyRotate, 0, 1, 0);
	modelStack.Rotate(-90, 0, 1, 0);
	renderMesh(meshList[GEO_ROBBY], true);
	modelStack.PopMatrix();
	modelStack.PushMatrix();
	modelStack.Translate(0, -1, 0);
	modelStack.Rotate(-90, 0, 1, 0);
	modelStack.Scale(1500, 1500, 1500);
	renderMesh(meshList[GEO_BOTTOM], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	modelStack.Translate(snowBarricadeCoord.x, snowBarricadeCoord.y, snowBarricadeCoord.z);
	renderMesh(meshList[GEO_SNOWBARRICADE], true);
	modelStack.PopMatrix();

	modelStack.PushMatrix();
	//modelStack.Translate(snowBarricadeCoord.x, snowBarricadeCoord.y, snowBarricadeCoord.z);
	modelStack.Scale(7.5, 7.5, 7.5);
	renderMesh(meshList[GEO_SNOWFORT], true);
	modelStack.PopMatrix();

	if (throwSnowball == true)
	{
		modelStack.PushMatrix();
		modelStack.Translate(ballCoord.x, ballCoord.y, ballCoord.z);
		modelStack.Scale(0.2, 0.2, 0.2);
		renderMesh(meshList[GEO_SPHERE], true);
		modelStack.PopMatrix();
	}
	

	std::stringstream playerPos;
	playerPos << "X = " << camPosX << " Y = " << camPosY << " Z = " << camPosz;
	//RenderTextOnScreen(meshList[GEO_TEXT], playerPos.str(), Color(1, 0, 0), 2, 0, 18);
	std::stringstream ss;
	ss << "FPS:" << fps<<"         "<<playerPos.str();
	RenderTextOnScreen(meshList[GEO_TEXT], ss.str(), Color(0, 1, 0), 3, 0, 19);
	std::stringstream snowballcount;
	snowballcount << "Snow Ball Count: " << snowBallCount;
	RenderTextOnScreen(meshList[GEO_TEXT], snowballcount.str(), Color(0, 1, 0), 3, 0, 1);
	
	if (showdialog1 == true)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "Hi Pingu, can you get me 1 snowball?", Color(1, 0, 1), 2, 0, 15);
	}
	if (showdialog2 == true)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "Thank You!", Color(1, 0, 1), 2, 0, 15);
	}
	if (showdialog3 == true || showdialog5 == true || showdialog7 == true || showdialog13 == true || showdialog15 == true)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "Gained 1 Snow Ball, Max capacity", Color(1, 0, 1), 2, 0, 15);
	}
	if (showdialog4 == true || showdialog6 == true || showdialog8 == true || showdialog14 == true || showdialog16 == true)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "You can only hold 1 Snow Ball!", Color(1, 0, 1), 2, 0, 15);
	}
	if (isHit == true)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "NICE SHOT", Color(1, 0, 1), 3, 0, 18);
	}
}
Beispiel #19
0
void Assignment3::Render()
{
	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Set view matrix using camera settings
	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();

	if (light[0].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[0].position.x, light[0].position.y, light[0].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[0].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[0].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT0_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	}


	if (light[1].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[1].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[1].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[1].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT1_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
	}
	//skybox
	RenderSkybox();

	//axes
	//RenderMesh(meshList[GEO_AXES], false);

	//floor
	modelStack.PushMatrix();
	modelStack.Translate(0, -1, 0);
	modelStack.Scale(100, 1, 100);
	RenderMesh(meshList[GEO_QUAD], true);
	modelStack.PopMatrix();

	//SHIP
	modelStack.PushMatrix();
	modelStack.Translate(SHIP.x,SHIP.y,SHIP.z);
	modelStack.Rotate(4, 0, 0, 1);
	modelStack.Translate(0, -1, 0);
	RenderMesh(meshList[GEO_MODEL1], true);
	modelStack.PopMatrix();
	
	//FLAG
	modelStack.PushMatrix();
	modelStack.Translate(FLAG.x,FLAG.y,FLAG.z);
	modelStack.Rotate(-flagRotate, 0, 0, 1);
	modelStack.Rotate(90, 0, 1, 0);
	RenderMesh(meshList[GEO_MODEL2], true);
	modelStack.PopMatrix();

	//CRATERS;
	for (int i = 0; i < 3; ++i)
	{
		if (i == 0)
		{
			modelStack.PushMatrix();
			modelStack.Translate(0, -0.5, 0);
			modelStack.Scale(2, 2, 2);
			RenderMesh(meshList[GEO_CRATER], true);
			modelStack.PopMatrix();
		}
		else if (i == 1)
		{
			modelStack.PushMatrix();
			modelStack.Translate(30, -0.5, 5);
			modelStack.Scale(3, 2, 3);
			RenderMesh(meshList[GEO_CRATER], true);
			modelStack.PopMatrix();
		}
		else
		{
			for (int j = 0; j < 2; ++j)
			{
				modelStack.PushMatrix();
				modelStack.Translate(-20, -0.5, 10 - j*20);
				modelStack.Scale(3, 2, 3);
				RenderMesh(meshList[GEO_CRATER], true);
				modelStack.PopMatrix();
			}
		}
	}

	// ROCKS AT PERIMETER
	for (int i = 0; i < 2; ++i)
	{
		for (int j = 0; j < 11; ++j)
		{
			modelStack.PushMatrix();
			modelStack.Translate(-50 + j * 10, 1, -50 + 100*i);
			modelStack.Scale(10, 5, 10);
			RenderMesh(meshList[GEO_BOULDER], true);
			modelStack.PopMatrix();
		}
	}
	for (int i = 0; i < 2; ++i)
	{
		for (int j = 0; j < 11; ++j)
		{
			modelStack.PushMatrix();
			modelStack.Translate(-50 + i*100, 1, -50 + j * 10);
			modelStack.Scale(10, 5, 10);
			RenderMesh(meshList[GEO_BOULDER], true);
			modelStack.PopMatrix();
		}
	}

	//MOONBASE
	
	for (int j = 0; j < 3; ++j)
	{
		for (int i = -1; i < j; ++i)
		{
			modelStack.PushMatrix();
			modelStack.Translate(3 - i*10, -0.9, -25 - 7 * j);
			modelStack.Rotate(-135 + j*45 - i*45, 0, 1, 0);
			modelStack.Scale(1 + j*0.5, 1 + j*0.5, 1 + j*0.5);
			RenderMesh(meshList[GEO_TENT], true);
			modelStack.PopMatrix();
		}
	}
	modelStack.PushMatrix();
	modelStack.Translate(5, 0, -20);
	modelStack.PushMatrix();
	modelStack.Translate(4, 0, -0.5);
	modelStack.Scale(10, 2, 1);
	RenderMesh(meshList[GEO_SIGN], true);
	modelStack.PopMatrix();
	RenderText(meshList[GEO_TEXT], "MOON BASE", Color(1, 1, 0));
	modelStack.PopMatrix();

	// HELMET

	modelStack.PushMatrix();
	RenderModelOnScreen(meshList[GEO_HELMET], true, 120, 0.35, 0.2 + helmetY + helmetUP);
	RenderTextOnScreen(meshList[GEO_TEXT], framerate.str(), Color(0, 1, 1), 3, 1, 1 + helmetY * 40 + helmetUP * 40);
	RenderTextOnScreen(meshList[GEO_TEXT], "Push F to take off helmet", Color(0, 1, 1), 3, 1, 18.5 + helmetY * 40 + helmetUP * 40);
	if (displayMore == false)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "(Press 'U' to see more info)", Color(0, 1, 1), 2.5, 1, 20.5 + helmetY * 48 + helmetUP * 48);
	}
	else
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "UI only available with helmet on", Color(0, 1, 1), 2, 1, 20.5 + helmetY * 60 + helmetUP * 60);
		RenderTextOnScreen(meshList[GEO_TEXT], "Some things can only be seen without the helmet", Color(1, 0, 0), 2, 1, 18.5 + helmetY * 60 + helmetUP * 60);
		RenderTextOnScreen(meshList[GEO_TEXT], "The flag may be scaring extraterrestial life!", Color(0, 1, 0), 2, 1, 16.5 + helmetY * 60 + helmetUP * 60);
		RenderTextOnScreen(meshList[GEO_TEXT], "Press 'R' to reset", Color(0, 1, 1), 2, 1, 14.5 + helmetY * 60 + helmetUP * 60);
	}
	RenderTextOnScreen(meshList[GEO_TEXT], "PD ENTERTAINMENT INC.", Color(0, 1, 0), 2, 1, -15 + helmetY * 60 + helmetUP * 60);
	if (camera.position.x > SHIP.x - 6.f && camera.position.x < SHIP.x + 6.f
		&& camera.position.z > SHIP.z - 6.f && camera.position.z < SHIP.z + 6.f
		&& shipFlew == false)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "Press 'E'", Color(0, 1, 0), shipNotiSize, 3, 5 + helmetY * 20 + helmetUP * 20);
	}

	framerate.str("");
	modelStack.PopMatrix();

	//ALIEN

	for (int j = 0; j < 6; ++j)
	{
		for (int i = -1 - j; i < 2 + j; ++i)
		{
			modelStack.PushMatrix();
			modelStack.Translate(i* -3, alienY, 5 + j * 5);
			modelStack.Rotate(0, 0, 0, 1);
			RenderAlien();
			modelStack.PopMatrix();
		}
	}
	
}
Beispiel #20
0
void SP2::Render()
{
	std::ostringstream oss;
	oss << "Camera X: " << camera.position.x;
	string var = oss.str();

	std::ostringstream oss1;
	oss1 << "Camera Z: " << camera.position.z;
	string var1 = oss1.str();

	std::ostringstream dia;
	dia << data[dialogue];
	string dialoguedata = dia.str();

	std::ostringstream diaV;
	diaV << data[dialogueVending];
	string dialogueV = diaV.str();

	std::ostringstream diaD;
	diaD << data[dialogueDoor];
	string dialogueD = diaD.str();

	std::ostringstream diaC;
	diaC << data[dialogueCoke];
	string dialogueC = diaC.str();

	std::ostringstream diaS;
	diaS << data[dialogueSteve];
	string dialogueS = diaS.str();

	std::ostringstream fpsOSS;
	fpsOSS << "FPS: " << deltaTime;
	string Fps = fpsOSS.str();

	std::ostringstream keyOSS;
	keyOSS << "Key: " << key1;
	string Key = keyOSS.str();

	std::ostringstream cokeOSS;
	cokeOSS << "Coke: " << coca;
	string Coke = cokeOSS.str();


	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Set view matrix using camera settings
	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();
//new code
	if (light[0].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[0].position.x, light[0].position.y, light[0].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[0].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[0].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT0_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	}

	if (light[1].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[1].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[1].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[1].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT1_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[1].position;
		glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightPosition_cameraspace.x);
	}

	if (light[2].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[2].position.x, light[2].position.y, light[2].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT2_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[2].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[2].position;
		glUniform3fv(m_parameters[U_LIGHT2_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[2].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT2_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[2].position;
		glUniform3fv(m_parameters[U_LIGHT2_POSITION], 1, &lightPosition_cameraspace.x);
	}

	if (light[3].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[3].position.x, light[3].position.y, light[3].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT3_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[3].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[3].position;
		glUniform3fv(m_parameters[U_LIGHT3_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[3].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT3_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[3].position;
		glUniform3fv(m_parameters[U_LIGHT3_POSITION], 1, &lightPosition_cameraspace.x);
	}

	if (light[4].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[4].position.x, light[4].position.y, light[4].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT4_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[4].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[4].position;
		glUniform3fv(m_parameters[U_LIGHT4_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[4].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT4_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[4].position;
		glUniform3fv(m_parameters[U_LIGHT4_POSITION], 1, &lightPosition_cameraspace.x);
	}

	if (light[5].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[5].position.x, light[5].position.y, light[5].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT5_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[5].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[5].position;
		glUniform3fv(m_parameters[U_LIGHT5_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[5].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT5_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[5].position;
		glUniform3fv(m_parameters[U_LIGHT5_POSITION], 1, &lightPosition_cameraspace.x);
	}

	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(light[1].position.x, light[1].position.y, light[1].position.z);
	RenderMesh(meshList[GEO_LIGHTBALL], false);
	modelStack.PopMatrix();

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

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

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

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

	modelStack.PushMatrix();
	modelStack.Translate(0, 1, 0);

	
	//Move skybox
	modelStack.PushMatrix();
	modelStack.Translate(0 + camera.position.x, 0, -90 + camera.position.z + 50);
	RenderSkybox();
	modelStack.PopMatrix();
	
	modelStack.PushMatrix();
	modelStack.Translate(0, 0, 0);
	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(0, -20, 0);
	modelStack.Rotate(180, 1, 0, 0);
	modelStack.Scale(1000, 1, 1000);
	RenderMesh(meshList[GEO_QUAD], true);
	modelStack.PopMatrix();

	if (door)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], dialogueD, Color(1, 1, 0), 2, 6, 10);
	}

	if (santa)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], dialoguedata, Color(1, 1, 0), 2, 6, 10);
	}

	if (showV)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], dialogueV, Color(1, 1, 0), 2, 6, 10);
	}

	if (showC)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], dialogueC, Color(1, 1, 0), 2, 6, 10);
	}

	if (showS)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], dialogueS, Color(1, 1, 0), 2, 6, 10);
	}


	if (showInstructions)
	{
		RenderTextOnScreen(meshList[GEO_TEXT], "Up,down,left,right to shift character view" , Color(1, 0, 0), 1.7, 2, 21);
		RenderTextOnScreen(meshList[GEO_TEXT], "W, A, S, D to move", Color(1, 0, 0), 1.7, 2, 20);
		RenderTextOnScreen(meshList[GEO_TEXT], "Z/X to on/off light", Color(1, 0, 0), 1.7, 2, 19);

		RenderTextOnScreen(meshList[GEO_TEXT], "Move near to objects to see interaction", Color(1, 0, 1), 1.7, 2, 17);
		RenderTextOnScreen(meshList[GEO_TEXT], "Interactions: Door,NPC,Vending machine,Coke", Color(1, 0, 1), 1.7, 2, 16);
		RenderTextOnScreen(meshList[GEO_TEXT], "Different things happens based on your choice", Color(1, 0, 1), 1.7, 2, 14);


	}


	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(-10, 3, -60);
	RenderText(meshList[GEO_TEXT], "", Color(0, 1, 0));
	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(25, 0, 0);
	RenderText(meshList[GEO_TEXT], "", Color(0, 1, 0));
	modelStack.PopMatrix();
	modelStack.PopMatrix();
	modelStack.PopMatrix();

	RenderTextOnScreen(meshList[GEO_TEXT], "Hold V for instructions", Color(1, 1, 0), 2, 1, 4);
	RenderTextOnScreen(meshList[GEO_TEXT], Fps, Color(1, 1, 0), 2, 1, 29);
	RenderTextOnScreen(meshList[GEO_TEXT], var, Color(1, 1, 0), 2, 1, 3);
	RenderTextOnScreen(meshList[GEO_TEXT], var1, Color(1, 1, 0), 2, 1, 2);
	RenderTextOnScreen(meshList[GEO_TEXT], Key, Color(1, 1, 0),2,1,1);
	RenderTextOnScreen(meshList[GEO_TEXT], Coke, Color(1, 1, 0), 2, 8, 1);

	modelStack.PopMatrix();
}
Beispiel #21
0
void SceneMenu::Render()
{
	std::ostringstream oss;
	oss << "Camera X: " << camera.position.x;
	string var = oss.str();

	std::ostringstream oss1;
	oss1 << "Camera Z: " << camera.position.z;
	string var1 = oss1.str();

	std::ostringstream ammoOSS;
	std::ostringstream goldOSS;
	std::ostringstream fpsOSS;
	fpsOSS << "FPS : " << deltaTime;
	string Fps = fpsOSS.str();
	string ammo = ammoOSS.str();
	string s_gold = goldOSS.str();


	// Render VBO here
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Set view matrix using camera settings
	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();

	if (light[0].type == Light::LIGHT_DIRECTIONAL)
	{
		Vector3 lightDir(light[0].position.x, light[0].position.y, light[0].position.z);
		Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightDirection_cameraspace.x);
	}
	else if (light[0].type == Light::LIGHT_SPOT)
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
		Vector3 spotDirection_cameraspace = viewStack.Top() * light[0].spotDirection;
		glUniform3fv(m_parameters[U_LIGHT0_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
	}
	else
	{
		Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
		glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
	}
	/*if (Input == "Game")
	{
		modelStack.PushMatrix();
		Enemy_Rendering();
		modelStack.PopMatrix();

		modelStack.PushMatrix();
		Map_Rendering();
		modelStack.PopMatrix();

		modelStack.PushMatrix();
		Object_Rendering();
		modelStack.PopMatrix();

		modelStack.PushMatrix();
		modelStack.Scale(30, 30, 30);
		modelStack.Translate(0, -1, 0);
		RenderMesh(meshList[GEO_MOONBALL], true);
		modelStack.PopMatrix();
	}*/

	////Move skybox
	//modelStack.PushMatrix();
	//modelStack.Translate(0 + camera.position.x, 0, -90 + camera.position.z + 50);
	//modelStack.Scale(3, 3, 3);
	//RenderSkybox();
	//modelStack.PopMatrix();
	
	modelStack.PushMatrix();
	modelStack.Translate(0, 0, 0);
	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(0, -20, 0);
	modelStack.Rotate(180, 1, 0, 0);
	modelStack.Scale(1000, 1, 1000);
	RenderMesh(meshList[GEO_QUAD], true);
	modelStack.PopMatrix();
	modelStack.PushMatrix();
	modelStack.Translate(0, 1, 0);
	modelStack.Rotate(90, 1, 0, 0);
	
	RenderQuadOnScreen(meshList[GEO_STAR], 0.3, 20, menuIcon, rotateCoke, 0, 1, 0,2);

	RenderQuadOnScreen(meshList[GEO_PATH], 6, 6.7, menu_pos, 90, 1, 0, 0,0);
	
	/*if (menushop.shopInput == "Shop")
	{
		int j = 21;
		RenderQuadOnScreen(meshList[GEO_COKE], 1, 6, icon, rotateCoke,0,1,0,0);
		RenderTextOnScreen(meshList[GEO_TEXT], ">", Color(0, 1, 0), 1.7, 4, icon2);
		for (int arr = 0; arr < my_arr.size() - 3; ++arr)
		{
			--j;
			RenderTextOnScreen(meshList[GEO_TEXT], my_arr[arr], Color(1, 1, 1), 1.7, 5, j);
		}
	}
	if (menushop.shopInput == "Buy")
	{
		int j = 18;
		RenderQuadOnScreen(meshList[GEO_COKE], 1, 6, icon, rotateCoke, 0, 1, 0, 0);
		for (int arr = 6; arr < my_arr.size(); ++arr)
		{
			--j;
			RenderTextOnScreen(meshList[GEO_TEXT], my_arr[arr], Color(1, 1, 1), 1.7, 5, j);
		}
		if (b_gold)
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "No more gold!", Color(1, 1, 1), 1.7, 10, 20);
		}
	}*/
	if (Input == "Menu")
	{
		if (color == "Red1")
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Start", Color(1, 0, 0), 1.7, 5, 21);
		}
		else
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Start", Color(0, 1, 0), 1.7, 5, 21);

		}
		if (color == "Red2")
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Options", Color(1, 0, 0), 1.7, 5, 20);
		}
		else
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Options", Color(0, 1, 0), 1.7, 5, 20);
		}
		if (color == "Red3")
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Quit", Color(1, 0, 0), 1.7, 5, 19);
		}
		else
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Quit", Color(0, 1, 0), 1.7, 5, 19);

		}
	}
	if (Input == "Options")
	{
		if (color == "Red4")
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Settings", Color(1, 0, 0), 1.7, 5, 19);
		}
		else
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Settings", Color(0, 1, 0), 1.7, 5, 19);
		}
		if (color == "Red5")
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Quit", Color(1, 0, 0), 1.7, 5, 18);
		}
		else
		{
			RenderTextOnScreen(meshList[GEO_TEXT], "Quit", Color(0, 1, 0), 1.7, 5, 18);
		}
	}

	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(-10, 3, -60);
	RenderText(meshList[GEO_TEXT], "", Color(0, 1, 0));
	modelStack.PushMatrix();
	//scale, translate, rotate
	modelStack.Translate(25, 0, 0);
	RenderText(meshList[GEO_TEXT], "", Color(0, 1, 0));
	modelStack.PopMatrix();
	modelStack.PopMatrix();
	modelStack.PopMatrix();
	var.resize(16);
	var1.resize(16);
	Fps.resize(11);
	RenderTextOnScreen(meshList[GEO_TEXT], ammo, Color(1, 1, 0), 1.5, 1, 39);
	RenderTextOnScreen(meshList[GEO_TEXT], s_gold, Color(1, 1, 0), 1.5, 45, 39);
	RenderTextOnScreen(meshList[GEO_TEXT], var, Color(1, 1, 0), 1.5, 1, 3);
	RenderTextOnScreen(meshList[GEO_TEXT], var1, Color(1, 1, 0), 1.5, 1, 2);
	RenderTextOnScreen(meshList[GEO_TEXT], Fps, Color(1, 1, 0), 1.5, 1, 1);
	modelStack.PopMatrix();
}
void SceneManagerCMPause::RenderStaticObject()
{
	Mesh* drawMesh = resourceManager.retrieveMesh("FONT");
	drawMesh->textureID = resourceManager.retrieveTexture("AlbaFont");
	RenderTextOnScreen(drawMesh, "test", resourceManager.retrieveColor("Red"), 75, 400, 550, 0);
}
Beispiel #23
0
void SceneText::Render()
{
    // Clear color & depth buffer every frame
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    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();

    if (light[0].type == Light::LIGHT_DIRECTIONAL) {
        Vector3 lightDir(light[0].position.x, light[0].position.y, light[0].position.z);
        Vector3 lightDirection_cameraspace = viewStack.Top() * lightDir;
        glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightDirection_cameraspace.x);
    }
    else if (light[0].type == Light::LIGHT_SPOT) {
        Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
        glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
        Vector3 spotDirection_cameraspace = viewStack.Top() * light[0].spotDirection;
        glUniform3fv(m_parameters[U_LIGHT0_SPOTDIRECTION], 1, &spotDirection_cameraspace.x);
    }
    else {
        Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
        glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
    }

    //RENDER OBJECTS
    RenderMesh(meshList[GEO_AXES], false);

    modelStack.PushMatrix();
    modelStack.Translate(camera.position.x, camera.position.y, camera.position.z);
    RenderSkybox();
    modelStack.PopMatrix();

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

    //OBJs with transparency to be rendered Last

    modelStack.PushMatrix();
    modelStack.Scale(10, 10, 10);
    RenderText(meshList[GEO_TEXT], "Darrus is gay", Color(0, 1, 0));
    modelStack.PopMatrix();

    RenderTextOnScreen(meshList[GEO_TEXT], "Hello World", Color(0, 1, 0), 5, 0, 0);

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 0, 0);
    //RenderMesh(meshList[GEO_MODEL1], true);
    //modelStack.PopMatrix();

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 5, 0);
    //RenderMesh(meshList[GEO_MODEL2], true);
    //modelStack.PopMatrix();

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 10, 0);
    //RenderMesh(meshList[GEO_MODEL3], true);
    //modelStack.PopMatrix();

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 15, 0);
    //RenderMesh(meshList[GEO_MODEL4], true);
    //modelStack.PopMatrix();

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 20, 0);
    //RenderMesh(meshList[GEO_MODEL5], true);
    //modelStack.PopMatrix();

    //modelStack.PushMatrix();
    //modelStack.Translate(0, 25, 0);
    //RenderMesh(meshList[GEO_MODEL6], true);
    //modelStack.PopMatrix();

    modelStack.PushMatrix();
    modelStack.Translate(0, 40, 0);
    //RenderMesh(meshList[GEO_VEHICLE_SPACE_AIR], true);
    modelStack.PopMatrix();

    modelStack.PushMatrix();
    modelStack.Translate(0, 0, 0);
    //RenderMesh(meshList[GEO_VEHICLE_SPACE_LAND], true);
    modelStack.PopMatrix();
}