27 type == TypeNormal ||
type == TypeMatrix ||
type == TypeFloat2 ||
type == TypeFloat4 ||
71 char *
data = (
char *)&f;
72 const size_t size =
sizeof(f);
74 for (
size_t i = 0;
i <
size;
i++) {
85 char *
data = (
char *)&f;
86 const size_t size =
sizeof(f);
88 for (
size_t i = 0;
i <
size;
i++) {
99 char *
data = (
char *)&f;
100 const size_t size =
sizeof(f);
102 for (
size_t i = 0;
i <
size;
i++) {
113 char *
data = (
char *)&f;
114 const size_t size =
sizeof(f);
116 for (
size_t i = 0;
i <
size;
i++) {
127 char *
data = (
char *)&f;
128 const size_t size =
sizeof(f);
130 for (
size_t i = 0;
i <
size;
i++) {
141 for (
size_t i = 0;
i <
size;
i++) {
154 this->
flags = other.flags;
156 if (this->
buffer.size() != other.buffer.size()) {
157 this->
buffer = std::move(other.buffer);
160 else if (memcmp(this->
data(), other.data(), other.buffer.size()) != 0) {
161 this->
buffer = std::move(other.buffer);
174 if (
type == TypeFloat) {
175 return sizeof(
float);
177 if (
type == TypeFloat2) {
180 if (
type == TypeMatrix) {
185 if (
type == TypeFloat4) {
206 Mesh *mesh =
static_cast<Mesh *
>(geom);
211 size = mesh->get_verts().size();
221 Mesh *mesh =
static_cast<Mesh *
>(geom);
227 size = mesh->get_verts().size() * (mesh->get_motion_steps() - 1);
232 size = pointcloud->
num_points() * (pointcloud->get_motion_steps() - 1);
237 Mesh *mesh =
static_cast<Mesh *
>(geom);
249 Mesh *mesh =
static_cast<Mesh *
>(geom);
251 size = mesh->get_subd_face_corners().size();
260 Hair *hair =
static_cast<Hair *
>(geom);
266 Hair *hair =
static_cast<Hair *
>(geom);
267 size = hair->get_curve_keys().size();
272 Hair *hair =
static_cast<Hair *
>(geom);
274 size = hair->get_curve_keys().size() * (hair->get_motion_steps() - 1);
295 if (a == TypeColor || a == TypePoint || a == TypeVector || a == TypeNormal) {
296 if (
b == TypeColor ||
b == TypePoint ||
b == TypeVector ||
b == TypeNormal) {
318 return "generated_transform";
322 return "tangent_sign";
324 return "undisplaced_tangent";
326 return "undisplaced_tangent_sign";
328 return "vertex_color";
332 return "undisplaced";
334 return "undisplaced_N";
342 return "curve_intercept";
344 return "curve_length";
346 return "curve_random";
348 return "point_random";
350 return "ptex_face_id";
362 return "temperature";
374 return "random_per_island";
376 return "shadow_transparency";
405 if (attr.
type == TypeFloat) {
409 if (attr.
type == TypeFloat2) {
422 unordered_set<int> &
tiles)
const
424 if (
type != TypeFloat2) {
430 for (
int i = 0;
i <
num;
i++, uv++) {
431 const float u = uv->
x;
432 const float v = uv->
y;
442 if (
x > 0 && (u <
x + 1e-6f)) {
445 if (
y > 0 && (
v <
y + 1e-6f)) {
449 tiles.insert(1001 + 10 *
y +
x);
485 if (attr.name ==
name) {
498 list<Attribute>::iterator it;
568 else if (
geometry->is_pointcloud()) {
671 if (attr.std == std) {
682 if (attr.name != other.
name) {
685 if (attr.std != other.
std) {
688 if (attr.type != other.
type) {
691 if (attr.element != other.
element) {
704 list<Attribute>::iterator it;
748 if (preserve_voxel_data) {
749 list<Attribute>::iterator it;
768 list<Attribute>::iterator it;
771 if (new_attributes.find_matching(old_attr) ==
nullptr) {
779 for (
Attribute &attr : new_attributes.attributes) {
786 geometry->transform_applied =
false;
792 attr.modified =
false;
798void AttributeSet::tag_modified(
const Attribute &attr)
805 if (modifies_device_array) {
807 modified_flag |= (1u << kernel_type);
813 return (modified_flag & (1u << kernel_type)) != 0;
855 for (
size_t j = 0; j <
requests.size() && !found; j++) {
872 if (req.name ==
name) {
883 if (req.std == std) {
922 if (req.name ==
name) {
933 if (req.std == std) {
ATTR_WARN_UNUSED_RESULT const size_t num
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
vector< AttributeRequest > requests
bool modified(const AttributeRequestSet &other)
void add_standard(ustring name)
AttributeRequest(ustring name_)
void update(AttributeSet &&new_attributes)
Attribute & copy(const Attribute &attr)
list< Attribute > attributes
Attribute * find(ustring name) const
Attribute * find_matching(const Attribute &other)
bool modified(AttrKernelDataType kernel_type) const
Attribute * add(ustring name, const TypeDesc type, AttributeElement element)
void remove(ustring name)
AttributeSet(Geometry *geometry, AttributePrimitive prim)
void resize(bool reserve_only=false)
void clear(bool preserve_voxel_data=false)
bool is_pointcloud() const
size_t num_curves() const
#define CCL_NAMESPACE_END
#define assert(assertion)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
@ ATTR_STD_CURVE_INTERCEPT
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_MOTION_VERTEX_NORMAL
@ ATTR_STD_VOLUME_VELOCITY_Y
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VOLUME_VELOCITY_Z
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_POSITION_UNDISPLACED
@ ATTR_STD_VOLUME_VELOCITY
@ ATTR_STD_POSITION_UNDEFORMED
@ ATTR_STD_MOTION_VERTEX_POSITION
@ ATTR_STD_NORMAL_UNDISPLACED
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_UV_TANGENT_SIGN_UNDISPLACED
@ ATTR_STD_SHADOW_TRANSPARENCY
@ ATTR_STD_UV_TANGENT_UNDISPLACED
@ ATTR_STD_VOLUME_VELOCITY_X
@ ATTR_STD_RANDOM_PER_ISLAND
@ ATTR_ELEMENT_CORNER_BYTE
@ ATTR_ELEMENT_CURVE_KEY_MOTION
@ ATTR_ELEMENT_VERTEX_MOTION
static constexpr TypeDesc TypeRGBA(TypeDesc::FLOAT, TypeDesc::VEC4, TypeDesc::COLOR)
Attribute(ustring name, const TypeDesc type, AttributeElement element, Geometry *geom, AttributePrimitive prim)
static AttrKernelDataType kernel_type(const Attribute &attr)
static AttributeStandard name_standard(const char *name)
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
void set_data_from(Attribute &&other)
void zero_data(void *dst)
static const char * standard_name(AttributeStandard std)
size_t buffer_size(Geometry *geom, AttributePrimitive prim) const
ImageHandle & data_voxel()
size_t data_sizeof() const
static bool same_storage(const TypeDesc a, const TypeDesc b)
size_t get_num_subd_faces() const
size_t get_num_subd_base_verts() const
size_t num_triangles() const
size_t num_points() const