MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / main

Function main

Demos/ClothDemo/main.cpp:39–76  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

37
38// main
39int 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
78void reset()
79{

Callers

nothing calls this directly

Calls 8

setModelMethod · 0.80
buildModelFunction · 0.70
resetFunction · 0.70
initMethod · 0.45
createParameterGUIMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected