Vuo  2.0.0
VuoVertexAttribute.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoVertexAttribute.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Vertex Attribute",
18  "description" : "Data associated with a vertex of a 3D mesh.",
19  "keywords" : [ ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoVertexAttribute"
23  ]
24  });
25 #endif
26 
36 {
37  const char *valueAsString = "";
38  if (json_object_get_type(js) == json_type_string)
39  valueAsString = json_object_get_string(js);
40 
41  VuoVertexAttribute value = VuoVertexAttribute_Position;
42 
43  if (strcmp(valueAsString, "normal") == 0)
44  value = VuoVertexAttribute_Normal;
45  else if (strcmp(valueAsString, "tangent") == 0)
46  value = VuoVertexAttribute_Tangent;
47  else if (strcmp(valueAsString, "bitangent") == 0)
48  value = VuoVertexAttribute_Bitangent;
49  else if (strcmp(valueAsString, "textureCoordinate") == 0)
50  value = VuoVertexAttribute_TextureCoordinateChecker;
51  else if (strcmp(valueAsString, "textureCoordinateChecker") == 0)
52  value = VuoVertexAttribute_TextureCoordinateChecker;
53  else if (strcmp(valueAsString, "textureCoordinateGradient") == 0)
54  value = VuoVertexAttribute_TextureCoordinateGradient;
55 
56  return value;
57 }
58 
63 {
64  char *valueAsString = "position";
65 
66  if (value == VuoVertexAttribute_Normal)
67  valueAsString = "normal";
68  else if (value == VuoVertexAttribute_Tangent)
69  valueAsString = "tangent";
70  else if (value == VuoVertexAttribute_Bitangent)
71  valueAsString = "bitangent";
72  else if (value == VuoVertexAttribute_TextureCoordinateChecker)
73  valueAsString = "textureCoordinateChecker";
74  else if (value == VuoVertexAttribute_TextureCoordinateGradient)
75  valueAsString = "textureCoordinateGradient";
76 
77  return json_object_new_string(valueAsString);
78 }
79 
84 {
86  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_Position);
87  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_Normal);
88  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_Tangent);
89  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_Bitangent);
90  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_TextureCoordinateChecker);
91  VuoListAppendValue_VuoVertexAttribute(l, VuoVertexAttribute_TextureCoordinateGradient);
92  return l;
93 }
94 
99 {
100  char *valueAsString = "Position";
101 
102  if (value == VuoVertexAttribute_Normal)
103  valueAsString = "Normal";
104  else if (value == VuoVertexAttribute_Tangent)
105  valueAsString = "Tangent";
106  else if (value == VuoVertexAttribute_Bitangent)
107  valueAsString = "Bitangent";
108  else if (value == VuoVertexAttribute_TextureCoordinateChecker)
109  valueAsString = "Texture Coordinate (Checker)";
110  else if (value == VuoVertexAttribute_TextureCoordinateGradient)
111  valueAsString = "Texture Coordinate (Gradient)";
112 
113  return strdup(valueAsString);
114 }
115 
120 {
121  return valueA == valueB;
122 }
123 
128 {
129  return valueA < valueB;
130 }
131