34 for (
Node *node : used_shaders) {
50 for (
Node *node : used_shaders) {
64 for (
Node *node : used_shaders) {
90 attr_map[index].
id = id;
94 if (type == TypeFloat) {
97 else if (type == TypeMatrix) {
100 else if (type == TypeFloat2) {
103 else if (type == TypeFloat4) {
119 const uint chain_link)
123 attr_map[index + j].
element = chain;
124 attr_map[index + j].
offset = chain ? chain_link + j : 0;
125 attr_map[index + j].
type = 0;
149 size_t attr_map_size = 0;
155 size_t attr_count = 0;
169 attr_count = geom_attributes[
i].size();
179 if (object_attributes[
i].
size() == 0) {
180 object->attr_map_offset = 0;
183 object->attr_map_offset = attr_map_size;
188 if (attr_map_size == 0) {
237 if (attributes.
size() > 0) {
238 size_t index =
object->attr_map_offset;
272 template<
typename U>
size_t add(
const U *attr_data,
const size_t attr_size,
const bool modified)
275 size_t start_offset =
offset;
315 if (mattr ==
nullptr) {
330 int &offset = desc.
offset;
340 else if (mattr->
type == TypeFloat) {
343 else if (mattr->
type == TypeFloat2) {
346 else if (mattr->
type == TypeMatrix) {
359 Mesh *mesh =
static_cast<Mesh *
>(geom);
374 Hair *hair =
static_cast<Hair *
>(geom);
397 if (mattr ==
nullptr) {
409 else if (mattr->
type == TypeFloat) {
412 else if (mattr->
type == TypeFloat2) {
415 else if (mattr->
type == TypeMatrix) {
450 progress.
set_status(
"Updating Mesh",
"Computing attributes");
463 for (
Node *node : geom->get_used_shaders()) {
477 object_attribute_values.reserve(scene->
objects.
size());
482 const size_t geom_idx = geom->
index;
484 assert(geom_idx < scene->geometry.size() && scene->
geometry[geom_idx] == geom);
492 for (
size_t j = 0; j <
object->attributes.size(); j++) {
493 const ParamValue ¶m =
object->attributes[j];
497 attributes.
add(param.name());
501 memcpy(attr->
buffer.data(), param.data(), param.datasize());
527 for (
Attribute &attr : object_attribute_values[
i].attributes) {
598 progress.
set_status(
"Updating Mesh",
"Copying Attributes to device");
608 scene->
object_manager->device_update_geom_offsets(device, dscene, scene);
ATTR_WARN_UNUSED_RESULT const void * element
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
vector< AttributeRequest > requests
Attribute * find(ustring name) const
Attribute * add(ustring name, const TypeDesc type, AttributeElement element)
void add(Geometry *geom, Attribute *mattr, AttributePrimitive prim, TypeDesc &type, AttributeDescriptor &desc)
AttributeTableEntry< packed_float3 > attr_float3
AttributeTableEntry< float2 > attr_float2
void copy_to_device_if_modified()
AttributeTableBuilder(DeviceScene *dscene)
void reserve(Geometry *geom, Attribute *mattr, AttributePrimitive prim)
AttributeTableEntry< uchar4 > attr_uchar4
AttributeTableEntry< float > attr_float
AttributeTableEntry< float4 > attr_float4
device_vector< float4 > attributes_float4
device_vector< float2 > attributes_float2
device_vector< AttributeMap > attributes_map
device_vector< packed_float3 > attributes_float3
device_vector< float > attributes_float
device_vector< uchar4 > attributes_uchar4
void device_update_attributes(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)
void update_osl_globals(Device *device, Scene *scene)
void update_svm_attributes(Device *device, DeviceScene *dscene, Scene *scene, vector< AttributeRequestSet > &geom_attributes, vector< AttributeRequestSet > &object_attributes)
bool has_voxel_attributes() const
bool is_pointcloud() const
AttributeRequestSet needed_attributes()
bool need_attribute(Scene *scene, AttributeStandard std)
bool need_shadow_transparency()
int svm_slot(const int slot_index=0) const
void set_status(const string &status_, const string &substatus_="")
AttributeRequestSet attributes
T * alloc(const size_t width, const size_t height=0)
#define CCL_NAMESPACE_END
static void emit_attribute_mapping(AttributeMap *attr_map, const size_t index, const uint64_t id, AttributeRequest &req)
static void emit_attribute_map_terminator(AttributeMap *attr_map, const size_t index, const bool chain, const uint chain_link)
static void emit_attribute_map_entry(AttributeMap *attr_map, const size_t index, const uint64_t id, const TypeDesc type, const AttributeDescriptor &desc)
#define assert(assertion)
@ ATTR_STD_SHADOW_TRANSPARENCY
@ ATTR_ELEMENT_CORNER_BYTE
@ ATTR_ELEMENT_CURVE_KEY_MOTION
@ ATTR_ELEMENT_VERTEX_MOTION
ccl_device_inline uint as_uint(const int i)
static constexpr TypeDesc TypeRGBA(TypeDesc::FLOAT, TypeDesc::VEC4, TypeDesc::COLOR)
size_t add(const U *attr_data, const size_t attr_size, const bool modified)
void reserve(const size_t attr_size)
device_vector< T > & data
static AttrKernelDataType kernel_type(const Attribute &attr)
size_t element_size(Geometry *geom, AttributePrimitive prim) const
ImageHandle & data_voxel()
Transform * data_transform()
Node(const NodeType *type, ustring name=ustring())
unique_ptr< ObjectManager > object_manager
bool need_global_attribute(AttributeStandard std)
void need_global_attributes(AttributeRequestSet &attributes)
unique_ptr_vector< Geometry > geometry
unique_ptr< ShaderManager > shader_manager
unique_ptr_vector< Object > objects