MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / loadValuesFromFile

Method loadValuesFromFile

Source/Falcor/Scene/SDFs/SDFGrid.cpp:271–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 }
270
271 bool SDFGrid::loadValuesFromFile(const std::filesystem::path& path)
272 {
273 std::ifstream file(path, std::ios::in | std::ios::binary);
274
275 if (file.is_open())
276 {
277 uint32_t gridWidth;
278 file.read(reinterpret_cast<char*>(&gridWidth), sizeof(uint32_t));
279
280 uint32_t totalValueCount = (gridWidth + 1) * (gridWidth + 1) * (gridWidth + 1);
281 std::vector<float> cornerValues(totalValueCount, 0.0f);
282 file.read(reinterpret_cast<char*>(cornerValues.data()), totalValueCount * sizeof(float));
283
284 file.close();
285 setValues(cornerValues, gridWidth);
286
287 mInitializedWithPrimitives = false;
288 return true;
289 }
290
291 logWarning("SDFGrid::loadValuesFromFile() file '{}' could not be opened!", path);
292 return false;
293 }
294
295 void SDFGrid::generateCheeseValues(uint32_t gridWidth, uint32_t seed)
296 {

Callers 1

FALCOR_SCRIPT_BINDINGFunction · 0.80

Calls 5

is_openMethod · 0.80
logWarningFunction · 0.50
readMethod · 0.45
dataMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected