diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-11-04 13:17:38 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-11-04 15:03:33 +0300 |
commit | 31a620b9420cab6292b0aa1ea21c9dd1cf70b8bc (patch) | |
tree | 76cf425e110fe1c78930e54f3b56d24e1485877a /intern/cycles/bvh/bvh_optix.cpp | |
parent | a4a848d01b26ad094dabe0e935dd698847ac8f16 (diff) |
Cycles API: encapsulate Node socket members
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.
The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.
The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.
Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various modified methods
on Nodes in favor of Node::is_modified which checks the sockets'
update flags status.
Reviewed By: brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D8544
Diffstat (limited to 'intern/cycles/bvh/bvh_optix.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_optix.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/intern/cycles/bvh/bvh_optix.cpp b/intern/cycles/bvh/bvh_optix.cpp index f2666688123..52fc9c0a50d 100644 --- a/intern/cycles/bvh/bvh_optix.cpp +++ b/intern/cycles/bvh/bvh_optix.cpp @@ -69,7 +69,7 @@ void BVHOptiX::pack_blas() assert(geometry.size() == 1 && objects.size() == 1); // These are built per-mesh Geometry *const geom = geometry[0]; - if (geom->type == Geometry::HAIR) { + if (geom->geometry_type == Geometry::HAIR) { Hair *const hair = static_cast<Hair *const>(geom); if (hair->num_curves() > 0) { const size_t num_curves = hair->num_curves(); @@ -80,7 +80,7 @@ void BVHOptiX::pack_blas() // 'pack.prim_time' is only used in geom_curve_intersect.h // It is not needed because of OPTIX_MOTION_FLAG_[START|END]_VANISH - uint type = (hair->use_motion_blur && + uint type = (hair->get_use_motion_blur() && hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)) ? ((hair->curve_shape == CURVE_RIBBON) ? PRIMITIVE_MOTION_CURVE_RIBBON : PRIMITIVE_MOTION_CURVE_THICK) : @@ -98,7 +98,7 @@ void BVHOptiX::pack_blas() } } } - else if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) { + else if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) { Mesh *const mesh = static_cast<Mesh *const>(geom); if (mesh->num_triangles() > 0) { const size_t num_triangles = mesh->num_triangles(); @@ -107,7 +107,7 @@ void BVHOptiX::pack_blas() pack.prim_object.reserve(pack.prim_object.size() + num_triangles); uint type = PRIMITIVE_TRIANGLE; - if (mesh->use_motion_blur && mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)) + if (mesh->get_use_motion_blur() && mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)) type = PRIMITIVE_MOTION_TRIANGLE; for (size_t k = 0; k < num_triangles; ++k) { @@ -119,14 +119,14 @@ void BVHOptiX::pack_blas() } // Initialize visibility to zero and later update it during top-level build - uint prev_visibility = objects[0]->visibility; - objects[0]->visibility = 0; + uint prev_visibility = objects[0]->get_visibility(); + objects[0]->set_visibility(0); // Update 'pack.prim_tri_index', 'pack.prim_tri_verts' and 'pack.prim_visibility' pack_primitives(); // Reset visibility after packing - objects[0]->visibility = prev_visibility; + objects[0]->set_visibility(prev_visibility); } void BVHOptiX::pack_tlas() @@ -170,7 +170,7 @@ void BVHOptiX::pack_tlas() int object_index = 0; // Unused for instanced geometry int object_visibility = 0; foreach (Object *ob, objects) { - if (ob->geometry == geom) { + if (ob->get_geometry() == geom) { object_visibility |= ob->visibility_for_tracing(); if (!geom->is_instanced()) { object_index = ob->get_device_index(); |