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

Function main

Demos/FluidDemo/main.cpp:67–120  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

65
66// main
67int main( int argc, char **argv )
68{
69 REPORT_MEMORY_LEAKS
70
71 base = new DemoBase();
72 base->init(argc, argv, "Fluid demo");
73
74 // we use an own time step controller
75 delete PBD::Simulation::getCurrent()->getTimeStep();
76 PBD::Simulation::getCurrent()->setTimeStep(nullptr);
77
78 MiniGL::setSelectionFunc(selection, nullptr);
79 MiniGL::setClientIdleFunc(timeStep);
80 MiniGL::addKeyFunc('r', reset);
81 MiniGL::setClientSceneFunc(render);
82 MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (0.0, 3.0, 8.0), Vector3r (0.0, 0.0, 0.0));
83
84 buildModel();
85
86 base->createParameterGUI();
87
88 // add additional parameter just for this demo
89 imguiParameters::imguiEnumParameter* eparam = new imguiParameters::imguiEnumParameter();
90 eparam->description = "Velocity update method";
91 eparam->label = "Velocity update method";
92 eparam->getFct = [&]() -> int { return simulation.getVelocityUpdateMethod(); };
93 eparam->setFct = [&](int i) -> void { simulation.setVelocityUpdateMethod(i); };
94 eparam->items.push_back("First Order Update");
95 eparam->items.push_back("Second Order Update");
96 imguiParameters::addParam("Simulation", "PBD", eparam);
97
98 imguiParameters::imguiNumericParameter<Real>* param = new imguiParameters::imguiNumericParameter<Real>();
99 param->description = "Viscosity coefficient";
100 param->label = "Viscosity";
101 param->getFct = [&]() -> Real { return model.getViscosity(); };
102 param->setFct = [&](Real v) -> void { model.setViscosity(v); };
103 imguiParameters::addParam("Simulation", "PBD", param);
104
105 MiniGL::getOpenGLVersion(context_major_version, context_minor_version);
106 if (context_major_version >= 3)
107 createSphereBuffers((Real)particleRadius, 8);
108
109 MiniGL::mainLoop();
110
111 cleanup ();
112 base->cleanup();
113
114 Utilities::Timing::printAverageTimes();
115 Utilities::Timing::printTimeSums();
116 delete base;
117 delete Simulation::getCurrent();
118
119 return 0;
120}
121
122void cleanup()
123{

Callers

nothing calls this directly

Calls 13

createSphereBuffersFunction · 0.85
cleanupFunction · 0.85
getTimeStepMethod · 0.80
setTimeStepMethod · 0.80
getViscosityMethod · 0.80
setViscosityMethod · 0.80
buildModelFunction · 0.70
initMethod · 0.45
createParameterGUIMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected