Merge branch 'main' into animation

This commit is contained in:
MihailRis 2026-09-06 20:11:24 +03:00
commit eca7eeadee
7 changed files with 39 additions and 19 deletions

View file

@ -192,7 +192,12 @@ static void perform_rect(const xmlelement& root, ModelBuilder& builder) {
}
std::string texture = root.attr("texture", "$0").getText();
auto normal = glm::cross(glm::normalize(right), glm::normalize(up));
glm::vec3 normal;
if (root.has("normal")) {
normal = root.attr("normal").asVec3();
} else {
normal = glm::cross(glm::normalize(right), glm::normalize(up));
}
builder.addRect(
texture,
shading,
@ -218,7 +223,12 @@ static void perform_triangle(const xmlelement& root, ModelBuilder& builder) {
glm::vec3 ba = pointB - pointA;
glm::vec3 ca = pointC - pointA;
glm::vec3 normal = glm::normalize(glm::cross(ba, ca));
glm::vec3 normal;
if (root.has("normal")) {
normal = root.attr("normal").asVec3();
} else {
normal = glm::normalize(glm::cross(ba, ca));
}
if (root.has("uv")) {
root.attr("uv").asNumbers(glm::value_ptr(uvs[0]), 6);

View file

@ -144,6 +144,7 @@ void BlockWrapsRenderer::draw(const DrawContext& pctx) {
auto& shader = assets.require<Shader>("entity");
shader.use();
shader.uniform1i("u_alphaClip", false);
shader.uniform1i("u_dithering", 0);
for (const auto& [_, wrapper] : wrappers) {
if (wrapper->dirtySides) {
@ -198,4 +199,4 @@ void BlockWrapsRenderer::clearOrder(const BlockWrapper* const wrapper) {
++it;
}
}
}
}

View file

@ -244,6 +244,7 @@ void WorldRenderer::renderOpaque(
}
entityShader.uniform1i("u_alphaClip", true);
entityShader.uniform1i("u_dithering", 1);
entityShader.uniform1f("u_opacity", 1.0f);
level.entities->render(
assets,
@ -512,6 +513,7 @@ void WorldRenderer::renderWeatherEffects(Camera& camera) {
float one = weather->fall.maxOpacity;
float t = (weather->intensity * (one - zero)) * maxIntensity + zero;
entityShader.uniform1i("u_alphaClip", weather->fall.opaque);
entityShader.uniform1i("u_dithering", 0);
entityShader.uniform1f(
"u_opacity", weather->fall.opaque ? t * t : t
);