Syntax changes, removed rotation in usd file format
This commit is contained in:
@@ -29,31 +29,41 @@ map_Kd texture.png
|
||||
|
||||
if (materialName.size() != 0)
|
||||
{
|
||||
objContent << "mtllib material.mtl\n";
|
||||
objContent << "usemtl " << materialName << "\n";
|
||||
std::string_view content = "mtllib material.mtl\n";
|
||||
objContent.write(content.data(), content.size());
|
||||
|
||||
content = "usemtl ";
|
||||
objContent.write(content.data(), content.size());
|
||||
|
||||
objContent.write(materialName.data(), materialName.size());
|
||||
objContent.write("\n", 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < geometry->vertexCount; ++i)
|
||||
{
|
||||
const auto& v = geometry->vertices[i];
|
||||
objContent << fmt::format("v {} {} {}\n", v.position.x, v.position.y, v.position.z);
|
||||
const std::string content = fmt::format("v {} {} {}\n", v.position.x, v.position.y, v.position.z);
|
||||
objContent.write(content.data(), content.size());
|
||||
}
|
||||
for (int i = 0; i < geometry->vertexCount; ++i)
|
||||
{
|
||||
const auto& v = geometry->vertices[i];
|
||||
objContent << fmt::format("vn {} {} {}\n", v.normal.x, v.normal.y, v.normal.z);
|
||||
const std::string content = fmt::format("vn {} {} {}\n", v.normal.x, v.normal.y, v.normal.z);
|
||||
objContent.write(content.data(), content.size());
|
||||
}
|
||||
for (int i = 0; i < geometry->vertexCount; ++i)
|
||||
{
|
||||
const auto& v = geometry->vertices[i];
|
||||
objContent << fmt::format("vt {} {}\n", v.textureCoordinates.x, v.textureCoordinates.y);
|
||||
const std::string content = fmt::format("vt {} {}\n", v.textureCoordinates.x, v.textureCoordinates.y);
|
||||
objContent.write(content.data(), content.size());
|
||||
}
|
||||
for (int i = 0; i < geometry->indexCount; i += 3)
|
||||
{
|
||||
uint32_t i0 = geometry->GetIndex(i + 0) + 1;
|
||||
uint32_t i1 = geometry->GetIndex(i + 1) + 1;
|
||||
uint32_t i2 = geometry->GetIndex(i + 2) + 1;
|
||||
objContent << fmt::format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n", i0, i1, i2);
|
||||
const std::string content = fmt::format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n", i0, i1, i2);
|
||||
objContent.write(content.data(), content.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user