Merge branch 'MihailRis:main' into main

This commit is contained in:
Astazium 2026-08-18 13:47:28 +03:00 • committed by GitHub
commit a7f50c25f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 177 additions and 55 deletions

View file

@ -55,12 +55,12 @@ model::Model VcmModel::squashed() const {
}
static const std::unordered_map<std::string, int> side_indices {
{"east", 0},
{"west", 1},
{"bottom", 2},
{"top", 3},
{"south", 4},
{"north", 5},
{"west", 0}, // -X
{"east", 1}, // +X
{"bottom", 2}, // -Y
{"top", 3}, // +Y
{"north", 4}, // -Z
{"south", 5}, // +Z
};
static bool to_boolean(const xml::Attribute& attr) {
@ -267,12 +267,12 @@ static void perform_box(const xmlelement& root, ModelBuilder& builder) {
}
UVRegion regions[6] {};
regions[0].scale(to.x - from.x, to.y - from.y);
regions[1].scale(from.x - to.x, to.y - from.y);
regions[0].scale(to.z - from.z, to.y - from.y);
regions[1].scale(from.z - to.z, to.y - from.y);
regions[2].scale(to.x - from.x, to.z - from.z);
regions[3].scale(from.x - to.x, to.z - from.z);
regions[4].scale(to.z - from.z, to.y - from.y);
regions[5].scale(from.z - to.z, to.y - from.y);
regions[4].scale(to.x - from.x, to.y - from.y);
regions[5].scale(from.x - to.x, to.y - from.y);
auto center = (from + to) * 0.5f;
auto halfsize = (to - from) * 0.5f;
@ -306,7 +306,11 @@ static void perform_box(const xmlelement& root, ModelBuilder& builder) {
texfaces[idx] = elem->attr("texture").getText();
}
if (elem->has("region")) {
regions[idx].set(elem->attr("region").asVec4());
auto region = elem->attr("region").asVec4();
if (idx % 2 == 1) {
std::swap(region[0], region[2]);
}
regions[idx].set(region);
}
if (elem->has("region-scale")) {
regions[idx].scale(elem->attr("region-scale").asVec2());

View file

@ -39,16 +39,18 @@ std::unique_ptr<Content> ContentBuilder::build() {
} else {
def.defaults.rt.solid = isSolid(def.defaults) || def.explictlySolid;
}
if (def.material.empty()) {
defaults.at("block-material").get(def.material);
}
def.rt.solid = def.defaults.rt.solid;
const float EPSILON = 0.01f;
def.rt.solid =
def.rt.solid = def.rt.solid &&
def.obstacle &&
(glm::i8vec3(def.hitboxes[0].size() + EPSILON) == def.size);
def.rt.extended = def.size.x > 1 || def.size.y > 1 || def.size.z > 1;
if (def.material.empty()) {
defaults.at("block-material").get(def.material);
}
if (def.rotatable) {
for (uint i = 0; i < BlockRotProfile::MAX_COUNT; i++) {
def.rt.hitboxes[i].reserve(def.hitboxes.size());

View file

@ -48,10 +48,14 @@ void gui::Frame::draw(const DrawContext& pctx, const Assets& assets) {
void gui::Frame::updateOutput(Assets& assets) {
if (fbo && (fbo->getWidth() != size.x || fbo->getHeight() != size.y)) {
fbo->resize(size.x, size.y);
assets.store(fbo->getSharedTexture(), outputTexture);
if (!outputTexture.empty()) {
assets.store(fbo->getSharedTexture(), outputTexture);
}
} else if (fbo == nullptr) {
fbo = std::make_unique<Framebuffer>(size.x, size.y, true);
assets.store(fbo->getSharedTexture(), outputTexture);
if (!outputTexture.empty()) {
assets.store(fbo->getSharedTexture(), outputTexture);
}
}
}

View file

@ -83,12 +83,12 @@ static util::TextureRegion determine_texture_region(
const Assets& assets, const std::string& texture
) {
static std::array<std::string, 6> faces {
"blocks:dbg_east",
"blocks:dbg_west",
"blocks:dbg_east",
"blocks:dbg_bottom",
"blocks:dbg_top",
"blocks:dbg_south",
"blocks:dbg_north",
"blocks:dbg_south",
};
if (texture.length() < 2 || texture.at(0) != '$') {