2022-02-05 20:44:31 +00:00
|
|
|
//
|
|
|
|
// Created by lukas on 04.02.22.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <glm/ext/matrix_float4x4.hpp>
|
|
|
|
#include <glm/ext/matrix_transform.hpp>
|
|
|
|
#include "BaseBlock.h"
|
|
|
|
#include "BlockRenderer.h"
|
|
|
|
|
|
|
|
void BaseBlock::render() {
|
2022-02-10 17:24:56 +00:00
|
|
|
BlockRenderer::getInstance()->s.Bind();
|
|
|
|
|
2022-02-05 20:44:31 +00:00
|
|
|
glm::mat4 position = glm::translate(glm::mat4(1.0f), glm::vec3((float) xpos * 2, (float) ypos * 2, (float) zpos * 2));
|
|
|
|
glUniformMatrix4fv(BlockRenderer::getInstance()->getUniformhandle("translation"), 1, GL_FALSE, &position[0][0]);
|
|
|
|
|
2022-02-06 21:53:29 +00:00
|
|
|
texture->Bind();
|
|
|
|
|
2022-02-05 20:44:31 +00:00
|
|
|
BlockRenderer::getInstance()->render();
|
|
|
|
}
|
|
|
|
|
2022-02-06 21:53:29 +00:00
|
|
|
BaseBlock::BaseBlock(uint xpos, uint ypos, uint zpos, Texture *texture): xpos(xpos), ypos(ypos), zpos(zpos), texture(texture) {
|
2022-02-05 20:44:31 +00:00
|
|
|
|
|
|
|
}
|