Replaced NULL with nullptr for pointers in sample SimpleTexturedDirectx11.

pull/3131/head
Marc-Antoine Lortie 2020-04-04 15:37:50 -04:00
parent 085212e58a
commit 105b2bdeaf
2 changed files with 20 additions and 20 deletions

View File

@ -22,7 +22,7 @@ bool ModelLoader::Load(HWND hwnd, ID3D11Device * dev, ID3D11DeviceContext * devc
aiProcess_Triangulate | aiProcess_Triangulate |
aiProcess_ConvertToLeftHanded); aiProcess_ConvertToLeftHanded);
if (pScene == NULL) if (pScene == nullptr)
return false; return false;
this->directory_ = filename.substr(0, filename.find_last_of("/\\")); this->directory_ = filename.substr(0, filename.find_last_of("/\\"));

View File

@ -126,7 +126,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
int argc; int argc;
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if (!argv) { if (!argv) {
MessageBox(NULL, MessageBox(nullptr,
TEXT("An error occured while reading command line arguments."), TEXT("An error occured while reading command line arguments."),
TEXT("Error!"), TEXT("Error!"),
MB_ICONERROR | MB_OK); MB_ICONERROR | MB_OK);
@ -143,7 +143,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
// Ensure that a model file has been specified. // Ensure that a model file has been specified.
if (argc < 2) { if (argc < 2) {
MessageBox(NULL, MessageBox(nullptr,
TEXT("No model file specified. The program will now close."), TEXT("No model file specified. The program will now close."),
TEXT("Error!"), TEXT("Error!"),
MB_ICONERROR | MB_OK); MB_ICONERROR | MB_OK);
@ -165,16 +165,16 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = hInstance; wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = NULL; wc.hbrBackground = nullptr;
wc.lpszMenuName = NULL; wc.lpszMenuName = nullptr;
wc.lpszClassName = g_szClassName; wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wc.hIconSm = LoadIcon(nullptr, IDI_APPLICATION);
if (!RegisterClassEx(&wc)) if (!RegisterClassEx(&wc))
{ {
MessageBox(NULL, "Window Registration Failed!", "Error!", MessageBox(nullptr, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK); MB_ICONEXCLAMATION | MB_OK);
return 0; return 0;
} }
@ -188,12 +188,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
" Simple Textured Directx11 Sample ", " Simple Textured Directx11 Sample ",
WS_OVERLAPPEDWINDOW, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top,
NULL, NULL, hInstance, NULL nullptr, nullptr, hInstance, nullptr
); );
if (g_hwnd == NULL) if (g_hwnd == nullptr)
{ {
MessageBox(NULL, "Window Creation Failed!", "Error!", MessageBox(nullptr, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK); MB_ICONEXCLAMATION | MB_OK);
return 0; return 0;
} }
@ -210,7 +210,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
while (true) while (true)
{ {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
@ -372,7 +372,7 @@ void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd)
ID3D11Texture2D *pBackBuffer; ID3D11Texture2D *pBackBuffer;
swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer); dev->CreateRenderTargetView(pBackBuffer, nullptr, &backbuffer);
pBackBuffer->Release(); pBackBuffer->Release();
D3D11_TEXTURE2D_DESC descDepth; D3D11_TEXTURE2D_DESC descDepth;
@ -440,7 +440,7 @@ void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd)
void CleanD3D(void) void CleanD3D(void)
{ {
if (swapchain) if (swapchain)
swapchain->SetFullscreenState(FALSE, NULL); swapchain->SetFullscreenState(FALSE, nullptr);
if (ourModel) { if (ourModel) {
ourModel->Close(); ourModel->Close();
@ -513,8 +513,8 @@ void InitPipeline()
if(FAILED(CompileShaderFromFile(SHADER_PATH PIXEL_SHADER_FILE, 0, "main", "ps_4_0", &PS))) if(FAILED(CompileShaderFromFile(SHADER_PATH PIXEL_SHADER_FILE, 0, "main", "ps_4_0", &PS)))
Throwanerror(UTFConverter(L"Failed to compile shader from file " PIXEL_SHADER_FILE).c_str()); Throwanerror(UTFConverter(L"Failed to compile shader from file " PIXEL_SHADER_FILE).c_str());
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), nullptr, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS); dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), nullptr, &pPS);
D3D11_INPUT_ELEMENT_DESC ied[] = D3D11_INPUT_ELEMENT_DESC ied[] =
{ {
@ -576,16 +576,16 @@ HRESULT CompileShaderFromFile(LPCWSTR pFileName, const D3D_SHADER_MACRO* pDefine
compileFlags |= D3DCOMPILE_DEBUG; compileFlags |= D3DCOMPILE_DEBUG;
#endif #endif
ID3DBlob* pErrorBlob = NULL; ID3DBlob* pErrorBlob = nullptr;
HRESULT result = D3DCompileFromFile(pFileName, pDefines, D3D_COMPILE_STANDARD_FILE_INCLUDE, pEntryPoint, pShaderModel, compileFlags, 0, ppBytecodeBlob, &pErrorBlob); HRESULT result = D3DCompileFromFile(pFileName, pDefines, D3D_COMPILE_STANDARD_FILE_INCLUDE, pEntryPoint, pShaderModel, compileFlags, 0, ppBytecodeBlob, &pErrorBlob);
if (FAILED(result)) if (FAILED(result))
{ {
if (pErrorBlob != NULL) if (pErrorBlob != nullptr)
OutputDebugStringA((LPCSTR)pErrorBlob->GetBufferPointer()); OutputDebugStringA((LPCSTR)pErrorBlob->GetBufferPointer());
} }
if (pErrorBlob != NULL) if (pErrorBlob != nullptr)
pErrorBlob->Release(); pErrorBlob->Release();
return result; return result;