Temporary commit to investigate build error
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
#include "Material.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Graphics/VertexShaderInput.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <sstream>
|
||||
|
||||
Gfx::ShaderMap Material::shaderMap;
|
||||
std::mutex Material::shaderMapLock;
|
||||
|
||||
using namespace Seele;
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -102,4 +106,20 @@ void Material::compile()
|
||||
|
||||
codeStream << "}};" << std::endl;
|
||||
materialCode = codeStream.str();
|
||||
}
|
||||
}
|
||||
|
||||
const Gfx::ShaderCollection* Material::getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const
|
||||
{
|
||||
Gfx::ShaderPermutation permutation;
|
||||
std::string materialName = getMaterialName();
|
||||
std::string vertexInputName = vertexInput->getName();
|
||||
std::memcpy(permutation.materialName, materialName.c_str(), sizeof(permutation.materialName));
|
||||
std::memcpy(permutation.materialName, vertexInputName.c_str(), sizeof(permutation.materialName));
|
||||
return shaderMap.findShaders(Gfx::PermutationId(permutation));
|
||||
}
|
||||
|
||||
Gfx::ShaderCollection& Material::createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput)
|
||||
{
|
||||
std::lock_guard lock(shaderMapLock);
|
||||
return shaderMap.createShaders(graphics, renderPass, this, vertexInput, false);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,13 @@ public:
|
||||
virtual void load() override;
|
||||
virtual std::string getMaterialName() const { return materialName; }
|
||||
inline std::string getCode() const { return materialCode; }
|
||||
|
||||
const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const;
|
||||
Gfx::ShaderCollection& createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput);
|
||||
private:
|
||||
static Gfx::ShaderMap shaderMap;
|
||||
static std::mutex shaderMapLock;
|
||||
|
||||
void compile();
|
||||
std::string materialName;
|
||||
std::string materialCode;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "MaterialAsset.h"
|
||||
#include "Graphics/VertexShaderInput.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
Gfx::ShaderMap MaterialAsset::shaderMap;
|
||||
|
||||
MaterialAsset::MaterialAsset()
|
||||
{
|
||||
}
|
||||
@@ -22,18 +19,3 @@ MaterialAsset::MaterialAsset(const std::filesystem::path& fullPath)
|
||||
MaterialAsset::~MaterialAsset()
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::ShaderCollection* MaterialAsset::getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const
|
||||
{
|
||||
Gfx::ShaderPermutation permutation;
|
||||
std::string materialName = getMaterialName();
|
||||
std::string vertexInputName = vertexInput->getName();
|
||||
std::memcpy(permutation.materialName, materialName.c_str(), sizeof(permutation.materialName));
|
||||
std::memcpy(permutation.materialName, vertexInputName.c_str(), sizeof(permutation.materialName));
|
||||
return shaderMap.findShaders(Gfx::PermutationId(permutation));
|
||||
}
|
||||
|
||||
Gfx::ShaderCollection& MaterialAsset::createShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput)
|
||||
{
|
||||
return Gfx::ShaderCollection();
|
||||
}
|
||||
|
||||
@@ -19,13 +19,9 @@ public:
|
||||
Gfx::SeBlendOp getBlendMode() const {return Gfx::SE_BLEND_OP_END_RANGE;}
|
||||
Gfx::MaterialShadingModel getShadingModel() const {return Gfx::MaterialShadingModel::DefaultLit;}
|
||||
|
||||
const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const;
|
||||
Gfx::ShaderCollection& createShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput);
|
||||
|
||||
protected:
|
||||
//For now its simply the collection of parameters, since there is no point for expressions
|
||||
Array<PShaderParameter> parameters;
|
||||
static Gfx::ShaderMap shaderMap;
|
||||
};
|
||||
DEFINE_REF(MaterialAsset);
|
||||
} // namespace Seele
|
||||
|
||||
Reference in New Issue
Block a user