I was wondering how my vertex shader is causing my cube to be render weirdly? I am using the Visual Studio graphics tool and see that my input assembler is correctly receiving the cube and I can only guess my issue is within my shader. I did enable device creation flags but nothing related to the issue.
//Constant Buffer Variables
cbuffer constantObjects : register (b0)
{
matrix World;
matrix View;
matrix Projection;
}
// Input Structure
struct VS_INPUT
{
float3 inputPosition : POSITION0;
float4 inputColor: COLOR0;
};
// Output Structure
struct VS_OUTPUT
{
float4 position : SV_POSITION;
float4 color : COLOR;
};
VS_OUTPUT VS(VS_INPUT input)
{
// Create Pixel Shader output
VS_OUTPUT output;
float4 pos = float4(input.inputPosition, 1.0f);
// Multiple to get worldViewProject for object position
output.position = mul(pos, World);
output.position = mul(output.position, View);
output.position = mul(output.position, Projection);
// Simply set color to color;
output.color = input.inputColor;
// Return position and color to PS
return output;
}
// Create World View
worldMatrix = DirectX::XMMatrixIdentity();
// Create view matrix
DirectX::XMVECTOR eyePosition = DirectX::XMVectorSet(0.0f, 1.0f, -5.0f, 0.0f);
DirectX::XMVECTOR targetPosition = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
DirectX::XMVECTOR upDirection = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
// Store View Matrix
viewMatrix = DirectX::XMMatrixLookAtLH(eyePosition, targetPosition, upDirection);
// Create Projection Matrix
projectionMatrix = DirectX::XMMatrixPerspectiveFovLH(DirectX::XM_PIDIV2, (float)getHeight(), 0.01f, 100.0f);
It might be an issue with my world, view, and projection matrix but I don't really understand why that might be the issue. Here is the debug information. As you can see it goes to the input assembler correctly and has an issue with the vertex shader. Any help will be appreciated.