Adding nlohmanns json library
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
target_sources(SeeleEngine
|
||||
PRIVATE
|
||||
Material.h
|
||||
Material.cpp
|
||||
MaterialInstance.h
|
||||
MaterialInstance.cpp)
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "Material.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using namespace Seele;
|
||||
using json = nlohmann::json;
|
||||
|
||||
Material::Material()
|
||||
{
|
||||
}
|
||||
|
||||
Material::Material(const std::string& directory, const std::string& name)
|
||||
: FileAsset(directory, name)
|
||||
{
|
||||
}
|
||||
|
||||
Material::Material(const std::string& fullPath)
|
||||
: FileAsset(fullPath)
|
||||
{
|
||||
}
|
||||
|
||||
Material::~Material()
|
||||
{
|
||||
}
|
||||
|
||||
void Material::compile()
|
||||
{
|
||||
auto& stream = getReadStream();
|
||||
stream.seekg(0);
|
||||
json j;
|
||||
stream >> j;
|
||||
std::cout << j["test"] << std::endl;
|
||||
}
|
||||
|
||||
Gfx::PGraphicsPipeline Material::getPipeline()
|
||||
{
|
||||
return pipeline;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "Asset/FileAsset.h"
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
struct FloatExpression
|
||||
{
|
||||
float data;
|
||||
std::string name;
|
||||
uint32 location;
|
||||
};
|
||||
struct VectorExpression
|
||||
{
|
||||
Vector data;
|
||||
std::string name;
|
||||
uint32 location;
|
||||
};
|
||||
struct TextureExpression
|
||||
{
|
||||
Gfx::PTexture texture;
|
||||
std::string name;
|
||||
uint32 location;
|
||||
};
|
||||
DECLARE_NAME_REF(Gfx, GraphicsPipeline);
|
||||
DECLARE_NAME_REF(Gfx, PipelineLayout);
|
||||
class Material : public FileAsset
|
||||
{
|
||||
public:
|
||||
Material();
|
||||
Material(const std::string &directory, const std::string &name);
|
||||
Material(const std::string &fullPath);
|
||||
~Material();
|
||||
void compile();
|
||||
Gfx::PGraphicsPipeline getPipeline();
|
||||
|
||||
private:
|
||||
Gfx::PGraphicsPipeline pipeline;
|
||||
Gfx::PPipelineLayout pipelineLayout;
|
||||
};
|
||||
DEFINE_REF(Material);
|
||||
} // namespace Seele
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "MaterialInstance.h"
|
||||
#include "Material.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
MaterialInstance::MaterialInstance()
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInstance::MaterialInstance(const std::string& directory, const std::string& name)
|
||||
: FileAsset(directory, name)
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInstance::MaterialInstance(const std::string& fullPath)
|
||||
: FileAsset(fullPath)
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInstance::~MaterialInstance()
|
||||
{
|
||||
}
|
||||
|
||||
PMaterial MaterialInstance::getBaseMaterial() const
|
||||
{
|
||||
return baseMaterial;
|
||||
}
|
||||
|
||||
Gfx::PDescriptorSet MaterialInstance::getDescriptor()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "Asset/FileAsset.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_NAME_REF(Gfx, DescriptorSet);
|
||||
DECLARE_REF(Material);
|
||||
class MaterialInstance : public FileAsset
|
||||
{
|
||||
public:
|
||||
MaterialInstance();
|
||||
MaterialInstance(const std::string& directory, const std::string& name);
|
||||
MaterialInstance(const std::string& fullPath);
|
||||
~MaterialInstance();
|
||||
PMaterial getBaseMaterial() const;
|
||||
Gfx::PDescriptorSet getDescriptor();
|
||||
private:
|
||||
PMaterial baseMaterial;
|
||||
};
|
||||
DEFINE_REF(MaterialInstance);
|
||||
} // namespace Seele
|
||||
Reference in New Issue
Block a user