Possible fix for levels without statics

This commit is contained in:
MontyTRC89 2022-05-28 05:54:28 +02:00
parent f2b003bd57
commit 45d61b5ba9
2 changed files with 12 additions and 3 deletions

View file

@ -30,7 +30,7 @@ test = Level.new();
test.nameKey = "level_andrea1";
test.scriptFile = "Scripts\\andrea1.lua";
test.ambientTrack = "108_A8_Coastal";
test.levelFile = "Data\\andrea1.ten";
test.levelFile = "Data\\luatest.ten";
test.loadScreenFile = "Screens\\rome.jpg";
test.weather = 1;
test.weatherStrength = 1;

View file

@ -679,9 +679,18 @@ namespace TEN::Renderer
m_staticObjects[StaticObjectsIds[i]] = staticObject;
}
m_staticsVertexBuffer = VertexBuffer(m_device.Get(), staticsVertices.size(), staticsVertices.data());
m_staticsIndexBuffer = IndexBuffer(m_device.Get(), staticsIndices.size(), staticsIndices.data());
if (staticsVertices.size() > 0)
{
m_staticsVertexBuffer = VertexBuffer(m_device.Get(), staticsVertices.size(), staticsVertices.data());
m_staticsIndexBuffer = IndexBuffer(m_device.Get(), staticsIndices.size(), staticsIndices.data());
}
else
{
m_staticsVertexBuffer = VertexBuffer(m_device.Get(), 1);
m_staticsIndexBuffer = IndexBuffer(m_device.Get(), 1);
}
// Step 5: prepare sprites
m_sprites.resize(g_Level.Sprites.size());