fix mesh indexing

This commit is contained in:
Asuro
2025-03-27 16:52:34 +01:00
parent aafa5e966e
commit 24a724a021
5 changed files with 32 additions and 13 deletions

View File

@@ -9,6 +9,7 @@
#include "SDL3/SDL_events.h"
#include "backends/imgui_impl_sdl3.h"
#include "bgfx/defines.h"
#include "bgfx/platform.h"
#include "bx/bx.h"
#include "bx/constants.h"
#include "bx/filepath.h"
@@ -343,7 +344,7 @@ namespace Game
bgfx::Init init;
init.type = bgfx::RendererType::Direct3D12;
#ifdef _DEBUG
// init.debug = true;
init.debug = true;
#endif
init.platformData.nwh = shared.Window.Handle;
init.platformData.ndt = nullptr;
@@ -375,7 +376,7 @@ namespace Game
Textures[0].SamplerHandle = DefaultSampler;
LoadModels(Models, ModelCount);
Materials[0] =
Materials[(uint16_t)EMaterial::Default] =
Material::LoadFromShader("vert", "frag", MainViewID, Textures[0].Handle, Textures[0].SamplerHandle);
imguiCreate();
SetImguiStyle();
@@ -448,7 +449,7 @@ namespace Game
bgfx::ProgramHandle newProgram = bgfx::createProgram(vertexShader, fragmentShader, true);
if (isValid(newProgram))
{
Materials[0].Shader = newProgram;
Materials[(uint16_t)EMaterial::Default].Shader = newProgram;
LastShaderLoadTime = GetInstance().Time.Now;
}
else
@@ -741,6 +742,7 @@ namespace Game
return Models[i].Handle;
}
}
LOG_WARN("Failed to find model for path %s", path);
return {};
}

View File

@@ -88,6 +88,13 @@ namespace Game
ImTextureID PreviewID = 0;
};
enum class EMaterial : uint16_t
{
Default = 0,
UI = 1,
UNDEFINED = UINT16_MAX
};
class GameRendering
{
public: