Blender  V3.3
BKE_geometry_fields.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
11 #include "BKE_geometry_set.hh"
12 
13 #include "FN_field.hh"
14 
15 namespace blender::bke {
16 
18  private:
19  const GeometryComponent &component_;
20  const eAttrDomain domain_;
21 
22  public:
24  : component_(component), domain_(domain)
25  {
26  }
27 
29  {
30  return component_;
31  }
32 
34  {
35  return domain_;
36  }
37 };
38 
40  public:
42 
45  ResourceScope &scope) const override;
46 
48  eAttrDomain domain,
49  IndexMask mask) const = 0;
50 };
51 
53  private:
54  std::string name_;
55 
56  public:
57  AttributeFieldInput(std::string name, const CPPType &type)
58  : GeometryFieldInput(type, name), name_(std::move(name))
59  {
61  }
62 
63  template<typename T> static fn::Field<T> Create(std::string name)
64  {
65  const CPPType &type = CPPType::get<T>();
66  auto field_input = std::make_shared<AttributeFieldInput>(std::move(name), type);
67  return fn::Field<T>{field_input};
68  }
69 
71  {
72  return name_;
73  }
74 
76  eAttrDomain domain,
77  IndexMask mask) const override;
78 
79  std::string socket_inspection_name() const override;
80 
81  uint64_t hash() const override;
82  bool is_equal_to(const fn::FieldNode &other) const override;
83 };
84 
86  public:
88  {
90  }
91 
93  eAttrDomain domain,
94  IndexMask mask) const override;
95 
96  std::string socket_inspection_name() const override;
97 
98  uint64_t hash() const override;
99  bool is_equal_to(const fn::FieldNode &other) const override;
100 };
101 
103 
104 VArray<float3> mesh_normals_varray(const MeshComponent &mesh_component,
105  const Mesh &mesh,
106  const IndexMask mask,
107  eAttrDomain domain);
108 
110  public:
112  {
114  }
115 
117  const eAttrDomain domain,
118  IndexMask mask) const override;
119 
120  std::string socket_inspection_name() const override;
121 
122  uint64_t hash() const override;
123  bool is_equal_to(const fn::FieldNode &other) const override;
124 };
125 
127  private:
132  StrongAnonymousAttributeID anonymous_id_;
133  std::string producer_name_;
134 
135  public:
137  const CPPType &type,
138  std::string producer_name)
139  : GeometryFieldInput(type, anonymous_id.debug_name()),
140  anonymous_id_(std::move(anonymous_id)),
141  producer_name_(producer_name)
142  {
144  }
145 
146  template<typename T>
147  static fn::Field<T> Create(StrongAnonymousAttributeID anonymous_id, std::string producer_name)
148  {
149  const CPPType &type = CPPType::get<T>();
150  auto field_input = std::make_shared<AnonymousAttributeFieldInput>(
151  std::move(anonymous_id), type, std::move(producer_name));
152  return fn::Field<T>{field_input};
153  }
154 
156  eAttrDomain domain,
157  IndexMask mask) const override;
158 
159  std::string socket_inspection_name() const override;
160 
161  uint64_t hash() const override;
162  bool is_equal_to(const fn::FieldNode &other) const override;
163 };
164 
166  public:
169  eAttrDomain domain,
170  IndexMask mask) const final;
171  uint64_t hash() const override;
172  bool is_equal_to(const fn::FieldNode &other) const override;
173 };
174 
175 } // namespace blender::bke
eAttrDomain
Definition: BKE_attribute.h:25
#define final(a, b, c)
Definition: BLI_hash.h:21
static uint8 component(Color32 c, uint i)
Definition: ColorBlock.cpp:108
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
GVArray get_varray_for_context(const GeometryComponent &component, eAttrDomain domain, IndexMask mask) const override
bool is_equal_to(const fn::FieldNode &other) const override
AnonymousAttributeFieldInput(StrongAnonymousAttributeID anonymous_id, const CPPType &type, std::string producer_name)
static fn::Field< T > Create(StrongAnonymousAttributeID anonymous_id, std::string producer_name)
std::string socket_inspection_name() const override
AttributeFieldInput(std::string name, const CPPType &type)
bool is_equal_to(const fn::FieldNode &other) const override
uint64_t hash() const override
GVArray get_varray_for_context(const GeometryComponent &component, eAttrDomain domain, IndexMask mask) const override
std::string socket_inspection_name() const override
static fn::Field< T > Create(std::string name)
bool is_equal_to(const fn::FieldNode &other) const override
GVArray get_varray_for_context(const GeometryComponent &component, eAttrDomain domain, IndexMask mask) const final
GeometryComponentFieldContext(const GeometryComponent &component, const eAttrDomain domain)
const GeometryComponent & geometry_component() const
virtual GVArray get_varray_for_context(const GeometryComponent &component, eAttrDomain domain, IndexMask mask) const =0
GVArray get_varray_for_context(const fn::FieldContext &context, IndexMask mask, ResourceScope &scope) const override
GVArray get_varray_for_context(const GeometryComponent &component, eAttrDomain domain, IndexMask mask) const override
bool is_equal_to(const fn::FieldNode &other) const override
std::string socket_inspection_name() const override
bool is_equal_to(const fn::FieldNode &other) const override
GVArray get_varray_for_context(const GeometryComponent &component, const eAttrDomain domain, IndexMask mask) const override
uint64_t hash() const override
std::string socket_inspection_name() const override
FieldInput(const CPPType &type, std::string debug_name="")
Definition: field.cc:660
blender::StringRef debug_name() const
Definition: FN_field.hh:658
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
VArray< float3 > curve_normals_varray(const CurveComponent &component, const eAttrDomain domain)
VArray< float3 > mesh_normals_varray(const MeshComponent &mesh_component, const Mesh &mesh, const IndexMask mask, eAttrDomain domain)
unsigned __int64 uint64_t
Definition: stdint.h:90