2023-01-21 18:43:21 +01:00
|
|
|
#pragma once
|
2023-10-24 15:01:09 +02:00
|
|
|
#include "Material.h"
|
2023-10-26 18:37:29 +02:00
|
|
|
#include "Graphics/Buffer.h"
|
2023-01-21 18:43:21 +01:00
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
2023-10-24 15:01:09 +02:00
|
|
|
class MaterialInstance
|
2023-01-21 18:43:21 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2023-10-26 18:37:29 +02:00
|
|
|
MaterialInstance(uint64 id, Gfx::PGraphics graphics, PMaterial baseMaterial, Gfx::PDescriptorLayout descriptor, Array<PShaderParameter> params, uint32 uniformBinding, uint32 uniformSize);
|
2023-10-24 15:01:09 +02:00
|
|
|
~MaterialInstance();
|
|
|
|
|
void updateDescriptor();
|
|
|
|
|
Gfx::PDescriptorSet getDescriptorSet() const;
|
|
|
|
|
PMaterial getBaseMaterial() const { return baseMaterial; }
|
|
|
|
|
uint64 getId() const { return id; }
|
2023-11-01 13:38:49 +01:00
|
|
|
|
|
|
|
|
void save(ArchiveBuffer& buffer) const;
|
|
|
|
|
void load(ArchiveBuffer& buffer);
|
|
|
|
|
|
2023-01-21 18:43:21 +01:00
|
|
|
private:
|
2023-10-24 15:01:09 +02:00
|
|
|
Gfx::PGraphics graphics;
|
|
|
|
|
Array<uint8> uniformData;
|
|
|
|
|
uint32 uniformBinding;
|
|
|
|
|
Gfx::PUniformBuffer uniformBuffer;
|
|
|
|
|
Array<PShaderParameter> parameters;
|
2023-10-26 18:37:29 +02:00
|
|
|
Gfx::PDescriptorLayout layout;
|
2023-10-24 15:01:09 +02:00
|
|
|
Gfx::PDescriptorSet descriptor;
|
2023-01-21 18:43:21 +01:00
|
|
|
PMaterial baseMaterial;
|
2023-10-24 15:01:09 +02:00
|
|
|
uint64 id;
|
2023-01-21 18:43:21 +01:00
|
|
|
};
|
|
|
|
|
DEFINE_REF(MaterialInstance)
|
|
|
|
|
} // namespace Seele
|