gameEngine/gameEngine/Scene.cpp
//renders background and all sprites, if visible state is true
renders background and all sprites, if visible state is true
renders background and all sprites if visible state is true
void Scene::Render()
{
	if (this->visible)
	{
		glm::mat4 projection;
		projection = glm::ortho(0.0f, this->camera.getWidth() * this->camera.getZoom().x, this->camera.getHeight() * this->camera.getZoom().y, 0.0f, -1.0f, 1.0f);
		projection = glm::translate(projection, glm::vec3(camera.getPosition(), 0.0f));
		projection = glm::translate(projection, glm::vec3(0.5f * this->camera.getWidth(), 0.5f * this->camera.getHeight(), 0.0f)); 
		projection = glm::rotate(projection, this->camera.getRotation(), glm::vec3(0.0f, 0.0f, 1.0f)); 
		projection = glm::translate(projection, glm::vec3(-0.5f * this->camera.getWidth(), -0.5f * this->camera.getHeight(), 0.0f)); 
		ResourceManager::GetShader("sprite").SetMatrix4("projection", projection);
		Texture2D tempTexture = ResourceManager::GetTexture("background");
		Renderer->DrawSprite(tempTexture, background.getPosition(), glm::vec2(this->width, this->height), 0.0f);
		for (int i = 0; i < DrawSceneObjects.size(); i++)
		{
			DrawSceneObjects.at(i)->Draw(*Renderer);
		}
	}
}
void Scene :: Render ( ) { if ( this -> visible ) { glm :: mat4 projection ; projection = glm :: ortho ( 0.0f , this -> camera . getWidth ( ) * this -> camera . getZoom ( ) . x , this -> camera . getHeight ( ) * this -> camera . getZoom ( ) . y , 0.0f , -1.0f , 1.0f ) ; projection = glm :: translate ( projection , glm :: vec3 ( camera . getPosition ( ) , 0.0f ) ) ; projection = glm :: translate ( projection , glm :: vec3 ( 0.5f * this -> camera . getWidth ( ) , 0.5f * this -> camera . getHeight ( ) , 0.0f ) ) ; projection = glm :: rotate ( projection , this -> camera . getRotation ( ) , glm :: vec3 ( 0.0f , 0.0f , 1.0f ) ) ; projection = glm :: translate ( projection , glm :: vec3 ( -0.5f * this -> camera . getWidth ( ) , -0.5f * this -> camera . getHeight ( ) , 0.0f ) ) ; ResourceManager :: GetShader ( " " ) . SetMatrix4 ( " " , projection ) ; Texture2D tempTexture = ResourceManager :: GetTexture ( " " ) ; Renderer -> DrawSprite ( tempTexture , background . getPosition ( ) , glm :: vec2 ( this -> width , this -> height ) , 0.0f ) ; for ( int i = 0 ; i < DrawSceneObjects . size ( ) ; i ++ ) { DrawSceneObjects . at ( i ) -> Draw ( * Renderer ) ; } } }
renders background and all sprites, if visible state is true
renders background and all sprites if visible state is true
// Move origin of rotation to center of quad // Then rotate // Move origin back