MCPcopy Create free account
hub / github.com/davidrmiller/biosim4 / saveVideoFrameSync

Method saveVideoFrameSync

src/imageWriter.cpp:169–196  ·  view source on GitHub ↗

Synchronous version, always returns true

Source from the content-addressed store, hash-verified

167
168// Synchronous version, always returns true
169bool ImageWriter::saveVideoFrameSync(unsigned simStep, unsigned generation)
170{
171 // We cache a local copy of data from params, grid, and peeps because
172 // those objects will change by the main thread at the same time our
173 // saveFrameThread() is using it to output a video frame.
174 data.simStep = simStep;
175 data.generation = generation;
176 data.indivLocs.clear();
177 data.indivColors.clear();
178 data.barrierLocs.clear();
179 data.signalLayers.clear();
180 //todo!!!
181 for (uint16_t index = 1; index <= p.population; ++index) {
182 const Indiv &indiv = peeps[index];
183 if (indiv.alive) {
184 data.indivLocs.push_back(indiv.loc);
185 data.indivColors.push_back(makeGeneticColor(indiv.genome));
186 }
187 }
188
189 auto const &barrierLocs = grid.getBarrierLocations();
190 for (Coord loc : barrierLocs) {
191 data.barrierLocs.push_back(loc);
192 }
193
194 saveOneFrameImmed(data);
195 return true;
196}
197
198
199// ToDo: put save_video() in its own thread

Callers 1

endOfSimStepFunction · 0.80

Calls 2

makeGeneticColorFunction · 0.85
saveOneFrameImmedFunction · 0.85

Tested by

no test coverage detected