BlockGame/blocks/BaseBlock.cpp

27 lines
849 B
C++
Raw Normal View History

2022-02-05 20:44:31 +00:00
//
// 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() {
glUniform3f(BlockRenderer::getInstance()->getUniformhandle("u_color"), r, g, b);
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]);
BlockRenderer::getInstance()->render();
}
BaseBlock::BaseBlock(float r, float g, float b, uint xpos, uint ypos, uint zpos) : r(r), g(g), b(b), xpos(xpos), ypos(ypos), zpos(zpos) {
// BlockRenderer::init();
// this->getrenderer().init();
}