mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
fix assertion failure with threading
This commit is contained in:
parent
35f3829d10
commit
703e4512b3
@ -404,12 +404,16 @@ clear_vertices() {
|
||||
void GeomPrimitive::
|
||||
offset_vertices(int offset) {
|
||||
if (is_indexed()) {
|
||||
{
|
||||
CDWriter cdata(_cycler, true);
|
||||
consider_elevate_index_type(cdata, get_max_vertex() + offset);
|
||||
}
|
||||
CDWriter cdata(_cycler, true);
|
||||
|
||||
GeomVertexRewriter index(modify_vertices(), 0);
|
||||
if (!cdata->_got_minmax) {
|
||||
recompute_minmax(cdata);
|
||||
nassertv(cdata->_got_minmax);
|
||||
}
|
||||
|
||||
consider_elevate_index_type(cdata, cdata->_max_vertex + offset);
|
||||
|
||||
GeomVertexRewriter index(do_modify_vertices(cdata), 0);
|
||||
while (!index.is_at_end()) {
|
||||
index.set_data1i(index.get_data1i() + offset);
|
||||
}
|
||||
@ -849,18 +853,7 @@ write(ostream &out, int indent_level) const {
|
||||
GeomVertexArrayData *GeomPrimitive::
|
||||
modify_vertices() {
|
||||
CDWriter cdata(_cycler, true);
|
||||
|
||||
if (cdata->_vertices == (GeomVertexArrayData *)NULL) {
|
||||
do_make_indexed(cdata);
|
||||
}
|
||||
|
||||
if (cdata->_vertices->get_ref_count() > 1) {
|
||||
cdata->_vertices = new GeomVertexArrayData(*cdata->_vertices);
|
||||
}
|
||||
|
||||
cdata->_modified = Geom::get_next_modified();
|
||||
cdata->_got_minmax = false;
|
||||
return cdata->_vertices;
|
||||
return do_modify_vertices(cdata);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -1477,6 +1470,26 @@ do_set_index_type(CData *cdata, GeomPrimitive::NumericType index_type) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomPrimitive::do_modify_vertices
|
||||
// Access: Private
|
||||
// Description: The private implementation of modify_vertices().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
GeomVertexArrayData *GeomPrimitive::
|
||||
do_modify_vertices(GeomPrimitive::CData *cdata) {
|
||||
if (cdata->_vertices == (GeomVertexArrayData *)NULL) {
|
||||
do_make_indexed(cdata);
|
||||
}
|
||||
|
||||
if (cdata->_vertices->get_ref_count() > 1) {
|
||||
cdata->_vertices = new GeomVertexArrayData(*cdata->_vertices);
|
||||
}
|
||||
|
||||
cdata->_modified = Geom::get_next_modified();
|
||||
cdata->_got_minmax = false;
|
||||
return cdata->_vertices;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomPrimitive::write_datagram
|
||||
// Access: Public, Virtual
|
||||
|
@ -210,6 +210,7 @@ private:
|
||||
void do_make_indexed(CData *cdata);
|
||||
void consider_elevate_index_type(CData *cdata, int vertex);
|
||||
void do_set_index_type(CData *cdata, NumericType index_type);
|
||||
GeomVertexArrayData *do_modify_vertices(CData *cdata);
|
||||
|
||||
private:
|
||||
// A GeomPrimitive keeps a list (actually, a map) of all the
|
||||
|
Loading…
x
Reference in New Issue
Block a user