19GeomMunger *DXGeomMunger9::_deleted_chain =
nullptr;
33 state->get_attrib(texture);
34 state->get_attrib(tex_gen);
44 state->get_attrib_def(shader_attrib);
47 shader_attrib->get_shader() ==
nullptr &&
48 state->get_attrib(color_attrib) &&
52 _color.set(1, 1, 1, 1);
58 if (state->get_attrib(color_scale_attrib) &&
60 _color.componentwise_mult(color_scale_attrib->
get_scale());
63 _should_munge_state =
true;
67 _filtered_texture =
nullptr;
68 _reffed_filtered_texture =
false;
69 if (texture !=
nullptr) {
71 if (_filtered_texture != texture) {
72 _filtered_texture->
ref();
73 _reffed_filtered_texture =
true;
78 _texture.add_callback(
this);
79 _tex_gen.add_callback(
this);
87 if (_reffed_filtered_texture) {
89 _reffed_filtered_texture =
false;
92 _texture.remove_callback(
this);
93 _tex_gen.remove_callback(
this);
105 if (_reffed_filtered_texture) {
107 _reffed_filtered_texture =
false;
118 if (dxgsg9_cat.is_debug()) {
121 <<
"preparing animation type " << animation <<
" for " << *orig
128 new_format->set_animation(animation);
135 if (vertex_type !=
nullptr) {
136 new_array_format->add_column
137 (InternalName::get_vertex(), 3, NT_float32,
139 new_format->remove_column(vertex_type->
get_name());
151 new_array_format->add_column
153 NT_float32, C_other);
159 new_array_format->add_column
160 (InternalName::get_transform_index(), 1,
161 NT_packed_dcba, C_index);
165 new_format->
remove_column(InternalName::get_transform_weight());
166 new_format->remove_column(InternalName::get_transform_index());
169 new_format->remove_column(InternalName::get_transform_blend());
172 if (normal_type !=
nullptr) {
173 new_array_format->add_column
174 (InternalName::get_normal(), 3, NT_float32, C_normal);
175 new_format->remove_column(normal_type->
get_name());
178 if (color_type !=
nullptr) {
179 new_array_format->add_column
180 (InternalName::get_color(), 1, NT_packed_dabc, C_color);
181 new_format->remove_column(color_type->
get_name());
190 if (_filtered_texture !=
nullptr) {
192 vector_int ff_tc_index(num_stages, 0);
198 int max_tc_index = -1;
199 for (si = 0; si < num_stages; ++si) {
201 nassertr(tc_index < num_stages, orig);
202 ff_tc_index[tc_index] = si;
203 max_tc_index = std::max(tc_index, max_tc_index);
209 for (tc_index = 0; tc_index <= max_tc_index; ++tc_index) {
210 si = ff_tc_index[tc_index];
216 if (texcoord_type !=
nullptr) {
217 new_array_format->add_column
222 new_array_format->add_column(name, 2, NT_float32, C_texcoord);
224 new_format->remove_column(name);
230 for (
size_t i = 0; i < new_format->get_num_arrays(); ++i) {
232 if (orig_a->count_unused_space() != 0) {
234 for (
int j = 0; j < orig_a->get_num_columns(); ++j) {
239 new_format->set_array(i, new_a);
244 new_format->insert_array(0, new_array_format);
246 return GeomVertexFormat::register_format(new_format);
264 if (vertex_type !=
nullptr) {
265 new_array_format->add_column
266 (InternalName::get_vertex(), 3, NT_float32,
268 new_format->remove_column(vertex_type->
get_name());
275 if (normal_type !=
nullptr) {
276 new_array_format->add_column
277 (InternalName::get_normal(), 3, NT_float32, C_normal);
281 if (color_type !=
nullptr) {
282 new_array_format->add_column
283 (InternalName::get_color(), 1, NT_packed_dabc, C_color);
284 new_format->remove_column(color_type->
get_name());
293 if (_filtered_texture !=
nullptr) {
295 vector_int ff_tc_index(num_stages, 0);
301 int max_tc_index = -1;
302 for (si = 0; si < num_stages; ++si) {
304 nassertr(tc_index < num_stages, orig);
305 ff_tc_index[tc_index] = si;
306 max_tc_index = std::max(tc_index, max_tc_index);
312 for (tc_index = 0; tc_index <= max_tc_index; ++tc_index) {
313 si = ff_tc_index[tc_index];
319 if (texcoord_type !=
nullptr) {
320 new_array_format->add_column
325 new_array_format->add_column(name, 2, NT_float32, C_texcoord);
327 new_format->remove_column(name);
333 for (
size_t i = 0; i < new_format->get_num_arrays(); ++i) {
335 if (orig_a->count_unused_space() != 0) {
337 for (
int j = 0; j < orig_a->get_num_columns(); ++j) {
342 new_format->set_array(i, new_a);
347 new_format->insert_array(0, new_array_format);
349 return GeomVertexFormat::register_format(new_format);
358compare_to_impl(
const GeomMunger *other)
const {
360 if (_filtered_texture != om->_filtered_texture) {
361 return _filtered_texture < om->_filtered_texture ? -1 : 1;
363 if (_tex_gen.owner_before(om->_tex_gen)) {
366 if (om->_tex_gen.owner_before(_tex_gen)) {
370 return StandardMunger::compare_to_impl(other);
379geom_compare_to_impl(
const GeomMunger *other)
const {
384 if (_filtered_texture != om->_filtered_texture) {
385 return _filtered_texture < om->_filtered_texture ? -1 : 1;
387 if (_tex_gen.owner_before(om->_tex_gen)) {
390 if (om->_tex_gen.owner_before(_tex_gen)) {
394 return StandardMunger::geom_compare_to_impl(other);
Indicates what color should be applied to renderable geometry.
get_color
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
get_color_type
Returns the type of color specified by this ColorAttrib.
Applies a scale to colors in the scene graph and on vertices.
has_scale
Returns true if the ColorScaleAttrib has a non-identity scale, false otherwise (in which case it migh...
get_scale
Returns the scale to be applied to colors.
This specialization on GeomMunger finesses vertices for DirectX rendering.
virtual void wp_callback(void *)
This callback is set to be made whenever the associated _texture or _tex_gen attributes are destructe...
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
This object describes how the vertex animation, if any, represented in a GeomVertexData is encoded.
get_animation_type
Returns the type of animation represented by this spec.
get_indexed_transforms
This is only meaningful for animation_type AT_hardware.
get_num_transforms
This is only meaningful for animation_type AT_hardware.
This defines how a single column is interleaved within a vertex array stored within a Geom.
int get_num_values() const
Returns the number of numeric values of the column: the number of distinct numeric values that go int...
NumericType get_numeric_type() const
Returns the token representing the numeric type of the data storage.
const InternalName * get_name() const
Returns the name of this particular data field, e.g.
Contents get_contents() const
Returns the token representing the semantic meaning of the stored value.
int get_num_components() const
Returns the number of components of the column: the number of instances of the NumericType in each el...
Encapsulates all the communication with a particular instance of a given rendering backend.
bool get_color_scale_via_lighting() const
Returns true if this particular GSG can implement (or would prefer to implement) set color and/or col...
get_max_texture_stages
Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturi...
Encodes a string name in a hash table, mapping it to a pointer.
void ref() const
Explicitly increments the reference count.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
bool auto_shader() const
If true, then this ShaderAttrib does not contain an explicit shader - instead, it requests the automa...
Performs some generic munging that is appropriate for all GSG types; for instance,...
Computes texture coordinates for geometry automatically based on vertex position and/or normal.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
get_num_on_ff_stages
Returns the number of on-stages that are relevant to the classic fixed function pipeline.
get_on_ff_stage
Returns the nth stage turned on by the attribute, sorted in render order, including only those releva...
int get_ff_tc_index(int n) const
For each TextureStage listed in get_on_ff_stage(), this returns a unique index number for the texture...
Defines the properties of a named stage of the multitexture pipeline.
get_texcoord_name
See set_texcoord_name.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...