diff --git a/res/textures/blocks/pane.png b/res/textures/blocks/pane.png new file mode 100644 index 00000000..f9e2a5d7 Binary files /dev/null and b/res/textures/blocks/pane.png differ diff --git a/res/textures/blocks/pane_side.png b/res/textures/blocks/pane_side.png new file mode 100644 index 00000000..5d68d745 Binary files /dev/null and b/res/textures/blocks/pane_side.png differ diff --git a/res/textures/blocks/pane_side_2.png b/res/textures/blocks/pane_side_2.png new file mode 100644 index 00000000..dfd6ba27 Binary files /dev/null and b/res/textures/blocks/pane_side_2.png differ diff --git a/src/content/Content.cpp b/src/content/Content.cpp index 4b61b9e0..6184edb7 100644 --- a/src/content/Content.cpp +++ b/src/content/Content.cpp @@ -22,10 +22,12 @@ Content* ContentBuilder::build() { vector blockDefsIndices; for (const string& name : blockIds) { Block* def = blockDefs[name]; - def->id = blockDefsIndices.size(); + + // Generating runtime info + def->rt.id = blockDefsIndices.size(); def->rt.emissive = *((uint32_t*)def->emission); - // build hitbox grid 3d for raycasts + // building hitbox grid 3d for raycasts const AABB& hitbox = def->hitbox; for (uint gy = 0; gy < BLOCK_AABB_GRID; gy++) { for (uint gz = 0; gz < BLOCK_AABB_GRID; gz++) { diff --git a/src/definitions.cpp b/src/definitions.cpp index 7deec6dc..fbdac15d 100644 --- a/src/definitions.cpp +++ b/src/definitions.cpp @@ -106,6 +106,18 @@ void setup_definitions(ContentBuilder* builder) { block = new Block("base:blue_lamp", "blue_lamp"); block->emission[2] = 15; builder->add(block); + + // block added for test + block = new Block("base:pane", "pane"); + block->textureFaces[FACE_MX] = "pane_side"; + block->textureFaces[FACE_PX] = "pane_side"; + block->textureFaces[FACE_MY] = "pane_side_2"; + block->textureFaces[FACE_PY] = "pane_side_2"; + block->model = BlockModel::aabb; + block->hitbox.scale(vec3(1.0f, 1.0f, 0.2f), vec3(0.5f, 0.5f, 0.0f)); + block->lightPassing = true; + block->skyLightPassing = true; + builder->add(block); } void setup_bindings() { diff --git a/src/frontend/gui/GUI.cpp b/src/frontend/gui/GUI.cpp index 5aeda08c..4710b4c4 100644 --- a/src/frontend/gui/GUI.cpp +++ b/src/frontend/gui/GUI.cpp @@ -12,6 +12,8 @@ #include "../../window/input.h" #include "../../window/Camera.h" +using glm::vec2; +using glm::vec3; using std::string; using std::shared_ptr; using namespace gui; diff --git a/src/frontend/gui/controls.cpp b/src/frontend/gui/controls.cpp index b9dba5f9..35f9cc57 100644 --- a/src/frontend/gui/controls.cpp +++ b/src/frontend/gui/controls.cpp @@ -11,6 +11,8 @@ using std::string; using std::wstring; using std::shared_ptr; using glm::vec2; +using glm::vec3; +using glm::vec4; #define KEY_ESCAPE 256 #define KEY_ENTER 257 diff --git a/src/frontend/gui/panels.cpp b/src/frontend/gui/panels.cpp index 87771cd8..6c77eaa3 100644 --- a/src/frontend/gui/panels.cpp +++ b/src/frontend/gui/panels.cpp @@ -171,7 +171,7 @@ void Panel::refresh() { } if (resizing_) { if (maxLength_) - this->size(vec2(size.x, min(maxLength_, (int)(y+padding.w)))); + this->size(vec2(size.x, glm::min(maxLength_, (int)(y+padding.w)))); else this->size(vec2(size.x, y+padding.w)); } @@ -193,7 +193,7 @@ void Panel::refresh() { bool increased = maxh > size.y; if (resizing_) { if (maxLength_) - this->size(vec2(min(maxLength_, (int)(x+padding.z)), size.y)); + this->size(vec2(glm::min(maxLength_, (int)(x+padding.z)), size.y)); else this->size(vec2(x+padding.z, size.y)); } diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index 475177af..0d2bfa07 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -91,11 +91,15 @@ HudRenderer::HudRenderer(Engine* engine, L" visible: "+std::to_wstring(level->chunks->visible); }))); panel->add(shared_ptr