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

Method finalize

Source/Falcor/Scene/Scene.cpp:1230–1289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1228 }
1229
1230 void Scene::finalize()
1231 {
1232 RenderContext* pRenderContext = mpDevice->getRenderContext();
1233
1234 // Perform setup that affects the scene defines.
1235 initSDFGrids();
1236 mHitInfo.init(*this, mUseCompressedHitInfo);
1237 updateGeometryTypes();
1238
1239 // Prepare the materials.
1240 // This sets up defines and materials parameter block, which are needed for creating the scene parameter block.
1241 updateMaterials(true);
1242
1243 // Prepare scene defines.
1244 // These are currently assumed not to change beyond this point.
1245 // The defines are needed by the functions below for setting up the scene parameter block.
1246 updateSceneDefines();
1247 mPrevSceneDefines = mSceneDefines;
1248
1249 // Prepare and upload resources.
1250 // The order of these calls is important as there are dependencies between them.
1251 // First we bind current data to the Scene block to be able to perform the updates below.
1252 // Last we bind the final updated data after all initialization is complete.
1253 createParameterBlock(); // Requires scene defines
1254 bindParameterBlock(); // Bind current data.
1255
1256 mpAnimationController->animate(pRenderContext, 0); // Requires Scene block to exist
1257 updateGeometry(pRenderContext, true); // Requires scene defines
1258 updateGeometryInstances(true);
1259
1260 updateBounds();
1261 createDrawList();
1262 if (mCameras.size() == 0)
1263 {
1264 // Create a new camera to use in the event of a scene with no cameras
1265 mCameras.push_back(Camera::create());
1266 resetCamera();
1267 }
1268 setCameraController(mCamCtrlType);
1269 initializeCameras();
1270 addViewpoint();
1271 updateLights(true);
1272 updateGridVolumes(true);
1273 updateEnvMap(true);
1274 uploadGeometry();
1275 bindParameterBlock(); // Bind final data after initialization is complete.
1276
1277 // Update stats and UI data.
1278 updateGeometryStats();
1279 updateMaterialStats();
1280 updateLightStats();
1281 updateGridVolumeStats();
1282 prepareUI();
1283
1284 // Validate assumption that scene defines didn't change.
1285 updateSceneDefines();
1286 FALCOR_CHECK(mSceneDefines == mPrevSceneDefines, "Scene defines changed unexpectedly");
1287

Callers 2

computeSceneCacheKeyFunction · 0.45
CPU_TESTFunction · 0.45

Calls 5

createFunction · 0.50
initMethod · 0.45
animateMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by 1

CPU_TESTFunction · 0.36