texture loading!

This commit is contained in:
Asuro
2025-03-28 04:28:06 +01:00
parent f56ffdaa13
commit 365805537c
26 changed files with 244 additions and 84 deletions

View File

@@ -27,15 +27,16 @@ namespace Game
struct Texture
{
bgfx::UniformHandle SamplerHandle;
bgfx::TextureHandle Handle;
bgfx::UniformHandle SamplerHandle = {bgfx::kInvalidHandle};
bgfx::TextureHandle RenderHandle = {bgfx::kInvalidHandle};
bgfx::TextureInfo Info;
Generated::TextureHandle TexHandle;
};
struct Model
{
bgfx::VertexBufferHandle VertexBuffer;
bgfx::IndexBufferHandle IndexBuffer;
bgfx::VertexBufferHandle VertexBuffer = {bgfx::kInvalidHandle};
bgfx::IndexBufferHandle IndexBuffer = {bgfx::kInvalidHandle};
bgfx::VertexLayout VertLayout;
Generated::ModelHandle Handle;
};
@@ -52,14 +53,9 @@ namespace Game
bgfx::ProgramHandle Shader;
bgfx::UniformHandle Uniforms[8];
Texture Textures[4];
uint64_t State = 0;
uint32_t ViewID = 0;
static Material LoadFromShader(const char* vertPath,
const char* fragPath,
uint16_t view,
bgfx::TextureHandle = BGFX_INVALID_HANDLE,
bgfx::UniformHandle sampler = BGFX_INVALID_HANDLE);
static Material LoadFromShader(const char* vertPath, const char* fragPath, uint16_t view);
};
enum class UIVisibilityState
@@ -99,6 +95,7 @@ namespace Game
{
public:
static constexpr uint32_t MaxModels = 64;
static constexpr uint32_t MaxTextures = 64;
static GameRendering& Get();
public:
@@ -107,7 +104,7 @@ namespace Game
public:
bgfx::UniformHandle DefaultSampler;
Texture Textures[8];
Texture Textures[MaxTextures];
Material Materials[8];
uint32_t ModelCount = 0;
Model Models[MaxModels];
@@ -125,6 +122,7 @@ namespace Game
void Update();
void HandleEvents();
void RenderDebugUI();
void LoadTextures();
void ReloadShaders();
void Shutdown();
Generated::ModelHandle GetModelHandleFromPath(const char* path);