<commit_before>/*
 * File:   LightSystem.cpp
 * Author: iMer
 *
 * Created on 17. August 2014, 10:39
 */

#include "LightSystem.hpp"
#include "Scene.hpp"
#include "Game.hpp"
#include <iostream>

namespace engine {

	void applyShader(const sf::Shader& shader, sf::RenderTarget& output) {
		sf::Vector2f outputSize(static_cast<float>(output.getSize().x),
								static_cast<float>(output.getSize().y));
		sf::VertexArray vertices(sf::TrianglesStrip, 4);
		vertices[0] = sf::Vertex(sf::Vector2f(0, 0), sf::Vector2f(0, 1));
		vertices[1] = sf::Vertex(sf::Vector2f(outputSize.x, 0), sf::Vector2f(1, 1));
		vertices[2] = sf::Vertex(sf::Vector2f(0, outputSize.y), sf::Vector2f(0, 0));
		vertices[3] = sf::Vertex(sf::Vector2f(outputSize), sf::Vector2f(1, 0));
		sf::RenderStates states;
		states.shader = &shader;
		states.blendMode = sf::BlendNone;
		output.draw(vertices, states);
	}

	LightSystem::LightSystem(Scene* scene) : m_scene(scene), m_ambientColor(sf::Color::White), m_needsUpdate(true),
											 m_enabled(true) {
		if (!sf::Shader::isAvailable()) {
			std::cerr << "Shaders are not available" << std::endl;
			m_available = false;
		} else {
			m_available = true;
			m_blurShader.loadFromFile("assets/shader/fullpass.vert", "assets/shader/blur.frag");

		}
		auto size = m_scene->GetGame()->GetWindow()->getView().getSize();
		m_buffer.create(static_cast<unsigned int>(size.x), static_cast<unsigned int>(size.y));
		m_pingPongBuffer.create(static_cast<unsigned int>(size.x), static_cast<unsigned int>(size.y));
		m_buffer.setActive(false);
		m_pingPongBuffer.setActive(false);
	}

	LightSystem::~LightSystem() {
	}

	bool LightSystem::update(sf::Time interval) {
		m_needsUpdate = true;
		return false;
	}
<commit_msg>Add way to disable lighting since its broken<commit_after>/*
 * File:   LightSystem.cpp
 * Author: iMer
 *
 * Created on 17. August 2014, 10:39
 */

#include "LightSystem.hpp"
#include "Scene.hpp"
#include "Game.hpp"
#include <iostream>

namespace engine {

	void applyShader(const sf::Shader& shader, sf::RenderTarget& output) {
		sf::Vector2f outputSize(static_cast<float>(output.getSize().x),
								static_cast<float>(output.getSize().y));
		sf::VertexArray vertices(sf::TrianglesStrip, 4);
		vertices[0] = sf::Vertex(sf::Vector2f(0, 0), sf::Vector2f(0, 1));
		vertices[1] = sf::Vertex(sf::Vector2f(outputSize.x, 0), sf::Vector2f(1, 1));
		vertices[2] = sf::Vertex(sf::Vector2f(0, outputSize.y), sf::Vector2f(0, 0));
		vertices[3] = sf::Vertex(sf::Vector2f(outputSize), sf::Vector2f(1, 0));
		sf::RenderStates states;
		states.shader = &shader;
		states.blendMode = sf::BlendNone;
		output.draw(vertices, states);
	}

	LightSystem::LightSystem(Scene* scene) : m_scene(scene), m_ambientColor(sf::Color::White), m_needsUpdate(true),
											 m_enabled(true) {
#ifndef DISABLE_LIGHTING
		if (!sf::Shader::isAvailable()) {
			std::cerr << "Shaders are not available" << std::endl;
			m_available = false;
		} else {
			m_available = true;
			m_blurShader.loadFromFile("assets/shader/fullpass.vert", "assets/shader/blur.frag");

		}
		auto size = m_scene->GetGame()->GetWindow()->getView().getSize();
		m_buffer.create(static_cast<unsigned int>(size.x), static_cast<unsigned int>(size.y));
		m_pingPongBuffer.create(static_cast<unsigned int>(size.x), static_cast<unsigned int>(size.y));
		m_buffer.setActive(false);
		m_pingPongBuffer.setActive(false);
#else
		m_enabled = false;
#endif
	}

	LightSystem::~LightSystem() {
	}

	bool LightSystem::update(sf::Time interval) {
		m_needsUpdate = true;
		return false;
	}

{'fraction_non_alphanumeric': 0.17446448703494927, 'fraction_numerical': 0.020293122886133032, 'mean_word_length': 5.56007393715342, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1734961', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1278, 'n_words': 217}