<commit_before>// GLRender.cpp - Copyright 2013-2015 <NAME>, All Rights Reserved

#include <Core/Console.h>
#include "glew.h"
#include "../include/GLRender/GLRenderer.h"
#include <Engine/Components/StaticMeshComponent.h>
#include <Engine/Components/CameraComponent.h>

////////////////////////
///   Constructors   ///

GLRenderer::GLRenderer(uint32 /*width*/, uint32 /*height*/)
{
	// Initialize GLEW
	glewExperimental = GL_TRUE;
	glewInit();

	// Initialize OpenGL
	glClearColor(0, 0, 0, 1);
	glClearDepth(1.f);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	glDisable(GL_STENCIL_TEST);

//	// Create a framebuffer for deferred rendering (GBuffer)
//	glGenFramebuffers(1, &gBuffer);
//	glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);
//
//	// Create a depth buffer for the GBuffer
//	glGenTextures(1, &depthBuffer);
//	glBindTexture(GL_TEXTURE_2D, depthBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); // 1 32-bit unsigned integer component for depth
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthBuffer, 0);
//
//	// Create a position buffer for the GBuffer
//	glGenTextures(1, &positionBuffer);
//	glBindTexture(GL_TEXTURE_2D, positionBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // 3 32-bit floating point components for position
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, positionBuffer, 0);
//
//	// Create a diffuse buffer for the GBuffer
//	glGenTextures(1, &diffuseBuffer);
//	glBindTexture(GL_TEXTURE_2D, diffuseBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); // 4 8-bit unsigned integer components for diffuse
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, diffuseBuffer, 0);
//
//	// Create a normal buffer for the GBuffer
//	glGenTextures(1, &normalBuffer);
//	glBindTexture(GL_TEXTURE_2D, normalBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // 3 32-bit floating point components for normal
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, normalBuffer, 0);
//
//	// Create a specular buffer for the GBuffer
//	glGenTextures(1, &specularBuffer);
//	glBindTexture(GL_TEXTURE_2D, specularBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for specular
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, specularBuffer, 0);
//
//	// Create a metallic buffer for the GBuffer
//	glGenTextures(1, &metallicBuffer);
//	glBindTexture(GL_TEXTURE_2D, metallicBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for metallic
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT4, GL_TEXTURE_2D, metallicBuffer, 0);
//
//	// Create a roughness buffer for the GBuffer
//	glGenTextures(1, &roughnessBuffer);
//	glBindTexture(GL_TEXTURE_2D, roughnessBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for roughness
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT5, GL_TEXTURE_2D, roughnessBuffer, 0);
//
//	// Make sure the GBuffer was constructed successfully
//	if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
//	{
//		Console::WriteLine("GBuffer created successfully");
//	}
//	else
//	{
//		Console::WriteLine("Error creating the GBuffer");
//	}
//
//	// Create a VAO for screen quad
//	glGenVertexArrays(1, &screenQuadVAO);
//	glBindVertexArray(screenQuadVAO);
//
//	// Create and upload a VBO for screen quad
//	glGenBuffers(1, &screenQuadVBO);
//	glBindBuffer(GL_ARRAY_BUFFER, screenQuadVBO);
//	float screenQuadData[] = {
//		-1.f, 1.f, 0.f, 1.f, // Top-left point
//		-1.f, -1.f, 0.f, 0.f, // Bottom-left point
//		1.f, -1.f, 1.f, 0.f, // Bottom-right point
//		1.f, 1.f, 1.f, 1.f // Top-right point
//	};
//	glBufferData(GL_ARRAY_BUFFER, sizeof(screenQuadData), screenQuadData, GL_STATIC_DRAW);
//
//	// Create and upload a shader program for the screen quad
//	GLShader vShader("data/viewport.vert");
//	GLShader fShader("data/viewport.frag");
//	screenQuadProgram = glCreateProgram();
//	glAttachShader(screenQuadProgram, vShader.GetID());
//	glAttachShader(screenQuadProgram, fShader.GetID());
//	glLinkProgram(screenQuadProgram);
//	glUseProgram(screenQuadProgram);
//
//	// Specify shader data
//	GLint positionAttrib = glGetAttribLocation(screenQuadProgram, "position");
//	glEnableVertexAttribArray(positionAttrib);
//	glVertexAttribPointer(positionAttrib, 2, GL_FLOAT, false, sizeof(float)*4, 0);
//
//	GLint coordinateAttrib = glGetAttribLocation(screenQuadProgram, "vTexCoord");
//	glEnableVertexAttribArray(coordinateAttrib);
//	glVertexAttribPointer(coordinateAttrib, 2, GL_FLOAT, false, sizeof(float)*4, (void*)(sizeof(float)*2));
//
//	float lightPos[] = { 0.f, 1.f, 0.f };
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "positionBuffer"), 0);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "diffuseBuffer"), 1);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "normalBuffer"), 2);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "specularBuffer"), 3);
//	glUniform3fv(glGetUniformLocation(screenQuadProgram, "lightPos"), 1, lightPos);
}

GLRenderer::~GLRenderer()
{
	// TODO
}

///////////////////
///   Methods   ///

void GLRenderer::RenderScene(const Scene& scene)
{
	// Clear color and depth buffer
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	// Get first camera in scene
	const auto* cam = scene.GetComponentsOfType<CameraComponent>().FirstOrDefault();

	// We can't render the scene without a camera
	if (!cam)
		return;

	Mat4 view = cam->GetOwner().GetModelMatrix().Inverse();
	Mat4 proj = cam->GetPerspective();

	// Render each StaticMeshComponent in the scene
	for (auto staticMesh : scene.GetComponentsOfType<StaticMeshComponent>())
	{
		if (!staticMesh->Visible)
			continue;

		Mat4 model = staticMesh->GetOwner().Transform.GetMatrix();
		
		// Bind the mesh and material
		auto& mesh = FindStaticMesh(*staticMesh->Mesh);
		mesh.Bind();
		FindMaterial(*staticMesh->Material).Bind(staticMesh->InstanceParams);

		// Upload transformation matrices
		glUniformMatrix4fv(0, 1, false, (const float*)&model);
		glUniformMatrix4fv(1, 1, false, (const float*)&view);
		glUniformMatrix4fv(2, 1, false, (const float*)&proj);

		glDrawElements(GL_TRIANGLES, mesh.GetNumElements(), GL_UNSIGNED_INT, nullptr);
	}
}

GLShader& GLRenderer::FindShader(const Shader& asset)<commit_msg>Updated render code to function with the new engine API<commit_after>// GLRender.cpp - Copyright 2013-2015 <NAME>, All Rights Reserved

#include <Core/Console.h>
#include "glew.h"
#include "../include/GLRender/GLRenderer.h"
#include <Engine/Components/StaticMeshComponent.h>
#include <Engine/Components/CameraComponent.h>

////////////////////////
///   Constructors   ///

GLRenderer::GLRenderer(uint32 /*width*/, uint32 /*height*/)
{
	// Initialize GLEW
	glewExperimental = GL_TRUE;
	glewInit();

	// Initialize OpenGL
	glClearColor(0, 0, 0, 1);
	glClearDepth(1.f);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	glDisable(GL_STENCIL_TEST);

//	// Create a framebuffer for deferred rendering (GBuffer)
//	glGenFramebuffers(1, &gBuffer);
//	glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);
//
//	// Create a depth buffer for the GBuffer
//	glGenTextures(1, &depthBuffer);
//	glBindTexture(GL_TEXTURE_2D, depthBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); // 1 32-bit unsigned integer component for depth
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthBuffer, 0);
//
//	// Create a position buffer for the GBuffer
//	glGenTextures(1, &positionBuffer);
//	glBindTexture(GL_TEXTURE_2D, positionBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // 3 32-bit floating point components for position
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, positionBuffer, 0);
//
//	// Create a diffuse buffer for the GBuffer
//	glGenTextures(1, &diffuseBuffer);
//	glBindTexture(GL_TEXTURE_2D, diffuseBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); // 4 8-bit unsigned integer components for diffuse
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, diffuseBuffer, 0);
//
//	// Create a normal buffer for the GBuffer
//	glGenTextures(1, &normalBuffer);
//	glBindTexture(GL_TEXTURE_2D, normalBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // 3 32-bit floating point components for normal
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, normalBuffer, 0);
//
//	// Create a specular buffer for the GBuffer
//	glGenTextures(1, &specularBuffer);
//	glBindTexture(GL_TEXTURE_2D, specularBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for specular
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, specularBuffer, 0);
//
//	// Create a metallic buffer for the GBuffer
//	glGenTextures(1, &metallicBuffer);
//	glBindTexture(GL_TEXTURE_2D, metallicBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for metallic
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT4, GL_TEXTURE_2D, metallicBuffer, 0);
//
//	// Create a roughness buffer for the GBuffer
//	glGenTextures(1, &roughnessBuffer);
//	glBindTexture(GL_TEXTURE_2D, roughnessBuffer);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//	glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, height, 0, GL_RED, GL_FLOAT, NULL); // 1 32-bit floating point component for roughness
//	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT5, GL_TEXTURE_2D, roughnessBuffer, 0);
//
//	// Make sure the GBuffer was constructed successfully
//	if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
//	{
//		Console::WriteLine("GBuffer created successfully");
//	}
//	else
//	{
//		Console::WriteLine("Error creating the GBuffer");
//	}
//
//	// Create a VAO for screen quad
//	glGenVertexArrays(1, &screenQuadVAO);
//	glBindVertexArray(screenQuadVAO);
//
//	// Create and upload a VBO for screen quad
//	glGenBuffers(1, &screenQuadVBO);
//	glBindBuffer(GL_ARRAY_BUFFER, screenQuadVBO);
//	float screenQuadData[] = {
//		-1.f, 1.f, 0.f, 1.f, // Top-left point
//		-1.f, -1.f, 0.f, 0.f, // Bottom-left point
//		1.f, -1.f, 1.f, 0.f, // Bottom-right point
//		1.f, 1.f, 1.f, 1.f // Top-right point
//	};
//	glBufferData(GL_ARRAY_BUFFER, sizeof(screenQuadData), screenQuadData, GL_STATIC_DRAW);
//
//	// Create and upload a shader program for the screen quad
//	GLShader vShader("data/viewport.vert");
//	GLShader fShader("data/viewport.frag");
//	screenQuadProgram = glCreateProgram();
//	glAttachShader(screenQuadProgram, vShader.GetID());
//	glAttachShader(screenQuadProgram, fShader.GetID());
//	glLinkProgram(screenQuadProgram);
//	glUseProgram(screenQuadProgram);
//
//	// Specify shader data
//	GLint positionAttrib = glGetAttribLocation(screenQuadProgram, "position");
//	glEnableVertexAttribArray(positionAttrib);
//	glVertexAttribPointer(positionAttrib, 2, GL_FLOAT, false, sizeof(float)*4, 0);
//
//	GLint coordinateAttrib = glGetAttribLocation(screenQuadProgram, "vTexCoord");
//	glEnableVertexAttribArray(coordinateAttrib);
//	glVertexAttribPointer(coordinateAttrib, 2, GL_FLOAT, false, sizeof(float)*4, (void*)(sizeof(float)*2));
//
//	float lightPos[] = { 0.f, 1.f, 0.f };
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "positionBuffer"), 0);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "diffuseBuffer"), 1);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "normalBuffer"), 2);
//	glUniform1i(glGetUniformLocation(screenQuadProgram, "specularBuffer"), 3);
//	glUniform3fv(glGetUniformLocation(screenQuadProgram, "lightPos"), 1, lightPos);
}

GLRenderer::~GLRenderer()
{
	// TODO
}

///////////////////
///   Methods   ///

void GLRenderer::RenderScene(const Scene& scene)
{
	// Clear color and depth buffer
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	// Get first camera in scene
	const auto* cam = scene.GetComponentsOfType<CameraComponent>().FirstOrDefault();

	// We can't render the scene without a camera
	if (!cam)
		return;

	Mat4 view = cam->GetTransform().GetMatrix().Inverse();
	Mat4 proj = cam->GetPerspective();

	// Render each StaticMeshComponent in the scene
	for (auto staticMesh : scene.GetComponentsOfType<StaticMeshComponent>())
	{
		if (!staticMesh->Visible)
			continue;

		Mat4 model = staticMesh->GetTransform().GetMatrix();
		
		// Bind the mesh and material
		auto& mesh = FindStaticMesh(*staticMesh->Mesh);
		mesh.Bind();
		FindMaterial(*staticMesh->Material).Bind(staticMesh->InstanceParams);

		// Upload transformation matrices
		glUniformMatrix4fv(0, 1, false, (const float*)&model);
		glUniformMatrix4fv(1, 1, false, (const float*)&view);
		glUniformMatrix4fv(2, 1, false, (const float*)&proj);

		glDrawElements(GL_TRIANGLES, mesh.GetNumElements(), GL_UNSIGNED_INT, nullptr);
	}
}

GLShader& GLRenderer::FindShader(const Shader& asset)
{'fraction_non_alphanumeric': 0.13628216247470368, 'fraction_numerical': 0.022781150621566926, 'mean_word_length': 5.578927348801826, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, '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': '961213', 'n_tokens_mistral': 6757, 'n_tokens_neox': 6349, 'n_words': 1180}