hud refactor (part II)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <glm/ext.hpp>
|
||||
|
||||
#include "../assets/Assets.h"
|
||||
#include "../graphics/Viewport.h"
|
||||
#include "../graphics/Shader.h"
|
||||
#include "../graphics/Texture.h"
|
||||
@@ -11,10 +12,10 @@
|
||||
#include "../voxels/Block.h"
|
||||
#include "ContentGfxCache.h"
|
||||
|
||||
BlocksPreview::BlocksPreview(Shader* shader,
|
||||
Atlas* atlas,
|
||||
const ContentGfxCache* cache)
|
||||
: shader(shader), atlas(atlas), cache(cache) {
|
||||
BlocksPreview::BlocksPreview(Assets* assets, const ContentGfxCache* cache)
|
||||
: shader(assets->getShader("ui3d")),
|
||||
atlas(assets->getAtlas("blocks")),
|
||||
cache(cache) {
|
||||
batch = std::make_unique<Batch3D>(1024);
|
||||
}
|
||||
|
||||
@@ -37,9 +38,8 @@ void BlocksPreview::draw(const Block* def, int x, int y, int size, glm::vec4 tin
|
||||
uint width = viewport->getWidth();
|
||||
uint height = viewport->getHeight();
|
||||
|
||||
y = height - y - 1;
|
||||
y = height - y - 1 - 35 /* magic garbage */;
|
||||
x += 2;
|
||||
y -= 35;
|
||||
|
||||
glm::vec3 offset (x/float(width) * 2, y/float(height) * 2, 0.0f);
|
||||
shader->uniformMatrix("u_apply", glm::translate(glm::mat4(1.0f), offset));
|
||||
|
||||
Reference in New Issue
Block a user