29 if (tokens.size() % VECTOR_SIZE != 0) {
33 value.resize(tokens.size() / VECTOR_SIZE);
34 for (
size_t i = 0; i < value.size(); i++) {
35 float *value_float = (
float *)&value[i];
37 for (
size_t j = 0; j < VECTOR_SIZE; j++) {
38 value_float[j] = (
float)atof(tokens[i * VECTOR_SIZE + j].c_str());
45 xml_attribute name_attr = xml_node.attribute(
"name");
47 node->name = ustring(name_attr.value());
58 xml_attribute attr = xml_node.attribute(socket.
name.c_str());
64 switch (socket.
type) {
74 value.
resize(tokens.size());
75 for (
size_t i = 0; i < value.size(); i++) {
78 node->set(socket, value);
82 node->set(socket, (
float)atof(attr.value()));
88 node->set(socket, value);
92 node->set(socket, (
int)atoi(attr.value()));
96 node->set(socket, (
uint)atoi(attr.value()));
100 node->set(socket, (
uint64_t)strtoull(attr.value(),
nullptr, 10));
108 value.
resize(tokens.size());
109 for (
size_t i = 0; i < value.size(); i++) {
110 value[i] = (
int)atoi(attr.value());
112 node->set(socket, value);
121 if (value.size() == 1) {
122 node->set(socket, value[0]);
132 node->set(socket, value);
138 if (value.size() == 1) {
139 node->set(socket, value[0]);
146 node->set(socket, value);
150 node->set(socket, attr.value());
154 ustring value(attr.value());
156 node->set(socket, value);
160 "Unknown value \"%s\" for attribute \"%s\".\n",
162 socket.
name.c_str());
171 value.
resize(tokens.size());
172 for (
size_t i = 0; i < value.size(); i++) {
173 value[i] = ustring(tokens[i]);
175 node->set(socket, value);
181 if (value.size() == 1) {
182 node->set(socket, value[0]);
189 node->set(socket, value);
193 ustring value(attr.value());
194 map<ustring, Node *>::iterator it = reader.
node_map.find(value);
196 Node *value_node = it->second;
198 node->
set(socket, it->second);
208 value.
resize(tokens.size());
209 for (
size_t i = 0; i < value.size(); i++) {
210 map<ustring, Node *>::iterator it = reader.
node_map.find(ustring(tokens[i]));
212 Node *value_node = it->second;
219 node->set(socket, value);
229 if (!node->name.empty()) {
236 xml_node xml_node = xml_root.append_child(node->type->name.c_str());
238 xml_node.append_attribute(
"name") = node->name.c_str();
247 if (node->has_default_value(socket)) {
251 xml_attribute attr = xml_node.append_attribute(socket.
name.c_str());
253 switch (socket.
type) {
259 std::stringstream ss;
260 const array<bool> &value = node->get_bool_array(socket);
261 for (
size_t i = 0; i < value.size(); i++) {
263 if (i != value.size() - 1) {
267 attr = ss.str().c_str();
271 attr = (
double)node->get_float(socket);
275 std::stringstream ss;
276 const array<float> &value = node->get_float_array(socket);
277 for (
size_t i = 0; i < value.size(); i++) {
279 if (i != value.size() - 1) {
283 attr = ss.str().c_str();
287 attr = node->get_int(socket);
291 attr = node->get_uint(socket);
295 attr = node->get_uint64(socket);
299 std::stringstream ss;
300 const array<int> &value = node->get_int_array(socket);
301 for (
size_t i = 0; i < value.size(); i++) {
303 if (i != value.size() - 1) {
307 attr = ss.str().c_str();
314 float3 value = node->get_float3(socket);
316 string_printf(
"%g %g %g", (
double)value.x, (
double)value.y, (
double)value.z).c_str();
323 std::stringstream ss;
325 for (
size_t i = 0; i < value.size(); i++) {
327 "%g %g %g", (
double)value[i].x, (
double)value[i].y, (
double)value[i].
z);
328 if (i != value.size() - 1) {
332 attr = ss.str().c_str();
336 float2 value = node->get_float2(socket);
337 attr =
string_printf(
"%g %g", (
double)value.x, (
double)value.y).c_str();
341 std::stringstream ss;
343 for (
size_t i = 0; i < value.size(); i++) {
344 ss <<
string_printf(
"%g %g", (
double)value[i].x, (
double)value[i].y);
345 if (i != value.size() - 1) {
349 attr = ss.str().c_str();
354 attr = node->get_string(socket).c_str();
358 std::stringstream ss;
360 for (
size_t i = 0; i < value.size(); i++) {
362 if (i != value.size() - 1) {
366 attr = ss.str().c_str();
370 Transform tfm = node->get_transform(socket);
371 std::stringstream ss;
372 for (
int i = 0; i < 3; i++) {
380 attr = ss.str().c_str();
384 std::stringstream ss;
386 for (
size_t j = 0; j < value.size(); j++) {
389 for (
int i = 0; i < 3; i++) {
397 if (j != value.size() - 1) {
401 attr = ss.str().c_str();
407 attr = value->name.c_str();
412 std::stringstream ss;
414 for (
size_t i = 0; i < value.size(); i++) {
416 ss << value[i]->name.c_str();
418 if (i != value.size() - 1) {
422 attr = ss.str().c_str();
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