|
|
@@ -46,13 +46,7 @@ make_cow_copy() {
|
|
|
*
|
|
|
*/
|
|
|
Geom::
|
|
|
-Geom(const GeomVertexData *data) {
|
|
|
- // Let's ensure the vertex data gets set on all stages at once.
|
|
|
- OPEN_ITERATE_ALL_STAGES(_cycler) {
|
|
|
- CDStageWriter cdata(_cycler, pipeline_stage);
|
|
|
- cdata->_data = (GeomVertexData *)data;
|
|
|
- }
|
|
|
- CLOSE_ITERATE_ALL_STAGES(_cycler);
|
|
|
+Geom(const GeomVertexData *data) : _cycler(CData((GeomVertexData *)data)) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -631,7 +625,7 @@ unify_in_place(int max_indices, bool preserve_order) {
|
|
|
} else {
|
|
|
// We have already encountered another primitive of this type. Combine
|
|
|
// them.
|
|
|
- combine_primitives((*npi).second, primitive, current_thread);
|
|
|
+ combine_primitives((*npi).second, move(primitive), current_thread);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1491,31 +1485,29 @@ reset_geom_rendering(Geom::CData *cdata) {
|
|
|
* is modified to append the vertices from b_prim, which is unmodified.
|
|
|
*/
|
|
|
void Geom::
|
|
|
-combine_primitives(GeomPrimitive *a_prim, const GeomPrimitive *b_prim,
|
|
|
+combine_primitives(GeomPrimitive *a_prim, CPT(GeomPrimitive) b_prim,
|
|
|
Thread *current_thread) {
|
|
|
nassertv(a_prim != b_prim);
|
|
|
nassertv(a_prim->get_type() == b_prim->get_type());
|
|
|
|
|
|
- CPT(GeomPrimitive) b_prim2 = b_prim;
|
|
|
-
|
|
|
- if (a_prim->get_index_type() != b_prim2->get_index_type()) {
|
|
|
- GeomPrimitive::NumericType index_type = max(a_prim->get_index_type(), b_prim2->get_index_type());
|
|
|
+ if (a_prim->get_index_type() != b_prim->get_index_type()) {
|
|
|
+ GeomPrimitive::NumericType index_type = max(a_prim->get_index_type(), b_prim->get_index_type());
|
|
|
a_prim->set_index_type(index_type);
|
|
|
- if (b_prim2->get_index_type() != index_type) {
|
|
|
- PT(GeomPrimitive) b_prim_copy = b_prim2->make_copy();
|
|
|
+ if (b_prim->get_index_type() != index_type) {
|
|
|
+ PT(GeomPrimitive) b_prim_copy = b_prim->make_copy();
|
|
|
b_prim_copy->set_index_type(index_type);
|
|
|
- b_prim2 = b_prim_copy;
|
|
|
+ b_prim = b_prim_copy;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!b_prim2->is_indexed()) {
|
|
|
- PT(GeomPrimitive) b_prim_copy = b_prim2->make_copy();
|
|
|
+ if (!b_prim->is_indexed()) {
|
|
|
+ PT(GeomPrimitive) b_prim_copy = b_prim->make_copy();
|
|
|
b_prim_copy->make_indexed();
|
|
|
- b_prim2 = b_prim_copy;
|
|
|
+ b_prim = b_prim_copy;
|
|
|
}
|
|
|
|
|
|
PT(GeomVertexArrayData) a_vertices = a_prim->modify_vertices();
|
|
|
- CPT(GeomVertexArrayData) b_vertices = b_prim2->get_vertices();
|
|
|
+ CPT(GeomVertexArrayData) b_vertices = b_prim->get_vertices();
|
|
|
|
|
|
if (a_prim->requires_unused_vertices()) {
|
|
|
GeomVertexReader index(b_vertices, 0);
|
|
|
@@ -1536,7 +1528,7 @@ combine_primitives(GeomPrimitive *a_prim, const GeomPrimitive *b_prim,
|
|
|
if (a_prim->is_composite()) {
|
|
|
// Also copy the ends array.
|
|
|
PTA_int a_ends = a_prim->modify_ends();
|
|
|
- CPTA_int b_ends = b_prim2->get_ends();
|
|
|
+ CPTA_int b_ends = b_prim->get_ends();
|
|
|
for (size_t i = 0; i < b_ends.size(); ++i) {
|
|
|
a_ends.push_back(b_ends[i] + orig_a_vertices);
|
|
|
}
|