34 StandardMunger::NumericType numeric_type,
35 StandardMunger::Contents contents) :
37 _num_components(num_components),
38 _numeric_type(numeric_type),
41 _munge_color_scale(false),
43 _shader_skinning(false),
44 _remove_material(false)
47 state->get_attrib_def(shader_attrib);
51 if (shader_attrib->get_flag(ShaderAttrib::F_hardware_skinning)) {
52 _shader_skinning =
true;
55 if (!
get_gsg()->get_runtime_color_scale() && !_auto_shader &&
56 shader_attrib->get_shader() ==
nullptr) {
61 if (state->get_attrib(color_attrib) &&
67 }
else if (state->get_attrib(color_scale_attrib) &&
69 _color_scale = color_scale_attrib->
get_scale();
72 state->get_attrib(TextureAttrib::get_class_slot());
78 _munge_color_scale =
true;
79 _should_munge_state =
true;
95 state->get_attrib(material_attrib) &&
97 shader_attrib->get_shader() ==
nullptr) {
98 _remove_material =
true;
99 _should_munge_state =
true;
118 new_data = new_data->set_color(_color, _num_components, _numeric_type,
120 }
else if (_munge_color_scale) {
121 new_data = new_data->scale_color(_color_scale, _num_components,
122 _numeric_type, _contents);
127 (_auto_shader && hardware_animated_vertices &&
131 }
else if (hardware_animated_vertices &&
133 new_data->get_slider_table() ==
nullptr) {
136 if (table !=
nullptr &&
139 get_gsg()->get_max_vertex_transforms()) {
140 if (matrix_palette &&
156 get_gsg()->get_max_vertex_transforms()) {
167 if (new_format == orig_format) {
172 return new_data->convert_to(new_format);
178 void StandardMunger::
184 if (unsupported_bits != 0) {
189 if ((unsupported_bits & Geom::GR_composite_bits) != 0 ||
190 (unsupported_bits & Geom::GR_strip_cut_index) != 0) {
199 geom = geom->decompose();
205 if ((unsupported_bits & Geom::GR_shade_model_bits) != 0) {
208 geom = geom->rotate();
210 if ((unsupported_bits & Geom::GR_indexed_bits) != 0) {
214 new_geom->make_nonindexed(
false);
216 vertex_data = new_geom->get_vertex_data();
224 void StandardMunger::
229 if (unsupported_bits != 0) {
234 if ((unsupported_bits & Geom::GR_composite_bits) != 0 ||
235 (unsupported_bits & Geom::GR_strip_cut_index) != 0) {
244 geom = geom->decompose();
250 if ((unsupported_bits & Geom::GR_shade_model_bits) != 0) {
253 geom = geom->rotate();
255 if ((unsupported_bits & Geom::GR_indexed_bits) != 0) {
259 new_geom->make_nonindexed(
false);
261 vertex_data = new_geom->get_vertex_data();
272 compare_to_impl(
const GeomMunger *other)
const {
275 if (_munge_color != om->_munge_color) {
276 return (
int)_munge_color - (int)om->_munge_color;
278 if (_munge_color_scale != om->_munge_color_scale) {
279 return (
int)_munge_color_scale - (int)om->_munge_color_scale;
282 int compare = _color.compare_to(om->_color);
287 if (_munge_color_scale) {
288 int compare = _color_scale.compare_to(om->_color_scale);
293 if (_shader_skinning != om->_shader_skinning) {
294 return (
int)_shader_skinning - (int)om->_shader_skinning;
296 if (_auto_shader != om->_auto_shader) {
297 return (
int)_auto_shader - (int)om->_auto_shader;
299 if (_remove_material != om->_remove_material) {
300 return (
int)_remove_material - (int)om->_remove_material;
303 return StateMunger::compare_to_impl(other);
313 geom_compare_to_impl(
const GeomMunger *other)
const {
316 if (_munge_color != om->_munge_color) {
317 return (
int)_munge_color - (int)om->_munge_color;
319 if (_munge_color_scale != om->_munge_color_scale) {
320 return (
int)_munge_color_scale - (int)om->_munge_color_scale;
323 int compare = _color.compare_to(om->_color);
328 if (_munge_color_scale) {
329 int compare = _color_scale.compare_to(om->_color_scale);
334 if (_shader_skinning != om->_shader_skinning) {
335 return (
int)_shader_skinning - (int)om->_shader_skinning;
338 return StateMunger::geom_compare_to_impl(other);
349 munged_state = munged_state->remove_attrib(ColorAttrib::get_class_slot());
350 munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot());
351 }
else if (_munge_color_scale) {
352 munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot());
355 if (_remove_material) {
356 munged_state = munged_state->remove_attrib(MaterialAttrib::get_class_slot());