diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-08-19 16:46:50 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-08-19 16:47:09 +0300 |
commit | aa1e4baa22b3393dc723d48061c9781f4b8b42c7 (patch) | |
tree | abef7319b60e2a1faa5ce227ed8c73ac2d37e1f4 /intern/cycles/bvh | |
parent | 3e56dd8fd9210735c654661c8ada5a5f92623826 (diff) |
Cycles : add a Volume Geometry Node
This splits the volume related data (properties for rendering and attributes) of the Mesh node
into a new `Volume` node type.
This `Volume` node derives from the `Mesh` class since we generate a mesh for the bounds of the
volume, as such we can safely work on `Volumes` as if they were `Meshes`, e.g. for BVH creation.
However such code should still check for the geometry type of the object to be `MESH` or `VOLUME`
which may be bug prone if this is forgotten.
This is part of T79131.
Reviewed By: brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8538
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh_build.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/bvh/bvh_embree.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/bvh/bvh_optix.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/bvh/bvh_split.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 86ab7b00815..360cac59e9b 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -270,7 +270,7 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox ¢er, Hair *hair void BVHBuild::add_reference_geometry(BoundBox &root, BoundBox ¢er, Geometry *geom, int i) { - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); add_reference_triangles(root, center, mesh, i); } @@ -299,7 +299,7 @@ static size_t count_curve_segments(Hair *hair) static size_t count_primitives(Geometry *geom) { - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); return mesh->num_triangles(); } diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index 4ef873634f0..d5c442516c7 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -306,7 +306,7 @@ thread_mutex BVHEmbree::rtc_shared_mutex; static size_t count_primitives(Geometry *geom) { - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); return mesh->num_triangles(); } @@ -531,7 +531,7 @@ void BVHEmbree::add_object(Object *ob, int i) { Geometry *geom = ob->geometry; - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); if (mesh->num_triangles() > 0) { add_triangles(ob, mesh, i); @@ -979,7 +979,7 @@ void BVHEmbree::refit_nodes() if (!params.top_level || (ob->is_traceable() && !ob->geometry->is_instanced())) { Geometry *geom = ob->geometry; - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); if (mesh->num_triangles() > 0) { update_tri_vertex_buffer(rtcGetGeometry(scene, geom_id), mesh); diff --git a/intern/cycles/bvh/bvh_optix.cpp b/intern/cycles/bvh/bvh_optix.cpp index ccb7ae08625..0527c0eeda8 100644 --- a/intern/cycles/bvh/bvh_optix.cpp +++ b/intern/cycles/bvh/bvh_optix.cpp @@ -95,7 +95,7 @@ void BVHOptiX::pack_blas() } } } - else if (geom->type == Geometry::MESH) { + else if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *const mesh = static_cast<Mesh *const>(geom); if (mesh->num_triangles() > 0) { const size_t num_triangles = mesh->num_triangles(); diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp index 4b21f852d7a..2f1960d664e 100644 --- a/intern/cycles/bvh/bvh_split.cpp +++ b/intern/cycles/bvh/bvh_split.cpp @@ -458,7 +458,7 @@ void BVHSpatialSplit::split_object_reference( { Geometry *geom = object->geometry; - if (geom->type == Geometry::MESH) { + if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { Mesh *mesh = static_cast<Mesh *>(geom); for (int tri_idx = 0; tri_idx < mesh->num_triangles(); ++tri_idx) { split_triangle_primitive(mesh, &object->tfm, tri_idx, dim, pos, left_bounds, right_bounds); |