From e541881492afa81c22759824bda2404e76e8c5f2 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 29 Nov 2003 00:52:41 +0000 Subject: [PATCH] fix texture matrix on dx7 --- panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx index 9f05480133..dc10bde5c4 100644 --- a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx +++ b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx @@ -3856,7 +3856,24 @@ issue_transform(const TransformState *transform) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian7:: issue_tex_matrix(const TexMatrixAttrib *attrib) { - // Not implemented. + const LMatrix4f &m = attrib->get_mat(); + + // This is ugly. Need to make this a simple boolean test instead of + // a matrix compare. + if (m == LMatrix4f::ident_mat()) { + _pScrn->pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, + D3DTTFF_DISABLE); + } else { + // We have to reorder the elements of the matrix for some reason. + LMatrix4f dm(m(0, 0), m(0, 1), m(0, 3), 0.0f, + m(1, 0), m(1, 1), m(1, 3), 0.0f, + m(3, 0), m(3, 1), m(3, 3), 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); + _pScrn->pD3DDevice->SetTransform(D3DTRANSFORMSTATE_TEXTURE0, + (D3DMATRIX *)dm.get_data()); + _pScrn->pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, + D3DTTFF_COUNT2); + } } ////////////////////////////////////////////////////////////////////