I would like to use a matrix stack to keep track of transforms in a hierarchical model. Only bummer is, it appears that there is no built-in matrix stack class I can use to do this. The Direct3D templates simply keep track of a model, view, and projection matrix and then passes those to the vertex shader.
Renderer making the constant buffer:
CD3D11_BUFFER_DESC constantBufferDesc(sizeof(ModelViewProjectionConstantBuffer), D3D11_BIND_CONSTANT_BUFFER);
DX::ThrowIfFailed(
m_d3dDevice->CreateBuffer(
&constantBufferDesc,
nullptr,
&m_constantBuffer)
);
Vertex Shader transforming each vertex:
cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
matrix model;
matrix view;
matrix projection;
};
...
// Transform the vertex position into projected space.
pos = mul(pos, model);
pos = mul(pos, view);
pos = mul(pos, projection);
output.pos = pos;
...
I have spent some time looking for a built in matrix stack class so that I wouldn't have to reinvent the wheel, but the only promising lead I got, the ID3DXMatrixStack, doesn't appear to be accessible in a WP8 Direct3D app.
So am I missing something or do I need to write my own?