Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2020-10-26 23:00:37 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2020-10-27 01:11:14 +0300
commit527f8b32b32187f754e5b176db6377736f9cb8ff (patch)
treeda291ed0d180d105521a03b73107ec6c9c39ff3b /intern/cycles/bvh/bvh_build.cpp
parentd6180dd2f7e8e9fdfa472f99f7a17bcb487c4b2d (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_build.cpp')
-rw-r--r--intern/cycles/bvh/bvh_build.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 360cac59e9b..1727082b7ec 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -169,12 +169,12 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
const size_t num_curves = hair->num_curves();
for (uint j = 0; j < num_curves; j++) {
const Hair::Curve curve = hair->get_curve(j);
- const float *curve_radius = &hair->curve_radius[0];
+ const float *curve_radius = &hair->get_curve_radius()[0];
for (int k = 0; k < curve.num_keys - 1; k++) {
if (curve_attr_mP == NULL) {
/* Really simple logic for static hair. */
BoundBox bounds = BoundBox::empty;
- curve.bounds_grow(k, &hair->curve_keys[0], curve_radius, bounds);
+ curve.bounds_grow(k, &hair->get_curve_keys()[0], curve_radius, bounds);
if (bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(primitive_type, k);
references.push_back(BVHReference(bounds, j, i, packed_type));
@@ -189,9 +189,9 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
*/
/* TODO(sergey): Support motion steps for spatially split BVH. */
BoundBox bounds = BoundBox::empty;
- curve.bounds_grow(k, &hair->curve_keys[0], curve_radius, bounds);
- const size_t num_keys = hair->curve_keys.size();
- const size_t num_steps = hair->motion_steps;
+ curve.bounds_grow(k, &hair->get_curve_keys()[0], curve_radius, bounds);
+ const size_t num_keys = hair->get_curve_keys().size();
+ const size_t num_steps = hair->get_motion_steps();
const float3 *key_steps = curve_attr_mP->data_float3();
for (size_t step = 0; step < num_steps - 1; step++) {
curve.bounds_grow(k, key_steps + step * num_keys, curve_radius, bounds);
@@ -210,10 +210,10 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
*/
const int num_bvh_steps = params.num_motion_curve_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
- const size_t num_steps = hair->motion_steps;
- const float3 *curve_keys = &hair->curve_keys[0];
+ const size_t num_steps = hair->get_motion_steps();
+ const float3 *curve_keys = &hair->get_curve_keys()[0];
const float3 *key_steps = curve_attr_mP->data_float3();
- const size_t num_keys = hair->curve_keys.size();
+ const size_t num_keys = hair->get_curve_keys().size();
/* Calculate bounding box of the previous time step.
* Will be reused later to avoid duplicated work on
* calculating BVH time step boundbox.
@@ -270,11 +270,11 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
void BVHBuild::add_reference_geometry(BoundBox &root, BoundBox &center, Geometry *geom, int i)
{
- if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) {
+ if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) {
Mesh *mesh = static_cast<Mesh *>(geom);
add_reference_triangles(root, center, mesh, i);
}
- else if (geom->type == Geometry::HAIR) {
+ else if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
add_reference_curves(root, center, hair, i);
}
@@ -299,11 +299,11 @@ static size_t count_curve_segments(Hair *hair)
static size_t count_primitives(Geometry *geom)
{
- if (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME) {
+ if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) {
Mesh *mesh = static_cast<Mesh *>(geom);
return mesh->num_triangles();
}
- else if (geom->type == Geometry::HAIR) {
+ else if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
return count_curve_segments(hair);
}
@@ -321,14 +321,14 @@ void BVHBuild::add_references(BVHRange &root)
if (!ob->is_traceable()) {
continue;
}
- if (!ob->geometry->is_instanced()) {
- num_alloc_references += count_primitives(ob->geometry);
+ if (!ob->get_geometry()->is_instanced()) {
+ num_alloc_references += count_primitives(ob->get_geometry());
}
else
num_alloc_references++;
}
else {
- num_alloc_references += count_primitives(ob->geometry);
+ num_alloc_references += count_primitives(ob->get_geometry());
}
}
@@ -344,13 +344,13 @@ void BVHBuild::add_references(BVHRange &root)
++i;
continue;
}
- if (!ob->geometry->is_instanced())
- add_reference_geometry(bounds, center, ob->geometry, i);
+ if (!ob->get_geometry()->is_instanced())
+ add_reference_geometry(bounds, center, ob->get_geometry(), i);
else
add_reference_object(bounds, center, ob, i);
}
else
- add_reference_geometry(bounds, center, ob->geometry, i);
+ add_reference_geometry(bounds, center, ob->get_geometry(), i);
i++;