24 assert(
type == TypeFloat ||
type == TypeColor ||
type == TypePoint ||
type == TypeVector ||
69 char *
data = (
char *)&f;
70 size_t size =
sizeof(f);
72 for (
size_t i = 0; i <
size; i++) {
83 char *
data = (
char *)&f;
84 size_t size =
sizeof(f);
86 for (
size_t i = 0; i <
size; i++) {
97 char *
data = (
char *)&f;
98 size_t size =
sizeof(f);
100 for (
size_t i = 0; i <
size; i++) {
111 char *
data = (
char *)&f;
112 size_t size =
sizeof(f);
114 for (
size_t i = 0; i <
size; i++) {
125 char *
data = (
char *)&f;
126 size_t size =
sizeof(f);
128 for (
size_t i = 0; i <
size; i++) {
139 for (
size_t i = 0; i <
size; i++) {
148 assert(other.std ==
std);
149 assert(other.type ==
type);
150 assert(other.element ==
element);
152 this->
flags = other.flags;
154 if (this->
buffer.size() != other.buffer.size()) {
155 this->
buffer = std::move(other.buffer);
158 else if (memcmp(this->
data(), other.data(), other.buffer.size()) != 0) {
159 this->
buffer = std::move(other.buffer);
172 else if (
type == TypeFloat) {
173 return sizeof(
float);
178 else if (
type == TypeMatrix) {
183 else if (
type == TypeFloat4) {
210 Mesh *mesh =
static_cast<Mesh *
>(geom);
211 size = mesh->get_verts().size() + mesh->get_num_ngons();
223 Mesh *mesh =
static_cast<Mesh *
>(geom);
225 size = (mesh->get_verts().
size() + mesh->get_num_ngons()) * (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);
254 size = mesh->get_subd_face_corners().size() + mesh->get_num_ngons();
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) {
311 for (
int i = 0; i < 4; i++) {
316 *((
float *)dst) += *((
float *)src) * weight;
326 assert(!
"not implemented for this type");
342 return "generated_transform";
346 return "tangent_sign";
348 return "vertex_color";
352 return "undisplaced";
360 return "curve_intercept";
362 return "curve_length";
364 return "curve_random";
366 return "point_random";
368 return "ptex_face_id";
380 return "temperature";
392 return "random_per_island";
394 return "shadow_transparency";
423 if (attr.
type == TypeFloat) {
440 unordered_set<int> &
tiles)
const
448 for (
int i = 0; i < num; i++, uv++) {
449 float u = uv->
x,
v = uv->
y;
450 int x = (
int)u,
y = (
int)
v;
458 if (
x > 0 && (u <
x + 1e-6f)) {
461 if (
y > 0 && (
v <
y + 1e-6f)) {
465 tiles.insert(1001 + 10 *
y +
x);
501 if (attr.
name == name) {
513 list<Attribute>::iterator it;
528 if (name == ustring()) {
682 if (attr.
std == std) {
692 if (attr.name != other.
name) {
695 if (attr.std != other.
std) {
698 if (attr.type != other.
type) {
701 if (attr.element != other.
element) {
714 list<Attribute>::iterator it;
760 if (preserve_voxel_data) {
761 list<Attribute>::iterator it;
780 list<Attribute>::iterator it;
783 if (new_attributes.find_matching(old_attr) ==
nullptr) {
791 foreach (
Attribute &attr, new_attributes.attributes) {
798 geometry->transform_applied =
false;
810void AttributeSet::tag_modified(
const Attribute &attr)
818 if (modifies_device_array) {
820 modified_flag |= (1u << kernel_type);
826 return (modified_flag & (1u << kernel_type)) != 0;
875 for (
size_t i = 0; i <
requests.size(); i++) {
878 for (
size_t j = 0; j <
requests.size() && !found; j++) {
895 if (req.
name == name) {
906 if (req.
std == std) {
944 if (req.
name == name) {
954 if (req.
std == std) {
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 Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture 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)
vector< AttributeRequest > requests
bool modified(const AttributeRequestSet &other)
void add_standard(ustring name)
AttributeRequest(ustring name_)
AttributeDescriptor subd_desc
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)
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)
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)
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
ImageHandle & data_voxel()
size_t data_sizeof() const
size_t num_curves() const
local_group_size(16, 16) .push_constant(Type b
#define CCL_NAMESPACE_END
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
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_UV_TANGENT_SIGN
@ ATTR_STD_SHADOW_TRANSPARENCY
@ 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)
CCL_NAMESPACE_BEGIN static OIIO_NAMESPACE_USING constexpr TypeDesc TypeFloat2(TypeDesc::FLOAT, TypeDesc::VEC2)
size_t get_num_subd_faces() const
size_t num_triangles() const
size_t get_num_subd_verts()
size_t num_points() const
VecBase< float, 4 > float4