it works??

This commit is contained in:
Asuro
2025-02-11 20:58:50 +01:00
parent 851db78d66
commit bf2371eca0
12 changed files with 33 additions and 18 deletions

View File

@@ -126,6 +126,7 @@ namespace Game
| BGFX_STATE_DEPTH_TEST_LESS
| BGFX_STATE_CULL_CCW
| BGFX_STATE_MSAA;
Materials[0].Uniforms[Material::UniformTimeIdx] = bgfx::createUniform("u_time", bgfx::UniformType::Vec4);
if (!GetInstance().IsInitialized)
{
@@ -179,9 +180,8 @@ namespace Game
bgfx::setViewRect(0, 0, 0, shared.Window.WindowWidth, shared.Window.WindowHeight);
}
// This dummy draw call is here to make sure that view 0 is cleared
// if no other draw calls are submitted to view 0.
bgfx::touch(0);
float TimeValues[4]{0.0f};
TimeValues[0] = GetInstance().Now;
for (int32_t i = 0; i < GetInstance().GameLevel.Cubes.Count; ++i)
{
@@ -195,6 +195,7 @@ namespace Game
bgfx::setVertexBuffer(0, currentModel.VertexBuffer);
bgfx::setIndexBuffer(currentModel.IndexBuffer);
bgfx::setState(currentMaterial.State);
bgfx::setUniform(Materials[0].Uniforms[Material::UniformTimeIdx], TimeValues);
// Submit primitive for rendering to view 0.
bgfx::submit(0, currentMaterial.Shader);

View File

@@ -88,7 +88,9 @@ namespace Game
struct Material
{
static constexpr uint32_t UniformTimeIdx = 0;
bgfx::ProgramHandle Shader;
bgfx::UniformHandle Uniforms[8];
uint64_t State = 0;
};