32 foreach (
const SocketType &socket, type->inputs) {
98 set(input, ustring(value));
107 const NodeEnum &enm = *input.enum_values;
230 const NodeEnum &enm = *input.enum_values;
232 return (enm.
exists(intvalue)) ? enm[intvalue] : ustring();
305 const void *src = input.default_value;
307 return memcmp(dst, src, input.size()) == 0;
314 if (socket.
size() > 0) {
315 memcpy(dst, src, socket.
size());
332 assert(socket.
type == other_socket.
type);
335 switch (socket.
type) {
371 for (
Node *node : node_array) {
383 const void *src = ((
char *)&other) + other_socket.
struct_offset;
385 memcpy(dst, src, socket.
size());
399 assert(socket.
type == other_socket.
type);
403 switch (socket.
type) {
437 switch (socket.
type) {
492 const T *a = (
const T *)(((
char *)node) + socket.
struct_offset);
499 switch (socket.
type) {
566 assert(type == other.type);
568 foreach (
const SocketType &socket, type->inputs) {
595 for (
size_t i = 0; i < a.size(); i++) {
604 for (
size_t i = 0; i < a.size(); i++) {
613 md5.
append(type->name.string());
615 foreach (
const SocketType &socket, type->inputs) {
618 switch (socket.
type) {
620 value_hash<bool>(
this, socket, md5);
623 value_hash<float>(
this, socket, md5);
626 value_hash<int>(
this, socket, md5);
629 value_hash<uint>(
this, socket, md5);
632 value_hash<uint64_t>(
this, socket, md5);
635 float3_hash(
this, socket, md5);
638 float3_hash(
this, socket, md5);
641 float3_hash(
this, socket, md5);
644 float3_hash(
this, socket, md5);
647 value_hash<float2>(
this, socket, md5);
652 value_hash<ustring>(
this, socket, md5);
655 value_hash<int>(
this, socket, md5);
658 value_hash<Transform>(
this, socket, md5);
661 value_hash<void *>(
this, socket, md5);
665 array_hash<bool>(
this, socket, md5);
668 array_hash<float>(
this, socket, md5);
671 array_hash<int>(
this, socket, md5);
674 float3_array_hash(
this, socket, md5);
677 float3_array_hash(
this, socket, md5);
680 float3_array_hash(
this, socket, md5);
683 float3_array_hash(
this, socket, md5);
686 array_hash<float2>(
this, socket, md5);
689 array_hash<ustring>(
this, socket, md5);
692 array_hash<Transform>(
this, socket, md5);
695 array_hash<void *>(
this, socket, md5);
707template<
typename T>
size_t array_size_in_bytes(
const Node *node,
const SocketType &socket)
710 return a.
size() *
sizeof(
T);
717 size_t total_size = 0;
718 foreach (
const SocketType &socket, type->inputs) {
719 switch (socket.
type) {
735 total_size += socket.
size();
739 total_size += array_size_in_bytes<bool>(
this, socket);
742 total_size += array_size_in_bytes<float>(
this, socket);
745 total_size += array_size_in_bytes<int>(
this, socket);
748 total_size += array_size_in_bytes<float3>(
this, socket);
751 total_size += array_size_in_bytes<float3>(
this, socket);
754 total_size += array_size_in_bytes<float3>(
this, socket);
757 total_size += array_size_in_bytes<float3>(
this, socket);
760 total_size += array_size_in_bytes<float2>(
this, socket);
763 total_size += array_size_in_bytes<ustring>(
this, socket);
766 total_size += array_size_in_bytes<Transform>(
this, socket);
769 total_size += array_size_in_bytes<void *>(
this, socket);
782 for (
const NodeType *base = type; base; base = base->
base) {
803 foreach (
const SocketType &socket, type->inputs) {
814 for (
Node *node : nodes) {
891 for (
Node *old_node : old_nodes) {
892 old_node->dereference();
895 for (
Node *new_node : value) {
896 new_node->reference();
905 printf(
"Node : %s\n", name.c_str());
906 for (
auto &socket : type->inputs) {
908 printf(
"-- socket modified : %s\n", socket.
name.c_str());
void append(const uint8_t *data, int size)
local_group_size(16, 16) .push_constant(Type b
#define CCL_NAMESPACE_END
draw_view in_light_buf[] float
static bool is_socket_array_float3(const SocketType &socket)
static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
static bool is_socket_float3(const SocketType &socket)
static void copy_array(const Node *node, const SocketType &socket, const Node *other, const SocketType &other_socket)
unsigned __int64 uint64_t
bool exists(ustring x) const
bool has_default_value(const SocketType &input) const
const array< float3 > & get_float3_array(const SocketType &input) const
bool equals(const Node &other) 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
void set_value(const SocketType &input, const Node &other, const SocketType &other_input)
void dereference_all_used_nodes()
float3 get_float3(const SocketType &input) const
void set_default_value(const SocketType &input)
static T & get_socket_value(const Node *node, const SocketType &socket)
const array< bool > & get_bool_array(const SocketType &input) const
void copy_value(const SocketType &input, const Node &other, const SocketType &other_input)
const array< Node * > & get_node_array(const SocketType &input) const
size_t get_total_size_in_bytes() const
SocketModifiedFlags socket_modified
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
bool socket_is_modified(const SocketType &input) const
ustring get_string(const SocketType &input) const
bool is_a(const NodeType *type)
void set_if_different(const SocketType &input, T value)
Node * get_node(const SocketType &input) const
const NodeOwner * get_owner() const
uint get_uint(const SocketType &input) const
Node(const NodeType *type, ustring name=ustring())
int get_int(const SocketType &input) const
const array< Transform > & get_transform_array(const SocketType &input) const
bool equals_value(const Node &other, const SocketType &input) const
void print_modified_sockets() const
void set_owner(const NodeOwner *owner_)
const void * default_value