2020-05-05 01:51:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "MinimalEngine.h"
|
2020-06-02 11:46:18 +02:00
|
|
|
#include "MaterialAsset.h"
|
2020-05-05 01:51:13 +02:00
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
2020-06-02 11:46:18 +02:00
|
|
|
|
|
|
|
|
class Material : public MaterialAsset
|
2020-05-05 01:51:13 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Material();
|
|
|
|
|
Material(const std::string &directory, const std::string &name);
|
2020-06-08 01:44:47 +02:00
|
|
|
Material(const std::filesystem::path& fullPath);
|
2020-05-05 01:51:13 +02:00
|
|
|
~Material();
|
2020-08-06 00:54:43 +02:00
|
|
|
virtual void save() override;
|
|
|
|
|
virtual void load() override;
|
|
|
|
|
virtual std::string getMaterialName() const { return materialName; }
|
|
|
|
|
inline std::string getCode() const { return materialCode; }
|
2020-08-11 21:23:20 +02:00
|
|
|
|
|
|
|
|
const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const;
|
|
|
|
|
Gfx::ShaderCollection& createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput);
|
2020-05-05 01:51:13 +02:00
|
|
|
private:
|
2020-08-11 21:23:20 +02:00
|
|
|
static Gfx::ShaderMap shaderMap;
|
|
|
|
|
static std::mutex shaderMapLock;
|
|
|
|
|
|
2020-06-02 11:46:18 +02:00
|
|
|
void compile();
|
|
|
|
|
std::string materialName;
|
2020-08-06 00:54:43 +02:00
|
|
|
std::string materialCode;
|
2020-06-02 11:46:18 +02:00
|
|
|
friend class MaterialLoader;
|
2020-05-05 01:51:13 +02:00
|
|
|
};
|
|
|
|
|
DEFINE_REF(Material);
|
|
|
|
|
} // namespace Seele
|