m_graphicsWorldTrans matrix format - D3D compatible?

steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

m_graphicsWorldTrans matrix format - D3D compatible?

Post by steveh »

Hi,
I'm plugging the rows/columns straight from the m_graphicsWorldTrans
matrix into my D3D matrix. My objetcts appear to rtate in the wrong direction, is there some row/column swapping that I have to do instead of a direct copy?

Many thanks,

Steve.
steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

Post by steveh »

The matrices need munging in order to get them working with D3D. Looks like it's a simple row->columns thing. Here's what I'm using (pDst is used by D3D to render from):

btVector3 v;

v=pSrc->getBasis().getRow(0);
pDst->Row[0].v[0] = v.getX();
pDst->Row[1].v[0] = v.getY();
pDst->Row[2].v[0] = v.getZ();

v=pSrc->getBasis().getRow(1);
pDst->Row[0].v[1] = v.getX();
pDst->Row[1].v[1] = v.getY();
pDst->Row[2].v[1] = v.getZ();

v=pSrc->getBasis().getRow(2);
pDst->Row[0].v[2] = v.getX();
pDst->Row[1].v[2] = v.getY();
pDst->Row[2].v[2] = v.getZ();

v=pSrc->getOrigin();
pDst->Row[3].v[0] = v.getX();
pDst->Row[3].v[1] = v.getY();
pDst->Row[3].v[2] = v.getZ();