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

Method readSceneData

Source/Falcor/Scene/SceneCache.cpp:407–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405 }
406
407 Scene::SceneData SceneCache::readSceneData(InputStream& stream, ref<Device> pDevice)
408 {
409 Scene::SceneData sceneData;
410 sceneData.pMaterials = std::make_unique<MaterialSystem>(pDevice);
411
412 readMarker(stream, "Paths");
413 sceneData.importPaths.resize(stream.read<uint32_t>());
414 for (auto& pPath : sceneData.importPaths) stream.read(pPath);
415
416 readMarker(stream, "Dicts");
417 sceneData.importDicts.resize(stream.read<uint32_t>());
418 for (auto& pDict : sceneData.importDicts) stream.read(pDict);
419
420 readMarker(stream, "RenderSettings");
421 stream.read(sceneData.renderSettings);
422
423 readMarker(stream, "Cameras");
424 sceneData.cameras.resize(stream.read<uint32_t>());
425 for (auto& pCamera : sceneData.cameras) pCamera = readCamera(stream);
426 stream.read(sceneData.selectedCamera);
427 stream.read(sceneData.cameraSpeed);
428
429 readMarker(stream, "Lights");
430 sceneData.lights.resize(stream.read<uint32_t>());
431 for (auto& pLight : sceneData.lights) pLight = readLight(stream);
432
433 readMarker(stream, "Grids");
434 sceneData.grids.resize(stream.read<uint32_t>());
435 for (auto& pGrid : sceneData.grids) pGrid = readGrid(stream, pDevice);
436
437 readMarker(stream, "GridVolumes");
438 sceneData.gridVolumes.resize(stream.read<uint32_t>());
439 for (auto& pGridVolume : sceneData.gridVolumes) pGridVolume = readGridVolume(stream, sceneData.grids, pDevice);
440
441 readMarker(stream, "EnvMap");
442 auto hasEnvMap = stream.read<bool>();
443 if (hasEnvMap) sceneData.pEnvMap = readEnvMap(stream, pDevice);
444
445 // Material textures are loaded asynchronously to allow loading other data
446 // in parallel while loading textures from files and uploading them to the GPU.
447 // Due to the current implementation, we need to make sure no other GPU operations (transfers)
448 // are executed while loading material textures. Due to this, we load volume grids and the envmap
449 // before material textures, as they upload buffers to the GPU when created.
450 // Make sure no other GPU operations are executed until calling pMaterialTextureLoader.reset()
451 // further down which blocks until all textures are loaded.
452 auto pMaterialTextureLoader = std::make_unique<MaterialTextureLoader>(sceneData.pMaterials->getTextureManager(), true);
453
454 readMarker(stream, "Materials");
455 readMaterials(stream, *sceneData.pMaterials, *pMaterialTextureLoader, pDevice);
456
457 readMarker(stream, "SceneGraph");
458 sceneData.sceneGraph.resize(stream.read<uint32_t>());
459 for (auto &node : sceneData.sceneGraph)
460 {
461 stream.read(node.name);
462 stream.read(node.parent);
463 stream.read(node.transform);
464 stream.read(node.meshBind);

Callers

nothing calls this directly

Calls 3

resizeMethod · 0.45
readMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected