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