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/render/geometry.h
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/render/geometry.h')
-rw-r--r--intern/cycles/render/geometry.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h
index bcadb3a8051..1a374c57463 100644
--- a/intern/cycles/render/geometry.h
+++ b/intern/cycles/render/geometry.h
@@ -56,13 +56,13 @@ class Geometry : public Node {
VOLUME,
};
- Type type;
+ Type geometry_type;
/* Attributes */
AttributeSet attributes;
/* Shaders */
- vector<Shader *> used_shaders;
+ NODE_SOCKET_API_ARRAY(array<Node *>, used_shaders)
/* Transform */
BoundBox bounds;
@@ -71,8 +71,8 @@ class Geometry : public Node {
Transform transform_normal;
/* Motion Blur */
- uint motion_steps;
- bool use_motion_blur;
+ NODE_SOCKET_API(uint, motion_steps)
+ NODE_SOCKET_API(bool, use_motion_blur)
/* Maximum number of motion steps supported (due to Embree). */
static const uint MAX_MOTION_STEPS = 129;
@@ -88,7 +88,6 @@ class Geometry : public Node {
bool has_surface_bssrdf; /* Set in the device_update_flags(). */
/* Update Flags */
- bool need_update;
bool need_update_rebuild;
/* Constructor/Destructor */
@@ -138,6 +137,16 @@ class Geometry : public Node {
bool has_motion_blur() const;
bool has_voxel_attributes() const;
+ bool is_mesh() const
+ {
+ return geometry_type == MESH;
+ }
+
+ bool is_hair() const
+ {
+ return geometry_type == HAIR;
+ }
+
/* Updates */
void tag_update(Scene *scene, bool rebuild);
};
@@ -200,6 +209,21 @@ class GeometryManager {
void device_update_displacement_images(Device *device, Scene *scene, Progress &progress);
void device_update_volume_images(Device *device, Scene *scene, Progress &progress);
+
+ private:
+ static void update_attribute_element_offset(Geometry *geom,
+ device_vector<float> &attr_float,
+ size_t &attr_float_offset,
+ device_vector<float2> &attr_float2,
+ size_t &attr_float2_offset,
+ device_vector<float4> &attr_float3,
+ size_t &attr_float3_offset,
+ device_vector<uchar4> &attr_uchar4,
+ size_t &attr_uchar4_offset,
+ Attribute *mattr,
+ AttributePrimitive prim,
+ TypeDesc &type,
+ AttributeDescriptor &desc);
};
CCL_NAMESPACE_END