Cleanup: simplify Cycles primitive attribute map storage

This commit is contained in:
2020-02-03 21:40:58 +01:00
parent d9c5f0d25f
commit d809853513
9 changed files with 88 additions and 205 deletions

View File

@@ -135,7 +135,7 @@ NODE_DEFINE(Mesh)
return type;
}
Mesh::Mesh() : Geometry(node_type, Geometry::MESH)
Mesh::Mesh() : Geometry(node_type, Geometry::MESH), subd_attributes(this, ATTR_PRIM_SUBD)
{
vert_offset = 0;
@@ -145,9 +145,6 @@ Mesh::Mesh() : Geometry(node_type, Geometry::MESH)
num_subd_verts = 0;
attributes.triangle_mesh = this;
subd_attributes.subd_mesh = this;
volume_isovalue = 0.001f;
num_ngons = 0;
@@ -329,7 +326,9 @@ void Mesh::get_uv_tiles(ustring map, unordered_set<int> &tiles)
}
if (attr) {
attr->get_uv_tiles(this, ATTR_PRIM_TRIANGLE, tiles);
attr->get_uv_tiles(this, ATTR_PRIM_GEOMETRY, tiles);
}
if (subd_attr) {
subd_attr->get_uv_tiles(this, ATTR_PRIM_SUBD, tiles);
}
}
@@ -546,8 +545,7 @@ void Mesh::add_undisplaced()
float3 *data = attr->data_float3();
/* copy verts */
size_t size = attr->buffer_size(
this, (subdivision_type == SUBDIVISION_NONE) ? ATTR_PRIM_TRIANGLE : ATTR_PRIM_SUBD);
size_t size = attr->buffer_size(this, attrs.prim);
/* Center points for ngons aren't stored in Mesh::verts but are included in size since they will
* be calculated later, we subtract them from size here so we don't have an overflow while