main
| 37 | |
| 38 | // main |
| 39 | int main( int argc, char **argv ) |
| 40 | { |
| 41 | REPORT_MEMORY_LEAKS |
| 42 | |
| 43 | base = new DemoBase(); |
| 44 | base->init(argc, argv, "Cloth demo"); |
| 45 | |
| 46 | SimulationModel *model = new SimulationModel(); |
| 47 | model->init(); |
| 48 | Simulation::getCurrent()->setModel(model); |
| 49 | |
| 50 | buildModel(); |
| 51 | |
| 52 | base->createParameterGUI(); |
| 53 | |
| 54 | // reset simulation when cloth simulation/bending method has changed |
| 55 | model->setClothSimulationMethodChangedCallback([&]() { reset(); }); |
| 56 | model->setClothBendingMethodChangedCallback([&]() { reset(); }); |
| 57 | |
| 58 | // OpenGL |
| 59 | MiniGL::setClientIdleFunc (timeStep); |
| 60 | MiniGL::addKeyFunc('r', reset); |
| 61 | MiniGL::setClientSceneFunc(render); |
| 62 | MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); |
| 63 | |
| 64 | MiniGL::mainLoop(); |
| 65 | |
| 66 | base->cleanup(); |
| 67 | |
| 68 | Utilities::Timing::printAverageTimes(); |
| 69 | Utilities::Timing::printTimeSums(); |
| 70 | |
| 71 | delete Simulation::getCurrent(); |
| 72 | delete base; |
| 73 | delete model; |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | void reset() |
| 79 | { |
nothing calls this directly
no test coverage detected