mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add matrix-palette option
This commit is contained in:
parent
f37bdbf512
commit
aba5f97b25
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 "
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user