diff --git a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx index 5dcab2a865..252e69fd52 100644 --- a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx +++ b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx @@ -3770,11 +3770,14 @@ void DXGraphicsStateGuardian7:: issue_tex_matrix(const TexMatrixAttrib *attrib) { 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()) { + if (!attrib->has_stage(TextureStage::get_default())) { _pScrn->pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); + // For some reason, "disabling" texture coordinate transforms + // doesn't seem to be sufficient. We'll load an identity matrix + // to underscore the point. + _pScrn->pD3DDevice->SetTransform(D3DTRANSFORMSTATE_TEXTURE0, &matIdentity); + } 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, diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 2639435431..7600ab9e8d 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -3163,11 +3163,14 @@ void DXGraphicsStateGuardian8:: issue_tex_matrix(const TexMatrixAttrib *attrib) { 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()) { + if (!attrib->has_stage(TextureStage::get_default())) { _pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); + // For some reason, "disabling" texture coordinate transforms + // doesn't seem to be sufficient. We'll load an identity matrix + // to underscore the point. + _pD3DDevice->SetTransform(D3DTS_TEXTURE0, &matIdentity); + } 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, diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index d6c04f1b93..9d5f6c7980 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -3151,11 +3151,14 @@ void DXGraphicsStateGuardian9:: issue_tex_matrix(const TexMatrixAttrib *attrib) { 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()) { + if (!attrib->has_stage(TextureStage::get_default())) { _pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); + // For some reason, "disabling" texture coordinate transforms + // doesn't seem to be sufficient. We'll load an identity matrix + // to underscore the point. + _pD3DDevice->SetTransform(D3DTS_TEXTURE0, &matIdentity); + } 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,