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/mesh.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/mesh.h')
-rw-r--r--intern/cycles/render/mesh.h80
1 files changed, 66 insertions, 14 deletions
diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h
index c8286a01e2c..b8107085006 100644
--- a/intern/cycles/render/mesh.h
+++ b/intern/cycles/render/mesh.h
@@ -118,36 +118,57 @@ class Mesh : public Geometry {
float crease;
};
+ SubdEdgeCrease get_subd_crease(size_t i) const
+ {
+ SubdEdgeCrease s;
+ s.v[0] = subd_creases_edge[i * 2];
+ s.v[1] = subd_creases_edge[i * 2 + 1];
+ s.crease = subd_creases_weight[i];
+ return s;
+ }
+
+ bool need_tesselation();
+
enum SubdivisionType {
SUBDIVISION_NONE,
SUBDIVISION_LINEAR,
SUBDIVISION_CATMULL_CLARK,
};
- SubdivisionType subdivision_type;
+ NODE_SOCKET_API(SubdivisionType, subdivision_type)
/* Mesh Data */
- array<int> triangles;
- array<float3> verts;
- array<int> shader;
- array<bool> smooth;
+ NODE_SOCKET_API_ARRAY(array<int>, triangles)
+ NODE_SOCKET_API_ARRAY(array<float3>, verts)
+ NODE_SOCKET_API_ARRAY(array<int>, shader)
+ NODE_SOCKET_API_ARRAY(array<bool>, smooth)
/* used for storing patch info for subd triangles, only allocated if there are patches */
- array<int> triangle_patch; /* must be < 0 for non subd triangles */
- array<float2> vert_patch_uv;
+ NODE_SOCKET_API_ARRAY(array<int>, triangle_patch) /* must be < 0 for non subd triangles */
+ NODE_SOCKET_API_ARRAY(array<float2>, vert_patch_uv)
+
+ /* SubdFaces */
+ NODE_SOCKET_API_ARRAY(array<int>, subd_start_corner)
+ NODE_SOCKET_API_ARRAY(array<int>, subd_num_corners)
+ NODE_SOCKET_API_ARRAY(array<int>, subd_shader)
+ NODE_SOCKET_API_ARRAY(array<bool>, subd_smooth)
+ NODE_SOCKET_API_ARRAY(array<int>, subd_ptex_offset)
- array<SubdFace> subd_faces;
- array<int> subd_face_corners;
- int num_ngons;
+ NODE_SOCKET_API_ARRAY(array<int>, subd_face_corners)
+ NODE_SOCKET_API(int, num_ngons)
- array<SubdEdgeCrease> subd_creases;
+ NODE_SOCKET_API_ARRAY(array<int>, subd_creases_edge)
+ NODE_SOCKET_API_ARRAY(array<float>, subd_creases_weight)
- SubdParams *subd_params;
+ /* Subdivisions parameters */
+ NODE_SOCKET_API(float, subd_dicing_rate)
+ NODE_SOCKET_API(int, subd_max_level)
+ NODE_SOCKET_API(Transform, subd_objecttoworld)
AttributeSet subd_attributes;
+ private:
PackedPatchTable *patch_table;
-
/* BVH */
size_t vert_offset;
@@ -157,13 +178,23 @@ class Mesh : public Geometry {
size_t corner_offset;
size_t num_subd_verts;
+ size_t num_subd_faces;
- private:
unordered_map<int, int> vert_to_stitching_key_map; /* real vert index -> stitching index */
unordered_multimap<int, int>
vert_stitching_map; /* stitching index -> multiple real vert indices */
+
+ friend class BVH;
+ friend class BVHBuild;
+ friend class BVHEmbree;
+ friend class BVHSpatialSplit;
friend class DiagSplit;
+ friend class EdgeDice;
friend class GeometryManager;
+ friend class Object;
+ friend class ObjectManager;
+
+ SubdParams *subd_params = nullptr;
public:
/* Functions */
@@ -174,12 +205,14 @@ class Mesh : public Geometry {
void reserve_mesh(int numverts, int numfaces);
void resize_subd_faces(int numfaces, int num_ngons, int numcorners);
void reserve_subd_faces(int numfaces, int num_ngons, int numcorners);
+ void reserve_subd_creases(size_t num_creases);
void clear(bool preserve_voxel_data);
void clear() override;
void add_vertex(float3 P);
void add_vertex_slow(float3 P);
void add_triangle(int v0, int v1, int v2, int shader, bool smooth);
void add_subd_face(int *corners, int num_corners, int shader_, bool smooth_);
+ void add_crease(int v0, int v1, float weight);
void copy_center_to_motion_step(const int motion_step);
@@ -202,6 +235,25 @@ class Mesh : public Geometry {
void pack_patches(uint *patch_data, uint vert_offset, uint face_offset, uint corner_offset);
void tessellate(DiagSplit *split);
+
+ SubdFace get_subd_face(size_t index) const;
+
+ SubdParams *get_subd_params();
+
+ size_t get_num_subd_faces() const
+ {
+ return num_subd_faces;
+ }
+
+ void set_num_subd_faces(size_t num_subd_faces_)
+ {
+ num_subd_faces = num_subd_faces_;
+ }
+
+ size_t get_num_subd_verts()
+ {
+ return num_subd_verts;
+ }
};
CCL_NAMESPACE_END