From 62e0ca3d4f98df84198955c3b9a6f93f24630ba0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 16 Aug 2005 20:26:36 +0000 Subject: [PATCH] fix issues animation 1-transform geometry --- panda/src/dxgsg8/dxGeomMunger8.cxx | 14 +++++--------- panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx | 8 +++++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/panda/src/dxgsg8/dxGeomMunger8.cxx b/panda/src/dxgsg8/dxGeomMunger8.cxx index e87a66bdbd..886e58662f 100644 --- a/panda/src/dxgsg8/dxGeomMunger8.cxx +++ b/panda/src/dxgsg8/dxGeomMunger8.cxx @@ -36,7 +36,8 @@ munge_format_impl(const GeomVertexFormat *orig, if (dxgsg8_cat.is_debug()) { if (animation.get_animation_type() != AT_none) { dxgsg8_cat.debug() - << "preparing animation type " << animation << "\n"; + << "preparing animation type " << animation << " for " << *orig + << "\n"; } } // We have to build a completely new format that includes only the @@ -135,15 +136,10 @@ munge_format_impl(const GeomVertexFormat *orig, } } - if (new_array_format->is_data_subset_of(*orig->get_array(0))) { - // If the new array format we have built is essentially the same - // as the first data array anyway, go ahead and keep the original. - return orig; - } - - // Use the new format; make sure the FVF-style array we just built - // up is first in the list. + // Make sure the FVF-style array we just built up is first in the + // list. new_format->insert_array(0, new_array_format); + return GeomVertexFormat::register_format(new_format); } diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 4cd209421a..32a9fb16a4 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -788,7 +788,13 @@ begin_draw_primitives(const Geom *geom, const GeomMunger *munger, // Set up vertex blending. switch (animation.get_num_transforms()) { case 1: - _d3d_device->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_0WEIGHTS); + // The MSDN docs suggest we should use D3DVBF_0WEIGHTS here, but + // that doesn't seem to work at all. On the other hand, + // D3DVBF_DISABLE *does* work, because it disables special + // handling, meaning only the world matrix affects these + // vertices--and by accident or design, the first matrix, + // D3DTS_WORLDMATRIX(0), *is* the world matrix. + _d3d_device->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE); break; case 2: _d3d_device->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_1WEIGHTS);