|
8 | 8 | #include "Demos/Simulation/TimeStepController.h" |
9 | 9 | #include <iostream> |
10 | 10 | #include "Demos/Visualization/Visualization.h" |
11 | | -#include "Demos/Utils/Utilities.h" |
12 | 11 | #include "Demos/Simulation/DistanceFieldCollisionDetection.h" |
13 | 12 | #include "Demos/Utils/OBJLoader.h" |
| 13 | +#include "Demos/Utils/Logger.h" |
14 | 14 | #include "Demos/Utils/Timing.h" |
| 15 | +#include "Demos/Utils/FileSystem.h" |
15 | 16 |
|
16 | 17 | // Enable memory leak detection |
17 | 18 | #if defined(_DEBUG) && !defined(EIGEN_ALIGN) |
18 | 19 | #define new DEBUG_NEW |
19 | 20 | #endif |
20 | 21 |
|
| 22 | +INIT_TIMING |
| 23 | +INIT_LOGGING |
| 24 | + |
21 | 25 | using namespace PBD; |
22 | 26 | using namespace Eigen; |
23 | 27 | using namespace std; |
@@ -78,7 +82,12 @@ int main( int argc, char **argv ) |
78 | 82 | { |
79 | 83 | REPORT_MEMORY_LEAKS |
80 | 84 |
|
81 | | - exePath = Utilities::getFilePath(argv[0]); |
| 85 | + std::string logPath = FileSystem::normalizePath(FileSystem::getProgramPath() + "/log"); |
| 86 | + FileSystem::makeDirs(logPath); |
| 87 | + logger.addSink(unique_ptr<ConsoleSink>(new ConsoleSink(LogLevel::INFO))); |
| 88 | + logger.addSink(unique_ptr<FileSink>(new FileSink(LogLevel::DEBUG, logPath + "/PBD.log"))); |
| 89 | + |
| 90 | + exePath = FileSystem::getProgramPath(); |
82 | 91 | dataPath = exePath + "/" + std::string(PBD_DATA_PATH); |
83 | 92 |
|
84 | 93 | // OpenGL |
@@ -210,12 +219,12 @@ void buildModel () |
210 | 219 | createMesh(); |
211 | 220 |
|
212 | 221 | // create static rigid body |
213 | | - string fileName = Utilities::normalizePath(dataPath + "/models/cube.obj"); |
| 222 | + string fileName = FileSystem::normalizePath(dataPath + "/models/cube.obj"); |
214 | 223 | IndexedFaceMesh mesh; |
215 | 224 | VertexData vd; |
216 | 225 | OBJLoader::loadObj(fileName, vd, mesh); |
217 | 226 |
|
218 | | - string fileNameTorus = Utilities::normalizePath(dataPath + "/models/torus.obj"); |
| 227 | + string fileNameTorus = FileSystem::normalizePath(dataPath + "/models/torus.obj"); |
219 | 228 | IndexedFaceMesh meshTorus; |
220 | 229 | VertexData vdTorus; |
221 | 230 | OBJLoader::loadObj(fileNameTorus, vdTorus, meshTorus); |
@@ -480,8 +489,8 @@ void createMesh() |
480 | 489 | model.getTetModels()[cm]->updateMeshNormals(pd); |
481 | 490 | } |
482 | 491 |
|
483 | | - std::cout << "Number of tets: " << indices.size() / 4 << "\n"; |
484 | | - std::cout << "Number of vertices: " << width*height*depth << "\n"; |
| 492 | + LOG_INFO << "Number of tets: " << indices.size() / 4; |
| 493 | + LOG_INFO << "Number of vertices: " << width*height*depth; |
485 | 494 |
|
486 | 495 | } |
487 | 496 |
|
|
0 commit comments