Commit 02acf859 authored by Romain Pacanowski's avatar Romain Pacanowski

Debuging information cleaned a little bit.

parent b86a5178
......@@ -137,8 +137,8 @@ inline void loadPLY( std::string const & ply_filename,
std::vector<unsigned int> & index_faces )
{
std::cout << " PLY FILENAME = " << ply_filename << std::endl;
std::cout << " BEGINNING of Load Tiny Ply . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
std::cout << "[TRACE] Loadign Ply file: " << ply_filename << std::endl;
std::cout << "[TRACE] BEGINNING of Load Tiny Ply . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
try
{
......@@ -188,9 +188,7 @@ inline void loadPLY( std::string const & ply_filename,
}
catch (const std::exception &e)
{
// FIX ME ! Allow to construct a mesh even without normals... recompute them
std::cout << "No normals per vertex " << std::endl;
// throw std::runtime_error( std::string("Caught tinyply exception NO NORMALS")+e.what() );
std::cout << "[DEBUG] No normals per vertex " << std::endl;
tiny_normals = nullptr;
}
......@@ -221,7 +219,7 @@ inline void loadPLY( std::string const & ply_filename,
}
catch (const std::exception &e)
{
std::cerr << "tinyply exception: " << e.what() << std::endl;
std::cerr << "[DEBUG] tinyply exception: " << e.what() << std::endl;
tiny_color_per_vertex = nullptr;
}
......@@ -229,31 +227,32 @@ inline void loadPLY( std::string const & ply_filename,
read_timer.start();
file.read(ss);
read_timer.stop();
std::cout << "Ply file read in " << read_timer.elapsed() << " seconds " << std::endl;
std::cout << " AFTER read . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
std::cout << "[TRACE] Ply file read in " << read_timer.elapsed() << " seconds " << std::endl;
std::cout << "[TRACE] AFTER read . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
read_timer.reset();
read_timer.start();
if (tiny_vertices)
std::cout << "\tRead vertices:" << tiny_vertices->count << std::endl;
std::cout << "[TRACE] \tRead vertices:" << tiny_vertices->count << std::endl;
if (tiny_color_per_vertex)
std::cout << "\tRead color per verterx:" << tiny_color_per_vertex->count << std::endl;
std::cout << "[TRACE] \tRead color per verterx:" << tiny_color_per_vertex->count << std::endl;
if (tiny_texcoords)
std::cout << "\tRead texcoords:" << tiny_texcoords->count << std::endl;
std::cout << "[TRACE] \tRead texcoords:" << tiny_texcoords->count << std::endl;
if (tiny_faces)
std::cout << "\tRead faces(triangles):" << tiny_faces->count << std::endl;
std::cout << "[TRACE] \tRead faces(triangles):" << tiny_faces->count << std::endl;
std::cout << " Vertices = " << PlyTypeToString( tiny_vertices.get() ) << " Count " << tiny_vertices->count << " " << std::endl;
std::cout << " VEC3 sizeof underlyint type " << VEC3_TYPE::sizeOfT() << std::endl;
std::cout << "[DEBUG] Vertices = " << PlyTypeToString( tiny_vertices.get() ) << " Count " << tiny_vertices->count << " " << std::endl;
std::cout << "[DEBUG] VEC3 sizeof underlyint type " << VEC3_TYPE::sizeOfT() << std::endl;
if( (tiny_vertices->t != tinyply::Type::FLOAT32) && (tiny_vertices->t != tinyply::Type::FLOAT64 ) )
{
std::cerr << " Unsupported Type for vertices. Got " << PlyTypeToString(tiny_vertices.get()) << " Expecting FLOAT32 or FLOAT64" << std::endl;
std::cerr << "[FATAL] Unsupported Type for vertices. Got " << PlyTypeToString(tiny_vertices.get()) << " Expecting FLOAT32 or FLOAT64" << std::endl;
throw std::runtime_error("Unsupported vertex Types for PLY file");
}
......@@ -261,20 +260,19 @@ inline void loadPLY( std::string const & ply_filename,
// Prepare Copy
vertices.resize(tiny_vertices->count);
if (sizeOfPlyType( tiny_vertices.get() ) == VEC3_TYPE::sizeOfT()) // Direct copy
{
const size_t numVerticesBytes = tiny_vertices->buffer.size_bytes();
std::cout << " numVertics BYTES = " << numVerticesBytes << " for " << tiny_vertices->count << " vertices " << std::endl;
std::cout << "[DEBUG] numVertics BYTES = " << numVerticesBytes << " for " << tiny_vertices->count << " vertices " << std::endl;
std::memcpy((void *)vertices.data(), (const void *)tiny_vertices->buffer.get(), (size_t)numVerticesBytes);
}
else
{
std::cout << " Reading Ply. Slow copy " << std::endl;
std::cout << "[DEBUG] Reading Ply. Slow copy " << std::endl;
if (sizeOfPlyType( tiny_vertices.get() ) > VEC3_TYPE::sizeOfT() )
{
std::cout << " Precision of vertices positions will be lost " << std::endl;
std::cout << "[WARN] Precision of vertices positions will be lost " << std::endl;
}
if( tinyply::Type::FLOAT32 == tiny_vertices->t )
......@@ -308,13 +306,6 @@ inline void loadPLY( std::string const & ply_filename,
}
std::cout << " INSIDE LOAD PLY vertices[0] = " << vertices[0] << " " << std::endl;
if (tiny_texcoords)
{
const size_t numUVsBytes = tiny_texcoords->buffer.size_bytes();
......@@ -324,7 +315,7 @@ inline void loadPLY( std::string const & ply_filename,
if (tiny_faces->t != tinyply::Type::UINT32 && tiny_faces->t != tinyply::Type::INT32)
{
std::cerr << " Unsupported PLY index faces type " << ply_filename << std::endl;
std::cerr << "[FATAL] Unsupported PLY index faces type " << ply_filename << std::endl;
throw std::runtime_error("Unsupported PLY index faces type");
}
......@@ -367,17 +358,17 @@ inline void loadPLY( std::string const & ply_filename,
}
read_timer.stop();
std::cout << " Data Copied from PLY structures to vector in " << read_timer.elapsed() << std::endl;
std::cout << "[TRACE] Data Copied from PLY structures to vector in " << read_timer.elapsed() << std::endl;
read_timer.reset();
}
catch (const std::exception &e)
{
std::cerr << "Caught tinyply exception: " << e.what() << std::endl;
std::cerr << "[FATAL] Caught tinyply exception: " << e.what() << std::endl;
throw std::runtime_error("Caught tinyply exception");
}
std::cout << " End of Load Tiny Ply . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
std::cout << "[TRACE] End of Load Tiny Ply . Available Memory " << mrf::util::CPUMemory::availableMemory() << " MB" << std::endl;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment