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);
126 if (_shader_skinning || (_auto_shader && hardware_animated_vertices &&
130 }
else if (hardware_animated_vertices &&
132 new_data->get_slider_table() ==
nullptr) {
135 if (table !=
nullptr &&
138 get_gsg()->get_max_vertex_transforms()) {
139 if (matrix_palette &&
155 get_gsg()->get_max_vertex_transforms()) {
166 if (new_format == orig_format) {
171 return new_data->convert_to(new_format);
177 void StandardMunger::
183 if (unsupported_bits != 0) {
188 if ((unsupported_bits & Geom::GR_composite_bits) != 0 ||
189 (unsupported_bits & Geom::GR_strip_cut_index) != 0) {
198 geom = geom->decompose();
204 if ((unsupported_bits & Geom::GR_shade_model_bits) != 0) {
207 geom = geom->rotate();
209 if ((unsupported_bits & Geom::GR_indexed_bits) != 0) {
213 new_geom->make_nonindexed(
false);
215 vertex_data = new_geom->get_vertex_data();
223 void StandardMunger::
228 if (unsupported_bits != 0) {
233 if ((unsupported_bits & Geom::GR_composite_bits) != 0 ||
234 (unsupported_bits & Geom::GR_strip_cut_index) != 0) {
243 geom = geom->decompose();
249 if ((unsupported_bits & Geom::GR_shade_model_bits) != 0) {
252 geom = geom->rotate();
254 if ((unsupported_bits & Geom::GR_indexed_bits) != 0) {
258 new_geom->make_nonindexed(
false);
260 vertex_data = new_geom->get_vertex_data();
271 compare_to_impl(
const GeomMunger *other)
const {
274 if (_munge_color != om->_munge_color) {
275 return (
int)_munge_color - (int)om->_munge_color;
277 if (_munge_color_scale != om->_munge_color_scale) {
278 return (
int)_munge_color_scale - (int)om->_munge_color_scale;
281 int compare = _color.compare_to(om->_color);
286 if (_munge_color_scale) {
287 int compare = _color_scale.compare_to(om->_color_scale);
292 if (_shader_skinning != om->_shader_skinning) {
293 return (
int)_shader_skinning - (int)om->_shader_skinning;
295 if (_auto_shader != om->_auto_shader) {
296 return (
int)_auto_shader - (int)om->_auto_shader;
298 if (_remove_material != om->_remove_material) {
299 return (
int)_remove_material - (int)om->_remove_material;
302 return StateMunger::compare_to_impl(other);
312 geom_compare_to_impl(
const GeomMunger *other)
const {
315 if (_munge_color != om->_munge_color) {
316 return (
int)_munge_color - (int)om->_munge_color;
318 if (_munge_color_scale != om->_munge_color_scale) {
319 return (
int)_munge_color_scale - (int)om->_munge_color_scale;
322 int compare = _color.compare_to(om->_color);
327 if (_munge_color_scale) {
328 int compare = _color_scale.compare_to(om->_color_scale);
333 if (_shader_skinning != om->_shader_skinning) {
334 return (
int)_shader_skinning - (int)om->_shader_skinning;
337 return StateMunger::geom_compare_to_impl(other);
348 munged_state = munged_state->remove_attrib(ColorAttrib::get_class_slot());
349 munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot());
350 }
else if (_munge_color_scale) {
351 munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot());
354 if (_remove_material) {
355 munged_state = munged_state->remove_attrib(MaterialAttrib::get_class_slot());