<commit_before>#include "common.h"

class Material
{
public:
	Texture diffuse;
	Texture specular;
	Texture normal;
	float shininess;

	Material(Texture tex)
		: diffuse(tex), specular(tex), normal(tex)
	{
		shininess = 32.0f;
	}

	Material(Texture d, Texture s, Texture n)
		: diffuse(d), specular(s), normal(n)
	{
		shininess = 32.0f;
	}
};

class BasicShader : public ShaderProgram
{
public:
	BasicShader(const std::string& fileName)
		: ShaderProgram(fileName) {}

	void SetMVP(mat4 m, mat4 v, mat4 p)
	{
		SetUniform4fv("model", m);
		SetUniform4fv("view", v);
		SetUniform4fv("projection", p);
	}
	void SetMaterial(Material material)
	{
		SetUniform1i("material.diffuse", material.diffuse.GetTextureID());
		SetUniform1i("material.specular", material.specular.GetTextureID());
		SetUniform1i("material.normal", material.normal.GetTextureID());
		SetUniform1f("material.shininess", material.shininess);
	}

	void SetDirLight(DirLight dirLight)
	{
		SetUniform3fv("dirLight.direction", dirLight.direction);
		SetUniform3fv("dirLight.ambient", dirLight.ambient);
		SetUniform3fv("dirLight.diffuse", dirLight.diffuse);
		SetUniform3fv("dirLight.specular", dirLight.specular);
	}

	void SetPointLight(PointLight pointLight)
	{
		SetUniform3fv("pointLight.position", pointLight.position);
		SetUniform3fv("pointLight.ambient", pointLight.ambient);
		SetUniform3fv("pointLight.diffuse", pointLight.diffuse);
		SetUniform3fv("pointLight.specular", pointLight.specular);
		SetUniform1f("pointLight.constant", pointLight.constant);
		SetUniform1f("pointLight.linear", pointLight.linear);
		SetUniform1f("pointLight.quadratic", pointLight.quadratic);
	}

	void SetSpotLight(SpotLight spotLight)
	{
		SetUniform3fv("spotLight.position", spotLight.position);
		SetUniform3fv("spotLight.direction", spotLight.direction);
		SetUniform3fv("spotLight.ambient", spotLight.ambient);
		SetUniform3fv("spotLight.diffuse", spotLight.diffuse);
		SetUniform3fv("spotLight.specular", spotLight.specular);
		SetUniform1f("spotLight.constant", spotLight.constant);
		SetUniform1f("spotLight.linear", spotLight.linear);
		SetUniform1f("spotLight.quadratic", spotLight.quadratic);
		SetUniform1f("spotLight.cutOff", spotLight.cutOff);
		SetUniform1f("spotLight.outerCutOff", spotLight.outerCutOff);
	}
};


int main(int argc, char *argv[])
{
	Window window = Window("OpenGL Skeleton", 1280, 720);

	Input input = Input();

	Camera camera = Camera();
	camera.Position = vec3(0, 0, 5);


	BasicShader basicShader = BasicShader("../res/shaders/basicShader");
	ShaderProgram lampShader = ShaderProgram("../res/shaders/lampShader");
	ShaderProgram depthShader = ShaderProgram("../res/shaders/depthShader");

	Mesh objectMesh = Mesh("../res/models/head/head.obj");
	Texture texture = Texture("../res/models/head/Diffuse.png");
	Texture specularMap = Texture("../res/models/head/Specular.png");
	Texture normalMap = Texture("../res/models/head/Normal.png");

	texture.Bind(texture.GetTextureID());
	specularMap.Bind(specularMap.GetTextureID());
	normalMap.Bind(normalMap.GetTextureID());

	Material material = Material(texture, texture, normalMap);

	Transformation objectTrans = Transformation();
	objectTrans.SetScale(vec3(5.8f));

	Mesh dirLightMesh = Mesh("../res/models/cube.obj");
	Mesh pointLightMesh = Mesh("../res/models/sphere.obj");
	Mesh flashlightMesh = Mesh("../res/models/flashlight.obj");

	Transformation dirLightTrans = Transformation();
	dirLightTrans.SetPosition(vec3(0, 2.0f, 0));
	dirLightTrans.SetScale(vec3(0.2f));

	Transformation pointLightTrans = Transformation();
	pointLightTrans.SetPosition(vec3(1, 1, 1));
	pointLightTrans.SetScale(vec3(0.1f));

	Transformation spotLightTrans = Transformation();
	spotLightTrans.SetPosition(vec3(0.0f, 0.0f, 2.0f));
	spotLightTrans.SetRotation(vec3(90.0f, 0.0f, 0.0f));
	spotLightTrans.SetScale(vec3(0.1f));

	DirLight dirLight = DirLight(vec3(-0.2f, -1.0f, -0.3f), WHITE);
	PointLight pointLight = PointLight(RED);
	SpotLight spotLight = SpotLight(spotLightTrans.GetPosition(), camera.Front, GREEN);

	int centerX = window.getWidth() / 2;
	int centerY = window.getHeight() / 2;

	bool UseNormalMapping = true;
	bool UseWireFrame = false;

	DebugUi debugUi = DebugUi(window.getWindow());

	debugUi.addFloat("PointLight R", &pointLight.color.r);

	debugUi.addFloat("Camera X", &camera.Position.x);
	debugUi.addFloat("Camera Y", &camera.Position.y);
	debugUi.addFloat("Camera Z", &camera.Position.z);

	debugUi.addBool("Normal Mapping", &UseNormalMapping);
	debugUi.addBool("Wireframe", &UseWireFrame);

	while (!window.isCloseRequested()) {

		// Determine deltaTime
		float deltaTime = 1000.0f / SDL_GetTicks();

		input.pollInput();
		if (input.wasKeyPressed(SDL_SCANCODE_ESCAPE)) {
			window.requestClose();
		}
		if (input.isKeyHeld(SDL_SCANCODE_A))
		{
			camera.ProcessKeyboard(LEFT, deltaTime);
		}
		if (input.isKeyHeld(SDL_SCANCODE_D))
		{
			camera.ProcessKeyboard(RIGHT, deltaTime);
		}<commit_msg>PointLight sliders<commit_after>#include "common.h"

class Material
{
public:
	Texture diffuse;
	Texture specular;
	Texture normal;
	float shininess;

	Material(Texture tex)
		: diffuse(tex), specular(tex), normal(tex)
	{
		shininess = 32.0f;
	}

	Material(Texture d, Texture s, Texture n)
		: diffuse(d), specular(s), normal(n)
	{
		shininess = 32.0f;
	}
};

class BasicShader : public ShaderProgram
{
public:
	BasicShader(const std::string& fileName)
		: ShaderProgram(fileName) {}

	void SetMVP(mat4 m, mat4 v, mat4 p)
	{
		SetUniform4fv("model", m);
		SetUniform4fv("view", v);
		SetUniform4fv("projection", p);
	}
	void SetMaterial(Material material)
	{
		SetUniform1i("material.diffuse", material.diffuse.GetTextureID());
		SetUniform1i("material.specular", material.specular.GetTextureID());
		SetUniform1i("material.normal", material.normal.GetTextureID());
		SetUniform1f("material.shininess", material.shininess);
	}

	void SetDirLight(DirLight dirLight)
	{
		SetUniform3fv("dirLight.direction", dirLight.direction);
		SetUniform3fv("dirLight.ambient", dirLight.ambient);
		SetUniform3fv("dirLight.diffuse", dirLight.diffuse);
		SetUniform3fv("dirLight.specular", dirLight.specular);
	}

	void SetPointLight(PointLight pointLight)
	{
		SetUniform3fv("pointLight.position", pointLight.position);
		SetUniform3fv("pointLight.ambient", pointLight.ambient);
		SetUniform3fv("pointLight.diffuse", pointLight.diffuse);
		SetUniform3fv("pointLight.specular", pointLight.specular);
		SetUniform1f("pointLight.constant", pointLight.constant);
		SetUniform1f("pointLight.linear", pointLight.linear);
		SetUniform1f("pointLight.quadratic", pointLight.quadratic);
	}

	void SetSpotLight(SpotLight spotLight)
	{
		SetUniform3fv("spotLight.position", spotLight.position);
		SetUniform3fv("spotLight.direction", spotLight.direction);
		SetUniform3fv("spotLight.ambient", spotLight.ambient);
		SetUniform3fv("spotLight.diffuse", spotLight.diffuse);
		SetUniform3fv("spotLight.specular", spotLight.specular);
		SetUniform1f("spotLight.constant", spotLight.constant);
		SetUniform1f("spotLight.linear", spotLight.linear);
		SetUniform1f("spotLight.quadratic", spotLight.quadratic);
		SetUniform1f("spotLight.cutOff", spotLight.cutOff);
		SetUniform1f("spotLight.outerCutOff", spotLight.outerCutOff);
	}
};


int main(int argc, char *argv[])
{
	Window window = Window("OpenGL Skeleton", 1280, 720);

	Input input = Input();

	Camera camera = Camera();
	camera.Position = vec3(0, 0, 5);


	BasicShader basicShader = BasicShader("../res/shaders/basicShader");
	ShaderProgram lampShader = ShaderProgram("../res/shaders/lampShader");
	ShaderProgram depthShader = ShaderProgram("../res/shaders/depthShader");

	Mesh objectMesh = Mesh("../res/models/head/head.obj");
	Texture texture = Texture("../res/models/head/Diffuse.png");
	Texture specularMap = Texture("../res/models/head/Specular.png");
	Texture normalMap = Texture("../res/models/head/Normal.png");

	texture.Bind(texture.GetTextureID());
	specularMap.Bind(specularMap.GetTextureID());
	normalMap.Bind(normalMap.GetTextureID());

	Material material = Material(texture, texture, normalMap);

	Transformation objectTrans = Transformation();
	objectTrans.SetScale(vec3(5.8f));

	Mesh dirLightMesh = Mesh("../res/models/cube.obj");
	Mesh pointLightMesh = Mesh("../res/models/sphere.obj");
	Mesh flashlightMesh = Mesh("../res/models/flashlight.obj");

	Transformation dirLightTrans = Transformation();
	dirLightTrans.SetPosition(vec3(0, 2.0f, 0));
	dirLightTrans.SetScale(vec3(0.2f));

	Transformation pointLightTrans = Transformation();
	pointLightTrans.SetPosition(vec3(1, 1, 1));
	pointLightTrans.SetScale(vec3(0.1f));

	Transformation spotLightTrans = Transformation();
	spotLightTrans.SetPosition(vec3(0.0f, 0.0f, 2.0f));
	spotLightTrans.SetRotation(vec3(90.0f, 0.0f, 0.0f));
	spotLightTrans.SetScale(vec3(0.1f));

	DirLight dirLight = DirLight(vec3(-0.2f, -1.0f, -0.3f), WHITE);
	PointLight pointLight = PointLight(RED);
	SpotLight spotLight = SpotLight(spotLightTrans.GetPosition(), camera.Front, GREEN);

	int centerX = window.getWidth() / 2;
	int centerY = window.getHeight() / 2;

	bool UseNormalMapping = true;
	bool UseWireFrame = false;

	DebugUi debugUi = DebugUi(window.getWindow());

	debugUi.addFloat("PointLight R", &pointLight.color.r, 0.0f, 1.0f);
	debugUi.addFloat("PointLight G", &pointLight.color.g, 0.0f, 1.0f);
	debugUi.addFloat("PointLight B", &pointLight.color.b, 0.0f, 1.0f);

	debugUi.addFloat("Camera X", &camera.Position.x);
	debugUi.addFloat("Camera Y", &camera.Position.y);
	debugUi.addFloat("Camera Z", &camera.Position.z);

	debugUi.addBool("Normal Mapping", &UseNormalMapping);
	debugUi.addBool("Wireframe", &UseWireFrame);

	while (!window.isCloseRequested()) {

		// Determine deltaTime
		float deltaTime = 1000.0f / SDL_GetTicks();

		input.pollInput();
		if (input.wasKeyPressed(SDL_SCANCODE_ESCAPE)) {
			window.requestClose();
		}
		if (input.isKeyHeld(SDL_SCANCODE_A))
		{
			camera.ProcessKeyboard(LEFT, deltaTime);
		}
		if (input.isKeyHeld(SDL_SCANCODE_D))
		{
			camera.ProcessKeyboard(RIGHT, deltaTime);
		}
{'fraction_non_alphanumeric': 0.14984557138587226, 'fraction_numerical': 0.020723323702301486, 'mean_word_length': 5.875342465753425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5779255', 'n_tokens_mistral': 3706, 'n_tokens_neox': 3436, 'n_words': 553}