Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Fill the vertex input layout description
- polygonLayout[0].SemanticName = "POSITION";
- polygonLayout[0].SemanticIndex = 0;
- polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
- polygonLayout[0].InputSlot = 0;
- polygonLayout[0].AlignedByteOffset = 0;
- polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- polygonLayout[0].InstanceDataStepRate = 0;
- polygonLayout[1].SemanticName = "TEXCOORD";
- polygonLayout[1].SemanticIndex = 0;
- polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
- polygonLayout[1].InputSlot = 0;
- polygonLayout[1].AlignedByteOffset = 12;
- polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- polygonLayout[1].InstanceDataStepRate = 0;
- //Get the number of elements in the layout
- numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
- //Create the vertex input layout.
- hresult = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &this->layout);
- if (FAILED(hresult)) {
- MessageBox(*hwnd, L"device->CreateInputLayout", L"Error", MB_OK);
- return false;
- }
- //screen quad for deferred rendering
- //Calculate the screen coordinates of the left side of the window
- left = (float)((screenWidth / 2) * -1);
- //Calculate the screen coordinates of the right side of the window
- right = left + (float)screenWidth;
- //Calculate the screen coordinates of the top of the window
- top = (float)(screenHeight / 2);
- //Calculate the screen coordinates of the bottom of the window
- bottom = top - (float)screenHeight;
- //Load the vertex array with data
- //First triangle
- vertices[0].position = DirectX::XMFLOAT3(left, top, 0.0f); //Top left
- vertices[0].texture = DirectX::XMFLOAT2(0.0f, 0.0f);
- vertices[1].position = DirectX::XMFLOAT3(right, bottom, 0.0f); //Bottom right
- vertices[1].texture = DirectX::XMFLOAT2(1.0f, 1.0f);
- vertices[2].position = DirectX::XMFLOAT3(left, bottom, 0.0f); //Bottom left
- vertices[2].texture = DirectX::XMFLOAT2(0.0f, 1.0f);
- //Second triangle
- vertices[3].position = DirectX::XMFLOAT3(left, top, 0.0f); //Top left
- vertices[3].texture = DirectX::XMFLOAT2(0.0f, 0.0f);
- vertices[4].position = DirectX::XMFLOAT3(right, top, 0.0f); //Top right
- vertices[4].texture = DirectX::XMFLOAT2(1.0f, 0.0f);
- vertices[5].position = DirectX::XMFLOAT3(right, bottom, 0.0f); //Bottom right
- vertices[5].texture = DirectX::XMFLOAT2(1.0f, 1.0f);
Advertisement
Add Comment
Please, Sign In to add comment