27 lines
849 B
C++
27 lines
849 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() {
|
||
|
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();
|
||
|
|
||
|
}
|