Fixing slang compilation temporarily, renaming vertexfactory

This commit is contained in:
Dynamitos
2020-08-06 00:54:43 +02:00
parent ab4a3b5e23
commit f27859a02c
66 changed files with 1005 additions and 627 deletions
+11
View File
@@ -24,6 +24,16 @@ Material::~Material()
{
}
void Material::save()
{
}
void Material::load()
{
}
void Material::compile()
{
@@ -91,4 +101,5 @@ void Material::compile()
}
codeStream << "}};" << std::endl;
materialCode = codeStream.str();
}
+5 -2
View File
@@ -12,11 +12,14 @@ public:
Material(const std::string &directory, const std::string &name);
Material(const std::filesystem::path& fullPath);
~Material();
inline std::string getMaterialName() const {return materialName;}
virtual void save() override;
virtual void load() override;
virtual std::string getMaterialName() const { return materialName; }
inline std::string getCode() const { return materialCode; }
private:
void compile();
std::string materialName;
Array<std::string> materialCode;
std::string materialCode;
friend class MaterialLoader;
};
DEFINE_REF(Material);
+18
View File
@@ -1,7 +1,10 @@
#include "MaterialAsset.h"
#include "Graphics/VertexShaderInput.h"
using namespace Seele;
Gfx::ShaderMap MaterialAsset::shaderMap;
MaterialAsset::MaterialAsset()
{
}
@@ -19,3 +22,18 @@ 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();
}
+12
View File
@@ -1,9 +1,11 @@
#pragma once
#include "Asset/Asset.h"
#include "Graphics/GraphicsResources.h"
#include "ShaderExpression.h"
namespace Seele
{
DECLARE_REF(VertexShaderInput);
class MaterialAsset : public Asset
{
public:
@@ -11,9 +13,19 @@ public:
MaterialAsset(const std::string &directory, const std::string &name);
MaterialAsset(const std::filesystem::path &fullPath);
~MaterialAsset();
virtual void save() = 0;
virtual void load() = 0;
virtual std::string getMaterialName() const = 0;
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
+17 -7
View File
@@ -8,17 +8,12 @@ MaterialInstance::MaterialInstance()
}
MaterialInstance::MaterialInstance(const std::string& directory, const std::string& name)
: Asset(directory, name)
: MaterialAsset(directory, name)
{
}
MaterialInstance::MaterialInstance(const std::string& fullPath)
: Asset(fullPath)
{
}
MaterialInstance::MaterialInstance(const std::filesystem::path& fullPath)
: Asset(fullPath)
: MaterialAsset(fullPath)
{
}
@@ -26,6 +21,21 @@ MaterialInstance::~MaterialInstance()
{
}
void MaterialInstance::save()
{
}
void MaterialInstance::load()
{
}
inline std::string MaterialInstance::getMaterialName() const
{
return baseMaterial->getMaterialName();
}
PMaterial MaterialInstance::getBaseMaterial() const
{
return baseMaterial;
+5 -3
View File
@@ -1,18 +1,20 @@
#pragma once
#include "Asset/Asset.h"
#include "MaterialAsset.h"
namespace Seele
{
DECLARE_NAME_REF(Gfx, DescriptorSet);
DECLARE_REF(Material);
class MaterialInstance : public Asset
class MaterialInstance : public MaterialAsset
{
public:
MaterialInstance();
MaterialInstance(const std::string& directory, const std::string& name);
MaterialInstance(const std::string& fullPath);
MaterialInstance(const std::filesystem::path& fullPath);
~MaterialInstance();
virtual void save() override;
virtual void load() override;
inline std::string getMaterialName() const;
PMaterial getBaseMaterial() const;
Gfx::PDescriptorSet getDescriptor();
private: