Skip to content
Snippets Groups Projects
Commit 97171b7b authored by BATON Theau's avatar BATON Theau
Browse files

Refactoring code

parent bd4dfe88
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 43 deletions
assets/textures/Cube_Red2.png

282 B

assets/textures/Cube_Sepia.png

282 B

assets/textures/Cube_Test.png

359 B

assets/textures/Cube_Void.png

307 B

assets/textures/Cube_White.png

282 B

assets/textures/Cube_Yellow.png

282 B

assets/textures/Image_Test.png

1.36 KiB

assets/textures/Neera.png

8.11 KiB

assets/textures/Tile_Test.png

460 B

assets/textures/Tile_Test_2.png

2.03 KiB

assets/textures/Tile_Test_3.png

604 B

assets/textures/Tile_Test_4.png

246 B

assets/textures/letters.png

1 KiB

assets/tilemap.png

4.87 KiB

#pragma once
#include "front/engine/Engine.hpp"
#include "front/engine/FrameBufferMerger.hpp"
#include "front/engine/Layer.hpp"
#include "front/engine/Renderer.hpp"
#include "front/engine/TextureArray.hpp"
#include "front/geometry/Quads.hpp"
#include "front/geometry/Plane.hpp"
#include "front/module/Quad_Module.hpp"
#include "front/object/Image.hpp"
#include "front/object/Sprite.hpp"
#include "front/object/TileArray.hpp"
\ No newline at end of file
...@@ -23,10 +23,6 @@ namespace megu { ...@@ -23,10 +23,6 @@ namespace megu {
return this->_layers[layer_priority].get()->push<T>(object_priority, object, modul); return this->_layers[layer_priority].get()->push<T>(object_priority, object, modul);
} }
/*void push(Priority layer_priority, Priority object_priority, Renderable & renderable) {
this->_layers[layer_priority].get()->push(object_priority, renderable);
}*/
void remove(Priority); void remove(Priority);
void remove(const Identifiable &); void remove(const Identifiable &);
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
#include "Image_Module.hpp" #include "Image_Module.hpp"
#include "Sprite_Module.hpp" #include "Sprite_Module.hpp"
#include "Text_Module.hpp"
#include "TileArray_Module.hpp" #include "TileArray_Module.hpp"
namespace megu { namespace megu {
class Quad_Module : public Image_Module, public Sprite_Module, public Text_Module, public TileArray_Module { class Quad_Module : public Image_Module, public Sprite_Module, public TileArray_Module {
// ... // ...
}; };
} }
\ No newline at end of file
...@@ -38,7 +38,7 @@ namespace megu { ...@@ -38,7 +38,7 @@ namespace megu {
std::vector<std::reference_wrapper<const Texture>>::iterator it = std::find(textures.begin(), textures.end(), image.get().texture()); std::vector<std::reference_wrapper<const Texture>>::iterator it = std::find(textures.begin(), textures.end(), image.get().texture());
if(it != textures.end()) { if(it != textures.end()) {
uModels.push_back(image.get().transformation().model()); uModels.push_back(image.get().transformation().model());
uFrames.push_back(image.get().frame()); uFrames.push_back(image.get().getFrame());
uSizes.push_back({it->get().width(), it->get().height()}); uSizes.push_back({it->get().width(), it->get().height()});
uTextures.push_back(static_cast<GLint>(it - textures.begin())); uTextures.push_back(static_cast<GLint>(it - textures.begin()));
...@@ -63,7 +63,7 @@ namespace megu { ...@@ -63,7 +63,7 @@ namespace megu {
uTextures.push_back(static_cast<GLint>(textures.size()-1)); uTextures.push_back(static_cast<GLint>(textures.size()-1));
uModels.push_back(image.get().transformation().model()); uModels.push_back(image.get().transformation().model());
uFrames.push_back(image.get().frame()); uFrames.push_back(image.get().getFrame());
uSizes.push_back({image.get().texture().width(), image.get().texture().height()}); uSizes.push_back({image.get().texture().width(), image.get().texture().height()});
} }
} }
......
#include "Text_Module.hpp"
#include <engine/graphics/back/cameras/Camera.hpp>
#include <engine/utility/array_generator.hpp>
namespace megu {
Text_Module::Text_Module()
: _vbo(this->_vao, Text::Layout(), Text::Vertices(), EditMode::STATIC) {
Source vert_source("assets/shaders/Text.vert", Source::Categorie::VERTEX);
this->_program << vert_source;
Source frag_source("assets/shaders/Text.frag", Source::Categorie::FRAGMENT);
this->_program << frag_source;
this->_program.link();
vert_source.release();
frag_source.release();
}
void Text_Module::draw(const Text & text, const Camera & camera, const Window &) const {
this->_vao.bind();
this->_program.use();
text.texture().bind();
this->_program.setUniform("uSampler", 0);
glm::vec4 glyphFrame = text['w'];
this->_program.setUniform("uSize", glm::vec2{text.texture().width(), text.texture().height()});
this->_program.setUniform("uGlyphFrame", glyphFrame);
glDrawArrays(Quads::Primitive(), 0, static_cast<GLsizei>(this->_vbo.size()));
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment