PolyGun/src/game/world/chunk_renderer.cpp
2023-04-11 10:21:13 +02:00

38 lines
1.1 KiB
C++

#include "chunk_renderer.hpp"
#include "common/logger.hpp"
namespace polygun::world {
ChunkRenderer::ChunkRenderer() : chunk_shader("shaders/chunk_vertex.glsl", "shaders/chunk_fragment.glsl") {}
ChunkRenderer::~ChunkRenderer() {}
void ChunkRenderer::init() {/*
float vertices[] = {
// Add your vertex data here
};
GLsizei v_size = sizeof(vertices);
GLuint indices[] = {
// Add your indices data here
};
GLsizei i_size = sizeof(indices);
vertex_array = polygun::renderer::VertexArray(vertices, v_size, indices, i_size);
// Load and configure textures here
chunk_shader.bind();
chunk_shader.set_uniform("texture", 0);*/
}
void ChunkRenderer::render(const glm::mat4& view, const glm::mat4& projection) {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
chunk_shader.bind();
chunk_shader.set_uniform("projection", projection);
chunk_shader.set_uniform("view", view);
vertex_array.draw_elements();
}
}