Hardcoded material name, capitalized constants
This commit is contained in:
@@ -42,18 +42,15 @@ namespace OpenVulkano::Scene
|
||||
{
|
||||
OpenVulkano::ArchiveWriter zipWriter(zipPath.c_str());
|
||||
|
||||
const char* materialName = "Material0";
|
||||
{
|
||||
std::stringstream objContents;
|
||||
WriteObjContents(geometry, materialName, objContents);
|
||||
WriteObjContents(geometry, DEFAULT_OBJ_MATERIAL_NAME, objContents);
|
||||
auto objContentsStr = objContents.str();
|
||||
auto objDesc = OpenVulkano::FileDescription::MakeDescriptionForFile("model.obj", objContentsStr.size());
|
||||
zipWriter.AddFile(objDesc, objContentsStr.data());
|
||||
}
|
||||
{
|
||||
std::stringstream mtlContents;
|
||||
mtlContents << "newmtl " << materialName << "\n" << ObjMaterialContents;
|
||||
auto mtlContentsStr = mtlContents.str();
|
||||
auto mtlContentsStr = DEFAULT_OBJ_MATERIAL_CONTENTS;
|
||||
auto mtlDesc = OpenVulkano::FileDescription::MakeDescriptionForFile("material.mtl", mtlContentsStr.size());
|
||||
zipWriter.AddFile(mtlDesc, mtlContentsStr.data());
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
static constexpr std::string_view ObjMaterialContents = R"(
|
||||
static constexpr std::string_view DEFAULT_OBJ_MATERIAL_NAME = "Material0";
|
||||
static constexpr std::string_view DEFAULT_OBJ_MATERIAL_CONTENTS = R"(newmtl Material0
|
||||
Ka 1.000 1.000 1.000
|
||||
Kd 1.000 1.000 1.000
|
||||
Ks 0.000 0.000 0.000
|
||||
@@ -22,7 +23,7 @@ map_Ka texture.png
|
||||
map_Kd texture.png
|
||||
)";
|
||||
|
||||
void WriteObjContents(Geometry* geometry, const std::string& materialName, std::ostream& objContent)
|
||||
void WriteObjContents(Geometry* geometry, const std::string_view& materialName, std::ostream& objContent)
|
||||
{
|
||||
objContent << "# OBJ file generated by OpenVulkanoCpp\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user