Merge branch 'ground_effects_editor' of gitlab.com:T1ti/noggit-red into ground_effects_editor

This commit is contained in:
Felfired
2024-04-04 02:10:09 +03:00
4 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
#include <noggit/application/NoggitApplication.hpp> #include <noggit/application/NoggitApplication.hpp>
#include <noggit/project/ApplicationProject.h> #include <noggit/project/ApplicationProject.h>
#include <noggit/Log.h>
namespace Noggit::Application namespace Noggit::Application
{ {

View File

@@ -9,6 +9,7 @@
#include <QString> #include <QString>
#include <chrono> #include <chrono>
#include <QJsonArray> #include <QJsonArray>
#include <noggit/Log.h>
namespace Noggit::Project namespace Noggit::Project
{ {

View File

@@ -51,6 +51,10 @@ void LiquidRender::draw(math::frustum const& frustum
} }
else else
{ {
// In some cases samplers_upload_buf becomes empty and causes crash
if (samplers_upload_buf.size() < N_SAMPLERS)
samplers_upload_buf.resize(N_SAMPLERS);
std::fill(samplers_upload_buf.begin(), samplers_upload_buf.end(), -1); std::fill(samplers_upload_buf.begin(), samplers_upload_buf.end(), -1);
for (std::size_t j = 0; j < render_layer.texture_samplers.size(); ++j) for (std::size_t j = 0; j < render_layer.texture_samplers.size(); ++j)

View File

@@ -338,9 +338,13 @@ void WMOGroupRender::initRenderBatches()
std::size_t batch_counter = 0; std::size_t batch_counter = 0;
for (auto& batch : _wmo_group->_batches) for (auto& batch : _wmo_group->_batches)
{ {
for (std::size_t i = 0; i < (batch.vertex_end - batch.vertex_start + 1); ++i) // some custom models have bugged batch.vertex_end as 0, avoid crash
if (batch.vertex_end >= batch.vertex_start)
{ {
_render_batch_mapping[batch.vertex_start + i] = static_cast<unsigned>(batch_counter + 1); for (std::size_t i = 0; i < (batch.vertex_end - batch.vertex_start + 1); ++i)
{
_render_batch_mapping[batch.vertex_start + i] = static_cast<unsigned>(batch_counter + 1);
}
} }
std::uint32_t flags = 0; std::uint32_t flags = 0;