Skip to content

Commit

Permalink
clean up codes (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
T-rvw authored Aug 7, 2023
1 parent 247f536 commit 18432ba
Show file tree
Hide file tree
Showing 30 changed files with 342 additions and 707 deletions.
80 changes: 40 additions & 40 deletions examples/ProgressiveMeshToFbx/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@ int main(int argc, char** argv)
return 1;
}

const char* pInputFilePath = argv[1];
const char* pOutputFilePath = argv[2];

using namespace cdtools;
PerformanceProfiler profiler("ProgressiveMesh");

auto pSceneDatabase = std::make_unique<cd::SceneDatabase>();

// Generate a source mesh.
{
cd::VertexFormat vertexFormat;
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);

//cd::Sphere shape(cd::Point(0.0f, 0.0f, 0.0f), 2.0f);
//std::optional<cd::Mesh> optMesh = cd::MeshGenerator::Generate(shape, 20, 20, vertexFormat);
cd::Box shape(cd::Vec3f(-1.0f, -1.0f, -1.0f), cd::Vec3f(1.0f, 1.0f, 1.0f));
std::optional<cd::Mesh> optMesh = cd::MeshGenerator::Generate(shape, vertexFormat);
assert(optMesh.has_value());
cd::Mesh& mesh = optMesh.value();
mesh.SetID(cd::MeshID(0U));
pSceneDatabase->SetMeshCount(1U);
pSceneDatabase->AddMesh(MoveTemp(mesh));

Processor processor(nullptr, nullptr, pSceneDatabase.get());
processor.SetDumpSceneDatabaseEnable(false);
processor.SetCalculateConnetivityDataEnable(true);
processor.Run();
}

// Generate a progressive target mesh.
{
ProgressiveMeshProducer producer("");
FbxConsumer consumer(pOutputFilePath);
Processor processor(&producer, &consumer, pSceneDatabase.get());
processor.Run();
}
//const char* pInputFilePath = argv[1];
//const char* pOutputFilePath = argv[2];
//
//using namespace cdtools;
//PerformanceProfiler profiler("ProgressiveMesh");
//
//auto pSceneDatabase = std::make_unique<cd::SceneDatabase>();
//
//// Generate a source mesh.
//{
// cd::VertexFormat vertexFormat;
// vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
// vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
// vertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
// vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
// vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
//
// //cd::Sphere shape(cd::Point(0.0f, 0.0f, 0.0f), 2.0f);
// //std::optional<cd::Mesh> optMesh = cd::MeshGenerator::Generate(shape, 20, 20, vertexFormat);
// cd::Box shape(cd::Vec3f(-1.0f, -1.0f, -1.0f), cd::Vec3f(1.0f, 1.0f, 1.0f));
// std::optional<cd::Mesh> optMesh = cd::MeshGenerator::Generate(shape, vertexFormat);
// assert(optMesh.has_value());
// cd::Mesh& mesh = optMesh.value();
// mesh.SetID(cd::MeshID(0U));
// pSceneDatabase->SetMeshCount(1U);
// pSceneDatabase->AddMesh(MoveTemp(mesh));
//
// Processor processor(nullptr, nullptr, pSceneDatabase.get());
// processor.SetDumpSceneDatabaseEnable(false);
// processor.SetCalculateConnetivityDataEnable(true);
// processor.Run();
//}
//
//// Generate a progressive target mesh.
//{
// ProgressiveMeshProducer producer("");
// FbxConsumer consumer(pOutputFilePath);
// Processor processor(&producer, &consumer, pSceneDatabase.get());
// processor.Run();
//}

return 0;
}
Loading

0 comments on commit 18432ba

Please sign in to comment.