These are snippets of my code:
My Shader file:
cbuffer ConstantBuffer
{
float4x4 final;
float4x4 rotation; // the rotation matrix
float4 lightvec; // the light's vector
float4 lightcol; // the light's color
float4 ambientcol; // the ambient light's color
float mp;
}
Here I just defined my constant buffer in my hlsl file.
Declaration in c++:
struct CBUFFER
{
public:D3DXMATRIX Final;
public:D3DXMATRIX Rotation;
public:D3DXVECTOR4 LightVector;
public:D3DXCOLOR LightColor;
public:D3DXCOLOR AmbientColor;
public:float MP;
};
Then later on:
cBuffer.Final = UmatRotate * UmatPosition * UmatScaling * matView * matProjection;
cBuffer.Rotation = UmatRotate;
cBuffer.MP = 2.0f;
And:
devcon->UpdateSubresource(pCBuffer, 0, 0, &cBuffer, 0, 0);
And also some other code, but which is irrelevant.
So all the values other than the mp works, the mp in my shader is not given a value, and I would like to ask why? What did I do wrong?
Best Regards
Miguel Petersen