Progress i guess

This commit is contained in:
Dynamitos
2023-11-08 23:27:21 +01:00
parent ecb5050dc7
commit 19c3e559b1
49 changed files with 268 additions and 361 deletions
+2 -2
View File
@@ -47,9 +47,9 @@ void AssetImporter::importMaterial(MaterialImportArgs args)
get().materialLoader->importAsset(args);
}
void AssetImporter::init(Gfx::PGraphics graphics, AssetRegistry* registry)
void AssetImporter::init(Gfx::PGraphics graphics)
{
get().registry = registry;
get().registry = AssetRegistry::getInstance();
get().meshLoader = new MeshLoader(graphics);
get().textureLoader = new TextureLoader(graphics);
get().materialLoader = new MaterialLoader(graphics);
+1 -1
View File
@@ -15,7 +15,7 @@ public:
static void importTexture(struct TextureImportArgs args);
static void importFont(struct FontImportArgs args);
static void importMaterial(struct MaterialImportArgs args);
static void init(Gfx::PGraphics graphics, AssetRegistry* registry);
static void init(Gfx::PGraphics graphics);
private:
static AssetImporter& get();
UPTextureLoader textureLoader;
-1
View File
@@ -47,7 +47,6 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
Gfx::ODescriptorLayout layout = graphics->createDescriptorLayout(materialName + "Layout");
//Shader file needs to conform to the slang standard, which prohibits _
materialName.erase(std::remove(materialName.begin(), materialName.end(), '_'), materialName.end());
materialName.erase(std::remove(materialName.begin(), materialName.end(), '.'), materialName.end());
uint32 uniformBufferOffset = 0;
uint32 bindingCounter = 0; // Uniform buffers are always binding 0
+4 -2
View File
@@ -48,7 +48,9 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
{
aiMaterial* material = scene->mMaterials[i];
json matCode;
matCode["name"] = baseName + material->GetName().C_Str();
std::string materialName = std::format("{0}{1}", baseName, material->GetName().C_Str());
materialName.erase(std::remove(materialName.begin(), materialName.end(), '.'), materialName.end()); // dots break adding the .asset extension later
matCode["name"] = materialName;
matCode["profile"] = "BlinnPhong"; //TODO: other shading models
aiString texPath;
//TODO make samplers based on used textures
@@ -58,7 +60,7 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
};
if(material->GetTexture(aiTextureType_DIFFUSE, 0, &texPath) == AI_SUCCESS)
{
std::string texFilename = std::filesystem::path(texPath.C_Str()).replace_extension("asset").stem().string();
std::string texFilename = std::filesystem::path(texPath.C_Str()).stem().string();
matCode["params"]["diffuseTexture"] =
{
{"type", "Texture2D"},
+1 -3
View File
@@ -17,8 +17,6 @@
using namespace Seele;
using namespace Seele::Editor;
extern AssetRegistry* instance;
int main()
{
#ifdef WIN32
@@ -41,7 +39,7 @@ int main()
vd->init(graphics);
PWindowManager windowManager = new WindowManager();
AssetRegistry::init(sourcePath / "Assets", graphics);
AssetImporter::init(graphics, AssetRegistry::getInstance());
AssetImporter::init(graphics);
AssetImporter::importFont(FontImportArgs{
.filePath = "./fonts/Calibri.ttf",
});