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

Method getScene

Source/Falcor/Scene/SceneBuilder.cpp:326–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324 }
325
326 ref<Scene> SceneBuilder::getScene()
327 {
328 if (mpScene) return mpScene;
329
330 // Finish loading textures. This blocks until all textures are loaded and assigned.
331 mpMaterialTextureLoader.reset();
332
333 // If no meshes were added, we create a dummy mesh to keep the scene generation working.
334 // Scenes with no meshes can be useful for example when using volumes in isolation.
335 if (mMeshes.empty())
336 {
337 logWarning("Scene contains no meshes. Creating a dummy mesh.");
338 // Add a dummy (degenerate) mesh.
339 auto dummyMesh = TriangleMesh::createDummy();
340 auto dummyMaterial = StandardMaterial::create(mpDevice, "Dummy");
341 auto meshID = addTriangleMesh(dummyMesh, dummyMaterial);
342 Node dummyNode = { "Dummy", float4x4::identity(), float4x4::identity() };
343 NodeID nodeID = addNode(dummyNode);
344 addMeshInstance(nodeID, meshID);
345 }
346
347 // Post-process the scene data.
348 TimeReport timeReport;
349
350 // Prepare displacement maps. This either removes them (if requested in build flags)
351 // or makes sure that normal maps are removed if displacement is in use.
352 prepareDisplacementMaps();
353
354 prepareSceneGraph();
355 prepareMeshes();
356 removeUnusedMeshes();
357 flattenStaticMeshInstances();
358 pretransformStaticMeshes();
359 unifyTriangleWinding();
360 optimizeSceneGraph();
361 calculateMeshBoundingBoxes();
362 createMeshGroups();
363 optimizeGeometry();
364 sortMeshes();
365 createGlobalBuffers();
366 createCurveGlobalBuffers();
367 collectVolumeGrids();
368 removeDuplicateSDFGrids();
369
370 timeReport.measure("Post processing geometry");
371
372 optimizeMaterials();
373 removeDuplicateMaterials();
374 quantizeTexCoords();
375
376 timeReport.measure("Optimizing materials");
377
378 // Prepare scene resources.
379 createSceneGraph();
380 createMeshData();
381 createMeshBoundingBoxes();
382 createCurveData();
383 calculateCurveBoundingBoxes();

Callers 1

createMethod · 0.45

Calls 8

addNodeFunction · 0.85
createSceneGraphFunction · 0.85
measureMethod · 0.80
printToLogMethod · 0.80
logWarningFunction · 0.50
createFunction · 0.50
resetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected