Blender  V3.3
scene/attribute.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "scene/attribute.h"
5 #include "scene/hair.h"
6 #include "scene/image.h"
7 #include "scene/mesh.h"
8 #include "scene/pointcloud.h"
9 
10 #include "util/foreach.h"
11 #include "util/log.h"
12 #include "util/transform.h"
13 
15 
16 /* Attribute */
17 
19  ustring name, TypeDesc type, AttributeElement element, Geometry *geom, AttributePrimitive prim)
20  : name(name), std(ATTR_STD_NONE), type(type), element(element), flags(0), modified(true)
21 {
22  /* string and matrix not supported! */
23  assert(type == TypeDesc::TypeFloat || type == TypeDesc::TypeColor ||
24  type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
25  type == TypeDesc::TypeNormal || type == TypeDesc::TypeMatrix || type == TypeFloat2 ||
26  type == TypeFloat4 || type == TypeRGBA);
27 
28  if (element == ATTR_ELEMENT_VOXEL) {
29  buffer.resize(sizeof(ImageHandle));
30  new (buffer.data()) ImageHandle();
31  }
32  else {
33  resize(geom, prim, false);
34  }
35 }
36 
38 {
39  /* For voxel data, we need to free the image handle. */
40  if (element == ATTR_ELEMENT_VOXEL && buffer.size()) {
41  ImageHandle &handle = data_voxel();
42  handle.~ImageHandle();
43  }
44 }
45 
46 void Attribute::resize(Geometry *geom, AttributePrimitive prim, bool reserve_only)
47 {
48  if (element != ATTR_ELEMENT_VOXEL) {
49  if (reserve_only) {
50  buffer.reserve(buffer_size(geom, prim));
51  }
52  else {
53  buffer.resize(buffer_size(geom, prim), 0);
54  }
55  }
56 }
57 
58 void Attribute::resize(size_t num_elements)
59 {
60  if (element != ATTR_ELEMENT_VOXEL) {
61  buffer.resize(num_elements * data_sizeof(), 0);
62  }
63 }
64 
65 void Attribute::add(const float &f)
66 {
67  assert(data_sizeof() == sizeof(float));
68 
69  char *data = (char *)&f;
70  size_t size = sizeof(f);
71 
72  for (size_t i = 0; i < size; i++)
73  buffer.push_back(data[i]);
74 
75  modified = true;
76 }
77 
78 void Attribute::add(const uchar4 &f)
79 {
80  assert(data_sizeof() == sizeof(uchar4));
81 
82  char *data = (char *)&f;
83  size_t size = sizeof(f);
84 
85  for (size_t i = 0; i < size; i++)
86  buffer.push_back(data[i]);
87 
88  modified = true;
89 }
90 
91 void Attribute::add(const float2 &f)
92 {
93  assert(data_sizeof() == sizeof(float2));
94 
95  char *data = (char *)&f;
96  size_t size = sizeof(f);
97 
98  for (size_t i = 0; i < size; i++)
99  buffer.push_back(data[i]);
100 
101  modified = true;
102 }
103 
104 void Attribute::add(const float3 &f)
105 {
106  assert(data_sizeof() == sizeof(float3));
107 
108  char *data = (char *)&f;
109  size_t size = sizeof(f);
110 
111  for (size_t i = 0; i < size; i++)
112  buffer.push_back(data[i]);
113 
114  modified = true;
115 }
116 
117 void Attribute::add(const Transform &f)
118 {
119  assert(data_sizeof() == sizeof(Transform));
120 
121  char *data = (char *)&f;
122  size_t size = sizeof(f);
123 
124  for (size_t i = 0; i < size; i++)
125  buffer.push_back(data[i]);
126 
127  modified = true;
128 }
129 
130 void Attribute::add(const char *data)
131 {
132  size_t size = data_sizeof();
133 
134  for (size_t i = 0; i < size; i++)
135  buffer.push_back(data[i]);
136 
137  modified = true;
138 }
139 
141 {
142  assert(other.std == std);
143  assert(other.type == type);
144  assert(other.element == element);
145 
146  this->flags = other.flags;
147 
148  if (this->buffer.size() != other.buffer.size()) {
149  this->buffer = std::move(other.buffer);
150  modified = true;
151  }
152  else if (memcmp(this->data(), other.data(), other.buffer.size()) != 0) {
153  this->buffer = std::move(other.buffer);
154  modified = true;
155  }
156 }
157 
159 {
161  return sizeof(ImageHandle);
162  else if (element == ATTR_ELEMENT_CORNER_BYTE)
163  return sizeof(uchar4);
164  else if (type == TypeDesc::TypeFloat)
165  return sizeof(float);
166  else if (type == TypeFloat2)
167  return sizeof(float2);
168  else if (type == TypeDesc::TypeMatrix)
169  return sizeof(Transform);
170  else
171  return sizeof(float3);
172 }
173 
175 {
176  if (flags & ATTR_FINAL_SIZE) {
177  return buffer.size() / data_sizeof();
178  }
179 
180  size_t size = 0;
181 
182  switch (element) {
183  case ATTR_ELEMENT_OBJECT:
184  case ATTR_ELEMENT_MESH:
185  case ATTR_ELEMENT_VOXEL:
186  size = 1;
187  break;
188  case ATTR_ELEMENT_VERTEX:
189  if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) {
190  Mesh *mesh = static_cast<Mesh *>(geom);
191  size = mesh->get_verts().size() + mesh->get_num_ngons();
192  if (prim == ATTR_PRIM_SUBD) {
194  }
195  }
196  else if (geom->geometry_type == Geometry::POINTCLOUD) {
197  PointCloud *pointcloud = static_cast<PointCloud *>(geom);
198  size = pointcloud->num_points();
199  }
200  break;
202  if (geom->geometry_type == Geometry::MESH) {
203  Mesh *mesh = static_cast<Mesh *>(geom);
204  DCHECK_GT(mesh->get_motion_steps(), 0);
205  size = (mesh->get_verts().size() + mesh->get_num_ngons()) * (mesh->get_motion_steps() - 1);
206  if (prim == ATTR_PRIM_SUBD) {
207  size -= mesh->get_num_subd_verts() * (mesh->get_motion_steps() - 1);
208  }
209  }
210  else if (geom->geometry_type == Geometry::POINTCLOUD) {
211  PointCloud *pointcloud = static_cast<PointCloud *>(geom);
212  size = pointcloud->num_points() * (pointcloud->get_motion_steps() - 1);
213  }
214  break;
215  case ATTR_ELEMENT_FACE:
216  if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) {
217  Mesh *mesh = static_cast<Mesh *>(geom);
218  if (prim == ATTR_PRIM_GEOMETRY) {
219  size = mesh->num_triangles();
220  }
221  else {
222  size = mesh->get_num_subd_faces() + mesh->get_num_ngons();
223  }
224  }
225  break;
226  case ATTR_ELEMENT_CORNER:
228  if (geom->geometry_type == Geometry::MESH) {
229  Mesh *mesh = static_cast<Mesh *>(geom);
230  if (prim == ATTR_PRIM_GEOMETRY) {
231  size = mesh->num_triangles() * 3;
232  }
233  else {
234  size = mesh->get_subd_face_corners().size() + mesh->get_num_ngons();
235  }
236  }
237  break;
238  case ATTR_ELEMENT_CURVE:
239  if (geom->geometry_type == Geometry::HAIR) {
240  Hair *hair = static_cast<Hair *>(geom);
241  size = hair->num_curves();
242  }
243  break;
245  if (geom->geometry_type == Geometry::HAIR) {
246  Hair *hair = static_cast<Hair *>(geom);
247  size = hair->get_curve_keys().size();
248  }
249  break;
251  if (geom->geometry_type == Geometry::HAIR) {
252  Hair *hair = static_cast<Hair *>(geom);
253  DCHECK_GT(hair->get_motion_steps(), 0);
254  size = hair->get_curve_keys().size() * (hair->get_motion_steps() - 1);
255  }
256  break;
257  default:
258  break;
259  }
260 
261  return size;
262 }
263 
265 {
266  return element_size(geom, prim) * data_sizeof();
267 }
268 
269 bool Attribute::same_storage(TypeDesc a, TypeDesc b)
270 {
271  if (a == b)
272  return true;
273 
274  if (a == TypeDesc::TypeColor || a == TypeDesc::TypePoint || a == TypeDesc::TypeVector ||
275  a == TypeDesc::TypeNormal) {
276  if (b == TypeDesc::TypeColor || b == TypeDesc::TypePoint || b == TypeDesc::TypeVector ||
277  b == TypeDesc::TypeNormal) {
278  return true;
279  }
280  }
281  return false;
282 }
283 
284 void Attribute::zero_data(void *dst)
285 {
286  memset(dst, 0, data_sizeof());
287 }
288 
289 void Attribute::add_with_weight(void *dst, void *src, float weight)
290 {
292  for (int i = 0; i < 4; i++) {
293  ((uchar *)dst)[i] += uchar(((uchar *)src)[i] * weight);
294  }
295  }
296  else if (same_storage(type, TypeDesc::TypeFloat)) {
297  *((float *)dst) += *((float *)src) * weight;
298  }
299  else if (same_storage(type, TypeFloat2)) {
300  *((float2 *)dst) += *((float2 *)src) * weight;
301  }
302  else if (same_storage(type, TypeDesc::TypeVector)) {
303  *((float4 *)dst) += *((float4 *)src) * weight;
304  }
305  else {
306  assert(!"not implemented for this type");
307  }
308 }
309 
311 {
312  switch (std) {
314  return "N";
316  return "Ng";
317  case ATTR_STD_UV:
318  return "uv";
319  case ATTR_STD_GENERATED:
320  return "generated";
322  return "generated_transform";
323  case ATTR_STD_UV_TANGENT:
324  return "tangent";
326  return "tangent_sign";
328  return "vertex_color";
330  return "undeformed";
332  return "undisplaced";
334  return "motion_P";
336  return "motion_N";
337  case ATTR_STD_PARTICLE:
338  return "particle";
340  return "curve_intercept";
342  return "curve_length";
344  return "curve_random";
346  return "point_random";
348  return "ptex_face_id";
349  case ATTR_STD_PTEX_UV:
350  return "ptex_uv";
352  return "density";
354  return "color";
356  return "flame";
358  return "heat";
360  return "temperature";
362  return "velocity";
364  return "velocity_x";
366  return "velocity_y";
368  return "velocity_z";
369  case ATTR_STD_POINTINESS:
370  return "pointiness";
372  return "random_per_island";
374  return "shadow_transparency";
375  case ATTR_STD_NOT_FOUND:
376  case ATTR_STD_NONE:
377  case ATTR_STD_NUM:
378  return "";
379  }
380 
381  return "";
382 }
383 
385 {
386  if (name) {
387  for (int std = ATTR_STD_NONE; std < ATTR_STD_NUM; std++) {
388  if (strcmp(name, Attribute::standard_name((AttributeStandard)std)) == 0) {
389  return (AttributeStandard)std;
390  }
391  }
392  }
393 
394  return ATTR_STD_NONE;
395 }
396 
398 {
399  if (attr.element == ATTR_ELEMENT_CORNER) {
401  }
402 
403  if (attr.type == TypeDesc::TypeFloat) {
405  }
406 
407  if (attr.type == TypeFloat2) {
409  }
410 
411  if (attr.type == TypeFloat4 || attr.type == TypeRGBA || attr.type == TypeDesc::TypeMatrix) {
413  }
414 
416 }
417 
419  AttributePrimitive prim,
420  unordered_set<int> &tiles) const
421 {
422  if (type != TypeFloat2) {
423  return;
424  }
425 
426  const int num = element_size(geom, prim);
427  const float2 *uv = data_float2();
428  for (int i = 0; i < num; i++, uv++) {
429  float u = uv->x, v = uv->y;
430  int x = (int)u, y = (int)v;
431 
432  if (x < 0 || y < 0 || x >= 10) {
433  continue;
434  }
435 
436  /* Be conservative in corners - precisely touching the right or upper edge of a tile
437  * should not load its right/upper neighbor as well. */
438  if (x > 0 && (u < x + 1e-6f)) {
439  x--;
440  }
441  if (y > 0 && (v < y + 1e-6f)) {
442  y--;
443  }
444 
445  tiles.insert(1001 + 10 * y + x);
446  }
447 }
448 
449 /* Attribute Set */
450 
452  : modified_flag(~0u), geometry(geometry), prim(prim)
453 {
454 }
455 
457 {
458 }
459 
461 {
462  Attribute *attr = find(name);
463 
464  if (attr) {
465  /* return if same already exists */
466  if (attr->type == type && attr->element == element)
467  return attr;
468 
469  /* overwrite attribute with same name but different type/element */
470  remove(name);
471  }
472 
473  Attribute new_attr(name, type, element, geometry, prim);
474  attributes.emplace_back(std::move(new_attr));
475  tag_modified(attributes.back());
476  return &attributes.back();
477 }
478 
479 Attribute *AttributeSet::find(ustring name) const
480 {
481  foreach (const Attribute &attr, attributes)
482  if (attr.name == name)
483  return (Attribute *)&attr;
484 
485  return NULL;
486 }
487 
488 void AttributeSet::remove(ustring name)
489 {
490  Attribute *attr = find(name);
491 
492  if (attr) {
493  list<Attribute>::iterator it;
494 
495  for (it = attributes.begin(); it != attributes.end(); it++) {
496  if (&*it == attr) {
497  remove(it);
498  return;
499  }
500  }
501  }
502 }
503 
505 {
506  Attribute *attr = NULL;
507 
508  if (name == ustring())
510 
512  switch (std) {
514  attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX);
515  break;
517  attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE);
518  break;
519  case ATTR_STD_UV:
520  attr = add(name, TypeFloat2, ATTR_ELEMENT_CORNER);
521  break;
522  case ATTR_STD_UV_TANGENT:
523  attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CORNER);
524  break;
526  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CORNER);
527  break;
529  attr = add(name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
530  break;
531  case ATTR_STD_GENERATED:
534  attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
535  break;
537  attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX_MOTION);
538  break;
540  attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX_MOTION);
541  break;
543  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_FACE);
544  break;
545  case ATTR_STD_PTEX_UV:
546  attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
547  break;
549  attr = add(name, TypeDesc::TypeMatrix, ATTR_ELEMENT_MESH);
550  break;
551  case ATTR_STD_POINTINESS:
552  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VERTEX);
553  break;
555  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_FACE);
556  break;
557  default:
558  assert(0);
559  break;
560  }
561  }
563  switch (std) {
564  case ATTR_STD_UV:
565  attr = add(name, TypeFloat2, ATTR_ELEMENT_VERTEX);
566  break;
567  case ATTR_STD_GENERATED:
568  attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
569  break;
571  attr = add(name, TypeDesc::TypeFloat4, ATTR_ELEMENT_VERTEX_MOTION);
572  break;
574  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VERTEX);
575  break;
577  attr = add(name, TypeDesc::TypeMatrix, ATTR_ELEMENT_MESH);
578  break;
579  default:
580  assert(0);
581  break;
582  }
583  }
584  else if (geometry->geometry_type == Geometry::VOLUME) {
585  switch (std) {
587  attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX);
588  break;
590  attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE);
591  break;
599  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VOXEL);
600  break;
602  attr = add(name, TypeDesc::TypeColor, ATTR_ELEMENT_VOXEL);
603  break;
605  attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_VOXEL);
606  break;
607  default:
608  assert(0);
609  break;
610  }
611  }
612  else if (geometry->geometry_type == Geometry::HAIR) {
613  switch (std) {
614  case ATTR_STD_UV:
615  attr = add(name, TypeFloat2, ATTR_ELEMENT_CURVE);
616  break;
617  case ATTR_STD_GENERATED:
618  attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
619  break;
621  attr = add(name, TypeDesc::TypeFloat4, ATTR_ELEMENT_CURVE_KEY_MOTION);
622  break;
624  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
625  break;
627  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE);
628  break;
630  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE);
631  break;
633  attr = add(name, TypeDesc::TypeMatrix, ATTR_ELEMENT_MESH);
634  break;
635  case ATTR_STD_POINTINESS:
636  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VERTEX);
637  break;
639  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_FACE);
640  break;
642  attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
643  break;
644  default:
645  assert(0);
646  break;
647  }
648  }
649 
650  attr->std = std;
651 
652  return attr;
653 }
654 
656 {
657  foreach (const Attribute &attr, attributes)
658  if (attr.std == std)
659  return (Attribute *)&attr;
660 
661  return NULL;
662 }
663 
665 {
666  for (Attribute &attr : attributes) {
667  if (attr.name != other.name) {
668  continue;
669  }
670  if (attr.std != other.std) {
671  continue;
672  }
673  if (attr.type != other.type) {
674  continue;
675  }
676  if (attr.element != other.element) {
677  continue;
678  }
679  return &attr;
680  }
681  return nullptr;
682 }
683 
685 {
686  Attribute *attr = find(std);
687 
688  if (attr) {
689  list<Attribute>::iterator it;
690 
691  for (it = attributes.begin(); it != attributes.end(); it++) {
692  if (&*it == attr) {
693  remove(it);
694  return;
695  }
696  }
697  }
698 }
699 
701 {
702  if (req.std == ATTR_STD_NONE)
703  return find(req.name);
704  else
705  return find(req.std);
706 }
707 
709 {
710  if (attribute->std == ATTR_STD_NONE) {
711  remove(attribute->name);
712  }
713  else {
714  remove(attribute->std);
715  }
716 }
717 
718 void AttributeSet::remove(list<Attribute>::iterator it)
719 {
720  tag_modified(*it);
721  attributes.erase(it);
722 }
723 
724 void AttributeSet::resize(bool reserve_only)
725 {
726  foreach (Attribute &attr, attributes) {
727  attr.resize(geometry, prim, reserve_only);
728  }
729 }
730 
731 void AttributeSet::clear(bool preserve_voxel_data)
732 {
733  if (preserve_voxel_data) {
734  list<Attribute>::iterator it;
735 
736  for (it = attributes.begin(); it != attributes.end();) {
737  if (it->element == ATTR_ELEMENT_VOXEL || it->std == ATTR_STD_GENERATED_TRANSFORM) {
738  it++;
739  }
740  else {
741  attributes.erase(it++);
742  }
743  }
744  }
745  else {
746  attributes.clear();
747  }
748 }
749 
750 void AttributeSet::update(AttributeSet &&new_attributes)
751 {
752  /* Remove any attributes not on new_attributes. */
753  list<Attribute>::iterator it;
754  for (it = attributes.begin(); it != attributes.end();) {
755  const Attribute &old_attr = *it;
756  if (new_attributes.find_matching(old_attr) == nullptr) {
757  remove(it++);
758  continue;
759  }
760  it++;
761  }
762 
763  /* Add or update old_attributes based on the new_attributes. */
764  foreach (Attribute &attr, new_attributes.attributes) {
765  Attribute *nattr = add(attr.name, attr.type, attr.element);
766  nattr->std = attr.std;
767  nattr->set_data_from(std::move(attr));
768  }
769 
770  /* If all attributes were replaced, transform is no longer applied. */
771  geometry->transform_applied = false;
772 }
773 
775 {
776  foreach (Attribute &attr, attributes) {
777  attr.modified = false;
778  }
779 
780  modified_flag = 0;
781 }
782 
783 void AttributeSet::tag_modified(const Attribute &attr)
784 {
785  /* Some attributes are not stored in the various kernel attribute arrays
786  * (DeviceScene::attribute_*), so the modified flags are only set if the associated standard
787  * corresponds to an attribute which will be stored in the kernel's attribute arrays. */
788  const bool modifies_device_array = (attr.std != ATTR_STD_FACE_NORMAL &&
789  attr.std != ATTR_STD_VERTEX_NORMAL);
790 
791  if (modifies_device_array) {
792  AttrKernelDataType kernel_type = Attribute::kernel_type(attr);
793  modified_flag |= (1u << kernel_type);
794  }
795 }
796 
798 {
799  return (modified_flag & (1u << kernel_type)) != 0;
800 }
801 
802 /* AttributeRequest */
803 
805 {
806  name = name_;
807  std = ATTR_STD_NONE;
808 
809  type = TypeDesc::TypeFloat;
811  desc.offset = 0;
813 
814  subd_type = TypeDesc::TypeFloat;
816  subd_desc.offset = 0;
818 }
819 
821 {
822  name = ustring();
823  std = std_;
824 
825  type = TypeDesc::TypeFloat;
827  desc.offset = 0;
829 
830  subd_type = TypeDesc::TypeFloat;
832  subd_desc.offset = 0;
834 }
835 
836 /* AttributeRequestSet */
837 
839 {
840 }
841 
843 {
844 }
845 
847 {
848  if (requests.size() != other.requests.size())
849  return true;
850 
851  for (size_t i = 0; i < requests.size(); i++) {
852  bool found = false;
853 
854  for (size_t j = 0; j < requests.size() && !found; j++)
855  if (requests[i].name == other.requests[j].name && requests[i].std == other.requests[j].std) {
856  found = true;
857  }
858 
859  if (!found) {
860  return true;
861  }
862  }
863 
864  return false;
865 }
866 
867 void AttributeRequestSet::add(ustring name)
868 {
869  foreach (AttributeRequest &req, requests) {
870  if (req.name == name) {
871  return;
872  }
873  }
874 
875  requests.push_back(AttributeRequest(name));
876 }
877 
879 {
880  foreach (AttributeRequest &req, requests)
881  if (req.std == std)
882  return;
883 
884  requests.push_back(AttributeRequest(std));
885 }
886 
888 {
889  foreach (AttributeRequest &req, reqs.requests) {
890  if (req.std == ATTR_STD_NONE)
891  add(req.name);
892  else
893  add(req.std);
894  }
895 }
896 
898 {
899  if (name.empty()) {
900  return;
901  }
902 
904 
905  if (std) {
906  add(std);
907  }
908  else {
909  add(name);
910  }
911 }
912 
913 bool AttributeRequestSet::find(ustring name)
914 {
915  foreach (AttributeRequest &req, requests)
916  if (req.name == name)
917  return true;
918 
919  return false;
920 }
921 
923 {
924  foreach (AttributeRequest &req, requests)
925  if (req.std == std)
926  return true;
927 
928  return false;
929 }
930 
932 {
933  return requests.size();
934 }
935 
937 {
938  requests.clear();
939 }
940 
typedef float(TangentPoint)[2]
unsigned char uchar
Definition: BLI_sys_types.h:70
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_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
float float4[4]
float float2[2]
float float3[3]
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
vector< AttributeRequest > requests
bool find(ustring name)
void add(ustring name)
bool modified(const AttributeRequestSet &other)
void add_standard(ustring name)
AttributeRequest(ustring name_)
AttributeDescriptor subd_desc
AttributeDescriptor desc
AttributeStandard std
Geometry * geometry
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
void update(AttributeSet &&new_attributes)
list< Attribute > attributes
Attribute * find(ustring name) const
Attribute * find_matching(const Attribute &other)
bool modified(AttrKernelDataType kernel_type) const
void remove(ustring name)
AttributeSet(Geometry *geometry, AttributePrimitive prim)
void resize(bool reserve_only=false)
void clear(bool preserve_voxel_data=false)
AttributePrimitive prim
ImageHandle & data_voxel()
AttributeElement element
static bool same_storage(TypeDesc a, TypeDesc b)
void add_with_weight(void *dst, void *src, float weight)
static AttrKernelDataType kernel_type(const Attribute &attr)
static AttributeStandard name_standard(const char *name)
TypeDesc type
void resize(Geometry *geom, AttributePrimitive prim, bool reserve_only)
size_t element_size(Geometry *geom, AttributePrimitive prim) const
void get_uv_tiles(Geometry *geom, AttributePrimitive prim, unordered_set< int > &tiles) const
char * data()
vector< char > buffer
void set_data_from(Attribute &&other)
void zero_data(void *dst)
Attribute(ustring name, TypeDesc type, AttributeElement element, Geometry *geom, AttributePrimitive prim)
static const char * standard_name(AttributeStandard std)
size_t buffer_size(Geometry *geom, AttributePrimitive prim) const
AttributeStandard std
ustring name
size_t data_sizeof() const
void add(const float &f)
float2 * data_float2()
Type geometry_type
bool transform_applied
Definition: hair.h:13
size_t num_curves() const
Definition: hair.h:123
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
SyclQueue void void * src
CCL_NAMESPACE_BEGIN struct Transform Transform
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
@ NODE_ATTR_FLOAT
AttributeStandard
Definition: kernel/types.h:612
@ ATTR_STD_CURVE_INTERCEPT
Definition: kernel/types.h:627
@ ATTR_STD_GENERATED_TRANSFORM
Definition: kernel/types.h:621
@ ATTR_STD_UV
Definition: kernel/types.h:616
@ ATTR_STD_MOTION_VERTEX_NORMAL
Definition: kernel/types.h:625
@ ATTR_STD_VOLUME_VELOCITY_Y
Definition: kernel/types.h:640
@ ATTR_STD_VOLUME_TEMPERATURE
Definition: kernel/types.h:637
@ ATTR_STD_VERTEX_NORMAL
Definition: kernel/types.h:614
@ ATTR_STD_UV_TANGENT
Definition: kernel/types.h:617
@ ATTR_STD_NOT_FOUND
Definition: kernel/types.h:647
@ ATTR_STD_NONE
Definition: kernel/types.h:613
@ ATTR_STD_VOLUME_VELOCITY_Z
Definition: kernel/types.h:641
@ ATTR_STD_POINT_RANDOM
Definition: kernel/types.h:630
@ ATTR_STD_VERTEX_COLOR
Definition: kernel/types.h:619
@ ATTR_STD_VOLUME_DENSITY
Definition: kernel/types.h:633
@ ATTR_STD_NUM
Definition: kernel/types.h:645
@ ATTR_STD_POSITION_UNDISPLACED
Definition: kernel/types.h:623
@ ATTR_STD_VOLUME_FLAME
Definition: kernel/types.h:635
@ ATTR_STD_PTEX_FACE_ID
Definition: kernel/types.h:631
@ ATTR_STD_VOLUME_VELOCITY
Definition: kernel/types.h:638
@ ATTR_STD_POSITION_UNDEFORMED
Definition: kernel/types.h:622
@ ATTR_STD_VOLUME_COLOR
Definition: kernel/types.h:634
@ ATTR_STD_MOTION_VERTEX_POSITION
Definition: kernel/types.h:624
@ ATTR_STD_VOLUME_HEAT
Definition: kernel/types.h:636
@ ATTR_STD_UV_TANGENT_SIGN
Definition: kernel/types.h:618
@ ATTR_STD_CURVE_RANDOM
Definition: kernel/types.h:629
@ ATTR_STD_SHADOW_TRANSPARENCY
Definition: kernel/types.h:644
@ ATTR_STD_FACE_NORMAL
Definition: kernel/types.h:615
@ ATTR_STD_PTEX_UV
Definition: kernel/types.h:632
@ ATTR_STD_POINTINESS
Definition: kernel/types.h:642
@ ATTR_STD_GENERATED
Definition: kernel/types.h:620
@ ATTR_STD_CURVE_LENGTH
Definition: kernel/types.h:628
@ ATTR_STD_VOLUME_VELOCITY_X
Definition: kernel/types.h:639
@ ATTR_STD_RANDOM_PER_ISLAND
Definition: kernel/types.h:643
@ ATTR_STD_PARTICLE
Definition: kernel/types.h:626
@ ATTR_FINAL_SIZE
Definition: kernel/types.h:651
AttributeElement
Definition: kernel/types.h:597
@ ATTR_ELEMENT_NONE
Definition: kernel/types.h:598
@ ATTR_ELEMENT_CORNER_BYTE
Definition: kernel/types.h:605
@ ATTR_ELEMENT_CURVE_KEY
Definition: kernel/types.h:607
@ ATTR_ELEMENT_CURVE_KEY_MOTION
Definition: kernel/types.h:608
@ ATTR_ELEMENT_VOXEL
Definition: kernel/types.h:609
@ ATTR_ELEMENT_CORNER
Definition: kernel/types.h:604
@ ATTR_ELEMENT_OBJECT
Definition: kernel/types.h:599
@ ATTR_ELEMENT_VERTEX_MOTION
Definition: kernel/types.h:603
@ ATTR_ELEMENT_VERTEX
Definition: kernel/types.h:602
@ ATTR_ELEMENT_FACE
Definition: kernel/types.h:601
@ ATTR_ELEMENT_MESH
Definition: kernel/types.h:600
@ ATTR_ELEMENT_CURVE
Definition: kernel/types.h:606
AttributePrimitive
Definition: kernel/types.h:590
@ ATTR_PRIM_SUBD
Definition: kernel/types.h:592
@ ATTR_PRIM_GEOMETRY
Definition: kernel/types.h:591
#define DCHECK_GT(a, b)
Definition: log.h:65
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static constexpr TypeDesc TypeRGBA(TypeDesc::FLOAT, TypeDesc::VEC4, TypeDesc::COLOR)
CCL_NAMESPACE_BEGIN static constexpr OIIO_NAMESPACE_USING TypeDesc TypeFloat2(TypeDesc::FLOAT, TypeDesc::VEC2)
AttrKernelDataType
@ FLOAT4
@ FLOAT2
@ UCHAR4
@ FLOAT3
@ FLOAT
AttributeElement element
Definition: kernel/types.h:656
NodeAttributeType type
Definition: kernel/types.h:657
size_t get_num_subd_faces() const
Definition: scene/mesh.h:232
float size[3]
size_t num_triangles() const
Definition: scene/mesh.h:79
size_t get_num_subd_verts()
Definition: scene/mesh.h:242
size_t num_points() const
float x
Definition: types_float2.h:15
float y
Definition: types_float2.h:15