MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / Initialize

Method Initialize

BakingLab/BakingLab.cpp:401–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401void BakingLab::Initialize()
402{
403 App::Initialize();
404
405 ID3D11DevicePtr device = deviceManager.Device();
406 ID3D11DeviceContextPtr deviceContext = deviceManager.ImmediateContext();
407
408 // Uncomment this line to re-generate the lookup textures for the SH specular BRDF
409 // GenerateSHSpecularLookupTextures(device);
410
411 // Create a font + SpriteRenderer
412 font.Initialize(L"Arial", 18, SpriteFont::Regular, true, device);
413 spriteRenderer.Initialize(device);
414
415 // Load the scenes
416 for(uint64 i = 0; i < uint64(Scenes::NumValues); ++i)
417 {
418 if(GetFileExtension(ScenePaths[i]) == L"meshdata")
419 sceneModels[i].CreateFromMeshData(device, ScenePaths[i], true);
420 else
421 sceneModels[i].CreateWithAssimp(device, ScenePaths[i], true);
422 }
423
424 Model& currentModel = sceneModels[AppSettings::CurrentScene.Value()];
425 meshRenderer.Initialize(device, deviceManager.ImmediateContext(), &currentModel);
426
427 camera.SetPosition(Float3(0.0f, 2.5f, -15.0f));
428
429 skybox.Initialize(device);
430
431 for(uint64 i = 0; i < AppSettings::NumCubeMaps; ++i)
432 envMaps[i] = LoadTexture(device, AppSettings::CubeMapPaths(i));
433
434 // Load shaders
435 for(uint32 msaaMode = 0; msaaMode < uint32(MSAAModes::NumValues); ++msaaMode)
436 {
437 CompileOptions opts;
438 opts.Add("MSAASamples_", AppSettings::NumMSAASamples(MSAAModes(msaaMode)));
439 resolvePS[msaaMode] = CompilePSFromFile(device, L"Resolve.hlsl", "ResolvePS", "ps_5_0", opts);
440 }
441
442 resolveVS = CompileVSFromFile(device, L"Resolve.hlsl", "ResolveVS");
443
444 backgroundVelocityVS = CompileVSFromFile(device, L"BackgroundVelocity.hlsl", "BackgroundVelocityVS");
445 backgroundVelocityPS = CompilePSFromFile(device, L"BackgroundVelocity.hlsl", "BackgroundVelocityPS");
446
447 resolveConstants.Initialize(device);
448 backgroundVelocityConstants.Initialize(device);
449
450 // Init the post processor
451 postProcessor.Initialize(device);
452
453 BakeInputData bakeInput;
454 bakeInput.SceneModel = &currentModel;
455 bakeInput.Device = device;
456 for(uint64 i = 0; i < AppSettings::NumCubeMaps; ++i)
457 bakeInput.EnvMaps[i] = envMaps[i];
458 meshBaker.Initialize(bakeInput);

Callers 1

CreateRenderTargetsMethod · 0.45

Calls 15

InitializeFunction · 0.85
GetFileExtensionFunction · 0.85
Float3Class · 0.85
LoadTextureFunction · 0.85
CubeMapPathsFunction · 0.85
NumMSAASamplesFunction · 0.85
CompilePSFromFileFunction · 0.85
CompileVSFromFileFunction · 0.85
UpdateHorizontalCoordsFunction · 0.85
DeviceMethod · 0.80
ImmediateContextMethod · 0.80
CreateFromMeshDataMethod · 0.80

Tested by

no test coverage detected