20 return (value) ?
"true" :
"false";
23template<
int VECTOR_SIZE,
typename T>
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();
251 xml_attribute attr = xml_node.append_attribute(socket.
name.c_str());
253 switch (socket.
type) {
259 std::stringstream ss;
261 for (
size_t i = 0; i < value.
size(); i++) {
263 if (i != value.
size() - 1) {
267 attr = ss.str().c_str();
275 std::stringstream ss;
277 for (
size_t i = 0; i < value.
size(); i++) {
279 if (i != value.size() - 1) {
283 attr = ss.str().c_str();
299 std::stringstream ss;
301 for (
size_t i = 0; i < value.
size(); i++) {
303 if (i != value.size() - 1) {
307 attr = ss.str().c_str();
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();
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++) {
345 if (i != value.
size() - 1) {
349 attr = ss.str().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();
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();
typedef double(DMatrix)[4][4]
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
T * resize(size_t newsize)
#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
xml_node xml_write_node(Node *node, xml_node xml_root)
static void xml_read_float_array(T &value, xml_attribute attr)
void xml_read_node(XMLReader &reader, Node *node, xml_node xml_node)
static CCL_NAMESPACE_BEGIN bool xml_read_boolean(const char *value)
static const char * xml_write_boolean(bool value)
unsigned __int64 uint64_t
bool string_iequals(const string &a, const string &b)
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
void string_split(vector< string > &tokens, const string &str, const string &separators, bool skip_empty_tokens)
bool exists(ustring x) const
vector< SocketType, std::allocator< SocketType > > inputs
bool has_default_value(const SocketType &input) const
const array< float3 > & get_float3_array(const SocketType &input) const
const array< float > & get_float_array(const SocketType &input) const
const array< int > & get_int_array(const SocketType &input) const
float get_float(const SocketType &input) const
Transform get_transform(const SocketType &input) const
void set(const SocketType &input, bool value)
uint64_t get_uint64(const SocketType &input) const
float3 get_float3(const SocketType &input) const
const array< bool > & get_bool_array(const SocketType &input) const
const array< Node * > & get_node_array(const SocketType &input) const
bool get_bool(const SocketType &input) const
float2 get_float2(const SocketType &input) const
const array< ustring > & get_string_array(const SocketType &input) const
const array< float2 > & get_float2_array(const SocketType &input) const
ustring get_string(const SocketType &input) const
bool is_a(const NodeType *type)
Node * get_node(const SocketType &input) const
uint get_uint(const SocketType &input) const
int get_int(const SocketType &input) const
const array< Transform > & get_transform_array(const SocketType &input) const
const NodeType * node_type
const NodeEnum * enum_values
map< ustring, Node * > node_map