| 78 | } |
| 79 | |
| 80 | void MSAAFilter::Initialize() |
| 81 | { |
| 82 | App::Initialize(); |
| 83 | |
| 84 | ID3D11DevicePtr device = deviceManager.Device(); |
| 85 | ID3D11DeviceContextPtr deviceContext = deviceManager.ImmediateContext(); |
| 86 | |
| 87 | // Create a font + SpriteRenderer |
| 88 | font.Initialize(L"Arial", 18, SpriteFont::Regular, true, device); |
| 89 | spriteRenderer.Initialize(device); |
| 90 | |
| 91 | // Camera setup |
| 92 | camera.SetPosition(Float3(0.0f, 2.5f, -10.0f)); |
| 93 | |
| 94 | // Load the scenes |
| 95 | for(uint64 i = 0; i < uint64(Scenes::NumValues); ++i) |
| 96 | { |
| 97 | if(i == uint64(Scenes::Plane)) |
| 98 | models[i].GeneratePlaneScene(device, Float2(10.0f, 10.0f), Float3(), Quaternion(), |
| 99 | L"", L"Bricks_NML.dds"); |
| 100 | else |
| 101 | models[i].CreateFromMeshData(device, ModelPaths[i].c_str()); |
| 102 | } |
| 103 | |
| 104 | modelOrientations[uint64(Scenes::RoboHand)] = Quaternion(0.41f, -0.55f, -0.29f, 0.67f); |
| 105 | AppSettings::ModelOrientation.SetValue(modelOrientations[AppSettings::CurrentScene]); |
| 106 | |
| 107 | meshRenderer.Initialize(device, deviceManager.ImmediateContext()); |
| 108 | meshRenderer.SetModel(&models[AppSettings::CurrentScene]); |
| 109 | skybox.Initialize(device); |
| 110 | |
| 111 | envMap = LoadTexture(device, L"..\\Content\\EnvMaps\\Ennis.dds"); |
| 112 | |
| 113 | FileReadSerializer serializer(L"..\\Content\\EnvMaps\\Ennis.shdata"); |
| 114 | SerializeItem(serializer, envMapSH); |
| 115 | |
| 116 | // Load shaders |
| 117 | for(uint32 msaaMode = 0; msaaMode < uint32(MSAAModes::NumValues); ++msaaMode) |
| 118 | { |
| 119 | CompileOptions opts; |
| 120 | opts.Add("MSAASamples_", AppSettings::NumMSAASamples(MSAAModes(msaaMode))); |
| 121 | resolvePS[msaaMode] = CompilePSFromFile(device, L"Resolve.hlsl", "ResolvePS", "ps_5_0", opts); |
| 122 | } |
| 123 | |
| 124 | resolveVS = CompileVSFromFile(device, L"Resolve.hlsl", "ResolveVS"); |
| 125 | |
| 126 | backgroundVelocityVS = CompileVSFromFile(device, L"BackgroundVelocity.hlsl", "BackgroundVelocityVS"); |
| 127 | backgroundVelocityPS = CompilePSFromFile(device, L"BackgroundVelocity.hlsl", "BackgroundVelocityPS"); |
| 128 | |
| 129 | resolveConstants.Initialize(device); |
| 130 | backgroundVelocityConstants.Initialize(device); |
| 131 | |
| 132 | // Init the post processor |
| 133 | postProcessor.Initialize(device); |
| 134 | } |
| 135 | |
| 136 | // Creates all required render targets |
| 137 | void MSAAFilter::CreateRenderTargets() |
no test coverage detected