diff --git a/panda/src/display/standardMunger.cxx b/panda/src/display/standardMunger.cxx index 9ce9c8ca11..6f62c68bef 100644 --- a/panda/src/display/standardMunger.cxx +++ b/panda/src/display/standardMunger.cxx @@ -96,8 +96,8 @@ munge_data_impl(const qpGeomVertexData *data) { if (palette != (TransformBlendPalette *)NULL && palette->get_max_simultaneous_transforms() <= _gsg->get_max_vertex_transforms()) { - if (palette->get_num_transforms() <= - _gsg->get_max_vertex_transform_indices()) { + if (matrix_palette && + palette->get_num_transforms() <= _gsg->get_max_vertex_transform_indices()) { if (palette->get_num_transforms() == palette->get_max_simultaneous_transforms()) { // We can support an indexed palette, but since that won't diff --git a/panda/src/dxgsg8/dxGeomMunger8.cxx b/panda/src/dxgsg8/dxGeomMunger8.cxx index ddfe110b91..aa56e54217 100644 --- a/panda/src/dxgsg8/dxGeomMunger8.cxx +++ b/panda/src/dxgsg8/dxGeomMunger8.cxx @@ -80,6 +80,14 @@ munge_format_impl(const qpGeomVertexFormat *orig, (InternalName::get_transform_index(), 1, qpGeomVertexColumn::NT_packed_dcba, qpGeomVertexColumn::C_index); } + + // Make sure the old weights and indices are removed, just in + // case. + new_format->remove_column(InternalName::get_transform_weight()); + new_format->remove_column(InternalName::get_transform_index()); + + // And we don't need the transform_blend table any more. + new_format->remove_column(InternalName::get_transform_blend()); } if (normal_type != (const qpGeomVertexColumn *)NULL) { @@ -112,8 +120,8 @@ munge_format_impl(const qpGeomVertexFormat *orig, return orig; } - // Use the new format; make sure the DX8-friendly array is first in - // the list. + // Use the new format; make sure the FVF-style array we just built + // up is first in the list. new_format->insert_array(0, new_array_format); return qpGeomVertexFormat::register_format(new_format); } diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index bec866e283..2a228620b7 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -2688,8 +2688,8 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomMunger *munger, } else { // We're not using vertex blending. if (_vertex_blending_enabled) { - _pD3DDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE); _pD3DDevice->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE); + _pD3DDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE); _vertex_blending_enabled = false; } @@ -2797,8 +2797,8 @@ end_draw_primitives() { // Turn off vertex blending--it seems to cause problems if we leave // it on. if (_vertex_blending_enabled) { - _pD3DDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE); _pD3DDevice->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE); + _pD3DDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE); _vertex_blending_enabled = false; } } diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 52ec9460ea..31a62a7f05 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -129,6 +129,19 @@ ConfigVariableBool hardware_animated_vertices "necessary on your computer's bus. However, in some cases it " "may actually reduce performance.")); +ConfigVariableBool matrix_palette +("matrix-palette", false, + PRC_DESC("Set this true to allow the use of the matrix palette when " + "animating vertices in hardware (if hardware-animated-vertices " + "is also true). The matrix palette is not supported by all " + "devices, but if it is, using it can allow animation of more " + "sophisticated meshes in hardware, and it can also improve the " + "performance of animating some simpler meshes. Without " + "this option, certain meshes will have to be animated in " + "software. However, this option is not enabled by default, " + "because its support seems to be buggy in certain drivers " + "(ATI FireGL T2 8.103 in particular.)")); + ConfigVariableBool use_qpgeom ("use-qpgeom", false, PRC_DESC("A temporary variable while the experimental Geom rewrite is " diff --git a/panda/src/gobj/config_gobj.h b/panda/src/gobj/config_gobj.h index b581d79bad..6cb112eec7 100644 --- a/panda/src/gobj/config_gobj.h +++ b/panda/src/gobj/config_gobj.h @@ -54,6 +54,7 @@ extern EXPCL_PANDA ConfigVariableBool retained_mode; extern EXPCL_PANDA ConfigVariableBool vertex_buffers; extern EXPCL_PANDA ConfigVariableBool display_lists; extern EXPCL_PANDA ConfigVariableBool hardware_animated_vertices; +extern EXPCL_PANDA ConfigVariableBool matrix_palette; extern EXPCL_PANDA ConfigVariableBool use_qpgeom; diff --git a/panda/src/gobj/qpgeomVertexData.cxx b/panda/src/gobj/qpgeomVertexData.cxx index 13ca6b0312..9d8ef52347 100644 --- a/panda/src/gobj/qpgeomVertexData.cxx +++ b/panda/src/gobj/qpgeomVertexData.cxx @@ -763,6 +763,9 @@ replace_column(const InternalName *name, int num_components, //////////////////////////////////////////////////////////////////// void qpGeomVertexData:: output(ostream &out) const { + if (!get_name().empty()) { + out << get_name() << " "; + } out << get_num_vertices() << ": " << *get_format(); } @@ -773,6 +776,9 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// void qpGeomVertexData:: write(ostream &out, int indent_level) const { + if (!get_name().empty()) { + indent(out, indent_level) << get_name() << "\n"; + } _format->write_with_data(out, indent_level, this); if (get_transform_blend_palette() != (TransformBlendPalette *)NULL) { indent(out, indent_level) diff --git a/panda/src/gobj/qpgeomVertexFormat.cxx b/panda/src/gobj/qpgeomVertexFormat.cxx index b6b084e80c..f096a24894 100644 --- a/panda/src/gobj/qpgeomVertexFormat.cxx +++ b/panda/src/gobj/qpgeomVertexFormat.cxx @@ -397,6 +397,11 @@ write(ostream &out, int indent_level) const { << "Array " << i << ":\n"; _arrays[i]->write(out, indent_level + 2); } + + if (_animation.get_animation_type() != qpGeomVertexAnimationSpec::AT_none) { + indent(out, indent_level) + << "anim " << _animation; + } } ////////////////////////////////////////////////////////////////////