BlockGame/blocks/BaseBlock.cpp
2022-02-06 22:53:29 +01:00

25 lines
704 B
C++

//
// Created by lukas on 04.02.22.
//
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <cstdlib>
#include <glm/ext/matrix_float4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include "BaseBlock.h"
#include "BlockRenderer.h"
void BaseBlock::render() {
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]);
texture->Bind();
BlockRenderer::getInstance()->render();
}
BaseBlock::BaseBlock(uint xpos, uint ypos, uint zpos, Texture *texture): xpos(xpos), ypos(ypos), zpos(zpos), texture(texture) {
}