fix crashes and build bugs

This commit is contained in:
T1ti
2024-03-31 01:44:29 +01:00
parent e10a138939
commit e56b8aa214
5 changed files with 13 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
#include <math/ray.hpp>
#include <noggit/Selection.h>
#include <noggit/ContextObject.hpp>
#include <noggit/MapHeaders.h>
#include <cstdint>
#include <unordered_set>
#include <array>

View File

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

View File

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

View File

@@ -51,6 +51,10 @@ void LiquidRender::draw(math::frustum const& frustum
}
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);
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;
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;