mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix crash
This commit is contained in:
parent
8ddc7227ab
commit
9b23f1a89c
@ -109,27 +109,29 @@ munge_format_impl(const qpGeomVertexFormat *orig,
|
|||||||
|
|
||||||
// Now copy all of the texture coordinates in, in order by stage
|
// Now copy all of the texture coordinates in, in order by stage
|
||||||
// index. But we have to reuse previous columns.
|
// index. But we have to reuse previous columns.
|
||||||
typedef pset<const InternalName *> UsedStages;
|
if (_texture != (TextureAttrib *)NULL) {
|
||||||
UsedStages used_stages;
|
typedef pset<const InternalName *> UsedStages;
|
||||||
|
UsedStages used_stages;
|
||||||
|
|
||||||
int num_stages = _texture->get_num_on_stages();
|
int num_stages = _texture->get_num_on_stages();
|
||||||
for (int i = 0; i < num_stages; ++i) {
|
for (int i = 0; i < num_stages; ++i) {
|
||||||
TextureStage *stage = _texture->get_on_stage(i);
|
TextureStage *stage = _texture->get_on_stage(i);
|
||||||
|
|
||||||
const InternalName *name = stage->get_texcoord_name();
|
const InternalName *name = stage->get_texcoord_name();
|
||||||
if (used_stages.insert(name).second) {
|
if (used_stages.insert(name).second) {
|
||||||
// This is the first time we've encountered this texcoord name.
|
// This is the first time we've encountered this texcoord name.
|
||||||
const qpGeomVertexColumn *texcoord_type = orig->get_column(name);
|
const qpGeomVertexColumn *texcoord_type = orig->get_column(name);
|
||||||
|
|
||||||
if (texcoord_type != (const qpGeomVertexColumn *)NULL) {
|
if (texcoord_type != (const qpGeomVertexColumn *)NULL) {
|
||||||
new_array_format->add_column
|
new_array_format->add_column
|
||||||
(name, texcoord_type->get_num_values(), NT_float32, C_texcoord);
|
(name, texcoord_type->get_num_values(), NT_float32, C_texcoord);
|
||||||
} else {
|
} else {
|
||||||
// We have to add something as a placeholder, even if the
|
// We have to add something as a placeholder, even if the
|
||||||
// texture coordinates aren't defined.
|
// texture coordinates aren't defined.
|
||||||
new_array_format->add_column(name, 2, NT_float32, C_texcoord);
|
new_array_format->add_column(name, 2, NT_float32, C_texcoord);
|
||||||
|
}
|
||||||
|
new_format->remove_column(name);
|
||||||
}
|
}
|
||||||
new_format->remove_column(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user