2023-01-21 18:43:21 +01:00
|
|
|
#pragma once
|
|
|
|
|
#include "MaterialInterface.h"
|
|
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
|
|
|
|
DECLARE_REF(MaterialInstance)
|
|
|
|
|
class Material : public MaterialInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-02-13 14:56:13 +01:00
|
|
|
Material() {}
|
2023-02-24 22:09:07 +01:00
|
|
|
Material(Gfx::PGraphics graphics,
|
|
|
|
|
Array<PShaderParameter> parameter,
|
|
|
|
|
Gfx::PDescriptorLayout layout,
|
|
|
|
|
uint32 uniformDataSize,
|
|
|
|
|
uint32 uniformBinding,
|
|
|
|
|
std::string materialName,
|
|
|
|
|
Array<PShaderExpression> expressions,
|
|
|
|
|
MaterialNode brdf);
|
2023-01-21 18:43:21 +01:00
|
|
|
virtual ~Material();
|
|
|
|
|
virtual Gfx::PDescriptorSet createDescriptorSet();
|
|
|
|
|
virtual Gfx::PDescriptorLayout getDescriptorLayout() const { return layout; }
|
|
|
|
|
virtual const std::string& getName() { return materialName; }
|
|
|
|
|
|
2023-02-13 14:56:13 +01:00
|
|
|
virtual void save(ArchiveBuffer& buffer) const;
|
|
|
|
|
virtual void load(ArchiveBuffer& buffer);
|
2023-01-21 18:43:21 +01:00
|
|
|
|
2023-02-24 22:09:07 +01:00
|
|
|
void compile();
|
|
|
|
|
|
2023-01-21 18:43:21 +01:00
|
|
|
virtual const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, VertexInputType* vertexInput) const;
|
|
|
|
|
virtual Gfx::ShaderCollection& createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, VertexInputType* vertexInput);
|
|
|
|
|
private:
|
|
|
|
|
static Gfx::ShaderMap shaderMap;
|
|
|
|
|
static std::mutex shaderMapLock;
|
|
|
|
|
|
|
|
|
|
Gfx::PDescriptorLayout layout;
|
|
|
|
|
std::string materialName;
|
2023-02-24 22:09:07 +01:00
|
|
|
Array<PShaderExpression> codeExpressions;
|
|
|
|
|
MaterialNode brdf;
|
2023-01-21 18:43:21 +01:00
|
|
|
// With draw-indirect, we batch vertex data into big vertex buffers
|
|
|
|
|
// Gfx::PVertexDataManager vertexData;
|
|
|
|
|
|
|
|
|
|
friend class MaterialInstance;
|
|
|
|
|
};
|
|
|
|
|
DEFINE_REF(Material)
|
2023-02-13 14:56:13 +01:00
|
|
|
|
2023-01-21 18:43:21 +01:00
|
|
|
} // namespace Seele
|