Make Square transformable
This commit is contained in:
parent
18e01bde5a
commit
211d8957a3
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "../../renderable.h"
|
||||
#include "../../vertex.h"
|
||||
#include "../../transformable.h"
|
||||
#include "../../optional.h"
|
||||
|
||||
#include "../../gfx/vbo.h"
|
||||
#include "../../gfx/vao.h"
|
||||
|
@ -23,10 +25,8 @@
|
|||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include "../../optional.h"
|
||||
|
||||
namespace simpleengine::shapes_2d {
|
||||
class Square : public simpleengine::Renderable {
|
||||
class Square : public simpleengine::Renderable, public simpleengine::Transformable {
|
||||
private:
|
||||
using super = simpleengine::Renderable;
|
||||
private:
|
||||
|
|
|
@ -39,7 +39,9 @@ namespace simpleengine::shapes_2d {
|
|||
void Square::render(GLFWwindow* target) {
|
||||
shader.use();
|
||||
|
||||
// If theres a texture set, tell the fragment shader that and bind to the texture for drawing.
|
||||
shader.set_uniform_matrix_4f("transform", transform_matrix, false);
|
||||
|
||||
// When binding to the texture, also tell the shader if the texture is set or not.
|
||||
if (texture.has_value()) {
|
||||
shader.set_uniform_int("texture_is_set", true, false);
|
||||
texture.value().bind();
|
||||
|
|
Loading…
Reference in New Issue