diff --git a/tools/modelcompiler/src/modeleditor.cpp b/tools/modelcompiler/src/modeleditor.cpp index 4a0152a..bfceade 100755 --- a/tools/modelcompiler/src/modeleditor.cpp +++ b/tools/modelcompiler/src/modeleditor.cpp @@ -410,19 +410,22 @@ void ModelEditor::compile_model() { if(infile.good()) continue; - nlohmann::json j; - - j["version"] = 1; + Material mat; aiColor4D color; aiGetMaterialColor(sc->mMaterials[i], AI_MATKEY_COLOR_DIFFUSE,&color); - j["baseColor"] = prism::float3(color.r, color.g, color.b); - j["metallic"] = 0.0f; - j["roughness"] = 0.5f; + mat.colorProperty.type = DataType::Vector3; + mat.colorProperty.value = prism::float3(color.r, color.g, color.b); - std::ofstream out(path); - out << j; + aiString diffuse_path; + if(aiReturn_SUCCESS == aiGetMaterialTexture(sc->mMaterials[i], aiTextureType_DIFFUSE, 0, &diffuse_path)) { + mat.colorProperty.type = DataType::AssetTexture; + mat.colorProperty.value_tex.handle = new Texture(); + mat.colorProperty.value_tex->path = diffuse_path.C_Str(); + } + + save_material(&mat, path); } }