diff options
Diffstat (limited to 'ddl/out/cpp')
-rw-r--r-- | ddl/out/cpp/LambdaCube.IR.cpp | 2866 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.IR.hpp | 1071 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.IR2.hpp | 1071 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.Mesh.cpp | 228 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.Mesh.hpp | 107 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.Mesh2.hpp | 107 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.PipelineSchema.cpp | 208 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.PipelineSchema.hpp | 67 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.PipelineSchema2.hpp | 67 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.TypeInfo.cpp | 188 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.TypeInfo.hpp | 95 | ||||
-rw-r--r-- | ddl/out/cpp/LambdaCube.TypeInfo2.hpp | 95 | ||||
-rw-r--r-- | ddl/out/cpp/TestData.cpp | 246 | ||||
-rw-r--r-- | ddl/out/cpp/TestData.hpp | 123 | ||||
-rw-r--r-- | ddl/out/cpp/TestData2.hpp | 123 |
15 files changed, 6662 insertions, 0 deletions
diff --git a/ddl/out/cpp/LambdaCube.IR.cpp b/ddl/out/cpp/LambdaCube.IR.cpp new file mode 100644 index 0000000..dddde0a --- /dev/null +++ b/ddl/out/cpp/LambdaCube.IR.cpp | |||
@@ -0,0 +1,2866 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:02.701527000000Z | ||
3 | |||
4 | #include "LambdaCube.IR.hpp" | ||
5 | template<> json toJSON<std::shared_ptr<ArrayValue>>(std::shared_ptr<ArrayValue> &v) { | ||
6 | json obj({}); | ||
7 | switch (v->tag) { | ||
8 | case ::ArrayValue::tag::VBoolArray: | ||
9 | obj["tag"] = "VBoolArray"; | ||
10 | { | ||
11 | std::shared_ptr<data::VBoolArray> tv = std::static_pointer_cast<data::VBoolArray>(v); | ||
12 | obj["arg0"] = toJSON(tv->_0); | ||
13 | } | ||
14 | break; | ||
15 | case ::ArrayValue::tag::VIntArray: | ||
16 | obj["tag"] = "VIntArray"; | ||
17 | { | ||
18 | std::shared_ptr<data::VIntArray> tv = std::static_pointer_cast<data::VIntArray>(v); | ||
19 | obj["arg0"] = toJSON(tv->_0); | ||
20 | } | ||
21 | break; | ||
22 | case ::ArrayValue::tag::VWordArray: | ||
23 | obj["tag"] = "VWordArray"; | ||
24 | { | ||
25 | std::shared_ptr<data::VWordArray> tv = std::static_pointer_cast<data::VWordArray>(v); | ||
26 | obj["arg0"] = toJSON(tv->_0); | ||
27 | } | ||
28 | break; | ||
29 | case ::ArrayValue::tag::VFloatArray: | ||
30 | obj["tag"] = "VFloatArray"; | ||
31 | { | ||
32 | std::shared_ptr<data::VFloatArray> tv = std::static_pointer_cast<data::VFloatArray>(v); | ||
33 | obj["arg0"] = toJSON(tv->_0); | ||
34 | } | ||
35 | break; | ||
36 | } | ||
37 | return obj; | ||
38 | } | ||
39 | |||
40 | template<> std::shared_ptr<ArrayValue> fromJSON<std::shared_ptr<ArrayValue>>(W<std::shared_ptr<ArrayValue>> v, json &obj) { | ||
41 | enum ::ArrayValue::tag tagType; | ||
42 | std::string tag = obj["tag"]; | ||
43 | if (tag == "VBoolArray") { | ||
44 | tagType = ::ArrayValue::tag::VBoolArray; | ||
45 | std::shared_ptr<data::VBoolArray> tv(new data::VBoolArray()); | ||
46 | tv->_0 = fromJSON(W<std::vector<Bool>>(), obj["arg0"]); | ||
47 | return tv; | ||
48 | } | ||
49 | else if (tag == "VIntArray") { | ||
50 | tagType = ::ArrayValue::tag::VIntArray; | ||
51 | std::shared_ptr<data::VIntArray> tv(new data::VIntArray()); | ||
52 | tv->_0 = fromJSON(W<std::vector<Int32>>(), obj["arg0"]); | ||
53 | return tv; | ||
54 | } | ||
55 | else if (tag == "VWordArray") { | ||
56 | tagType = ::ArrayValue::tag::VWordArray; | ||
57 | std::shared_ptr<data::VWordArray> tv(new data::VWordArray()); | ||
58 | tv->_0 = fromJSON(W<std::vector<Word32>>(), obj["arg0"]); | ||
59 | return tv; | ||
60 | } | ||
61 | else if (tag == "VFloatArray") { | ||
62 | tagType = ::ArrayValue::tag::VFloatArray; | ||
63 | std::shared_ptr<data::VFloatArray> tv(new data::VFloatArray()); | ||
64 | tv->_0 = fromJSON(W<std::vector<Float>>(), obj["arg0"]); | ||
65 | return tv; | ||
66 | } | ||
67 | else throw "unknown constructor: " + tag; | ||
68 | std::shared_ptr<::ArrayValue> o(new ::ArrayValue()); | ||
69 | o->tag = tagType; | ||
70 | return o; | ||
71 | } | ||
72 | |||
73 | template<> json toJSON<std::shared_ptr<Value>>(std::shared_ptr<Value> &v) { | ||
74 | json obj({}); | ||
75 | switch (v->tag) { | ||
76 | case ::Value::tag::VBool: | ||
77 | obj["tag"] = "VBool"; | ||
78 | { | ||
79 | std::shared_ptr<data::VBool> tv = std::static_pointer_cast<data::VBool>(v); | ||
80 | obj["arg0"] = toJSON(tv->_0); | ||
81 | } | ||
82 | break; | ||
83 | case ::Value::tag::VV2B: | ||
84 | obj["tag"] = "VV2B"; | ||
85 | { | ||
86 | std::shared_ptr<data::VV2B> tv = std::static_pointer_cast<data::VV2B>(v); | ||
87 | obj["arg0"] = toJSON(tv->_0); | ||
88 | } | ||
89 | break; | ||
90 | case ::Value::tag::VV3B: | ||
91 | obj["tag"] = "VV3B"; | ||
92 | { | ||
93 | std::shared_ptr<data::VV3B> tv = std::static_pointer_cast<data::VV3B>(v); | ||
94 | obj["arg0"] = toJSON(tv->_0); | ||
95 | } | ||
96 | break; | ||
97 | case ::Value::tag::VV4B: | ||
98 | obj["tag"] = "VV4B"; | ||
99 | { | ||
100 | std::shared_ptr<data::VV4B> tv = std::static_pointer_cast<data::VV4B>(v); | ||
101 | obj["arg0"] = toJSON(tv->_0); | ||
102 | } | ||
103 | break; | ||
104 | case ::Value::tag::VWord: | ||
105 | obj["tag"] = "VWord"; | ||
106 | { | ||
107 | std::shared_ptr<data::VWord> tv = std::static_pointer_cast<data::VWord>(v); | ||
108 | obj["arg0"] = toJSON(tv->_0); | ||
109 | } | ||
110 | break; | ||
111 | case ::Value::tag::VV2U: | ||
112 | obj["tag"] = "VV2U"; | ||
113 | { | ||
114 | std::shared_ptr<data::VV2U> tv = std::static_pointer_cast<data::VV2U>(v); | ||
115 | obj["arg0"] = toJSON(tv->_0); | ||
116 | } | ||
117 | break; | ||
118 | case ::Value::tag::VV3U: | ||
119 | obj["tag"] = "VV3U"; | ||
120 | { | ||
121 | std::shared_ptr<data::VV3U> tv = std::static_pointer_cast<data::VV3U>(v); | ||
122 | obj["arg0"] = toJSON(tv->_0); | ||
123 | } | ||
124 | break; | ||
125 | case ::Value::tag::VV4U: | ||
126 | obj["tag"] = "VV4U"; | ||
127 | { | ||
128 | std::shared_ptr<data::VV4U> tv = std::static_pointer_cast<data::VV4U>(v); | ||
129 | obj["arg0"] = toJSON(tv->_0); | ||
130 | } | ||
131 | break; | ||
132 | case ::Value::tag::VInt: | ||
133 | obj["tag"] = "VInt"; | ||
134 | { | ||
135 | std::shared_ptr<data::VInt> tv = std::static_pointer_cast<data::VInt>(v); | ||
136 | obj["arg0"] = toJSON(tv->_0); | ||
137 | } | ||
138 | break; | ||
139 | case ::Value::tag::VV2I: | ||
140 | obj["tag"] = "VV2I"; | ||
141 | { | ||
142 | std::shared_ptr<data::VV2I> tv = std::static_pointer_cast<data::VV2I>(v); | ||
143 | obj["arg0"] = toJSON(tv->_0); | ||
144 | } | ||
145 | break; | ||
146 | case ::Value::tag::VV3I: | ||
147 | obj["tag"] = "VV3I"; | ||
148 | { | ||
149 | std::shared_ptr<data::VV3I> tv = std::static_pointer_cast<data::VV3I>(v); | ||
150 | obj["arg0"] = toJSON(tv->_0); | ||
151 | } | ||
152 | break; | ||
153 | case ::Value::tag::VV4I: | ||
154 | obj["tag"] = "VV4I"; | ||
155 | { | ||
156 | std::shared_ptr<data::VV4I> tv = std::static_pointer_cast<data::VV4I>(v); | ||
157 | obj["arg0"] = toJSON(tv->_0); | ||
158 | } | ||
159 | break; | ||
160 | case ::Value::tag::VFloat: | ||
161 | obj["tag"] = "VFloat"; | ||
162 | { | ||
163 | std::shared_ptr<data::VFloat> tv = std::static_pointer_cast<data::VFloat>(v); | ||
164 | obj["arg0"] = toJSON(tv->_0); | ||
165 | } | ||
166 | break; | ||
167 | case ::Value::tag::VV2F: | ||
168 | obj["tag"] = "VV2F"; | ||
169 | { | ||
170 | std::shared_ptr<data::VV2F> tv = std::static_pointer_cast<data::VV2F>(v); | ||
171 | obj["arg0"] = toJSON(tv->_0); | ||
172 | } | ||
173 | break; | ||
174 | case ::Value::tag::VV3F: | ||
175 | obj["tag"] = "VV3F"; | ||
176 | { | ||
177 | std::shared_ptr<data::VV3F> tv = std::static_pointer_cast<data::VV3F>(v); | ||
178 | obj["arg0"] = toJSON(tv->_0); | ||
179 | } | ||
180 | break; | ||
181 | case ::Value::tag::VV4F: | ||
182 | obj["tag"] = "VV4F"; | ||
183 | { | ||
184 | std::shared_ptr<data::VV4F> tv = std::static_pointer_cast<data::VV4F>(v); | ||
185 | obj["arg0"] = toJSON(tv->_0); | ||
186 | } | ||
187 | break; | ||
188 | case ::Value::tag::VM22F: | ||
189 | obj["tag"] = "VM22F"; | ||
190 | { | ||
191 | std::shared_ptr<data::VM22F> tv = std::static_pointer_cast<data::VM22F>(v); | ||
192 | obj["arg0"] = toJSON(tv->_0); | ||
193 | } | ||
194 | break; | ||
195 | case ::Value::tag::VM23F: | ||
196 | obj["tag"] = "VM23F"; | ||
197 | { | ||
198 | std::shared_ptr<data::VM23F> tv = std::static_pointer_cast<data::VM23F>(v); | ||
199 | obj["arg0"] = toJSON(tv->_0); | ||
200 | } | ||
201 | break; | ||
202 | case ::Value::tag::VM24F: | ||
203 | obj["tag"] = "VM24F"; | ||
204 | { | ||
205 | std::shared_ptr<data::VM24F> tv = std::static_pointer_cast<data::VM24F>(v); | ||
206 | obj["arg0"] = toJSON(tv->_0); | ||
207 | } | ||
208 | break; | ||
209 | case ::Value::tag::VM32F: | ||
210 | obj["tag"] = "VM32F"; | ||
211 | { | ||
212 | std::shared_ptr<data::VM32F> tv = std::static_pointer_cast<data::VM32F>(v); | ||
213 | obj["arg0"] = toJSON(tv->_0); | ||
214 | } | ||
215 | break; | ||
216 | case ::Value::tag::VM33F: | ||
217 | obj["tag"] = "VM33F"; | ||
218 | { | ||
219 | std::shared_ptr<data::VM33F> tv = std::static_pointer_cast<data::VM33F>(v); | ||
220 | obj["arg0"] = toJSON(tv->_0); | ||
221 | } | ||
222 | break; | ||
223 | case ::Value::tag::VM34F: | ||
224 | obj["tag"] = "VM34F"; | ||
225 | { | ||
226 | std::shared_ptr<data::VM34F> tv = std::static_pointer_cast<data::VM34F>(v); | ||
227 | obj["arg0"] = toJSON(tv->_0); | ||
228 | } | ||
229 | break; | ||
230 | case ::Value::tag::VM42F: | ||
231 | obj["tag"] = "VM42F"; | ||
232 | { | ||
233 | std::shared_ptr<data::VM42F> tv = std::static_pointer_cast<data::VM42F>(v); | ||
234 | obj["arg0"] = toJSON(tv->_0); | ||
235 | } | ||
236 | break; | ||
237 | case ::Value::tag::VM43F: | ||
238 | obj["tag"] = "VM43F"; | ||
239 | { | ||
240 | std::shared_ptr<data::VM43F> tv = std::static_pointer_cast<data::VM43F>(v); | ||
241 | obj["arg0"] = toJSON(tv->_0); | ||
242 | } | ||
243 | break; | ||
244 | case ::Value::tag::VM44F: | ||
245 | obj["tag"] = "VM44F"; | ||
246 | { | ||
247 | std::shared_ptr<data::VM44F> tv = std::static_pointer_cast<data::VM44F>(v); | ||
248 | obj["arg0"] = toJSON(tv->_0); | ||
249 | } | ||
250 | break; | ||
251 | } | ||
252 | return obj; | ||
253 | } | ||
254 | |||
255 | template<> std::shared_ptr<Value> fromJSON<std::shared_ptr<Value>>(W<std::shared_ptr<Value>> v, json &obj) { | ||
256 | enum ::Value::tag tagType; | ||
257 | std::string tag = obj["tag"]; | ||
258 | if (tag == "VBool") { | ||
259 | tagType = ::Value::tag::VBool; | ||
260 | std::shared_ptr<data::VBool> tv(new data::VBool()); | ||
261 | tv->_0 = fromJSON(W<Bool>(), obj["arg0"]); | ||
262 | return tv; | ||
263 | } | ||
264 | else if (tag == "VV2B") { | ||
265 | tagType = ::Value::tag::VV2B; | ||
266 | std::shared_ptr<data::VV2B> tv(new data::VV2B()); | ||
267 | tv->_0 = fromJSON(W<V2B>(), obj["arg0"]); | ||
268 | return tv; | ||
269 | } | ||
270 | else if (tag == "VV3B") { | ||
271 | tagType = ::Value::tag::VV3B; | ||
272 | std::shared_ptr<data::VV3B> tv(new data::VV3B()); | ||
273 | tv->_0 = fromJSON(W<V3B>(), obj["arg0"]); | ||
274 | return tv; | ||
275 | } | ||
276 | else if (tag == "VV4B") { | ||
277 | tagType = ::Value::tag::VV4B; | ||
278 | std::shared_ptr<data::VV4B> tv(new data::VV4B()); | ||
279 | tv->_0 = fromJSON(W<V4B>(), obj["arg0"]); | ||
280 | return tv; | ||
281 | } | ||
282 | else if (tag == "VWord") { | ||
283 | tagType = ::Value::tag::VWord; | ||
284 | std::shared_ptr<data::VWord> tv(new data::VWord()); | ||
285 | tv->_0 = fromJSON(W<Word32>(), obj["arg0"]); | ||
286 | return tv; | ||
287 | } | ||
288 | else if (tag == "VV2U") { | ||
289 | tagType = ::Value::tag::VV2U; | ||
290 | std::shared_ptr<data::VV2U> tv(new data::VV2U()); | ||
291 | tv->_0 = fromJSON(W<V2U>(), obj["arg0"]); | ||
292 | return tv; | ||
293 | } | ||
294 | else if (tag == "VV3U") { | ||
295 | tagType = ::Value::tag::VV3U; | ||
296 | std::shared_ptr<data::VV3U> tv(new data::VV3U()); | ||
297 | tv->_0 = fromJSON(W<V3U>(), obj["arg0"]); | ||
298 | return tv; | ||
299 | } | ||
300 | else if (tag == "VV4U") { | ||
301 | tagType = ::Value::tag::VV4U; | ||
302 | std::shared_ptr<data::VV4U> tv(new data::VV4U()); | ||
303 | tv->_0 = fromJSON(W<V4U>(), obj["arg0"]); | ||
304 | return tv; | ||
305 | } | ||
306 | else if (tag == "VInt") { | ||
307 | tagType = ::Value::tag::VInt; | ||
308 | std::shared_ptr<data::VInt> tv(new data::VInt()); | ||
309 | tv->_0 = fromJSON(W<Int32>(), obj["arg0"]); | ||
310 | return tv; | ||
311 | } | ||
312 | else if (tag == "VV2I") { | ||
313 | tagType = ::Value::tag::VV2I; | ||
314 | std::shared_ptr<data::VV2I> tv(new data::VV2I()); | ||
315 | tv->_0 = fromJSON(W<V2I>(), obj["arg0"]); | ||
316 | return tv; | ||
317 | } | ||
318 | else if (tag == "VV3I") { | ||
319 | tagType = ::Value::tag::VV3I; | ||
320 | std::shared_ptr<data::VV3I> tv(new data::VV3I()); | ||
321 | tv->_0 = fromJSON(W<V3I>(), obj["arg0"]); | ||
322 | return tv; | ||
323 | } | ||
324 | else if (tag == "VV4I") { | ||
325 | tagType = ::Value::tag::VV4I; | ||
326 | std::shared_ptr<data::VV4I> tv(new data::VV4I()); | ||
327 | tv->_0 = fromJSON(W<V4I>(), obj["arg0"]); | ||
328 | return tv; | ||
329 | } | ||
330 | else if (tag == "VFloat") { | ||
331 | tagType = ::Value::tag::VFloat; | ||
332 | std::shared_ptr<data::VFloat> tv(new data::VFloat()); | ||
333 | tv->_0 = fromJSON(W<Float>(), obj["arg0"]); | ||
334 | return tv; | ||
335 | } | ||
336 | else if (tag == "VV2F") { | ||
337 | tagType = ::Value::tag::VV2F; | ||
338 | std::shared_ptr<data::VV2F> tv(new data::VV2F()); | ||
339 | tv->_0 = fromJSON(W<V2F>(), obj["arg0"]); | ||
340 | return tv; | ||
341 | } | ||
342 | else if (tag == "VV3F") { | ||
343 | tagType = ::Value::tag::VV3F; | ||
344 | std::shared_ptr<data::VV3F> tv(new data::VV3F()); | ||
345 | tv->_0 = fromJSON(W<V3F>(), obj["arg0"]); | ||
346 | return tv; | ||
347 | } | ||
348 | else if (tag == "VV4F") { | ||
349 | tagType = ::Value::tag::VV4F; | ||
350 | std::shared_ptr<data::VV4F> tv(new data::VV4F()); | ||
351 | tv->_0 = fromJSON(W<V4F>(), obj["arg0"]); | ||
352 | return tv; | ||
353 | } | ||
354 | else if (tag == "VM22F") { | ||
355 | tagType = ::Value::tag::VM22F; | ||
356 | std::shared_ptr<data::VM22F> tv(new data::VM22F()); | ||
357 | tv->_0 = fromJSON(W<M22F>(), obj["arg0"]); | ||
358 | return tv; | ||
359 | } | ||
360 | else if (tag == "VM23F") { | ||
361 | tagType = ::Value::tag::VM23F; | ||
362 | std::shared_ptr<data::VM23F> tv(new data::VM23F()); | ||
363 | tv->_0 = fromJSON(W<M23F>(), obj["arg0"]); | ||
364 | return tv; | ||
365 | } | ||
366 | else if (tag == "VM24F") { | ||
367 | tagType = ::Value::tag::VM24F; | ||
368 | std::shared_ptr<data::VM24F> tv(new data::VM24F()); | ||
369 | tv->_0 = fromJSON(W<M24F>(), obj["arg0"]); | ||
370 | return tv; | ||
371 | } | ||
372 | else if (tag == "VM32F") { | ||
373 | tagType = ::Value::tag::VM32F; | ||
374 | std::shared_ptr<data::VM32F> tv(new data::VM32F()); | ||
375 | tv->_0 = fromJSON(W<M32F>(), obj["arg0"]); | ||
376 | return tv; | ||
377 | } | ||
378 | else if (tag == "VM33F") { | ||
379 | tagType = ::Value::tag::VM33F; | ||
380 | std::shared_ptr<data::VM33F> tv(new data::VM33F()); | ||
381 | tv->_0 = fromJSON(W<M33F>(), obj["arg0"]); | ||
382 | return tv; | ||
383 | } | ||
384 | else if (tag == "VM34F") { | ||
385 | tagType = ::Value::tag::VM34F; | ||
386 | std::shared_ptr<data::VM34F> tv(new data::VM34F()); | ||
387 | tv->_0 = fromJSON(W<M34F>(), obj["arg0"]); | ||
388 | return tv; | ||
389 | } | ||
390 | else if (tag == "VM42F") { | ||
391 | tagType = ::Value::tag::VM42F; | ||
392 | std::shared_ptr<data::VM42F> tv(new data::VM42F()); | ||
393 | tv->_0 = fromJSON(W<M42F>(), obj["arg0"]); | ||
394 | return tv; | ||
395 | } | ||
396 | else if (tag == "VM43F") { | ||
397 | tagType = ::Value::tag::VM43F; | ||
398 | std::shared_ptr<data::VM43F> tv(new data::VM43F()); | ||
399 | tv->_0 = fromJSON(W<M43F>(), obj["arg0"]); | ||
400 | return tv; | ||
401 | } | ||
402 | else if (tag == "VM44F") { | ||
403 | tagType = ::Value::tag::VM44F; | ||
404 | std::shared_ptr<data::VM44F> tv(new data::VM44F()); | ||
405 | tv->_0 = fromJSON(W<M44F>(), obj["arg0"]); | ||
406 | return tv; | ||
407 | } | ||
408 | else throw "unknown constructor: " + tag; | ||
409 | std::shared_ptr<::Value> o(new ::Value()); | ||
410 | o->tag = tagType; | ||
411 | return o; | ||
412 | } | ||
413 | |||
414 | template<> json toJSON<std::shared_ptr<InputType>>(std::shared_ptr<InputType> &v) { | ||
415 | json obj({}); | ||
416 | switch (v->tag) { | ||
417 | case ::InputType::tag::Bool: | ||
418 | obj["tag"] = "Bool"; | ||
419 | break; | ||
420 | case ::InputType::tag::V2B: | ||
421 | obj["tag"] = "V2B"; | ||
422 | break; | ||
423 | case ::InputType::tag::V3B: | ||
424 | obj["tag"] = "V3B"; | ||
425 | break; | ||
426 | case ::InputType::tag::V4B: | ||
427 | obj["tag"] = "V4B"; | ||
428 | break; | ||
429 | case ::InputType::tag::Word: | ||
430 | obj["tag"] = "Word"; | ||
431 | break; | ||
432 | case ::InputType::tag::V2U: | ||
433 | obj["tag"] = "V2U"; | ||
434 | break; | ||
435 | case ::InputType::tag::V3U: | ||
436 | obj["tag"] = "V3U"; | ||
437 | break; | ||
438 | case ::InputType::tag::V4U: | ||
439 | obj["tag"] = "V4U"; | ||
440 | break; | ||
441 | case ::InputType::tag::Int: | ||
442 | obj["tag"] = "Int"; | ||
443 | break; | ||
444 | case ::InputType::tag::V2I: | ||
445 | obj["tag"] = "V2I"; | ||
446 | break; | ||
447 | case ::InputType::tag::V3I: | ||
448 | obj["tag"] = "V3I"; | ||
449 | break; | ||
450 | case ::InputType::tag::V4I: | ||
451 | obj["tag"] = "V4I"; | ||
452 | break; | ||
453 | case ::InputType::tag::Float: | ||
454 | obj["tag"] = "Float"; | ||
455 | break; | ||
456 | case ::InputType::tag::V2F: | ||
457 | obj["tag"] = "V2F"; | ||
458 | break; | ||
459 | case ::InputType::tag::V3F: | ||
460 | obj["tag"] = "V3F"; | ||
461 | break; | ||
462 | case ::InputType::tag::V4F: | ||
463 | obj["tag"] = "V4F"; | ||
464 | break; | ||
465 | case ::InputType::tag::M22F: | ||
466 | obj["tag"] = "M22F"; | ||
467 | break; | ||
468 | case ::InputType::tag::M23F: | ||
469 | obj["tag"] = "M23F"; | ||
470 | break; | ||
471 | case ::InputType::tag::M24F: | ||
472 | obj["tag"] = "M24F"; | ||
473 | break; | ||
474 | case ::InputType::tag::M32F: | ||
475 | obj["tag"] = "M32F"; | ||
476 | break; | ||
477 | case ::InputType::tag::M33F: | ||
478 | obj["tag"] = "M33F"; | ||
479 | break; | ||
480 | case ::InputType::tag::M34F: | ||
481 | obj["tag"] = "M34F"; | ||
482 | break; | ||
483 | case ::InputType::tag::M42F: | ||
484 | obj["tag"] = "M42F"; | ||
485 | break; | ||
486 | case ::InputType::tag::M43F: | ||
487 | obj["tag"] = "M43F"; | ||
488 | break; | ||
489 | case ::InputType::tag::M44F: | ||
490 | obj["tag"] = "M44F"; | ||
491 | break; | ||
492 | case ::InputType::tag::STexture1D: | ||
493 | obj["tag"] = "STexture1D"; | ||
494 | break; | ||
495 | case ::InputType::tag::STexture2D: | ||
496 | obj["tag"] = "STexture2D"; | ||
497 | break; | ||
498 | case ::InputType::tag::STextureCube: | ||
499 | obj["tag"] = "STextureCube"; | ||
500 | break; | ||
501 | case ::InputType::tag::STexture1DArray: | ||
502 | obj["tag"] = "STexture1DArray"; | ||
503 | break; | ||
504 | case ::InputType::tag::STexture2DArray: | ||
505 | obj["tag"] = "STexture2DArray"; | ||
506 | break; | ||
507 | case ::InputType::tag::STexture2DRect: | ||
508 | obj["tag"] = "STexture2DRect"; | ||
509 | break; | ||
510 | case ::InputType::tag::FTexture1D: | ||
511 | obj["tag"] = "FTexture1D"; | ||
512 | break; | ||
513 | case ::InputType::tag::FTexture2D: | ||
514 | obj["tag"] = "FTexture2D"; | ||
515 | break; | ||
516 | case ::InputType::tag::FTexture3D: | ||
517 | obj["tag"] = "FTexture3D"; | ||
518 | break; | ||
519 | case ::InputType::tag::FTextureCube: | ||
520 | obj["tag"] = "FTextureCube"; | ||
521 | break; | ||
522 | case ::InputType::tag::FTexture1DArray: | ||
523 | obj["tag"] = "FTexture1DArray"; | ||
524 | break; | ||
525 | case ::InputType::tag::FTexture2DArray: | ||
526 | obj["tag"] = "FTexture2DArray"; | ||
527 | break; | ||
528 | case ::InputType::tag::FTexture2DMS: | ||
529 | obj["tag"] = "FTexture2DMS"; | ||
530 | break; | ||
531 | case ::InputType::tag::FTexture2DMSArray: | ||
532 | obj["tag"] = "FTexture2DMSArray"; | ||
533 | break; | ||
534 | case ::InputType::tag::FTextureBuffer: | ||
535 | obj["tag"] = "FTextureBuffer"; | ||
536 | break; | ||
537 | case ::InputType::tag::FTexture2DRect: | ||
538 | obj["tag"] = "FTexture2DRect"; | ||
539 | break; | ||
540 | case ::InputType::tag::ITexture1D: | ||
541 | obj["tag"] = "ITexture1D"; | ||
542 | break; | ||
543 | case ::InputType::tag::ITexture2D: | ||
544 | obj["tag"] = "ITexture2D"; | ||
545 | break; | ||
546 | case ::InputType::tag::ITexture3D: | ||
547 | obj["tag"] = "ITexture3D"; | ||
548 | break; | ||
549 | case ::InputType::tag::ITextureCube: | ||
550 | obj["tag"] = "ITextureCube"; | ||
551 | break; | ||
552 | case ::InputType::tag::ITexture1DArray: | ||
553 | obj["tag"] = "ITexture1DArray"; | ||
554 | break; | ||
555 | case ::InputType::tag::ITexture2DArray: | ||
556 | obj["tag"] = "ITexture2DArray"; | ||
557 | break; | ||
558 | case ::InputType::tag::ITexture2DMS: | ||
559 | obj["tag"] = "ITexture2DMS"; | ||
560 | break; | ||
561 | case ::InputType::tag::ITexture2DMSArray: | ||
562 | obj["tag"] = "ITexture2DMSArray"; | ||
563 | break; | ||
564 | case ::InputType::tag::ITextureBuffer: | ||
565 | obj["tag"] = "ITextureBuffer"; | ||
566 | break; | ||
567 | case ::InputType::tag::ITexture2DRect: | ||
568 | obj["tag"] = "ITexture2DRect"; | ||
569 | break; | ||
570 | case ::InputType::tag::UTexture1D: | ||
571 | obj["tag"] = "UTexture1D"; | ||
572 | break; | ||
573 | case ::InputType::tag::UTexture2D: | ||
574 | obj["tag"] = "UTexture2D"; | ||
575 | break; | ||
576 | case ::InputType::tag::UTexture3D: | ||
577 | obj["tag"] = "UTexture3D"; | ||
578 | break; | ||
579 | case ::InputType::tag::UTextureCube: | ||
580 | obj["tag"] = "UTextureCube"; | ||
581 | break; | ||
582 | case ::InputType::tag::UTexture1DArray: | ||
583 | obj["tag"] = "UTexture1DArray"; | ||
584 | break; | ||
585 | case ::InputType::tag::UTexture2DArray: | ||
586 | obj["tag"] = "UTexture2DArray"; | ||
587 | break; | ||
588 | case ::InputType::tag::UTexture2DMS: | ||
589 | obj["tag"] = "UTexture2DMS"; | ||
590 | break; | ||
591 | case ::InputType::tag::UTexture2DMSArray: | ||
592 | obj["tag"] = "UTexture2DMSArray"; | ||
593 | break; | ||
594 | case ::InputType::tag::UTextureBuffer: | ||
595 | obj["tag"] = "UTextureBuffer"; | ||
596 | break; | ||
597 | case ::InputType::tag::UTexture2DRect: | ||
598 | obj["tag"] = "UTexture2DRect"; | ||
599 | break; | ||
600 | } | ||
601 | return obj; | ||
602 | } | ||
603 | |||
604 | template<> std::shared_ptr<InputType> fromJSON<std::shared_ptr<InputType>>(W<std::shared_ptr<InputType>> v, json &obj) { | ||
605 | enum ::InputType::tag tagType; | ||
606 | std::string tag = obj["tag"]; | ||
607 | if (tag == "Bool") { | ||
608 | tagType = ::InputType::tag::Bool; | ||
609 | } | ||
610 | else if (tag == "V2B") { | ||
611 | tagType = ::InputType::tag::V2B; | ||
612 | } | ||
613 | else if (tag == "V3B") { | ||
614 | tagType = ::InputType::tag::V3B; | ||
615 | } | ||
616 | else if (tag == "V4B") { | ||
617 | tagType = ::InputType::tag::V4B; | ||
618 | } | ||
619 | else if (tag == "Word") { | ||
620 | tagType = ::InputType::tag::Word; | ||
621 | } | ||
622 | else if (tag == "V2U") { | ||
623 | tagType = ::InputType::tag::V2U; | ||
624 | } | ||
625 | else if (tag == "V3U") { | ||
626 | tagType = ::InputType::tag::V3U; | ||
627 | } | ||
628 | else if (tag == "V4U") { | ||
629 | tagType = ::InputType::tag::V4U; | ||
630 | } | ||
631 | else if (tag == "Int") { | ||
632 | tagType = ::InputType::tag::Int; | ||
633 | } | ||
634 | else if (tag == "V2I") { | ||
635 | tagType = ::InputType::tag::V2I; | ||
636 | } | ||
637 | else if (tag == "V3I") { | ||
638 | tagType = ::InputType::tag::V3I; | ||
639 | } | ||
640 | else if (tag == "V4I") { | ||
641 | tagType = ::InputType::tag::V4I; | ||
642 | } | ||
643 | else if (tag == "Float") { | ||
644 | tagType = ::InputType::tag::Float; | ||
645 | } | ||
646 | else if (tag == "V2F") { | ||
647 | tagType = ::InputType::tag::V2F; | ||
648 | } | ||
649 | else if (tag == "V3F") { | ||
650 | tagType = ::InputType::tag::V3F; | ||
651 | } | ||
652 | else if (tag == "V4F") { | ||
653 | tagType = ::InputType::tag::V4F; | ||
654 | } | ||
655 | else if (tag == "M22F") { | ||
656 | tagType = ::InputType::tag::M22F; | ||
657 | } | ||
658 | else if (tag == "M23F") { | ||
659 | tagType = ::InputType::tag::M23F; | ||
660 | } | ||
661 | else if (tag == "M24F") { | ||
662 | tagType = ::InputType::tag::M24F; | ||
663 | } | ||
664 | else if (tag == "M32F") { | ||
665 | tagType = ::InputType::tag::M32F; | ||
666 | } | ||
667 | else if (tag == "M33F") { | ||
668 | tagType = ::InputType::tag::M33F; | ||
669 | } | ||
670 | else if (tag == "M34F") { | ||
671 | tagType = ::InputType::tag::M34F; | ||
672 | } | ||
673 | else if (tag == "M42F") { | ||
674 | tagType = ::InputType::tag::M42F; | ||
675 | } | ||
676 | else if (tag == "M43F") { | ||
677 | tagType = ::InputType::tag::M43F; | ||
678 | } | ||
679 | else if (tag == "M44F") { | ||
680 | tagType = ::InputType::tag::M44F; | ||
681 | } | ||
682 | else if (tag == "STexture1D") { | ||
683 | tagType = ::InputType::tag::STexture1D; | ||
684 | } | ||
685 | else if (tag == "STexture2D") { | ||
686 | tagType = ::InputType::tag::STexture2D; | ||
687 | } | ||
688 | else if (tag == "STextureCube") { | ||
689 | tagType = ::InputType::tag::STextureCube; | ||
690 | } | ||
691 | else if (tag == "STexture1DArray") { | ||
692 | tagType = ::InputType::tag::STexture1DArray; | ||
693 | } | ||
694 | else if (tag == "STexture2DArray") { | ||
695 | tagType = ::InputType::tag::STexture2DArray; | ||
696 | } | ||
697 | else if (tag == "STexture2DRect") { | ||
698 | tagType = ::InputType::tag::STexture2DRect; | ||
699 | } | ||
700 | else if (tag == "FTexture1D") { | ||
701 | tagType = ::InputType::tag::FTexture1D; | ||
702 | } | ||
703 | else if (tag == "FTexture2D") { | ||
704 | tagType = ::InputType::tag::FTexture2D; | ||
705 | } | ||
706 | else if (tag == "FTexture3D") { | ||
707 | tagType = ::InputType::tag::FTexture3D; | ||
708 | } | ||
709 | else if (tag == "FTextureCube") { | ||
710 | tagType = ::InputType::tag::FTextureCube; | ||
711 | } | ||
712 | else if (tag == "FTexture1DArray") { | ||
713 | tagType = ::InputType::tag::FTexture1DArray; | ||
714 | } | ||
715 | else if (tag == "FTexture2DArray") { | ||
716 | tagType = ::InputType::tag::FTexture2DArray; | ||
717 | } | ||
718 | else if (tag == "FTexture2DMS") { | ||
719 | tagType = ::InputType::tag::FTexture2DMS; | ||
720 | } | ||
721 | else if (tag == "FTexture2DMSArray") { | ||
722 | tagType = ::InputType::tag::FTexture2DMSArray; | ||
723 | } | ||
724 | else if (tag == "FTextureBuffer") { | ||
725 | tagType = ::InputType::tag::FTextureBuffer; | ||
726 | } | ||
727 | else if (tag == "FTexture2DRect") { | ||
728 | tagType = ::InputType::tag::FTexture2DRect; | ||
729 | } | ||
730 | else if (tag == "ITexture1D") { | ||
731 | tagType = ::InputType::tag::ITexture1D; | ||
732 | } | ||
733 | else if (tag == "ITexture2D") { | ||
734 | tagType = ::InputType::tag::ITexture2D; | ||
735 | } | ||
736 | else if (tag == "ITexture3D") { | ||
737 | tagType = ::InputType::tag::ITexture3D; | ||
738 | } | ||
739 | else if (tag == "ITextureCube") { | ||
740 | tagType = ::InputType::tag::ITextureCube; | ||
741 | } | ||
742 | else if (tag == "ITexture1DArray") { | ||
743 | tagType = ::InputType::tag::ITexture1DArray; | ||
744 | } | ||
745 | else if (tag == "ITexture2DArray") { | ||
746 | tagType = ::InputType::tag::ITexture2DArray; | ||
747 | } | ||
748 | else if (tag == "ITexture2DMS") { | ||
749 | tagType = ::InputType::tag::ITexture2DMS; | ||
750 | } | ||
751 | else if (tag == "ITexture2DMSArray") { | ||
752 | tagType = ::InputType::tag::ITexture2DMSArray; | ||
753 | } | ||
754 | else if (tag == "ITextureBuffer") { | ||
755 | tagType = ::InputType::tag::ITextureBuffer; | ||
756 | } | ||
757 | else if (tag == "ITexture2DRect") { | ||
758 | tagType = ::InputType::tag::ITexture2DRect; | ||
759 | } | ||
760 | else if (tag == "UTexture1D") { | ||
761 | tagType = ::InputType::tag::UTexture1D; | ||
762 | } | ||
763 | else if (tag == "UTexture2D") { | ||
764 | tagType = ::InputType::tag::UTexture2D; | ||
765 | } | ||
766 | else if (tag == "UTexture3D") { | ||
767 | tagType = ::InputType::tag::UTexture3D; | ||
768 | } | ||
769 | else if (tag == "UTextureCube") { | ||
770 | tagType = ::InputType::tag::UTextureCube; | ||
771 | } | ||
772 | else if (tag == "UTexture1DArray") { | ||
773 | tagType = ::InputType::tag::UTexture1DArray; | ||
774 | } | ||
775 | else if (tag == "UTexture2DArray") { | ||
776 | tagType = ::InputType::tag::UTexture2DArray; | ||
777 | } | ||
778 | else if (tag == "UTexture2DMS") { | ||
779 | tagType = ::InputType::tag::UTexture2DMS; | ||
780 | } | ||
781 | else if (tag == "UTexture2DMSArray") { | ||
782 | tagType = ::InputType::tag::UTexture2DMSArray; | ||
783 | } | ||
784 | else if (tag == "UTextureBuffer") { | ||
785 | tagType = ::InputType::tag::UTextureBuffer; | ||
786 | } | ||
787 | else if (tag == "UTexture2DRect") { | ||
788 | tagType = ::InputType::tag::UTexture2DRect; | ||
789 | } | ||
790 | else throw "unknown constructor: " + tag; | ||
791 | std::shared_ptr<::InputType> o(new ::InputType()); | ||
792 | o->tag = tagType; | ||
793 | return o; | ||
794 | } | ||
795 | |||
796 | template<> json toJSON<std::shared_ptr<PointSpriteCoordOrigin>>(std::shared_ptr<PointSpriteCoordOrigin> &v) { | ||
797 | json obj({}); | ||
798 | switch (v->tag) { | ||
799 | case ::PointSpriteCoordOrigin::tag::LowerLeft: | ||
800 | obj["tag"] = "LowerLeft"; | ||
801 | break; | ||
802 | case ::PointSpriteCoordOrigin::tag::UpperLeft: | ||
803 | obj["tag"] = "UpperLeft"; | ||
804 | break; | ||
805 | } | ||
806 | return obj; | ||
807 | } | ||
808 | |||
809 | template<> std::shared_ptr<PointSpriteCoordOrigin> fromJSON<std::shared_ptr<PointSpriteCoordOrigin>>(W<std::shared_ptr<PointSpriteCoordOrigin>> v, json &obj) { | ||
810 | enum ::PointSpriteCoordOrigin::tag tagType; | ||
811 | std::string tag = obj["tag"]; | ||
812 | if (tag == "LowerLeft") { | ||
813 | tagType = ::PointSpriteCoordOrigin::tag::LowerLeft; | ||
814 | } | ||
815 | else if (tag == "UpperLeft") { | ||
816 | tagType = ::PointSpriteCoordOrigin::tag::UpperLeft; | ||
817 | } | ||
818 | else throw "unknown constructor: " + tag; | ||
819 | std::shared_ptr<::PointSpriteCoordOrigin> o(new ::PointSpriteCoordOrigin()); | ||
820 | o->tag = tagType; | ||
821 | return o; | ||
822 | } | ||
823 | |||
824 | template<> json toJSON<std::shared_ptr<PointSize>>(std::shared_ptr<PointSize> &v) { | ||
825 | json obj({}); | ||
826 | switch (v->tag) { | ||
827 | case ::PointSize::tag::PointSize: | ||
828 | obj["tag"] = "PointSize"; | ||
829 | { | ||
830 | std::shared_ptr<data::PointSize> tv = std::static_pointer_cast<data::PointSize>(v); | ||
831 | obj["arg0"] = toJSON(tv->_0); | ||
832 | } | ||
833 | break; | ||
834 | case ::PointSize::tag::ProgramPointSize: | ||
835 | obj["tag"] = "ProgramPointSize"; | ||
836 | break; | ||
837 | } | ||
838 | return obj; | ||
839 | } | ||
840 | |||
841 | template<> std::shared_ptr<PointSize> fromJSON<std::shared_ptr<PointSize>>(W<std::shared_ptr<PointSize>> v, json &obj) { | ||
842 | enum ::PointSize::tag tagType; | ||
843 | std::string tag = obj["tag"]; | ||
844 | if (tag == "PointSize") { | ||
845 | tagType = ::PointSize::tag::PointSize; | ||
846 | std::shared_ptr<data::PointSize> tv(new data::PointSize()); | ||
847 | tv->_0 = fromJSON(W<Float>(), obj["arg0"]); | ||
848 | return tv; | ||
849 | } | ||
850 | else if (tag == "ProgramPointSize") { | ||
851 | tagType = ::PointSize::tag::ProgramPointSize; | ||
852 | } | ||
853 | else throw "unknown constructor: " + tag; | ||
854 | std::shared_ptr<::PointSize> o(new ::PointSize()); | ||
855 | o->tag = tagType; | ||
856 | return o; | ||
857 | } | ||
858 | |||
859 | template<> json toJSON<std::shared_ptr<PolygonOffset>>(std::shared_ptr<PolygonOffset> &v) { | ||
860 | json obj({}); | ||
861 | switch (v->tag) { | ||
862 | case ::PolygonOffset::tag::NoOffset: | ||
863 | obj["tag"] = "NoOffset"; | ||
864 | break; | ||
865 | case ::PolygonOffset::tag::Offset: | ||
866 | obj["tag"] = "Offset"; | ||
867 | { | ||
868 | std::shared_ptr<data::Offset> tv = std::static_pointer_cast<data::Offset>(v); | ||
869 | obj["arg0"] = toJSON(tv->_0); | ||
870 | obj["arg1"] = toJSON(tv->_1); | ||
871 | } | ||
872 | break; | ||
873 | } | ||
874 | return obj; | ||
875 | } | ||
876 | |||
877 | template<> std::shared_ptr<PolygonOffset> fromJSON<std::shared_ptr<PolygonOffset>>(W<std::shared_ptr<PolygonOffset>> v, json &obj) { | ||
878 | enum ::PolygonOffset::tag tagType; | ||
879 | std::string tag = obj["tag"]; | ||
880 | if (tag == "NoOffset") { | ||
881 | tagType = ::PolygonOffset::tag::NoOffset; | ||
882 | } | ||
883 | else if (tag == "Offset") { | ||
884 | tagType = ::PolygonOffset::tag::Offset; | ||
885 | std::shared_ptr<data::Offset> tv(new data::Offset()); | ||
886 | tv->_0 = fromJSON(W<Float>(), obj["arg0"]); | ||
887 | tv->_1 = fromJSON(W<Float>(), obj["arg1"]); | ||
888 | return tv; | ||
889 | } | ||
890 | else throw "unknown constructor: " + tag; | ||
891 | std::shared_ptr<::PolygonOffset> o(new ::PolygonOffset()); | ||
892 | o->tag = tagType; | ||
893 | return o; | ||
894 | } | ||
895 | |||
896 | template<> json toJSON<std::shared_ptr<FrontFace>>(std::shared_ptr<FrontFace> &v) { | ||
897 | json obj({}); | ||
898 | switch (v->tag) { | ||
899 | case ::FrontFace::tag::CCW: | ||
900 | obj["tag"] = "CCW"; | ||
901 | break; | ||
902 | case ::FrontFace::tag::CW: | ||
903 | obj["tag"] = "CW"; | ||
904 | break; | ||
905 | } | ||
906 | return obj; | ||
907 | } | ||
908 | |||
909 | template<> std::shared_ptr<FrontFace> fromJSON<std::shared_ptr<FrontFace>>(W<std::shared_ptr<FrontFace>> v, json &obj) { | ||
910 | enum ::FrontFace::tag tagType; | ||
911 | std::string tag = obj["tag"]; | ||
912 | if (tag == "CCW") { | ||
913 | tagType = ::FrontFace::tag::CCW; | ||
914 | } | ||
915 | else if (tag == "CW") { | ||
916 | tagType = ::FrontFace::tag::CW; | ||
917 | } | ||
918 | else throw "unknown constructor: " + tag; | ||
919 | std::shared_ptr<::FrontFace> o(new ::FrontFace()); | ||
920 | o->tag = tagType; | ||
921 | return o; | ||
922 | } | ||
923 | |||
924 | template<> json toJSON<std::shared_ptr<PolygonMode>>(std::shared_ptr<PolygonMode> &v) { | ||
925 | json obj({}); | ||
926 | switch (v->tag) { | ||
927 | case ::PolygonMode::tag::PolygonPoint: | ||
928 | obj["tag"] = "PolygonPoint"; | ||
929 | { | ||
930 | std::shared_ptr<data::PolygonPoint> tv = std::static_pointer_cast<data::PolygonPoint>(v); | ||
931 | obj["arg0"] = toJSON(tv->_0); | ||
932 | } | ||
933 | break; | ||
934 | case ::PolygonMode::tag::PolygonLine: | ||
935 | obj["tag"] = "PolygonLine"; | ||
936 | { | ||
937 | std::shared_ptr<data::PolygonLine> tv = std::static_pointer_cast<data::PolygonLine>(v); | ||
938 | obj["arg0"] = toJSON(tv->_0); | ||
939 | } | ||
940 | break; | ||
941 | case ::PolygonMode::tag::PolygonFill: | ||
942 | obj["tag"] = "PolygonFill"; | ||
943 | break; | ||
944 | } | ||
945 | return obj; | ||
946 | } | ||
947 | |||
948 | template<> std::shared_ptr<PolygonMode> fromJSON<std::shared_ptr<PolygonMode>>(W<std::shared_ptr<PolygonMode>> v, json &obj) { | ||
949 | enum ::PolygonMode::tag tagType; | ||
950 | std::string tag = obj["tag"]; | ||
951 | if (tag == "PolygonPoint") { | ||
952 | tagType = ::PolygonMode::tag::PolygonPoint; | ||
953 | std::shared_ptr<data::PolygonPoint> tv(new data::PolygonPoint()); | ||
954 | tv->_0 = fromJSON(W<std::shared_ptr<::PointSize>>(), obj["arg0"]); | ||
955 | return tv; | ||
956 | } | ||
957 | else if (tag == "PolygonLine") { | ||
958 | tagType = ::PolygonMode::tag::PolygonLine; | ||
959 | std::shared_ptr<data::PolygonLine> tv(new data::PolygonLine()); | ||
960 | tv->_0 = fromJSON(W<Float>(), obj["arg0"]); | ||
961 | return tv; | ||
962 | } | ||
963 | else if (tag == "PolygonFill") { | ||
964 | tagType = ::PolygonMode::tag::PolygonFill; | ||
965 | } | ||
966 | else throw "unknown constructor: " + tag; | ||
967 | std::shared_ptr<::PolygonMode> o(new ::PolygonMode()); | ||
968 | o->tag = tagType; | ||
969 | return o; | ||
970 | } | ||
971 | |||
972 | template<> json toJSON<std::shared_ptr<ProvokingVertex>>(std::shared_ptr<ProvokingVertex> &v) { | ||
973 | json obj({}); | ||
974 | switch (v->tag) { | ||
975 | case ::ProvokingVertex::tag::FirstVertex: | ||
976 | obj["tag"] = "FirstVertex"; | ||
977 | break; | ||
978 | case ::ProvokingVertex::tag::LastVertex: | ||
979 | obj["tag"] = "LastVertex"; | ||
980 | break; | ||
981 | } | ||
982 | return obj; | ||
983 | } | ||
984 | |||
985 | template<> std::shared_ptr<ProvokingVertex> fromJSON<std::shared_ptr<ProvokingVertex>>(W<std::shared_ptr<ProvokingVertex>> v, json &obj) { | ||
986 | enum ::ProvokingVertex::tag tagType; | ||
987 | std::string tag = obj["tag"]; | ||
988 | if (tag == "FirstVertex") { | ||
989 | tagType = ::ProvokingVertex::tag::FirstVertex; | ||
990 | } | ||
991 | else if (tag == "LastVertex") { | ||
992 | tagType = ::ProvokingVertex::tag::LastVertex; | ||
993 | } | ||
994 | else throw "unknown constructor: " + tag; | ||
995 | std::shared_ptr<::ProvokingVertex> o(new ::ProvokingVertex()); | ||
996 | o->tag = tagType; | ||
997 | return o; | ||
998 | } | ||
999 | |||
1000 | template<> json toJSON<std::shared_ptr<CullMode>>(std::shared_ptr<CullMode> &v) { | ||
1001 | json obj({}); | ||
1002 | switch (v->tag) { | ||
1003 | case ::CullMode::tag::CullNone: | ||
1004 | obj["tag"] = "CullNone"; | ||
1005 | break; | ||
1006 | case ::CullMode::tag::CullFront: | ||
1007 | obj["tag"] = "CullFront"; | ||
1008 | { | ||
1009 | std::shared_ptr<data::CullFront> tv = std::static_pointer_cast<data::CullFront>(v); | ||
1010 | obj["arg0"] = toJSON(tv->_0); | ||
1011 | } | ||
1012 | break; | ||
1013 | case ::CullMode::tag::CullBack: | ||
1014 | obj["tag"] = "CullBack"; | ||
1015 | { | ||
1016 | std::shared_ptr<data::CullBack> tv = std::static_pointer_cast<data::CullBack>(v); | ||
1017 | obj["arg0"] = toJSON(tv->_0); | ||
1018 | } | ||
1019 | break; | ||
1020 | } | ||
1021 | return obj; | ||
1022 | } | ||
1023 | |||
1024 | template<> std::shared_ptr<CullMode> fromJSON<std::shared_ptr<CullMode>>(W<std::shared_ptr<CullMode>> v, json &obj) { | ||
1025 | enum ::CullMode::tag tagType; | ||
1026 | std::string tag = obj["tag"]; | ||
1027 | if (tag == "CullNone") { | ||
1028 | tagType = ::CullMode::tag::CullNone; | ||
1029 | } | ||
1030 | else if (tag == "CullFront") { | ||
1031 | tagType = ::CullMode::tag::CullFront; | ||
1032 | std::shared_ptr<data::CullFront> tv(new data::CullFront()); | ||
1033 | tv->_0 = fromJSON(W<std::shared_ptr<::FrontFace>>(), obj["arg0"]); | ||
1034 | return tv; | ||
1035 | } | ||
1036 | else if (tag == "CullBack") { | ||
1037 | tagType = ::CullMode::tag::CullBack; | ||
1038 | std::shared_ptr<data::CullBack> tv(new data::CullBack()); | ||
1039 | tv->_0 = fromJSON(W<std::shared_ptr<::FrontFace>>(), obj["arg0"]); | ||
1040 | return tv; | ||
1041 | } | ||
1042 | else throw "unknown constructor: " + tag; | ||
1043 | std::shared_ptr<::CullMode> o(new ::CullMode()); | ||
1044 | o->tag = tagType; | ||
1045 | return o; | ||
1046 | } | ||
1047 | |||
1048 | template<> json toJSON<std::shared_ptr<ComparisonFunction>>(std::shared_ptr<ComparisonFunction> &v) { | ||
1049 | json obj({}); | ||
1050 | switch (v->tag) { | ||
1051 | case ::ComparisonFunction::tag::Never: | ||
1052 | obj["tag"] = "Never"; | ||
1053 | break; | ||
1054 | case ::ComparisonFunction::tag::Less: | ||
1055 | obj["tag"] = "Less"; | ||
1056 | break; | ||
1057 | case ::ComparisonFunction::tag::Equal: | ||
1058 | obj["tag"] = "Equal"; | ||
1059 | break; | ||
1060 | case ::ComparisonFunction::tag::Lequal: | ||
1061 | obj["tag"] = "Lequal"; | ||
1062 | break; | ||
1063 | case ::ComparisonFunction::tag::Greater: | ||
1064 | obj["tag"] = "Greater"; | ||
1065 | break; | ||
1066 | case ::ComparisonFunction::tag::Notequal: | ||
1067 | obj["tag"] = "Notequal"; | ||
1068 | break; | ||
1069 | case ::ComparisonFunction::tag::Gequal: | ||
1070 | obj["tag"] = "Gequal"; | ||
1071 | break; | ||
1072 | case ::ComparisonFunction::tag::Always: | ||
1073 | obj["tag"] = "Always"; | ||
1074 | break; | ||
1075 | } | ||
1076 | return obj; | ||
1077 | } | ||
1078 | |||
1079 | template<> std::shared_ptr<ComparisonFunction> fromJSON<std::shared_ptr<ComparisonFunction>>(W<std::shared_ptr<ComparisonFunction>> v, json &obj) { | ||
1080 | enum ::ComparisonFunction::tag tagType; | ||
1081 | std::string tag = obj["tag"]; | ||
1082 | if (tag == "Never") { | ||
1083 | tagType = ::ComparisonFunction::tag::Never; | ||
1084 | } | ||
1085 | else if (tag == "Less") { | ||
1086 | tagType = ::ComparisonFunction::tag::Less; | ||
1087 | } | ||
1088 | else if (tag == "Equal") { | ||
1089 | tagType = ::ComparisonFunction::tag::Equal; | ||
1090 | } | ||
1091 | else if (tag == "Lequal") { | ||
1092 | tagType = ::ComparisonFunction::tag::Lequal; | ||
1093 | } | ||
1094 | else if (tag == "Greater") { | ||
1095 | tagType = ::ComparisonFunction::tag::Greater; | ||
1096 | } | ||
1097 | else if (tag == "Notequal") { | ||
1098 | tagType = ::ComparisonFunction::tag::Notequal; | ||
1099 | } | ||
1100 | else if (tag == "Gequal") { | ||
1101 | tagType = ::ComparisonFunction::tag::Gequal; | ||
1102 | } | ||
1103 | else if (tag == "Always") { | ||
1104 | tagType = ::ComparisonFunction::tag::Always; | ||
1105 | } | ||
1106 | else throw "unknown constructor: " + tag; | ||
1107 | std::shared_ptr<::ComparisonFunction> o(new ::ComparisonFunction()); | ||
1108 | o->tag = tagType; | ||
1109 | return o; | ||
1110 | } | ||
1111 | |||
1112 | template<> json toJSON<std::shared_ptr<StencilOperation>>(std::shared_ptr<StencilOperation> &v) { | ||
1113 | json obj({}); | ||
1114 | switch (v->tag) { | ||
1115 | case ::StencilOperation::tag::OpZero: | ||
1116 | obj["tag"] = "OpZero"; | ||
1117 | break; | ||
1118 | case ::StencilOperation::tag::OpKeep: | ||
1119 | obj["tag"] = "OpKeep"; | ||
1120 | break; | ||
1121 | case ::StencilOperation::tag::OpReplace: | ||
1122 | obj["tag"] = "OpReplace"; | ||
1123 | break; | ||
1124 | case ::StencilOperation::tag::OpIncr: | ||
1125 | obj["tag"] = "OpIncr"; | ||
1126 | break; | ||
1127 | case ::StencilOperation::tag::OpIncrWrap: | ||
1128 | obj["tag"] = "OpIncrWrap"; | ||
1129 | break; | ||
1130 | case ::StencilOperation::tag::OpDecr: | ||
1131 | obj["tag"] = "OpDecr"; | ||
1132 | break; | ||
1133 | case ::StencilOperation::tag::OpDecrWrap: | ||
1134 | obj["tag"] = "OpDecrWrap"; | ||
1135 | break; | ||
1136 | case ::StencilOperation::tag::OpInvert: | ||
1137 | obj["tag"] = "OpInvert"; | ||
1138 | break; | ||
1139 | } | ||
1140 | return obj; | ||
1141 | } | ||
1142 | |||
1143 | template<> std::shared_ptr<StencilOperation> fromJSON<std::shared_ptr<StencilOperation>>(W<std::shared_ptr<StencilOperation>> v, json &obj) { | ||
1144 | enum ::StencilOperation::tag tagType; | ||
1145 | std::string tag = obj["tag"]; | ||
1146 | if (tag == "OpZero") { | ||
1147 | tagType = ::StencilOperation::tag::OpZero; | ||
1148 | } | ||
1149 | else if (tag == "OpKeep") { | ||
1150 | tagType = ::StencilOperation::tag::OpKeep; | ||
1151 | } | ||
1152 | else if (tag == "OpReplace") { | ||
1153 | tagType = ::StencilOperation::tag::OpReplace; | ||
1154 | } | ||
1155 | else if (tag == "OpIncr") { | ||
1156 | tagType = ::StencilOperation::tag::OpIncr; | ||
1157 | } | ||
1158 | else if (tag == "OpIncrWrap") { | ||
1159 | tagType = ::StencilOperation::tag::OpIncrWrap; | ||
1160 | } | ||
1161 | else if (tag == "OpDecr") { | ||
1162 | tagType = ::StencilOperation::tag::OpDecr; | ||
1163 | } | ||
1164 | else if (tag == "OpDecrWrap") { | ||
1165 | tagType = ::StencilOperation::tag::OpDecrWrap; | ||
1166 | } | ||
1167 | else if (tag == "OpInvert") { | ||
1168 | tagType = ::StencilOperation::tag::OpInvert; | ||
1169 | } | ||
1170 | else throw "unknown constructor: " + tag; | ||
1171 | std::shared_ptr<::StencilOperation> o(new ::StencilOperation()); | ||
1172 | o->tag = tagType; | ||
1173 | return o; | ||
1174 | } | ||
1175 | |||
1176 | template<> json toJSON<std::shared_ptr<BlendEquation>>(std::shared_ptr<BlendEquation> &v) { | ||
1177 | json obj({}); | ||
1178 | switch (v->tag) { | ||
1179 | case ::BlendEquation::tag::FuncAdd: | ||
1180 | obj["tag"] = "FuncAdd"; | ||
1181 | break; | ||
1182 | case ::BlendEquation::tag::FuncSubtract: | ||
1183 | obj["tag"] = "FuncSubtract"; | ||
1184 | break; | ||
1185 | case ::BlendEquation::tag::FuncReverseSubtract: | ||
1186 | obj["tag"] = "FuncReverseSubtract"; | ||
1187 | break; | ||
1188 | case ::BlendEquation::tag::Min: | ||
1189 | obj["tag"] = "Min"; | ||
1190 | break; | ||
1191 | case ::BlendEquation::tag::Max: | ||
1192 | obj["tag"] = "Max"; | ||
1193 | break; | ||
1194 | } | ||
1195 | return obj; | ||
1196 | } | ||
1197 | |||
1198 | template<> std::shared_ptr<BlendEquation> fromJSON<std::shared_ptr<BlendEquation>>(W<std::shared_ptr<BlendEquation>> v, json &obj) { | ||
1199 | enum ::BlendEquation::tag tagType; | ||
1200 | std::string tag = obj["tag"]; | ||
1201 | if (tag == "FuncAdd") { | ||
1202 | tagType = ::BlendEquation::tag::FuncAdd; | ||
1203 | } | ||
1204 | else if (tag == "FuncSubtract") { | ||
1205 | tagType = ::BlendEquation::tag::FuncSubtract; | ||
1206 | } | ||
1207 | else if (tag == "FuncReverseSubtract") { | ||
1208 | tagType = ::BlendEquation::tag::FuncReverseSubtract; | ||
1209 | } | ||
1210 | else if (tag == "Min") { | ||
1211 | tagType = ::BlendEquation::tag::Min; | ||
1212 | } | ||
1213 | else if (tag == "Max") { | ||
1214 | tagType = ::BlendEquation::tag::Max; | ||
1215 | } | ||
1216 | else throw "unknown constructor: " + tag; | ||
1217 | std::shared_ptr<::BlendEquation> o(new ::BlendEquation()); | ||
1218 | o->tag = tagType; | ||
1219 | return o; | ||
1220 | } | ||
1221 | |||
1222 | template<> json toJSON<std::shared_ptr<BlendingFactor>>(std::shared_ptr<BlendingFactor> &v) { | ||
1223 | json obj({}); | ||
1224 | switch (v->tag) { | ||
1225 | case ::BlendingFactor::tag::Zero: | ||
1226 | obj["tag"] = "Zero"; | ||
1227 | break; | ||
1228 | case ::BlendingFactor::tag::One: | ||
1229 | obj["tag"] = "One"; | ||
1230 | break; | ||
1231 | case ::BlendingFactor::tag::SrcColor: | ||
1232 | obj["tag"] = "SrcColor"; | ||
1233 | break; | ||
1234 | case ::BlendingFactor::tag::OneMinusSrcColor: | ||
1235 | obj["tag"] = "OneMinusSrcColor"; | ||
1236 | break; | ||
1237 | case ::BlendingFactor::tag::DstColor: | ||
1238 | obj["tag"] = "DstColor"; | ||
1239 | break; | ||
1240 | case ::BlendingFactor::tag::OneMinusDstColor: | ||
1241 | obj["tag"] = "OneMinusDstColor"; | ||
1242 | break; | ||
1243 | case ::BlendingFactor::tag::SrcAlpha: | ||
1244 | obj["tag"] = "SrcAlpha"; | ||
1245 | break; | ||
1246 | case ::BlendingFactor::tag::OneMinusSrcAlpha: | ||
1247 | obj["tag"] = "OneMinusSrcAlpha"; | ||
1248 | break; | ||
1249 | case ::BlendingFactor::tag::DstAlpha: | ||
1250 | obj["tag"] = "DstAlpha"; | ||
1251 | break; | ||
1252 | case ::BlendingFactor::tag::OneMinusDstAlpha: | ||
1253 | obj["tag"] = "OneMinusDstAlpha"; | ||
1254 | break; | ||
1255 | case ::BlendingFactor::tag::ConstantColor: | ||
1256 | obj["tag"] = "ConstantColor"; | ||
1257 | break; | ||
1258 | case ::BlendingFactor::tag::OneMinusConstantColor: | ||
1259 | obj["tag"] = "OneMinusConstantColor"; | ||
1260 | break; | ||
1261 | case ::BlendingFactor::tag::ConstantAlpha: | ||
1262 | obj["tag"] = "ConstantAlpha"; | ||
1263 | break; | ||
1264 | case ::BlendingFactor::tag::OneMinusConstantAlpha: | ||
1265 | obj["tag"] = "OneMinusConstantAlpha"; | ||
1266 | break; | ||
1267 | case ::BlendingFactor::tag::SrcAlphaSaturate: | ||
1268 | obj["tag"] = "SrcAlphaSaturate"; | ||
1269 | break; | ||
1270 | } | ||
1271 | return obj; | ||
1272 | } | ||
1273 | |||
1274 | template<> std::shared_ptr<BlendingFactor> fromJSON<std::shared_ptr<BlendingFactor>>(W<std::shared_ptr<BlendingFactor>> v, json &obj) { | ||
1275 | enum ::BlendingFactor::tag tagType; | ||
1276 | std::string tag = obj["tag"]; | ||
1277 | if (tag == "Zero") { | ||
1278 | tagType = ::BlendingFactor::tag::Zero; | ||
1279 | } | ||
1280 | else if (tag == "One") { | ||
1281 | tagType = ::BlendingFactor::tag::One; | ||
1282 | } | ||
1283 | else if (tag == "SrcColor") { | ||
1284 | tagType = ::BlendingFactor::tag::SrcColor; | ||
1285 | } | ||
1286 | else if (tag == "OneMinusSrcColor") { | ||
1287 | tagType = ::BlendingFactor::tag::OneMinusSrcColor; | ||
1288 | } | ||
1289 | else if (tag == "DstColor") { | ||
1290 | tagType = ::BlendingFactor::tag::DstColor; | ||
1291 | } | ||
1292 | else if (tag == "OneMinusDstColor") { | ||
1293 | tagType = ::BlendingFactor::tag::OneMinusDstColor; | ||
1294 | } | ||
1295 | else if (tag == "SrcAlpha") { | ||
1296 | tagType = ::BlendingFactor::tag::SrcAlpha; | ||
1297 | } | ||
1298 | else if (tag == "OneMinusSrcAlpha") { | ||
1299 | tagType = ::BlendingFactor::tag::OneMinusSrcAlpha; | ||
1300 | } | ||
1301 | else if (tag == "DstAlpha") { | ||
1302 | tagType = ::BlendingFactor::tag::DstAlpha; | ||
1303 | } | ||
1304 | else if (tag == "OneMinusDstAlpha") { | ||
1305 | tagType = ::BlendingFactor::tag::OneMinusDstAlpha; | ||
1306 | } | ||
1307 | else if (tag == "ConstantColor") { | ||
1308 | tagType = ::BlendingFactor::tag::ConstantColor; | ||
1309 | } | ||
1310 | else if (tag == "OneMinusConstantColor") { | ||
1311 | tagType = ::BlendingFactor::tag::OneMinusConstantColor; | ||
1312 | } | ||
1313 | else if (tag == "ConstantAlpha") { | ||
1314 | tagType = ::BlendingFactor::tag::ConstantAlpha; | ||
1315 | } | ||
1316 | else if (tag == "OneMinusConstantAlpha") { | ||
1317 | tagType = ::BlendingFactor::tag::OneMinusConstantAlpha; | ||
1318 | } | ||
1319 | else if (tag == "SrcAlphaSaturate") { | ||
1320 | tagType = ::BlendingFactor::tag::SrcAlphaSaturate; | ||
1321 | } | ||
1322 | else throw "unknown constructor: " + tag; | ||
1323 | std::shared_ptr<::BlendingFactor> o(new ::BlendingFactor()); | ||
1324 | o->tag = tagType; | ||
1325 | return o; | ||
1326 | } | ||
1327 | |||
1328 | template<> json toJSON<std::shared_ptr<LogicOperation>>(std::shared_ptr<LogicOperation> &v) { | ||
1329 | json obj({}); | ||
1330 | switch (v->tag) { | ||
1331 | case ::LogicOperation::tag::Clear: | ||
1332 | obj["tag"] = "Clear"; | ||
1333 | break; | ||
1334 | case ::LogicOperation::tag::And: | ||
1335 | obj["tag"] = "And"; | ||
1336 | break; | ||
1337 | case ::LogicOperation::tag::AndReverse: | ||
1338 | obj["tag"] = "AndReverse"; | ||
1339 | break; | ||
1340 | case ::LogicOperation::tag::Copy: | ||
1341 | obj["tag"] = "Copy"; | ||
1342 | break; | ||
1343 | case ::LogicOperation::tag::AndInverted: | ||
1344 | obj["tag"] = "AndInverted"; | ||
1345 | break; | ||
1346 | case ::LogicOperation::tag::Noop: | ||
1347 | obj["tag"] = "Noop"; | ||
1348 | break; | ||
1349 | case ::LogicOperation::tag::Xor: | ||
1350 | obj["tag"] = "Xor"; | ||
1351 | break; | ||
1352 | case ::LogicOperation::tag::Or: | ||
1353 | obj["tag"] = "Or"; | ||
1354 | break; | ||
1355 | case ::LogicOperation::tag::Nor: | ||
1356 | obj["tag"] = "Nor"; | ||
1357 | break; | ||
1358 | case ::LogicOperation::tag::Equiv: | ||
1359 | obj["tag"] = "Equiv"; | ||
1360 | break; | ||
1361 | case ::LogicOperation::tag::Invert: | ||
1362 | obj["tag"] = "Invert"; | ||
1363 | break; | ||
1364 | case ::LogicOperation::tag::OrReverse: | ||
1365 | obj["tag"] = "OrReverse"; | ||
1366 | break; | ||
1367 | case ::LogicOperation::tag::CopyInverted: | ||
1368 | obj["tag"] = "CopyInverted"; | ||
1369 | break; | ||
1370 | case ::LogicOperation::tag::OrInverted: | ||
1371 | obj["tag"] = "OrInverted"; | ||
1372 | break; | ||
1373 | case ::LogicOperation::tag::Nand: | ||
1374 | obj["tag"] = "Nand"; | ||
1375 | break; | ||
1376 | case ::LogicOperation::tag::Set: | ||
1377 | obj["tag"] = "Set"; | ||
1378 | break; | ||
1379 | } | ||
1380 | return obj; | ||
1381 | } | ||
1382 | |||
1383 | template<> std::shared_ptr<LogicOperation> fromJSON<std::shared_ptr<LogicOperation>>(W<std::shared_ptr<LogicOperation>> v, json &obj) { | ||
1384 | enum ::LogicOperation::tag tagType; | ||
1385 | std::string tag = obj["tag"]; | ||
1386 | if (tag == "Clear") { | ||
1387 | tagType = ::LogicOperation::tag::Clear; | ||
1388 | } | ||
1389 | else if (tag == "And") { | ||
1390 | tagType = ::LogicOperation::tag::And; | ||
1391 | } | ||
1392 | else if (tag == "AndReverse") { | ||
1393 | tagType = ::LogicOperation::tag::AndReverse; | ||
1394 | } | ||
1395 | else if (tag == "Copy") { | ||
1396 | tagType = ::LogicOperation::tag::Copy; | ||
1397 | } | ||
1398 | else if (tag == "AndInverted") { | ||
1399 | tagType = ::LogicOperation::tag::AndInverted; | ||
1400 | } | ||
1401 | else if (tag == "Noop") { | ||
1402 | tagType = ::LogicOperation::tag::Noop; | ||
1403 | } | ||
1404 | else if (tag == "Xor") { | ||
1405 | tagType = ::LogicOperation::tag::Xor; | ||
1406 | } | ||
1407 | else if (tag == "Or") { | ||
1408 | tagType = ::LogicOperation::tag::Or; | ||
1409 | } | ||
1410 | else if (tag == "Nor") { | ||
1411 | tagType = ::LogicOperation::tag::Nor; | ||
1412 | } | ||
1413 | else if (tag == "Equiv") { | ||
1414 | tagType = ::LogicOperation::tag::Equiv; | ||
1415 | } | ||
1416 | else if (tag == "Invert") { | ||
1417 | tagType = ::LogicOperation::tag::Invert; | ||
1418 | } | ||
1419 | else if (tag == "OrReverse") { | ||
1420 | tagType = ::LogicOperation::tag::OrReverse; | ||
1421 | } | ||
1422 | else if (tag == "CopyInverted") { | ||
1423 | tagType = ::LogicOperation::tag::CopyInverted; | ||
1424 | } | ||
1425 | else if (tag == "OrInverted") { | ||
1426 | tagType = ::LogicOperation::tag::OrInverted; | ||
1427 | } | ||
1428 | else if (tag == "Nand") { | ||
1429 | tagType = ::LogicOperation::tag::Nand; | ||
1430 | } | ||
1431 | else if (tag == "Set") { | ||
1432 | tagType = ::LogicOperation::tag::Set; | ||
1433 | } | ||
1434 | else throw "unknown constructor: " + tag; | ||
1435 | std::shared_ptr<::LogicOperation> o(new ::LogicOperation()); | ||
1436 | o->tag = tagType; | ||
1437 | return o; | ||
1438 | } | ||
1439 | |||
1440 | template<> json toJSON<std::shared_ptr<StencilOps>>(std::shared_ptr<StencilOps> &v) { | ||
1441 | json obj({}); | ||
1442 | switch (v->tag) { | ||
1443 | case ::StencilOps::tag::StencilOps: | ||
1444 | obj["tag"] = "StencilOps"; | ||
1445 | { | ||
1446 | std::shared_ptr<data::StencilOps> tv = std::static_pointer_cast<data::StencilOps>(v); | ||
1447 | obj["frontStencilOp"] = toJSON(tv->frontStencilOp); | ||
1448 | obj["backStencilOp"] = toJSON(tv->backStencilOp); | ||
1449 | } | ||
1450 | break; | ||
1451 | } | ||
1452 | return obj; | ||
1453 | } | ||
1454 | |||
1455 | template<> std::shared_ptr<StencilOps> fromJSON<std::shared_ptr<StencilOps>>(W<std::shared_ptr<StencilOps>> v, json &obj) { | ||
1456 | enum ::StencilOps::tag tagType; | ||
1457 | std::string tag = obj["tag"]; | ||
1458 | if (tag == "StencilOps") { | ||
1459 | tagType = ::StencilOps::tag::StencilOps; | ||
1460 | std::shared_ptr<data::StencilOps> tv(new data::StencilOps()); | ||
1461 | tv->frontStencilOp = fromJSON(W<std::shared_ptr<::StencilOperation>>(), obj["frontStencilOp"]); | ||
1462 | tv->backStencilOp = fromJSON(W<std::shared_ptr<::StencilOperation>>(), obj["backStencilOp"]); | ||
1463 | return tv; | ||
1464 | } | ||
1465 | else throw "unknown constructor: " + tag; | ||
1466 | std::shared_ptr<::StencilOps> o(new ::StencilOps()); | ||
1467 | o->tag = tagType; | ||
1468 | return o; | ||
1469 | } | ||
1470 | |||
1471 | template<> json toJSON<std::shared_ptr<StencilTest>>(std::shared_ptr<StencilTest> &v) { | ||
1472 | json obj({}); | ||
1473 | switch (v->tag) { | ||
1474 | case ::StencilTest::tag::StencilTest: | ||
1475 | obj["tag"] = "StencilTest"; | ||
1476 | { | ||
1477 | std::shared_ptr<data::StencilTest> tv = std::static_pointer_cast<data::StencilTest>(v); | ||
1478 | obj["stencilComparision"] = toJSON(tv->stencilComparision); | ||
1479 | obj["stencilReference"] = toJSON(tv->stencilReference); | ||
1480 | obj["stencilMask"] = toJSON(tv->stencilMask); | ||
1481 | } | ||
1482 | break; | ||
1483 | } | ||
1484 | return obj; | ||
1485 | } | ||
1486 | |||
1487 | template<> std::shared_ptr<StencilTest> fromJSON<std::shared_ptr<StencilTest>>(W<std::shared_ptr<StencilTest>> v, json &obj) { | ||
1488 | enum ::StencilTest::tag tagType; | ||
1489 | std::string tag = obj["tag"]; | ||
1490 | if (tag == "StencilTest") { | ||
1491 | tagType = ::StencilTest::tag::StencilTest; | ||
1492 | std::shared_ptr<data::StencilTest> tv(new data::StencilTest()); | ||
1493 | tv->stencilComparision = fromJSON(W<std::shared_ptr<::ComparisonFunction>>(), obj["stencilComparision"]); | ||
1494 | tv->stencilReference = fromJSON(W<Int32>(), obj["stencilReference"]); | ||
1495 | tv->stencilMask = fromJSON(W<Word32>(), obj["stencilMask"]); | ||
1496 | return tv; | ||
1497 | } | ||
1498 | else throw "unknown constructor: " + tag; | ||
1499 | std::shared_ptr<::StencilTest> o(new ::StencilTest()); | ||
1500 | o->tag = tagType; | ||
1501 | return o; | ||
1502 | } | ||
1503 | |||
1504 | template<> json toJSON<std::shared_ptr<StencilTests>>(std::shared_ptr<StencilTests> &v) { | ||
1505 | json obj({}); | ||
1506 | switch (v->tag) { | ||
1507 | case ::StencilTests::tag::StencilTests: | ||
1508 | obj["tag"] = "StencilTests"; | ||
1509 | { | ||
1510 | std::shared_ptr<data::StencilTests> tv = std::static_pointer_cast<data::StencilTests>(v); | ||
1511 | obj["arg0"] = toJSON(tv->_0); | ||
1512 | obj["arg1"] = toJSON(tv->_1); | ||
1513 | } | ||
1514 | break; | ||
1515 | } | ||
1516 | return obj; | ||
1517 | } | ||
1518 | |||
1519 | template<> std::shared_ptr<StencilTests> fromJSON<std::shared_ptr<StencilTests>>(W<std::shared_ptr<StencilTests>> v, json &obj) { | ||
1520 | enum ::StencilTests::tag tagType; | ||
1521 | std::string tag = obj["tag"]; | ||
1522 | if (tag == "StencilTests") { | ||
1523 | tagType = ::StencilTests::tag::StencilTests; | ||
1524 | std::shared_ptr<data::StencilTests> tv(new data::StencilTests()); | ||
1525 | tv->_0 = fromJSON(W<std::shared_ptr<::StencilTest>>(), obj["arg0"]); | ||
1526 | tv->_1 = fromJSON(W<std::shared_ptr<::StencilTest>>(), obj["arg1"]); | ||
1527 | return tv; | ||
1528 | } | ||
1529 | else throw "unknown constructor: " + tag; | ||
1530 | std::shared_ptr<::StencilTests> o(new ::StencilTests()); | ||
1531 | o->tag = tagType; | ||
1532 | return o; | ||
1533 | } | ||
1534 | |||
1535 | template<> json toJSON<std::shared_ptr<FetchPrimitive>>(std::shared_ptr<FetchPrimitive> &v) { | ||
1536 | json obj({}); | ||
1537 | switch (v->tag) { | ||
1538 | case ::FetchPrimitive::tag::Points: | ||
1539 | obj["tag"] = "Points"; | ||
1540 | break; | ||
1541 | case ::FetchPrimitive::tag::Lines: | ||
1542 | obj["tag"] = "Lines"; | ||
1543 | break; | ||
1544 | case ::FetchPrimitive::tag::Triangles: | ||
1545 | obj["tag"] = "Triangles"; | ||
1546 | break; | ||
1547 | case ::FetchPrimitive::tag::LinesAdjacency: | ||
1548 | obj["tag"] = "LinesAdjacency"; | ||
1549 | break; | ||
1550 | case ::FetchPrimitive::tag::TrianglesAdjacency: | ||
1551 | obj["tag"] = "TrianglesAdjacency"; | ||
1552 | break; | ||
1553 | } | ||
1554 | return obj; | ||
1555 | } | ||
1556 | |||
1557 | template<> std::shared_ptr<FetchPrimitive> fromJSON<std::shared_ptr<FetchPrimitive>>(W<std::shared_ptr<FetchPrimitive>> v, json &obj) { | ||
1558 | enum ::FetchPrimitive::tag tagType; | ||
1559 | std::string tag = obj["tag"]; | ||
1560 | if (tag == "Points") { | ||
1561 | tagType = ::FetchPrimitive::tag::Points; | ||
1562 | } | ||
1563 | else if (tag == "Lines") { | ||
1564 | tagType = ::FetchPrimitive::tag::Lines; | ||
1565 | } | ||
1566 | else if (tag == "Triangles") { | ||
1567 | tagType = ::FetchPrimitive::tag::Triangles; | ||
1568 | } | ||
1569 | else if (tag == "LinesAdjacency") { | ||
1570 | tagType = ::FetchPrimitive::tag::LinesAdjacency; | ||
1571 | } | ||
1572 | else if (tag == "TrianglesAdjacency") { | ||
1573 | tagType = ::FetchPrimitive::tag::TrianglesAdjacency; | ||
1574 | } | ||
1575 | else throw "unknown constructor: " + tag; | ||
1576 | std::shared_ptr<::FetchPrimitive> o(new ::FetchPrimitive()); | ||
1577 | o->tag = tagType; | ||
1578 | return o; | ||
1579 | } | ||
1580 | |||
1581 | template<> json toJSON<std::shared_ptr<OutputPrimitive>>(std::shared_ptr<OutputPrimitive> &v) { | ||
1582 | json obj({}); | ||
1583 | switch (v->tag) { | ||
1584 | case ::OutputPrimitive::tag::TrianglesOutput: | ||
1585 | obj["tag"] = "TrianglesOutput"; | ||
1586 | break; | ||
1587 | case ::OutputPrimitive::tag::LinesOutput: | ||
1588 | obj["tag"] = "LinesOutput"; | ||
1589 | break; | ||
1590 | case ::OutputPrimitive::tag::PointsOutput: | ||
1591 | obj["tag"] = "PointsOutput"; | ||
1592 | break; | ||
1593 | } | ||
1594 | return obj; | ||
1595 | } | ||
1596 | |||
1597 | template<> std::shared_ptr<OutputPrimitive> fromJSON<std::shared_ptr<OutputPrimitive>>(W<std::shared_ptr<OutputPrimitive>> v, json &obj) { | ||
1598 | enum ::OutputPrimitive::tag tagType; | ||
1599 | std::string tag = obj["tag"]; | ||
1600 | if (tag == "TrianglesOutput") { | ||
1601 | tagType = ::OutputPrimitive::tag::TrianglesOutput; | ||
1602 | } | ||
1603 | else if (tag == "LinesOutput") { | ||
1604 | tagType = ::OutputPrimitive::tag::LinesOutput; | ||
1605 | } | ||
1606 | else if (tag == "PointsOutput") { | ||
1607 | tagType = ::OutputPrimitive::tag::PointsOutput; | ||
1608 | } | ||
1609 | else throw "unknown constructor: " + tag; | ||
1610 | std::shared_ptr<::OutputPrimitive> o(new ::OutputPrimitive()); | ||
1611 | o->tag = tagType; | ||
1612 | return o; | ||
1613 | } | ||
1614 | |||
1615 | template<> json toJSON<std::shared_ptr<ColorArity>>(std::shared_ptr<ColorArity> &v) { | ||
1616 | json obj({}); | ||
1617 | switch (v->tag) { | ||
1618 | case ::ColorArity::tag::Red: | ||
1619 | obj["tag"] = "Red"; | ||
1620 | break; | ||
1621 | case ::ColorArity::tag::RG: | ||
1622 | obj["tag"] = "RG"; | ||
1623 | break; | ||
1624 | case ::ColorArity::tag::RGB: | ||
1625 | obj["tag"] = "RGB"; | ||
1626 | break; | ||
1627 | case ::ColorArity::tag::RGBA: | ||
1628 | obj["tag"] = "RGBA"; | ||
1629 | break; | ||
1630 | } | ||
1631 | return obj; | ||
1632 | } | ||
1633 | |||
1634 | template<> std::shared_ptr<ColorArity> fromJSON<std::shared_ptr<ColorArity>>(W<std::shared_ptr<ColorArity>> v, json &obj) { | ||
1635 | enum ::ColorArity::tag tagType; | ||
1636 | std::string tag = obj["tag"]; | ||
1637 | if (tag == "Red") { | ||
1638 | tagType = ::ColorArity::tag::Red; | ||
1639 | } | ||
1640 | else if (tag == "RG") { | ||
1641 | tagType = ::ColorArity::tag::RG; | ||
1642 | } | ||
1643 | else if (tag == "RGB") { | ||
1644 | tagType = ::ColorArity::tag::RGB; | ||
1645 | } | ||
1646 | else if (tag == "RGBA") { | ||
1647 | tagType = ::ColorArity::tag::RGBA; | ||
1648 | } | ||
1649 | else throw "unknown constructor: " + tag; | ||
1650 | std::shared_ptr<::ColorArity> o(new ::ColorArity()); | ||
1651 | o->tag = tagType; | ||
1652 | return o; | ||
1653 | } | ||
1654 | |||
1655 | template<> json toJSON<std::shared_ptr<Blending>>(std::shared_ptr<Blending> &v) { | ||
1656 | json obj({}); | ||
1657 | switch (v->tag) { | ||
1658 | case ::Blending::tag::NoBlending: | ||
1659 | obj["tag"] = "NoBlending"; | ||
1660 | break; | ||
1661 | case ::Blending::tag::BlendLogicOp: | ||
1662 | obj["tag"] = "BlendLogicOp"; | ||
1663 | { | ||
1664 | std::shared_ptr<data::BlendLogicOp> tv = std::static_pointer_cast<data::BlendLogicOp>(v); | ||
1665 | obj["arg0"] = toJSON(tv->_0); | ||
1666 | } | ||
1667 | break; | ||
1668 | case ::Blending::tag::Blend: | ||
1669 | obj["tag"] = "Blend"; | ||
1670 | { | ||
1671 | std::shared_ptr<data::Blend> tv = std::static_pointer_cast<data::Blend>(v); | ||
1672 | obj["colorEqSrc"] = toJSON(tv->colorEqSrc); | ||
1673 | obj["alphaEqSrc"] = toJSON(tv->alphaEqSrc); | ||
1674 | obj["colorFSrc"] = toJSON(tv->colorFSrc); | ||
1675 | obj["colorFDst"] = toJSON(tv->colorFDst); | ||
1676 | obj["alphaFSrc"] = toJSON(tv->alphaFSrc); | ||
1677 | obj["alphaFDst"] = toJSON(tv->alphaFDst); | ||
1678 | obj["color"] = toJSON(tv->color); | ||
1679 | } | ||
1680 | break; | ||
1681 | } | ||
1682 | return obj; | ||
1683 | } | ||
1684 | |||
1685 | template<> std::shared_ptr<Blending> fromJSON<std::shared_ptr<Blending>>(W<std::shared_ptr<Blending>> v, json &obj) { | ||
1686 | enum ::Blending::tag tagType; | ||
1687 | std::string tag = obj["tag"]; | ||
1688 | if (tag == "NoBlending") { | ||
1689 | tagType = ::Blending::tag::NoBlending; | ||
1690 | } | ||
1691 | else if (tag == "BlendLogicOp") { | ||
1692 | tagType = ::Blending::tag::BlendLogicOp; | ||
1693 | std::shared_ptr<data::BlendLogicOp> tv(new data::BlendLogicOp()); | ||
1694 | tv->_0 = fromJSON(W<std::shared_ptr<::LogicOperation>>(), obj["arg0"]); | ||
1695 | return tv; | ||
1696 | } | ||
1697 | else if (tag == "Blend") { | ||
1698 | tagType = ::Blending::tag::Blend; | ||
1699 | std::shared_ptr<data::Blend> tv(new data::Blend()); | ||
1700 | tv->colorEqSrc = fromJSON(W<std::shared_ptr<::BlendEquation>>(), obj["colorEqSrc"]); | ||
1701 | tv->alphaEqSrc = fromJSON(W<std::shared_ptr<::BlendEquation>>(), obj["alphaEqSrc"]); | ||
1702 | tv->colorFSrc = fromJSON(W<std::shared_ptr<::BlendingFactor>>(), obj["colorFSrc"]); | ||
1703 | tv->colorFDst = fromJSON(W<std::shared_ptr<::BlendingFactor>>(), obj["colorFDst"]); | ||
1704 | tv->alphaFSrc = fromJSON(W<std::shared_ptr<::BlendingFactor>>(), obj["alphaFSrc"]); | ||
1705 | tv->alphaFDst = fromJSON(W<std::shared_ptr<::BlendingFactor>>(), obj["alphaFDst"]); | ||
1706 | tv->color = fromJSON(W<V4F>(), obj["color"]); | ||
1707 | return tv; | ||
1708 | } | ||
1709 | else throw "unknown constructor: " + tag; | ||
1710 | std::shared_ptr<::Blending> o(new ::Blending()); | ||
1711 | o->tag = tagType; | ||
1712 | return o; | ||
1713 | } | ||
1714 | |||
1715 | template<> json toJSON<std::shared_ptr<RasterContext>>(std::shared_ptr<RasterContext> &v) { | ||
1716 | json obj({}); | ||
1717 | switch (v->tag) { | ||
1718 | case ::RasterContext::tag::PointCtx: | ||
1719 | obj["tag"] = "PointCtx"; | ||
1720 | { | ||
1721 | std::shared_ptr<data::PointCtx> tv = std::static_pointer_cast<data::PointCtx>(v); | ||
1722 | obj["arg0"] = toJSON(tv->_0); | ||
1723 | obj["arg1"] = toJSON(tv->_1); | ||
1724 | obj["arg2"] = toJSON(tv->_2); | ||
1725 | } | ||
1726 | break; | ||
1727 | case ::RasterContext::tag::LineCtx: | ||
1728 | obj["tag"] = "LineCtx"; | ||
1729 | { | ||
1730 | std::shared_ptr<data::LineCtx> tv = std::static_pointer_cast<data::LineCtx>(v); | ||
1731 | obj["arg0"] = toJSON(tv->_0); | ||
1732 | obj["arg1"] = toJSON(tv->_1); | ||
1733 | } | ||
1734 | break; | ||
1735 | case ::RasterContext::tag::TriangleCtx: | ||
1736 | obj["tag"] = "TriangleCtx"; | ||
1737 | { | ||
1738 | std::shared_ptr<data::TriangleCtx> tv = std::static_pointer_cast<data::TriangleCtx>(v); | ||
1739 | obj["arg0"] = toJSON(tv->_0); | ||
1740 | obj["arg1"] = toJSON(tv->_1); | ||
1741 | obj["arg2"] = toJSON(tv->_2); | ||
1742 | obj["arg3"] = toJSON(tv->_3); | ||
1743 | } | ||
1744 | break; | ||
1745 | } | ||
1746 | return obj; | ||
1747 | } | ||
1748 | |||
1749 | template<> std::shared_ptr<RasterContext> fromJSON<std::shared_ptr<RasterContext>>(W<std::shared_ptr<RasterContext>> v, json &obj) { | ||
1750 | enum ::RasterContext::tag tagType; | ||
1751 | std::string tag = obj["tag"]; | ||
1752 | if (tag == "PointCtx") { | ||
1753 | tagType = ::RasterContext::tag::PointCtx; | ||
1754 | std::shared_ptr<data::PointCtx> tv(new data::PointCtx()); | ||
1755 | tv->_0 = fromJSON(W<std::shared_ptr<::PointSize>>(), obj["arg0"]); | ||
1756 | tv->_1 = fromJSON(W<Float>(), obj["arg1"]); | ||
1757 | tv->_2 = fromJSON(W<std::shared_ptr<::PointSpriteCoordOrigin>>(), obj["arg2"]); | ||
1758 | return tv; | ||
1759 | } | ||
1760 | else if (tag == "LineCtx") { | ||
1761 | tagType = ::RasterContext::tag::LineCtx; | ||
1762 | std::shared_ptr<data::LineCtx> tv(new data::LineCtx()); | ||
1763 | tv->_0 = fromJSON(W<Float>(), obj["arg0"]); | ||
1764 | tv->_1 = fromJSON(W<std::shared_ptr<::ProvokingVertex>>(), obj["arg1"]); | ||
1765 | return tv; | ||
1766 | } | ||
1767 | else if (tag == "TriangleCtx") { | ||
1768 | tagType = ::RasterContext::tag::TriangleCtx; | ||
1769 | std::shared_ptr<data::TriangleCtx> tv(new data::TriangleCtx()); | ||
1770 | tv->_0 = fromJSON(W<std::shared_ptr<::CullMode>>(), obj["arg0"]); | ||
1771 | tv->_1 = fromJSON(W<std::shared_ptr<::PolygonMode>>(), obj["arg1"]); | ||
1772 | tv->_2 = fromJSON(W<std::shared_ptr<::PolygonOffset>>(), obj["arg2"]); | ||
1773 | tv->_3 = fromJSON(W<std::shared_ptr<::ProvokingVertex>>(), obj["arg3"]); | ||
1774 | return tv; | ||
1775 | } | ||
1776 | else throw "unknown constructor: " + tag; | ||
1777 | std::shared_ptr<::RasterContext> o(new ::RasterContext()); | ||
1778 | o->tag = tagType; | ||
1779 | return o; | ||
1780 | } | ||
1781 | |||
1782 | template<> json toJSON<std::shared_ptr<FragmentOperation>>(std::shared_ptr<FragmentOperation> &v) { | ||
1783 | json obj({}); | ||
1784 | switch (v->tag) { | ||
1785 | case ::FragmentOperation::tag::DepthOp: | ||
1786 | obj["tag"] = "DepthOp"; | ||
1787 | { | ||
1788 | std::shared_ptr<data::DepthOp> tv = std::static_pointer_cast<data::DepthOp>(v); | ||
1789 | obj["arg0"] = toJSON(tv->_0); | ||
1790 | obj["arg1"] = toJSON(tv->_1); | ||
1791 | } | ||
1792 | break; | ||
1793 | case ::FragmentOperation::tag::StencilOp: | ||
1794 | obj["tag"] = "StencilOp"; | ||
1795 | { | ||
1796 | std::shared_ptr<data::StencilOp> tv = std::static_pointer_cast<data::StencilOp>(v); | ||
1797 | obj["arg0"] = toJSON(tv->_0); | ||
1798 | obj["arg1"] = toJSON(tv->_1); | ||
1799 | obj["arg2"] = toJSON(tv->_2); | ||
1800 | } | ||
1801 | break; | ||
1802 | case ::FragmentOperation::tag::ColorOp: | ||
1803 | obj["tag"] = "ColorOp"; | ||
1804 | { | ||
1805 | std::shared_ptr<data::ColorOp> tv = std::static_pointer_cast<data::ColorOp>(v); | ||
1806 | obj["arg0"] = toJSON(tv->_0); | ||
1807 | obj["arg1"] = toJSON(tv->_1); | ||
1808 | } | ||
1809 | break; | ||
1810 | } | ||
1811 | return obj; | ||
1812 | } | ||
1813 | |||
1814 | template<> std::shared_ptr<FragmentOperation> fromJSON<std::shared_ptr<FragmentOperation>>(W<std::shared_ptr<FragmentOperation>> v, json &obj) { | ||
1815 | enum ::FragmentOperation::tag tagType; | ||
1816 | std::string tag = obj["tag"]; | ||
1817 | if (tag == "DepthOp") { | ||
1818 | tagType = ::FragmentOperation::tag::DepthOp; | ||
1819 | std::shared_ptr<data::DepthOp> tv(new data::DepthOp()); | ||
1820 | tv->_0 = fromJSON(W<std::shared_ptr<::DepthFunction>>(), obj["arg0"]); | ||
1821 | tv->_1 = fromJSON(W<Bool>(), obj["arg1"]); | ||
1822 | return tv; | ||
1823 | } | ||
1824 | else if (tag == "StencilOp") { | ||
1825 | tagType = ::FragmentOperation::tag::StencilOp; | ||
1826 | std::shared_ptr<data::StencilOp> tv(new data::StencilOp()); | ||
1827 | tv->_0 = fromJSON(W<std::shared_ptr<::StencilTests>>(), obj["arg0"]); | ||
1828 | tv->_1 = fromJSON(W<std::shared_ptr<::StencilOps>>(), obj["arg1"]); | ||
1829 | tv->_2 = fromJSON(W<std::shared_ptr<::StencilOps>>(), obj["arg2"]); | ||
1830 | return tv; | ||
1831 | } | ||
1832 | else if (tag == "ColorOp") { | ||
1833 | tagType = ::FragmentOperation::tag::ColorOp; | ||
1834 | std::shared_ptr<data::ColorOp> tv(new data::ColorOp()); | ||
1835 | tv->_0 = fromJSON(W<std::shared_ptr<::Blending>>(), obj["arg0"]); | ||
1836 | tv->_1 = fromJSON(W<std::shared_ptr<::Value>>(), obj["arg1"]); | ||
1837 | return tv; | ||
1838 | } | ||
1839 | else throw "unknown constructor: " + tag; | ||
1840 | std::shared_ptr<::FragmentOperation> o(new ::FragmentOperation()); | ||
1841 | o->tag = tagType; | ||
1842 | return o; | ||
1843 | } | ||
1844 | |||
1845 | template<> json toJSON<std::shared_ptr<AccumulationContext>>(std::shared_ptr<AccumulationContext> &v) { | ||
1846 | json obj({}); | ||
1847 | switch (v->tag) { | ||
1848 | case ::AccumulationContext::tag::AccumulationContext: | ||
1849 | obj["tag"] = "AccumulationContext"; | ||
1850 | { | ||
1851 | std::shared_ptr<data::AccumulationContext> tv = std::static_pointer_cast<data::AccumulationContext>(v); | ||
1852 | obj["accViewportName"] = toJSON(tv->accViewportName); | ||
1853 | obj["accOperations"] = toJSON(tv->accOperations); | ||
1854 | } | ||
1855 | break; | ||
1856 | } | ||
1857 | return obj; | ||
1858 | } | ||
1859 | |||
1860 | template<> std::shared_ptr<AccumulationContext> fromJSON<std::shared_ptr<AccumulationContext>>(W<std::shared_ptr<AccumulationContext>> v, json &obj) { | ||
1861 | enum ::AccumulationContext::tag tagType; | ||
1862 | std::string tag = obj["tag"]; | ||
1863 | if (tag == "AccumulationContext") { | ||
1864 | tagType = ::AccumulationContext::tag::AccumulationContext; | ||
1865 | std::shared_ptr<data::AccumulationContext> tv(new data::AccumulationContext()); | ||
1866 | tv->accViewportName = fromJSON(W<Maybe<String>>(), obj["accViewportName"]); | ||
1867 | tv->accOperations = fromJSON(W<std::vector<std::shared_ptr<::FragmentOperation>>>(), obj["accOperations"]); | ||
1868 | return tv; | ||
1869 | } | ||
1870 | else throw "unknown constructor: " + tag; | ||
1871 | std::shared_ptr<::AccumulationContext> o(new ::AccumulationContext()); | ||
1872 | o->tag = tagType; | ||
1873 | return o; | ||
1874 | } | ||
1875 | |||
1876 | template<> json toJSON<std::shared_ptr<TextureDataType>>(std::shared_ptr<TextureDataType> &v) { | ||
1877 | json obj({}); | ||
1878 | switch (v->tag) { | ||
1879 | case ::TextureDataType::tag::FloatT: | ||
1880 | obj["tag"] = "FloatT"; | ||
1881 | { | ||
1882 | std::shared_ptr<data::FloatT> tv = std::static_pointer_cast<data::FloatT>(v); | ||
1883 | obj["arg0"] = toJSON(tv->_0); | ||
1884 | } | ||
1885 | break; | ||
1886 | case ::TextureDataType::tag::IntT: | ||
1887 | obj["tag"] = "IntT"; | ||
1888 | { | ||
1889 | std::shared_ptr<data::IntT> tv = std::static_pointer_cast<data::IntT>(v); | ||
1890 | obj["arg0"] = toJSON(tv->_0); | ||
1891 | } | ||
1892 | break; | ||
1893 | case ::TextureDataType::tag::WordT: | ||
1894 | obj["tag"] = "WordT"; | ||
1895 | { | ||
1896 | std::shared_ptr<data::WordT> tv = std::static_pointer_cast<data::WordT>(v); | ||
1897 | obj["arg0"] = toJSON(tv->_0); | ||
1898 | } | ||
1899 | break; | ||
1900 | case ::TextureDataType::tag::ShadowT: | ||
1901 | obj["tag"] = "ShadowT"; | ||
1902 | break; | ||
1903 | } | ||
1904 | return obj; | ||
1905 | } | ||
1906 | |||
1907 | template<> std::shared_ptr<TextureDataType> fromJSON<std::shared_ptr<TextureDataType>>(W<std::shared_ptr<TextureDataType>> v, json &obj) { | ||
1908 | enum ::TextureDataType::tag tagType; | ||
1909 | std::string tag = obj["tag"]; | ||
1910 | if (tag == "FloatT") { | ||
1911 | tagType = ::TextureDataType::tag::FloatT; | ||
1912 | std::shared_ptr<data::FloatT> tv(new data::FloatT()); | ||
1913 | tv->_0 = fromJSON(W<std::shared_ptr<::ColorArity>>(), obj["arg0"]); | ||
1914 | return tv; | ||
1915 | } | ||
1916 | else if (tag == "IntT") { | ||
1917 | tagType = ::TextureDataType::tag::IntT; | ||
1918 | std::shared_ptr<data::IntT> tv(new data::IntT()); | ||
1919 | tv->_0 = fromJSON(W<std::shared_ptr<::ColorArity>>(), obj["arg0"]); | ||
1920 | return tv; | ||
1921 | } | ||
1922 | else if (tag == "WordT") { | ||
1923 | tagType = ::TextureDataType::tag::WordT; | ||
1924 | std::shared_ptr<data::WordT> tv(new data::WordT()); | ||
1925 | tv->_0 = fromJSON(W<std::shared_ptr<::ColorArity>>(), obj["arg0"]); | ||
1926 | return tv; | ||
1927 | } | ||
1928 | else if (tag == "ShadowT") { | ||
1929 | tagType = ::TextureDataType::tag::ShadowT; | ||
1930 | } | ||
1931 | else throw "unknown constructor: " + tag; | ||
1932 | std::shared_ptr<::TextureDataType> o(new ::TextureDataType()); | ||
1933 | o->tag = tagType; | ||
1934 | return o; | ||
1935 | } | ||
1936 | |||
1937 | template<> json toJSON<std::shared_ptr<TextureType>>(std::shared_ptr<TextureType> &v) { | ||
1938 | json obj({}); | ||
1939 | switch (v->tag) { | ||
1940 | case ::TextureType::tag::Texture1D: | ||
1941 | obj["tag"] = "Texture1D"; | ||
1942 | { | ||
1943 | std::shared_ptr<data::Texture1D> tv = std::static_pointer_cast<data::Texture1D>(v); | ||
1944 | obj["arg0"] = toJSON(tv->_0); | ||
1945 | obj["arg1"] = toJSON(tv->_1); | ||
1946 | } | ||
1947 | break; | ||
1948 | case ::TextureType::tag::Texture2D: | ||
1949 | obj["tag"] = "Texture2D"; | ||
1950 | { | ||
1951 | std::shared_ptr<data::Texture2D> tv = std::static_pointer_cast<data::Texture2D>(v); | ||
1952 | obj["arg0"] = toJSON(tv->_0); | ||
1953 | obj["arg1"] = toJSON(tv->_1); | ||
1954 | } | ||
1955 | break; | ||
1956 | case ::TextureType::tag::Texture3D: | ||
1957 | obj["tag"] = "Texture3D"; | ||
1958 | { | ||
1959 | std::shared_ptr<data::Texture3D> tv = std::static_pointer_cast<data::Texture3D>(v); | ||
1960 | obj["arg0"] = toJSON(tv->_0); | ||
1961 | } | ||
1962 | break; | ||
1963 | case ::TextureType::tag::TextureCube: | ||
1964 | obj["tag"] = "TextureCube"; | ||
1965 | { | ||
1966 | std::shared_ptr<data::TextureCube> tv = std::static_pointer_cast<data::TextureCube>(v); | ||
1967 | obj["arg0"] = toJSON(tv->_0); | ||
1968 | } | ||
1969 | break; | ||
1970 | case ::TextureType::tag::TextureRect: | ||
1971 | obj["tag"] = "TextureRect"; | ||
1972 | { | ||
1973 | std::shared_ptr<data::TextureRect> tv = std::static_pointer_cast<data::TextureRect>(v); | ||
1974 | obj["arg0"] = toJSON(tv->_0); | ||
1975 | } | ||
1976 | break; | ||
1977 | case ::TextureType::tag::Texture2DMS: | ||
1978 | obj["tag"] = "Texture2DMS"; | ||
1979 | { | ||
1980 | std::shared_ptr<data::Texture2DMS> tv = std::static_pointer_cast<data::Texture2DMS>(v); | ||
1981 | obj["arg0"] = toJSON(tv->_0); | ||
1982 | obj["arg1"] = toJSON(tv->_1); | ||
1983 | obj["arg2"] = toJSON(tv->_2); | ||
1984 | obj["arg3"] = toJSON(tv->_3); | ||
1985 | } | ||
1986 | break; | ||
1987 | case ::TextureType::tag::TextureBuffer: | ||
1988 | obj["tag"] = "TextureBuffer"; | ||
1989 | { | ||
1990 | std::shared_ptr<data::TextureBuffer> tv = std::static_pointer_cast<data::TextureBuffer>(v); | ||
1991 | obj["arg0"] = toJSON(tv->_0); | ||
1992 | } | ||
1993 | break; | ||
1994 | } | ||
1995 | return obj; | ||
1996 | } | ||
1997 | |||
1998 | template<> std::shared_ptr<TextureType> fromJSON<std::shared_ptr<TextureType>>(W<std::shared_ptr<TextureType>> v, json &obj) { | ||
1999 | enum ::TextureType::tag tagType; | ||
2000 | std::string tag = obj["tag"]; | ||
2001 | if (tag == "Texture1D") { | ||
2002 | tagType = ::TextureType::tag::Texture1D; | ||
2003 | std::shared_ptr<data::Texture1D> tv(new data::Texture1D()); | ||
2004 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2005 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2006 | return tv; | ||
2007 | } | ||
2008 | else if (tag == "Texture2D") { | ||
2009 | tagType = ::TextureType::tag::Texture2D; | ||
2010 | std::shared_ptr<data::Texture2D> tv(new data::Texture2D()); | ||
2011 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2012 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2013 | return tv; | ||
2014 | } | ||
2015 | else if (tag == "Texture3D") { | ||
2016 | tagType = ::TextureType::tag::Texture3D; | ||
2017 | std::shared_ptr<data::Texture3D> tv(new data::Texture3D()); | ||
2018 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2019 | return tv; | ||
2020 | } | ||
2021 | else if (tag == "TextureCube") { | ||
2022 | tagType = ::TextureType::tag::TextureCube; | ||
2023 | std::shared_ptr<data::TextureCube> tv(new data::TextureCube()); | ||
2024 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2025 | return tv; | ||
2026 | } | ||
2027 | else if (tag == "TextureRect") { | ||
2028 | tagType = ::TextureType::tag::TextureRect; | ||
2029 | std::shared_ptr<data::TextureRect> tv(new data::TextureRect()); | ||
2030 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2031 | return tv; | ||
2032 | } | ||
2033 | else if (tag == "Texture2DMS") { | ||
2034 | tagType = ::TextureType::tag::Texture2DMS; | ||
2035 | std::shared_ptr<data::Texture2DMS> tv(new data::Texture2DMS()); | ||
2036 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2037 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2038 | tv->_2 = fromJSON(W<Int>(), obj["arg2"]); | ||
2039 | tv->_3 = fromJSON(W<Bool>(), obj["arg3"]); | ||
2040 | return tv; | ||
2041 | } | ||
2042 | else if (tag == "TextureBuffer") { | ||
2043 | tagType = ::TextureType::tag::TextureBuffer; | ||
2044 | std::shared_ptr<data::TextureBuffer> tv(new data::TextureBuffer()); | ||
2045 | tv->_0 = fromJSON(W<std::shared_ptr<::TextureDataType>>(), obj["arg0"]); | ||
2046 | return tv; | ||
2047 | } | ||
2048 | else throw "unknown constructor: " + tag; | ||
2049 | std::shared_ptr<::TextureType> o(new ::TextureType()); | ||
2050 | o->tag = tagType; | ||
2051 | return o; | ||
2052 | } | ||
2053 | |||
2054 | template<> json toJSON<std::shared_ptr<MipMap>>(std::shared_ptr<MipMap> &v) { | ||
2055 | json obj({}); | ||
2056 | switch (v->tag) { | ||
2057 | case ::MipMap::tag::Mip: | ||
2058 | obj["tag"] = "Mip"; | ||
2059 | { | ||
2060 | std::shared_ptr<data::Mip> tv = std::static_pointer_cast<data::Mip>(v); | ||
2061 | obj["arg0"] = toJSON(tv->_0); | ||
2062 | obj["arg1"] = toJSON(tv->_1); | ||
2063 | } | ||
2064 | break; | ||
2065 | case ::MipMap::tag::NoMip: | ||
2066 | obj["tag"] = "NoMip"; | ||
2067 | break; | ||
2068 | case ::MipMap::tag::AutoMip: | ||
2069 | obj["tag"] = "AutoMip"; | ||
2070 | { | ||
2071 | std::shared_ptr<data::AutoMip> tv = std::static_pointer_cast<data::AutoMip>(v); | ||
2072 | obj["arg0"] = toJSON(tv->_0); | ||
2073 | obj["arg1"] = toJSON(tv->_1); | ||
2074 | } | ||
2075 | break; | ||
2076 | } | ||
2077 | return obj; | ||
2078 | } | ||
2079 | |||
2080 | template<> std::shared_ptr<MipMap> fromJSON<std::shared_ptr<MipMap>>(W<std::shared_ptr<MipMap>> v, json &obj) { | ||
2081 | enum ::MipMap::tag tagType; | ||
2082 | std::string tag = obj["tag"]; | ||
2083 | if (tag == "Mip") { | ||
2084 | tagType = ::MipMap::tag::Mip; | ||
2085 | std::shared_ptr<data::Mip> tv(new data::Mip()); | ||
2086 | tv->_0 = fromJSON(W<Int>(), obj["arg0"]); | ||
2087 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2088 | return tv; | ||
2089 | } | ||
2090 | else if (tag == "NoMip") { | ||
2091 | tagType = ::MipMap::tag::NoMip; | ||
2092 | } | ||
2093 | else if (tag == "AutoMip") { | ||
2094 | tagType = ::MipMap::tag::AutoMip; | ||
2095 | std::shared_ptr<data::AutoMip> tv(new data::AutoMip()); | ||
2096 | tv->_0 = fromJSON(W<Int>(), obj["arg0"]); | ||
2097 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2098 | return tv; | ||
2099 | } | ||
2100 | else throw "unknown constructor: " + tag; | ||
2101 | std::shared_ptr<::MipMap> o(new ::MipMap()); | ||
2102 | o->tag = tagType; | ||
2103 | return o; | ||
2104 | } | ||
2105 | |||
2106 | template<> json toJSON<std::shared_ptr<Filter>>(std::shared_ptr<Filter> &v) { | ||
2107 | json obj({}); | ||
2108 | switch (v->tag) { | ||
2109 | case ::Filter::tag::Nearest: | ||
2110 | obj["tag"] = "Nearest"; | ||
2111 | break; | ||
2112 | case ::Filter::tag::Linear: | ||
2113 | obj["tag"] = "Linear"; | ||
2114 | break; | ||
2115 | case ::Filter::tag::NearestMipmapNearest: | ||
2116 | obj["tag"] = "NearestMipmapNearest"; | ||
2117 | break; | ||
2118 | case ::Filter::tag::NearestMipmapLinear: | ||
2119 | obj["tag"] = "NearestMipmapLinear"; | ||
2120 | break; | ||
2121 | case ::Filter::tag::LinearMipmapNearest: | ||
2122 | obj["tag"] = "LinearMipmapNearest"; | ||
2123 | break; | ||
2124 | case ::Filter::tag::LinearMipmapLinear: | ||
2125 | obj["tag"] = "LinearMipmapLinear"; | ||
2126 | break; | ||
2127 | } | ||
2128 | return obj; | ||
2129 | } | ||
2130 | |||
2131 | template<> std::shared_ptr<Filter> fromJSON<std::shared_ptr<Filter>>(W<std::shared_ptr<Filter>> v, json &obj) { | ||
2132 | enum ::Filter::tag tagType; | ||
2133 | std::string tag = obj["tag"]; | ||
2134 | if (tag == "Nearest") { | ||
2135 | tagType = ::Filter::tag::Nearest; | ||
2136 | } | ||
2137 | else if (tag == "Linear") { | ||
2138 | tagType = ::Filter::tag::Linear; | ||
2139 | } | ||
2140 | else if (tag == "NearestMipmapNearest") { | ||
2141 | tagType = ::Filter::tag::NearestMipmapNearest; | ||
2142 | } | ||
2143 | else if (tag == "NearestMipmapLinear") { | ||
2144 | tagType = ::Filter::tag::NearestMipmapLinear; | ||
2145 | } | ||
2146 | else if (tag == "LinearMipmapNearest") { | ||
2147 | tagType = ::Filter::tag::LinearMipmapNearest; | ||
2148 | } | ||
2149 | else if (tag == "LinearMipmapLinear") { | ||
2150 | tagType = ::Filter::tag::LinearMipmapLinear; | ||
2151 | } | ||
2152 | else throw "unknown constructor: " + tag; | ||
2153 | std::shared_ptr<::Filter> o(new ::Filter()); | ||
2154 | o->tag = tagType; | ||
2155 | return o; | ||
2156 | } | ||
2157 | |||
2158 | template<> json toJSON<std::shared_ptr<EdgeMode>>(std::shared_ptr<EdgeMode> &v) { | ||
2159 | json obj({}); | ||
2160 | switch (v->tag) { | ||
2161 | case ::EdgeMode::tag::Repeat: | ||
2162 | obj["tag"] = "Repeat"; | ||
2163 | break; | ||
2164 | case ::EdgeMode::tag::MirroredRepeat: | ||
2165 | obj["tag"] = "MirroredRepeat"; | ||
2166 | break; | ||
2167 | case ::EdgeMode::tag::ClampToEdge: | ||
2168 | obj["tag"] = "ClampToEdge"; | ||
2169 | break; | ||
2170 | case ::EdgeMode::tag::ClampToBorder: | ||
2171 | obj["tag"] = "ClampToBorder"; | ||
2172 | break; | ||
2173 | } | ||
2174 | return obj; | ||
2175 | } | ||
2176 | |||
2177 | template<> std::shared_ptr<EdgeMode> fromJSON<std::shared_ptr<EdgeMode>>(W<std::shared_ptr<EdgeMode>> v, json &obj) { | ||
2178 | enum ::EdgeMode::tag tagType; | ||
2179 | std::string tag = obj["tag"]; | ||
2180 | if (tag == "Repeat") { | ||
2181 | tagType = ::EdgeMode::tag::Repeat; | ||
2182 | } | ||
2183 | else if (tag == "MirroredRepeat") { | ||
2184 | tagType = ::EdgeMode::tag::MirroredRepeat; | ||
2185 | } | ||
2186 | else if (tag == "ClampToEdge") { | ||
2187 | tagType = ::EdgeMode::tag::ClampToEdge; | ||
2188 | } | ||
2189 | else if (tag == "ClampToBorder") { | ||
2190 | tagType = ::EdgeMode::tag::ClampToBorder; | ||
2191 | } | ||
2192 | else throw "unknown constructor: " + tag; | ||
2193 | std::shared_ptr<::EdgeMode> o(new ::EdgeMode()); | ||
2194 | o->tag = tagType; | ||
2195 | return o; | ||
2196 | } | ||
2197 | |||
2198 | template<> json toJSON<std::shared_ptr<ImageSemantic>>(std::shared_ptr<ImageSemantic> &v) { | ||
2199 | json obj({}); | ||
2200 | switch (v->tag) { | ||
2201 | case ::ImageSemantic::tag::Depth: | ||
2202 | obj["tag"] = "Depth"; | ||
2203 | break; | ||
2204 | case ::ImageSemantic::tag::Stencil: | ||
2205 | obj["tag"] = "Stencil"; | ||
2206 | break; | ||
2207 | case ::ImageSemantic::tag::Color: | ||
2208 | obj["tag"] = "Color"; | ||
2209 | break; | ||
2210 | } | ||
2211 | return obj; | ||
2212 | } | ||
2213 | |||
2214 | template<> std::shared_ptr<ImageSemantic> fromJSON<std::shared_ptr<ImageSemantic>>(W<std::shared_ptr<ImageSemantic>> v, json &obj) { | ||
2215 | enum ::ImageSemantic::tag tagType; | ||
2216 | std::string tag = obj["tag"]; | ||
2217 | if (tag == "Depth") { | ||
2218 | tagType = ::ImageSemantic::tag::Depth; | ||
2219 | } | ||
2220 | else if (tag == "Stencil") { | ||
2221 | tagType = ::ImageSemantic::tag::Stencil; | ||
2222 | } | ||
2223 | else if (tag == "Color") { | ||
2224 | tagType = ::ImageSemantic::tag::Color; | ||
2225 | } | ||
2226 | else throw "unknown constructor: " + tag; | ||
2227 | std::shared_ptr<::ImageSemantic> o(new ::ImageSemantic()); | ||
2228 | o->tag = tagType; | ||
2229 | return o; | ||
2230 | } | ||
2231 | |||
2232 | template<> json toJSON<std::shared_ptr<ImageRef>>(std::shared_ptr<ImageRef> &v) { | ||
2233 | json obj({}); | ||
2234 | switch (v->tag) { | ||
2235 | case ::ImageRef::tag::TextureImage: | ||
2236 | obj["tag"] = "TextureImage"; | ||
2237 | { | ||
2238 | std::shared_ptr<data::TextureImage> tv = std::static_pointer_cast<data::TextureImage>(v); | ||
2239 | obj["arg0"] = toJSON(tv->_0); | ||
2240 | obj["arg1"] = toJSON(tv->_1); | ||
2241 | obj["arg2"] = toJSON(tv->_2); | ||
2242 | } | ||
2243 | break; | ||
2244 | case ::ImageRef::tag::Framebuffer: | ||
2245 | obj["tag"] = "Framebuffer"; | ||
2246 | { | ||
2247 | std::shared_ptr<data::Framebuffer> tv = std::static_pointer_cast<data::Framebuffer>(v); | ||
2248 | obj["arg0"] = toJSON(tv->_0); | ||
2249 | } | ||
2250 | break; | ||
2251 | } | ||
2252 | return obj; | ||
2253 | } | ||
2254 | |||
2255 | template<> std::shared_ptr<ImageRef> fromJSON<std::shared_ptr<ImageRef>>(W<std::shared_ptr<ImageRef>> v, json &obj) { | ||
2256 | enum ::ImageRef::tag tagType; | ||
2257 | std::string tag = obj["tag"]; | ||
2258 | if (tag == "TextureImage") { | ||
2259 | tagType = ::ImageRef::tag::TextureImage; | ||
2260 | std::shared_ptr<data::TextureImage> tv(new data::TextureImage()); | ||
2261 | tv->_0 = fromJSON(W<::TextureName>(), obj["arg0"]); | ||
2262 | tv->_1 = fromJSON(W<Int>(), obj["arg1"]); | ||
2263 | tv->_2 = fromJSON(W<Maybe<Int>>(), obj["arg2"]); | ||
2264 | return tv; | ||
2265 | } | ||
2266 | else if (tag == "Framebuffer") { | ||
2267 | tagType = ::ImageRef::tag::Framebuffer; | ||
2268 | std::shared_ptr<data::Framebuffer> tv(new data::Framebuffer()); | ||
2269 | tv->_0 = fromJSON(W<std::shared_ptr<::ImageSemantic>>(), obj["arg0"]); | ||
2270 | return tv; | ||
2271 | } | ||
2272 | else throw "unknown constructor: " + tag; | ||
2273 | std::shared_ptr<::ImageRef> o(new ::ImageRef()); | ||
2274 | o->tag = tagType; | ||
2275 | return o; | ||
2276 | } | ||
2277 | |||
2278 | template<> json toJSON<std::shared_ptr<ClearImage>>(std::shared_ptr<ClearImage> &v) { | ||
2279 | json obj({}); | ||
2280 | switch (v->tag) { | ||
2281 | case ::ClearImage::tag::ClearImage: | ||
2282 | obj["tag"] = "ClearImage"; | ||
2283 | { | ||
2284 | std::shared_ptr<data::ClearImage> tv = std::static_pointer_cast<data::ClearImage>(v); | ||
2285 | obj["imageSemantic"] = toJSON(tv->imageSemantic); | ||
2286 | obj["clearValue"] = toJSON(tv->clearValue); | ||
2287 | } | ||
2288 | break; | ||
2289 | } | ||
2290 | return obj; | ||
2291 | } | ||
2292 | |||
2293 | template<> std::shared_ptr<ClearImage> fromJSON<std::shared_ptr<ClearImage>>(W<std::shared_ptr<ClearImage>> v, json &obj) { | ||
2294 | enum ::ClearImage::tag tagType; | ||
2295 | std::string tag = obj["tag"]; | ||
2296 | if (tag == "ClearImage") { | ||
2297 | tagType = ::ClearImage::tag::ClearImage; | ||
2298 | std::shared_ptr<data::ClearImage> tv(new data::ClearImage()); | ||
2299 | tv->imageSemantic = fromJSON(W<std::shared_ptr<::ImageSemantic>>(), obj["imageSemantic"]); | ||
2300 | tv->clearValue = fromJSON(W<std::shared_ptr<::Value>>(), obj["clearValue"]); | ||
2301 | return tv; | ||
2302 | } | ||
2303 | else throw "unknown constructor: " + tag; | ||
2304 | std::shared_ptr<::ClearImage> o(new ::ClearImage()); | ||
2305 | o->tag = tagType; | ||
2306 | return o; | ||
2307 | } | ||
2308 | |||
2309 | template<> json toJSON<std::shared_ptr<Command>>(std::shared_ptr<Command> &v) { | ||
2310 | json obj({}); | ||
2311 | switch (v->tag) { | ||
2312 | case ::Command::tag::SetRasterContext: | ||
2313 | obj["tag"] = "SetRasterContext"; | ||
2314 | { | ||
2315 | std::shared_ptr<data::SetRasterContext> tv = std::static_pointer_cast<data::SetRasterContext>(v); | ||
2316 | obj["arg0"] = toJSON(tv->_0); | ||
2317 | } | ||
2318 | break; | ||
2319 | case ::Command::tag::SetAccumulationContext: | ||
2320 | obj["tag"] = "SetAccumulationContext"; | ||
2321 | { | ||
2322 | std::shared_ptr<data::SetAccumulationContext> tv = std::static_pointer_cast<data::SetAccumulationContext>(v); | ||
2323 | obj["arg0"] = toJSON(tv->_0); | ||
2324 | } | ||
2325 | break; | ||
2326 | case ::Command::tag::SetRenderTarget: | ||
2327 | obj["tag"] = "SetRenderTarget"; | ||
2328 | { | ||
2329 | std::shared_ptr<data::SetRenderTarget> tv = std::static_pointer_cast<data::SetRenderTarget>(v); | ||
2330 | obj["arg0"] = toJSON(tv->_0); | ||
2331 | } | ||
2332 | break; | ||
2333 | case ::Command::tag::SetProgram: | ||
2334 | obj["tag"] = "SetProgram"; | ||
2335 | { | ||
2336 | std::shared_ptr<data::SetProgram> tv = std::static_pointer_cast<data::SetProgram>(v); | ||
2337 | obj["arg0"] = toJSON(tv->_0); | ||
2338 | } | ||
2339 | break; | ||
2340 | case ::Command::tag::SetSamplerUniform: | ||
2341 | obj["tag"] = "SetSamplerUniform"; | ||
2342 | { | ||
2343 | std::shared_ptr<data::SetSamplerUniform> tv = std::static_pointer_cast<data::SetSamplerUniform>(v); | ||
2344 | obj["arg0"] = toJSON(tv->_0); | ||
2345 | obj["arg1"] = toJSON(tv->_1); | ||
2346 | } | ||
2347 | break; | ||
2348 | case ::Command::tag::SetTexture: | ||
2349 | obj["tag"] = "SetTexture"; | ||
2350 | { | ||
2351 | std::shared_ptr<data::SetTexture> tv = std::static_pointer_cast<data::SetTexture>(v); | ||
2352 | obj["arg0"] = toJSON(tv->_0); | ||
2353 | obj["arg1"] = toJSON(tv->_1); | ||
2354 | } | ||
2355 | break; | ||
2356 | case ::Command::tag::SetSampler: | ||
2357 | obj["tag"] = "SetSampler"; | ||
2358 | { | ||
2359 | std::shared_ptr<data::SetSampler> tv = std::static_pointer_cast<data::SetSampler>(v); | ||
2360 | obj["arg0"] = toJSON(tv->_0); | ||
2361 | obj["arg1"] = toJSON(tv->_1); | ||
2362 | } | ||
2363 | break; | ||
2364 | case ::Command::tag::RenderSlot: | ||
2365 | obj["tag"] = "RenderSlot"; | ||
2366 | { | ||
2367 | std::shared_ptr<data::RenderSlot> tv = std::static_pointer_cast<data::RenderSlot>(v); | ||
2368 | obj["arg0"] = toJSON(tv->_0); | ||
2369 | } | ||
2370 | break; | ||
2371 | case ::Command::tag::RenderStream: | ||
2372 | obj["tag"] = "RenderStream"; | ||
2373 | { | ||
2374 | std::shared_ptr<data::RenderStream> tv = std::static_pointer_cast<data::RenderStream>(v); | ||
2375 | obj["arg0"] = toJSON(tv->_0); | ||
2376 | } | ||
2377 | break; | ||
2378 | case ::Command::tag::ClearRenderTarget: | ||
2379 | obj["tag"] = "ClearRenderTarget"; | ||
2380 | { | ||
2381 | std::shared_ptr<data::ClearRenderTarget> tv = std::static_pointer_cast<data::ClearRenderTarget>(v); | ||
2382 | obj["arg0"] = toJSON(tv->_0); | ||
2383 | } | ||
2384 | break; | ||
2385 | case ::Command::tag::GenerateMipMap: | ||
2386 | obj["tag"] = "GenerateMipMap"; | ||
2387 | { | ||
2388 | std::shared_ptr<data::GenerateMipMap> tv = std::static_pointer_cast<data::GenerateMipMap>(v); | ||
2389 | obj["arg0"] = toJSON(tv->_0); | ||
2390 | } | ||
2391 | break; | ||
2392 | case ::Command::tag::SaveImage: | ||
2393 | obj["tag"] = "SaveImage"; | ||
2394 | { | ||
2395 | std::shared_ptr<data::SaveImage> tv = std::static_pointer_cast<data::SaveImage>(v); | ||
2396 | obj["arg0"] = toJSON(tv->_0); | ||
2397 | obj["arg1"] = toJSON(tv->_1); | ||
2398 | } | ||
2399 | break; | ||
2400 | case ::Command::tag::LoadImage: | ||
2401 | obj["tag"] = "LoadImage"; | ||
2402 | { | ||
2403 | std::shared_ptr<data::LoadImage> tv = std::static_pointer_cast<data::LoadImage>(v); | ||
2404 | obj["arg0"] = toJSON(tv->_0); | ||
2405 | obj["arg1"] = toJSON(tv->_1); | ||
2406 | } | ||
2407 | break; | ||
2408 | } | ||
2409 | return obj; | ||
2410 | } | ||
2411 | |||
2412 | template<> std::shared_ptr<Command> fromJSON<std::shared_ptr<Command>>(W<std::shared_ptr<Command>> v, json &obj) { | ||
2413 | enum ::Command::tag tagType; | ||
2414 | std::string tag = obj["tag"]; | ||
2415 | if (tag == "SetRasterContext") { | ||
2416 | tagType = ::Command::tag::SetRasterContext; | ||
2417 | std::shared_ptr<data::SetRasterContext> tv(new data::SetRasterContext()); | ||
2418 | tv->_0 = fromJSON(W<std::shared_ptr<::RasterContext>>(), obj["arg0"]); | ||
2419 | return tv; | ||
2420 | } | ||
2421 | else if (tag == "SetAccumulationContext") { | ||
2422 | tagType = ::Command::tag::SetAccumulationContext; | ||
2423 | std::shared_ptr<data::SetAccumulationContext> tv(new data::SetAccumulationContext()); | ||
2424 | tv->_0 = fromJSON(W<std::shared_ptr<::AccumulationContext>>(), obj["arg0"]); | ||
2425 | return tv; | ||
2426 | } | ||
2427 | else if (tag == "SetRenderTarget") { | ||
2428 | tagType = ::Command::tag::SetRenderTarget; | ||
2429 | std::shared_ptr<data::SetRenderTarget> tv(new data::SetRenderTarget()); | ||
2430 | tv->_0 = fromJSON(W<::RenderTargetName>(), obj["arg0"]); | ||
2431 | return tv; | ||
2432 | } | ||
2433 | else if (tag == "SetProgram") { | ||
2434 | tagType = ::Command::tag::SetProgram; | ||
2435 | std::shared_ptr<data::SetProgram> tv(new data::SetProgram()); | ||
2436 | tv->_0 = fromJSON(W<::ProgramName>(), obj["arg0"]); | ||
2437 | return tv; | ||
2438 | } | ||
2439 | else if (tag == "SetSamplerUniform") { | ||
2440 | tagType = ::Command::tag::SetSamplerUniform; | ||
2441 | std::shared_ptr<data::SetSamplerUniform> tv(new data::SetSamplerUniform()); | ||
2442 | tv->_0 = fromJSON(W<::UniformName>(), obj["arg0"]); | ||
2443 | tv->_1 = fromJSON(W<::TextureUnit>(), obj["arg1"]); | ||
2444 | return tv; | ||
2445 | } | ||
2446 | else if (tag == "SetTexture") { | ||
2447 | tagType = ::Command::tag::SetTexture; | ||
2448 | std::shared_ptr<data::SetTexture> tv(new data::SetTexture()); | ||
2449 | tv->_0 = fromJSON(W<::TextureUnit>(), obj["arg0"]); | ||
2450 | tv->_1 = fromJSON(W<::TextureName>(), obj["arg1"]); | ||
2451 | return tv; | ||
2452 | } | ||
2453 | else if (tag == "SetSampler") { | ||
2454 | tagType = ::Command::tag::SetSampler; | ||
2455 | std::shared_ptr<data::SetSampler> tv(new data::SetSampler()); | ||
2456 | tv->_0 = fromJSON(W<::TextureUnit>(), obj["arg0"]); | ||
2457 | tv->_1 = fromJSON(W<Maybe<::SamplerName>>(), obj["arg1"]); | ||
2458 | return tv; | ||
2459 | } | ||
2460 | else if (tag == "RenderSlot") { | ||
2461 | tagType = ::Command::tag::RenderSlot; | ||
2462 | std::shared_ptr<data::RenderSlot> tv(new data::RenderSlot()); | ||
2463 | tv->_0 = fromJSON(W<::SlotName>(), obj["arg0"]); | ||
2464 | return tv; | ||
2465 | } | ||
2466 | else if (tag == "RenderStream") { | ||
2467 | tagType = ::Command::tag::RenderStream; | ||
2468 | std::shared_ptr<data::RenderStream> tv(new data::RenderStream()); | ||
2469 | tv->_0 = fromJSON(W<::StreamName>(), obj["arg0"]); | ||
2470 | return tv; | ||
2471 | } | ||
2472 | else if (tag == "ClearRenderTarget") { | ||
2473 | tagType = ::Command::tag::ClearRenderTarget; | ||
2474 | std::shared_ptr<data::ClearRenderTarget> tv(new data::ClearRenderTarget()); | ||
2475 | tv->_0 = fromJSON(W<std::vector<std::shared_ptr<::ClearImage>>>(), obj["arg0"]); | ||
2476 | return tv; | ||
2477 | } | ||
2478 | else if (tag == "GenerateMipMap") { | ||
2479 | tagType = ::Command::tag::GenerateMipMap; | ||
2480 | std::shared_ptr<data::GenerateMipMap> tv(new data::GenerateMipMap()); | ||
2481 | tv->_0 = fromJSON(W<::TextureUnit>(), obj["arg0"]); | ||
2482 | return tv; | ||
2483 | } | ||
2484 | else if (tag == "SaveImage") { | ||
2485 | tagType = ::Command::tag::SaveImage; | ||
2486 | std::shared_ptr<data::SaveImage> tv(new data::SaveImage()); | ||
2487 | tv->_0 = fromJSON(W<::FrameBufferComponent>(), obj["arg0"]); | ||
2488 | tv->_1 = fromJSON(W<std::shared_ptr<::ImageRef>>(), obj["arg1"]); | ||
2489 | return tv; | ||
2490 | } | ||
2491 | else if (tag == "LoadImage") { | ||
2492 | tagType = ::Command::tag::LoadImage; | ||
2493 | std::shared_ptr<data::LoadImage> tv(new data::LoadImage()); | ||
2494 | tv->_0 = fromJSON(W<std::shared_ptr<::ImageRef>>(), obj["arg0"]); | ||
2495 | tv->_1 = fromJSON(W<::FrameBufferComponent>(), obj["arg1"]); | ||
2496 | return tv; | ||
2497 | } | ||
2498 | else throw "unknown constructor: " + tag; | ||
2499 | std::shared_ptr<::Command> o(new ::Command()); | ||
2500 | o->tag = tagType; | ||
2501 | return o; | ||
2502 | } | ||
2503 | |||
2504 | template<> json toJSON<std::shared_ptr<SamplerDescriptor>>(std::shared_ptr<SamplerDescriptor> &v) { | ||
2505 | json obj({}); | ||
2506 | switch (v->tag) { | ||
2507 | case ::SamplerDescriptor::tag::SamplerDescriptor: | ||
2508 | obj["tag"] = "SamplerDescriptor"; | ||
2509 | { | ||
2510 | std::shared_ptr<data::SamplerDescriptor> tv = std::static_pointer_cast<data::SamplerDescriptor>(v); | ||
2511 | obj["samplerWrapS"] = toJSON(tv->samplerWrapS); | ||
2512 | obj["samplerWrapT"] = toJSON(tv->samplerWrapT); | ||
2513 | obj["samplerWrapR"] = toJSON(tv->samplerWrapR); | ||
2514 | obj["samplerMinFilter"] = toJSON(tv->samplerMinFilter); | ||
2515 | obj["samplerMagFilter"] = toJSON(tv->samplerMagFilter); | ||
2516 | obj["samplerBorderColor"] = toJSON(tv->samplerBorderColor); | ||
2517 | obj["samplerMinLod"] = toJSON(tv->samplerMinLod); | ||
2518 | obj["samplerMaxLod"] = toJSON(tv->samplerMaxLod); | ||
2519 | obj["samplerLodBias"] = toJSON(tv->samplerLodBias); | ||
2520 | obj["samplerCompareFunc"] = toJSON(tv->samplerCompareFunc); | ||
2521 | } | ||
2522 | break; | ||
2523 | } | ||
2524 | return obj; | ||
2525 | } | ||
2526 | |||
2527 | template<> std::shared_ptr<SamplerDescriptor> fromJSON<std::shared_ptr<SamplerDescriptor>>(W<std::shared_ptr<SamplerDescriptor>> v, json &obj) { | ||
2528 | enum ::SamplerDescriptor::tag tagType; | ||
2529 | std::string tag = obj["tag"]; | ||
2530 | if (tag == "SamplerDescriptor") { | ||
2531 | tagType = ::SamplerDescriptor::tag::SamplerDescriptor; | ||
2532 | std::shared_ptr<data::SamplerDescriptor> tv(new data::SamplerDescriptor()); | ||
2533 | tv->samplerWrapS = fromJSON(W<std::shared_ptr<::EdgeMode>>(), obj["samplerWrapS"]); | ||
2534 | tv->samplerWrapT = fromJSON(W<Maybe<std::shared_ptr<::EdgeMode>>>(), obj["samplerWrapT"]); | ||
2535 | tv->samplerWrapR = fromJSON(W<Maybe<std::shared_ptr<::EdgeMode>>>(), obj["samplerWrapR"]); | ||
2536 | tv->samplerMinFilter = fromJSON(W<std::shared_ptr<::Filter>>(), obj["samplerMinFilter"]); | ||
2537 | tv->samplerMagFilter = fromJSON(W<std::shared_ptr<::Filter>>(), obj["samplerMagFilter"]); | ||
2538 | tv->samplerBorderColor = fromJSON(W<std::shared_ptr<::Value>>(), obj["samplerBorderColor"]); | ||
2539 | tv->samplerMinLod = fromJSON(W<Maybe<Float>>(), obj["samplerMinLod"]); | ||
2540 | tv->samplerMaxLod = fromJSON(W<Maybe<Float>>(), obj["samplerMaxLod"]); | ||
2541 | tv->samplerLodBias = fromJSON(W<Float>(), obj["samplerLodBias"]); | ||
2542 | tv->samplerCompareFunc = fromJSON(W<Maybe<std::shared_ptr<::ComparisonFunction>>>(), obj["samplerCompareFunc"]); | ||
2543 | return tv; | ||
2544 | } | ||
2545 | else throw "unknown constructor: " + tag; | ||
2546 | std::shared_ptr<::SamplerDescriptor> o(new ::SamplerDescriptor()); | ||
2547 | o->tag = tagType; | ||
2548 | return o; | ||
2549 | } | ||
2550 | |||
2551 | template<> json toJSON<std::shared_ptr<TextureDescriptor>>(std::shared_ptr<TextureDescriptor> &v) { | ||
2552 | json obj({}); | ||
2553 | switch (v->tag) { | ||
2554 | case ::TextureDescriptor::tag::TextureDescriptor: | ||
2555 | obj["tag"] = "TextureDescriptor"; | ||
2556 | { | ||
2557 | std::shared_ptr<data::TextureDescriptor> tv = std::static_pointer_cast<data::TextureDescriptor>(v); | ||
2558 | obj["textureType"] = toJSON(tv->textureType); | ||
2559 | obj["textureSize"] = toJSON(tv->textureSize); | ||
2560 | obj["textureSemantic"] = toJSON(tv->textureSemantic); | ||
2561 | obj["textureSampler"] = toJSON(tv->textureSampler); | ||
2562 | obj["textureBaseLevel"] = toJSON(tv->textureBaseLevel); | ||
2563 | obj["textureMaxLevel"] = toJSON(tv->textureMaxLevel); | ||
2564 | } | ||
2565 | break; | ||
2566 | } | ||
2567 | return obj; | ||
2568 | } | ||
2569 | |||
2570 | template<> std::shared_ptr<TextureDescriptor> fromJSON<std::shared_ptr<TextureDescriptor>>(W<std::shared_ptr<TextureDescriptor>> v, json &obj) { | ||
2571 | enum ::TextureDescriptor::tag tagType; | ||
2572 | std::string tag = obj["tag"]; | ||
2573 | if (tag == "TextureDescriptor") { | ||
2574 | tagType = ::TextureDescriptor::tag::TextureDescriptor; | ||
2575 | std::shared_ptr<data::TextureDescriptor> tv(new data::TextureDescriptor()); | ||
2576 | tv->textureType = fromJSON(W<std::shared_ptr<::TextureType>>(), obj["textureType"]); | ||
2577 | tv->textureSize = fromJSON(W<std::shared_ptr<::Value>>(), obj["textureSize"]); | ||
2578 | tv->textureSemantic = fromJSON(W<std::shared_ptr<::ImageSemantic>>(), obj["textureSemantic"]); | ||
2579 | tv->textureSampler = fromJSON(W<std::shared_ptr<::SamplerDescriptor>>(), obj["textureSampler"]); | ||
2580 | tv->textureBaseLevel = fromJSON(W<Int>(), obj["textureBaseLevel"]); | ||
2581 | tv->textureMaxLevel = fromJSON(W<Int>(), obj["textureMaxLevel"]); | ||
2582 | return tv; | ||
2583 | } | ||
2584 | else throw "unknown constructor: " + tag; | ||
2585 | std::shared_ptr<::TextureDescriptor> o(new ::TextureDescriptor()); | ||
2586 | o->tag = tagType; | ||
2587 | return o; | ||
2588 | } | ||
2589 | |||
2590 | template<> json toJSON<std::shared_ptr<Parameter>>(std::shared_ptr<Parameter> &v) { | ||
2591 | json obj({}); | ||
2592 | switch (v->tag) { | ||
2593 | case ::Parameter::tag::Parameter: | ||
2594 | obj["tag"] = "Parameter"; | ||
2595 | { | ||
2596 | std::shared_ptr<data::Parameter> tv = std::static_pointer_cast<data::Parameter>(v); | ||
2597 | obj["name"] = toJSON(tv->name); | ||
2598 | obj["ty"] = toJSON(tv->ty); | ||
2599 | } | ||
2600 | break; | ||
2601 | } | ||
2602 | return obj; | ||
2603 | } | ||
2604 | |||
2605 | template<> std::shared_ptr<Parameter> fromJSON<std::shared_ptr<Parameter>>(W<std::shared_ptr<Parameter>> v, json &obj) { | ||
2606 | enum ::Parameter::tag tagType; | ||
2607 | std::string tag = obj["tag"]; | ||
2608 | if (tag == "Parameter") { | ||
2609 | tagType = ::Parameter::tag::Parameter; | ||
2610 | std::shared_ptr<data::Parameter> tv(new data::Parameter()); | ||
2611 | tv->name = fromJSON(W<String>(), obj["name"]); | ||
2612 | tv->ty = fromJSON(W<std::shared_ptr<::InputType>>(), obj["ty"]); | ||
2613 | return tv; | ||
2614 | } | ||
2615 | else throw "unknown constructor: " + tag; | ||
2616 | std::shared_ptr<::Parameter> o(new ::Parameter()); | ||
2617 | o->tag = tagType; | ||
2618 | return o; | ||
2619 | } | ||
2620 | |||
2621 | template<> json toJSON<std::shared_ptr<Program>>(std::shared_ptr<Program> &v) { | ||
2622 | json obj({}); | ||
2623 | switch (v->tag) { | ||
2624 | case ::Program::tag::Program: | ||
2625 | obj["tag"] = "Program"; | ||
2626 | { | ||
2627 | std::shared_ptr<data::Program> tv = std::static_pointer_cast<data::Program>(v); | ||
2628 | obj["programUniforms"] = toJSON(tv->programUniforms); | ||
2629 | obj["programStreams"] = toJSON(tv->programStreams); | ||
2630 | obj["programInTextures"] = toJSON(tv->programInTextures); | ||
2631 | obj["programOutput"] = toJSON(tv->programOutput); | ||
2632 | obj["vertexShader"] = toJSON(tv->vertexShader); | ||
2633 | obj["geometryShader"] = toJSON(tv->geometryShader); | ||
2634 | obj["fragmentShader"] = toJSON(tv->fragmentShader); | ||
2635 | } | ||
2636 | break; | ||
2637 | } | ||
2638 | return obj; | ||
2639 | } | ||
2640 | |||
2641 | template<> std::shared_ptr<Program> fromJSON<std::shared_ptr<Program>>(W<std::shared_ptr<Program>> v, json &obj) { | ||
2642 | enum ::Program::tag tagType; | ||
2643 | std::string tag = obj["tag"]; | ||
2644 | if (tag == "Program") { | ||
2645 | tagType = ::Program::tag::Program; | ||
2646 | std::shared_ptr<data::Program> tv(new data::Program()); | ||
2647 | tv->programUniforms = fromJSON(W<std::map<::UniformName, std::shared_ptr<::InputType>>>(), obj["programUniforms"]); | ||
2648 | tv->programStreams = fromJSON(W<std::map<::UniformName, std::shared_ptr<::Parameter>>>(), obj["programStreams"]); | ||
2649 | tv->programInTextures = fromJSON(W<std::map<::UniformName, std::shared_ptr<::InputType>>>(), obj["programInTextures"]); | ||
2650 | tv->programOutput = fromJSON(W<std::vector<std::shared_ptr<::Parameter>>>(), obj["programOutput"]); | ||
2651 | tv->vertexShader = fromJSON(W<String>(), obj["vertexShader"]); | ||
2652 | tv->geometryShader = fromJSON(W<Maybe<String>>(), obj["geometryShader"]); | ||
2653 | tv->fragmentShader = fromJSON(W<String>(), obj["fragmentShader"]); | ||
2654 | return tv; | ||
2655 | } | ||
2656 | else throw "unknown constructor: " + tag; | ||
2657 | std::shared_ptr<::Program> o(new ::Program()); | ||
2658 | o->tag = tagType; | ||
2659 | return o; | ||
2660 | } | ||
2661 | |||
2662 | template<> json toJSON<std::shared_ptr<Slot>>(std::shared_ptr<Slot> &v) { | ||
2663 | json obj({}); | ||
2664 | switch (v->tag) { | ||
2665 | case ::Slot::tag::Slot: | ||
2666 | obj["tag"] = "Slot"; | ||
2667 | { | ||
2668 | std::shared_ptr<data::Slot> tv = std::static_pointer_cast<data::Slot>(v); | ||
2669 | obj["slotName"] = toJSON(tv->slotName); | ||
2670 | obj["slotStreams"] = toJSON(tv->slotStreams); | ||
2671 | obj["slotUniforms"] = toJSON(tv->slotUniforms); | ||
2672 | obj["slotPrimitive"] = toJSON(tv->slotPrimitive); | ||
2673 | obj["slotPrograms"] = toJSON(tv->slotPrograms); | ||
2674 | } | ||
2675 | break; | ||
2676 | } | ||
2677 | return obj; | ||
2678 | } | ||
2679 | |||
2680 | template<> std::shared_ptr<Slot> fromJSON<std::shared_ptr<Slot>>(W<std::shared_ptr<Slot>> v, json &obj) { | ||
2681 | enum ::Slot::tag tagType; | ||
2682 | std::string tag = obj["tag"]; | ||
2683 | if (tag == "Slot") { | ||
2684 | tagType = ::Slot::tag::Slot; | ||
2685 | std::shared_ptr<data::Slot> tv(new data::Slot()); | ||
2686 | tv->slotName = fromJSON(W<String>(), obj["slotName"]); | ||
2687 | tv->slotStreams = fromJSON(W<std::map<String, std::shared_ptr<::InputType>>>(), obj["slotStreams"]); | ||
2688 | tv->slotUniforms = fromJSON(W<std::map<::UniformName, std::shared_ptr<::InputType>>>(), obj["slotUniforms"]); | ||
2689 | tv->slotPrimitive = fromJSON(W<std::shared_ptr<::FetchPrimitive>>(), obj["slotPrimitive"]); | ||
2690 | tv->slotPrograms = fromJSON(W<std::vector<::ProgramName>>(), obj["slotPrograms"]); | ||
2691 | return tv; | ||
2692 | } | ||
2693 | else throw "unknown constructor: " + tag; | ||
2694 | std::shared_ptr<::Slot> o(new ::Slot()); | ||
2695 | o->tag = tagType; | ||
2696 | return o; | ||
2697 | } | ||
2698 | |||
2699 | template<> json toJSON<std::shared_ptr<StreamData>>(std::shared_ptr<StreamData> &v) { | ||
2700 | json obj({}); | ||
2701 | switch (v->tag) { | ||
2702 | case ::StreamData::tag::StreamData: | ||
2703 | obj["tag"] = "StreamData"; | ||
2704 | { | ||
2705 | std::shared_ptr<data::StreamData> tv = std::static_pointer_cast<data::StreamData>(v); | ||
2706 | obj["streamData"] = toJSON(tv->streamData); | ||
2707 | obj["streamType"] = toJSON(tv->streamType); | ||
2708 | obj["streamPrimitive"] = toJSON(tv->streamPrimitive); | ||
2709 | obj["streamPrograms"] = toJSON(tv->streamPrograms); | ||
2710 | } | ||
2711 | break; | ||
2712 | } | ||
2713 | return obj; | ||
2714 | } | ||
2715 | |||
2716 | template<> std::shared_ptr<StreamData> fromJSON<std::shared_ptr<StreamData>>(W<std::shared_ptr<StreamData>> v, json &obj) { | ||
2717 | enum ::StreamData::tag tagType; | ||
2718 | std::string tag = obj["tag"]; | ||
2719 | if (tag == "StreamData") { | ||
2720 | tagType = ::StreamData::tag::StreamData; | ||
2721 | std::shared_ptr<data::StreamData> tv(new data::StreamData()); | ||
2722 | tv->streamData = fromJSON(W<std::map<String, std::shared_ptr<::ArrayValue>>>(), obj["streamData"]); | ||
2723 | tv->streamType = fromJSON(W<std::map<String, std::shared_ptr<::InputType>>>(), obj["streamType"]); | ||
2724 | tv->streamPrimitive = fromJSON(W<std::shared_ptr<::FetchPrimitive>>(), obj["streamPrimitive"]); | ||
2725 | tv->streamPrograms = fromJSON(W<std::vector<::ProgramName>>(), obj["streamPrograms"]); | ||
2726 | return tv; | ||
2727 | } | ||
2728 | else throw "unknown constructor: " + tag; | ||
2729 | std::shared_ptr<::StreamData> o(new ::StreamData()); | ||
2730 | o->tag = tagType; | ||
2731 | return o; | ||
2732 | } | ||
2733 | |||
2734 | template<> json toJSON<std::shared_ptr<TargetItem>>(std::shared_ptr<TargetItem> &v) { | ||
2735 | json obj({}); | ||
2736 | switch (v->tag) { | ||
2737 | case ::TargetItem::tag::TargetItem: | ||
2738 | obj["tag"] = "TargetItem"; | ||
2739 | { | ||
2740 | std::shared_ptr<data::TargetItem> tv = std::static_pointer_cast<data::TargetItem>(v); | ||
2741 | obj["targetSemantic"] = toJSON(tv->targetSemantic); | ||
2742 | obj["targetRef"] = toJSON(tv->targetRef); | ||
2743 | } | ||
2744 | break; | ||
2745 | } | ||
2746 | return obj; | ||
2747 | } | ||
2748 | |||
2749 | template<> std::shared_ptr<TargetItem> fromJSON<std::shared_ptr<TargetItem>>(W<std::shared_ptr<TargetItem>> v, json &obj) { | ||
2750 | enum ::TargetItem::tag tagType; | ||
2751 | std::string tag = obj["tag"]; | ||
2752 | if (tag == "TargetItem") { | ||
2753 | tagType = ::TargetItem::tag::TargetItem; | ||
2754 | std::shared_ptr<data::TargetItem> tv(new data::TargetItem()); | ||
2755 | tv->targetSemantic = fromJSON(W<std::shared_ptr<::ImageSemantic>>(), obj["targetSemantic"]); | ||
2756 | tv->targetRef = fromJSON(W<Maybe<std::shared_ptr<::ImageRef>>>(), obj["targetRef"]); | ||
2757 | return tv; | ||
2758 | } | ||
2759 | else throw "unknown constructor: " + tag; | ||
2760 | std::shared_ptr<::TargetItem> o(new ::TargetItem()); | ||
2761 | o->tag = tagType; | ||
2762 | return o; | ||
2763 | } | ||
2764 | |||
2765 | template<> json toJSON<std::shared_ptr<RenderTarget>>(std::shared_ptr<RenderTarget> &v) { | ||
2766 | json obj({}); | ||
2767 | switch (v->tag) { | ||
2768 | case ::RenderTarget::tag::RenderTarget: | ||
2769 | obj["tag"] = "RenderTarget"; | ||
2770 | { | ||
2771 | std::shared_ptr<data::RenderTarget> tv = std::static_pointer_cast<data::RenderTarget>(v); | ||
2772 | obj["renderTargets"] = toJSON(tv->renderTargets); | ||
2773 | } | ||
2774 | break; | ||
2775 | } | ||
2776 | return obj; | ||
2777 | } | ||
2778 | |||
2779 | template<> std::shared_ptr<RenderTarget> fromJSON<std::shared_ptr<RenderTarget>>(W<std::shared_ptr<RenderTarget>> v, json &obj) { | ||
2780 | enum ::RenderTarget::tag tagType; | ||
2781 | std::string tag = obj["tag"]; | ||
2782 | if (tag == "RenderTarget") { | ||
2783 | tagType = ::RenderTarget::tag::RenderTarget; | ||
2784 | std::shared_ptr<data::RenderTarget> tv(new data::RenderTarget()); | ||
2785 | tv->renderTargets = fromJSON(W<std::vector<std::shared_ptr<::TargetItem>>>(), obj["renderTargets"]); | ||
2786 | return tv; | ||
2787 | } | ||
2788 | else throw "unknown constructor: " + tag; | ||
2789 | std::shared_ptr<::RenderTarget> o(new ::RenderTarget()); | ||
2790 | o->tag = tagType; | ||
2791 | return o; | ||
2792 | } | ||
2793 | |||
2794 | template<> json toJSON<std::shared_ptr<Backend>>(std::shared_ptr<Backend> &v) { | ||
2795 | json obj({}); | ||
2796 | switch (v->tag) { | ||
2797 | case ::Backend::tag::WebGL1: | ||
2798 | obj["tag"] = "WebGL1"; | ||
2799 | break; | ||
2800 | case ::Backend::tag::OpenGL33: | ||
2801 | obj["tag"] = "OpenGL33"; | ||
2802 | break; | ||
2803 | } | ||
2804 | return obj; | ||
2805 | } | ||
2806 | |||
2807 | template<> std::shared_ptr<Backend> fromJSON<std::shared_ptr<Backend>>(W<std::shared_ptr<Backend>> v, json &obj) { | ||
2808 | enum ::Backend::tag tagType; | ||
2809 | std::string tag = obj["tag"]; | ||
2810 | if (tag == "WebGL1") { | ||
2811 | tagType = ::Backend::tag::WebGL1; | ||
2812 | } | ||
2813 | else if (tag == "OpenGL33") { | ||
2814 | tagType = ::Backend::tag::OpenGL33; | ||
2815 | } | ||
2816 | else throw "unknown constructor: " + tag; | ||
2817 | std::shared_ptr<::Backend> o(new ::Backend()); | ||
2818 | o->tag = tagType; | ||
2819 | return o; | ||
2820 | } | ||
2821 | |||
2822 | template<> json toJSON<std::shared_ptr<Pipeline>>(std::shared_ptr<Pipeline> &v) { | ||
2823 | json obj({}); | ||
2824 | switch (v->tag) { | ||
2825 | case ::Pipeline::tag::Pipeline: | ||
2826 | obj["tag"] = "Pipeline"; | ||
2827 | { | ||
2828 | std::shared_ptr<data::Pipeline> tv = std::static_pointer_cast<data::Pipeline>(v); | ||
2829 | obj["info"] = toJSON(tv->info); | ||
2830 | obj["backend"] = toJSON(tv->backend); | ||
2831 | obj["textures"] = toJSON(tv->textures); | ||
2832 | obj["samplers"] = toJSON(tv->samplers); | ||
2833 | obj["targets"] = toJSON(tv->targets); | ||
2834 | obj["programs"] = toJSON(tv->programs); | ||
2835 | obj["slots"] = toJSON(tv->slots); | ||
2836 | obj["streams"] = toJSON(tv->streams); | ||
2837 | obj["commands"] = toJSON(tv->commands); | ||
2838 | } | ||
2839 | break; | ||
2840 | } | ||
2841 | return obj; | ||
2842 | } | ||
2843 | |||
2844 | template<> std::shared_ptr<Pipeline> fromJSON<std::shared_ptr<Pipeline>>(W<std::shared_ptr<Pipeline>> v, json &obj) { | ||
2845 | enum ::Pipeline::tag tagType; | ||
2846 | std::string tag = obj["tag"]; | ||
2847 | if (tag == "Pipeline") { | ||
2848 | tagType = ::Pipeline::tag::Pipeline; | ||
2849 | std::shared_ptr<data::Pipeline> tv(new data::Pipeline()); | ||
2850 | tv->info = fromJSON(W<String>(), obj["info"]); | ||
2851 | tv->backend = fromJSON(W<std::shared_ptr<::Backend>>(), obj["backend"]); | ||
2852 | tv->textures = fromJSON(W<std::vector<std::shared_ptr<::TextureDescriptor>>>(), obj["textures"]); | ||
2853 | tv->samplers = fromJSON(W<std::vector<std::shared_ptr<::SamplerDescriptor>>>(), obj["samplers"]); | ||
2854 | tv->targets = fromJSON(W<std::vector<std::shared_ptr<::RenderTarget>>>(), obj["targets"]); | ||
2855 | tv->programs = fromJSON(W<std::vector<std::shared_ptr<::Program>>>(), obj["programs"]); | ||
2856 | tv->slots = fromJSON(W<std::vector<std::shared_ptr<::Slot>>>(), obj["slots"]); | ||
2857 | tv->streams = fromJSON(W<std::vector<std::shared_ptr<::StreamData>>>(), obj["streams"]); | ||
2858 | tv->commands = fromJSON(W<std::vector<std::shared_ptr<::Command>>>(), obj["commands"]); | ||
2859 | return tv; | ||
2860 | } | ||
2861 | else throw "unknown constructor: " + tag; | ||
2862 | std::shared_ptr<::Pipeline> o(new ::Pipeline()); | ||
2863 | o->tag = tagType; | ||
2864 | return o; | ||
2865 | } | ||
2866 | |||
diff --git a/ddl/out/cpp/LambdaCube.IR.hpp b/ddl/out/cpp/LambdaCube.IR.hpp new file mode 100644 index 0000000..47e1077 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.IR.hpp | |||
@@ -0,0 +1,1071 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:02.701527000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.IR_H | ||
5 | #define HEADER_LambdaCube.IR_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | |||
10 | typedef Int StreamName; | ||
11 | |||
12 | typedef Int ProgramName; | ||
13 | |||
14 | typedef Int TextureName; | ||
15 | |||
16 | typedef Int SamplerName; | ||
17 | |||
18 | typedef String UniformName; | ||
19 | |||
20 | typedef Int SlotName; | ||
21 | |||
22 | typedef Int FrameBufferComponent; | ||
23 | |||
24 | typedef Int TextureUnit; | ||
25 | |||
26 | typedef Int RenderTargetName; | ||
27 | |||
28 | typedef std::map<::UniformName, ::TextureUnit> TextureUnitMapping; | ||
29 | |||
30 | class ArrayValue { | ||
31 | public: | ||
32 | enum class tag { | ||
33 | VBoolArray, | ||
34 | VIntArray, | ||
35 | VWordArray, | ||
36 | VFloatArray | ||
37 | } tag; | ||
38 | }; | ||
39 | namespace data { | ||
40 | class VBoolArray : public ::ArrayValue { | ||
41 | public: | ||
42 | std::vector<Bool> _0; | ||
43 | VBoolArray() { tag = tag::VBoolArray; } | ||
44 | }; | ||
45 | class VIntArray : public ::ArrayValue { | ||
46 | public: | ||
47 | std::vector<Int32> _0; | ||
48 | VIntArray() { tag = tag::VIntArray; } | ||
49 | }; | ||
50 | class VWordArray : public ::ArrayValue { | ||
51 | public: | ||
52 | std::vector<Word32> _0; | ||
53 | VWordArray() { tag = tag::VWordArray; } | ||
54 | }; | ||
55 | class VFloatArray : public ::ArrayValue { | ||
56 | public: | ||
57 | std::vector<Float> _0; | ||
58 | VFloatArray() { tag = tag::VFloatArray; } | ||
59 | }; | ||
60 | } | ||
61 | class Value { | ||
62 | public: | ||
63 | enum class tag { | ||
64 | VBool, | ||
65 | VV2B, | ||
66 | VV3B, | ||
67 | VV4B, | ||
68 | VWord, | ||
69 | VV2U, | ||
70 | VV3U, | ||
71 | VV4U, | ||
72 | VInt, | ||
73 | VV2I, | ||
74 | VV3I, | ||
75 | VV4I, | ||
76 | VFloat, | ||
77 | VV2F, | ||
78 | VV3F, | ||
79 | VV4F, | ||
80 | VM22F, | ||
81 | VM23F, | ||
82 | VM24F, | ||
83 | VM32F, | ||
84 | VM33F, | ||
85 | VM34F, | ||
86 | VM42F, | ||
87 | VM43F, | ||
88 | VM44F | ||
89 | } tag; | ||
90 | }; | ||
91 | namespace data { | ||
92 | class VBool : public ::Value { | ||
93 | public: | ||
94 | Bool _0; | ||
95 | VBool() { tag = tag::VBool; } | ||
96 | }; | ||
97 | class VV2B : public ::Value { | ||
98 | public: | ||
99 | V2B _0; | ||
100 | VV2B() { tag = tag::VV2B; } | ||
101 | }; | ||
102 | class VV3B : public ::Value { | ||
103 | public: | ||
104 | V3B _0; | ||
105 | VV3B() { tag = tag::VV3B; } | ||
106 | }; | ||
107 | class VV4B : public ::Value { | ||
108 | public: | ||
109 | V4B _0; | ||
110 | VV4B() { tag = tag::VV4B; } | ||
111 | }; | ||
112 | class VWord : public ::Value { | ||
113 | public: | ||
114 | Word32 _0; | ||
115 | VWord() { tag = tag::VWord; } | ||
116 | }; | ||
117 | class VV2U : public ::Value { | ||
118 | public: | ||
119 | V2U _0; | ||
120 | VV2U() { tag = tag::VV2U; } | ||
121 | }; | ||
122 | class VV3U : public ::Value { | ||
123 | public: | ||
124 | V3U _0; | ||
125 | VV3U() { tag = tag::VV3U; } | ||
126 | }; | ||
127 | class VV4U : public ::Value { | ||
128 | public: | ||
129 | V4U _0; | ||
130 | VV4U() { tag = tag::VV4U; } | ||
131 | }; | ||
132 | class VInt : public ::Value { | ||
133 | public: | ||
134 | Int32 _0; | ||
135 | VInt() { tag = tag::VInt; } | ||
136 | }; | ||
137 | class VV2I : public ::Value { | ||
138 | public: | ||
139 | V2I _0; | ||
140 | VV2I() { tag = tag::VV2I; } | ||
141 | }; | ||
142 | class VV3I : public ::Value { | ||
143 | public: | ||
144 | V3I _0; | ||
145 | VV3I() { tag = tag::VV3I; } | ||
146 | }; | ||
147 | class VV4I : public ::Value { | ||
148 | public: | ||
149 | V4I _0; | ||
150 | VV4I() { tag = tag::VV4I; } | ||
151 | }; | ||
152 | class VFloat : public ::Value { | ||
153 | public: | ||
154 | Float _0; | ||
155 | VFloat() { tag = tag::VFloat; } | ||
156 | }; | ||
157 | class VV2F : public ::Value { | ||
158 | public: | ||
159 | V2F _0; | ||
160 | VV2F() { tag = tag::VV2F; } | ||
161 | }; | ||
162 | class VV3F : public ::Value { | ||
163 | public: | ||
164 | V3F _0; | ||
165 | VV3F() { tag = tag::VV3F; } | ||
166 | }; | ||
167 | class VV4F : public ::Value { | ||
168 | public: | ||
169 | V4F _0; | ||
170 | VV4F() { tag = tag::VV4F; } | ||
171 | }; | ||
172 | class VM22F : public ::Value { | ||
173 | public: | ||
174 | M22F _0; | ||
175 | VM22F() { tag = tag::VM22F; } | ||
176 | }; | ||
177 | class VM23F : public ::Value { | ||
178 | public: | ||
179 | M23F _0; | ||
180 | VM23F() { tag = tag::VM23F; } | ||
181 | }; | ||
182 | class VM24F : public ::Value { | ||
183 | public: | ||
184 | M24F _0; | ||
185 | VM24F() { tag = tag::VM24F; } | ||
186 | }; | ||
187 | class VM32F : public ::Value { | ||
188 | public: | ||
189 | M32F _0; | ||
190 | VM32F() { tag = tag::VM32F; } | ||
191 | }; | ||
192 | class VM33F : public ::Value { | ||
193 | public: | ||
194 | M33F _0; | ||
195 | VM33F() { tag = tag::VM33F; } | ||
196 | }; | ||
197 | class VM34F : public ::Value { | ||
198 | public: | ||
199 | M34F _0; | ||
200 | VM34F() { tag = tag::VM34F; } | ||
201 | }; | ||
202 | class VM42F : public ::Value { | ||
203 | public: | ||
204 | M42F _0; | ||
205 | VM42F() { tag = tag::VM42F; } | ||
206 | }; | ||
207 | class VM43F : public ::Value { | ||
208 | public: | ||
209 | M43F _0; | ||
210 | VM43F() { tag = tag::VM43F; } | ||
211 | }; | ||
212 | class VM44F : public ::Value { | ||
213 | public: | ||
214 | M44F _0; | ||
215 | VM44F() { tag = tag::VM44F; } | ||
216 | }; | ||
217 | } | ||
218 | class InputType { | ||
219 | public: | ||
220 | enum class tag { | ||
221 | Bool, | ||
222 | V2B, | ||
223 | V3B, | ||
224 | V4B, | ||
225 | Word, | ||
226 | V2U, | ||
227 | V3U, | ||
228 | V4U, | ||
229 | Int, | ||
230 | V2I, | ||
231 | V3I, | ||
232 | V4I, | ||
233 | Float, | ||
234 | V2F, | ||
235 | V3F, | ||
236 | V4F, | ||
237 | M22F, | ||
238 | M23F, | ||
239 | M24F, | ||
240 | M32F, | ||
241 | M33F, | ||
242 | M34F, | ||
243 | M42F, | ||
244 | M43F, | ||
245 | M44F, | ||
246 | STexture1D, | ||
247 | STexture2D, | ||
248 | STextureCube, | ||
249 | STexture1DArray, | ||
250 | STexture2DArray, | ||
251 | STexture2DRect, | ||
252 | FTexture1D, | ||
253 | FTexture2D, | ||
254 | FTexture3D, | ||
255 | FTextureCube, | ||
256 | FTexture1DArray, | ||
257 | FTexture2DArray, | ||
258 | FTexture2DMS, | ||
259 | FTexture2DMSArray, | ||
260 | FTextureBuffer, | ||
261 | FTexture2DRect, | ||
262 | ITexture1D, | ||
263 | ITexture2D, | ||
264 | ITexture3D, | ||
265 | ITextureCube, | ||
266 | ITexture1DArray, | ||
267 | ITexture2DArray, | ||
268 | ITexture2DMS, | ||
269 | ITexture2DMSArray, | ||
270 | ITextureBuffer, | ||
271 | ITexture2DRect, | ||
272 | UTexture1D, | ||
273 | UTexture2D, | ||
274 | UTexture3D, | ||
275 | UTextureCube, | ||
276 | UTexture1DArray, | ||
277 | UTexture2DArray, | ||
278 | UTexture2DMS, | ||
279 | UTexture2DMSArray, | ||
280 | UTextureBuffer, | ||
281 | UTexture2DRect | ||
282 | } tag; | ||
283 | }; | ||
284 | namespace data { | ||
285 | } | ||
286 | class PointSpriteCoordOrigin { | ||
287 | public: | ||
288 | enum class tag { | ||
289 | LowerLeft, | ||
290 | UpperLeft | ||
291 | } tag; | ||
292 | }; | ||
293 | namespace data { | ||
294 | } | ||
295 | class PointSize { | ||
296 | public: | ||
297 | enum class tag { | ||
298 | PointSize, | ||
299 | ProgramPointSize | ||
300 | } tag; | ||
301 | }; | ||
302 | namespace data { | ||
303 | class PointSize : public ::PointSize { | ||
304 | public: | ||
305 | Float _0; | ||
306 | PointSize() { tag = tag::PointSize; } | ||
307 | }; | ||
308 | } | ||
309 | class PolygonOffset { | ||
310 | public: | ||
311 | enum class tag { | ||
312 | NoOffset, | ||
313 | Offset | ||
314 | } tag; | ||
315 | }; | ||
316 | namespace data { | ||
317 | class Offset : public ::PolygonOffset { | ||
318 | public: | ||
319 | Float _0; | ||
320 | Float _1; | ||
321 | Offset() { tag = tag::Offset; } | ||
322 | }; | ||
323 | } | ||
324 | class FrontFace { | ||
325 | public: | ||
326 | enum class tag { | ||
327 | CCW, | ||
328 | CW | ||
329 | } tag; | ||
330 | }; | ||
331 | namespace data { | ||
332 | } | ||
333 | class PolygonMode { | ||
334 | public: | ||
335 | enum class tag { | ||
336 | PolygonPoint, | ||
337 | PolygonLine, | ||
338 | PolygonFill | ||
339 | } tag; | ||
340 | }; | ||
341 | namespace data { | ||
342 | class PolygonPoint : public ::PolygonMode { | ||
343 | public: | ||
344 | std::shared_ptr<::PointSize> _0; | ||
345 | PolygonPoint() { tag = tag::PolygonPoint; } | ||
346 | }; | ||
347 | class PolygonLine : public ::PolygonMode { | ||
348 | public: | ||
349 | Float _0; | ||
350 | PolygonLine() { tag = tag::PolygonLine; } | ||
351 | }; | ||
352 | } | ||
353 | class ProvokingVertex { | ||
354 | public: | ||
355 | enum class tag { | ||
356 | FirstVertex, | ||
357 | LastVertex | ||
358 | } tag; | ||
359 | }; | ||
360 | namespace data { | ||
361 | } | ||
362 | class CullMode { | ||
363 | public: | ||
364 | enum class tag { | ||
365 | CullNone, | ||
366 | CullFront, | ||
367 | CullBack | ||
368 | } tag; | ||
369 | }; | ||
370 | namespace data { | ||
371 | class CullFront : public ::CullMode { | ||
372 | public: | ||
373 | std::shared_ptr<::FrontFace> _0; | ||
374 | CullFront() { tag = tag::CullFront; } | ||
375 | }; | ||
376 | class CullBack : public ::CullMode { | ||
377 | public: | ||
378 | std::shared_ptr<::FrontFace> _0; | ||
379 | CullBack() { tag = tag::CullBack; } | ||
380 | }; | ||
381 | } | ||
382 | class ComparisonFunction { | ||
383 | public: | ||
384 | enum class tag { | ||
385 | Never, | ||
386 | Less, | ||
387 | Equal, | ||
388 | Lequal, | ||
389 | Greater, | ||
390 | Notequal, | ||
391 | Gequal, | ||
392 | Always | ||
393 | } tag; | ||
394 | }; | ||
395 | namespace data { | ||
396 | } | ||
397 | typedef ComparisonFunction DepthFunction; | ||
398 | |||
399 | class StencilOperation { | ||
400 | public: | ||
401 | enum class tag { | ||
402 | OpZero, | ||
403 | OpKeep, | ||
404 | OpReplace, | ||
405 | OpIncr, | ||
406 | OpIncrWrap, | ||
407 | OpDecr, | ||
408 | OpDecrWrap, | ||
409 | OpInvert | ||
410 | } tag; | ||
411 | }; | ||
412 | namespace data { | ||
413 | } | ||
414 | class BlendEquation { | ||
415 | public: | ||
416 | enum class tag { | ||
417 | FuncAdd, | ||
418 | FuncSubtract, | ||
419 | FuncReverseSubtract, | ||
420 | Min, | ||
421 | Max | ||
422 | } tag; | ||
423 | }; | ||
424 | namespace data { | ||
425 | } | ||
426 | class BlendingFactor { | ||
427 | public: | ||
428 | enum class tag { | ||
429 | Zero, | ||
430 | One, | ||
431 | SrcColor, | ||
432 | OneMinusSrcColor, | ||
433 | DstColor, | ||
434 | OneMinusDstColor, | ||
435 | SrcAlpha, | ||
436 | OneMinusSrcAlpha, | ||
437 | DstAlpha, | ||
438 | OneMinusDstAlpha, | ||
439 | ConstantColor, | ||
440 | OneMinusConstantColor, | ||
441 | ConstantAlpha, | ||
442 | OneMinusConstantAlpha, | ||
443 | SrcAlphaSaturate | ||
444 | } tag; | ||
445 | }; | ||
446 | namespace data { | ||
447 | } | ||
448 | class LogicOperation { | ||
449 | public: | ||
450 | enum class tag { | ||
451 | Clear, | ||
452 | And, | ||
453 | AndReverse, | ||
454 | Copy, | ||
455 | AndInverted, | ||
456 | Noop, | ||
457 | Xor, | ||
458 | Or, | ||
459 | Nor, | ||
460 | Equiv, | ||
461 | Invert, | ||
462 | OrReverse, | ||
463 | CopyInverted, | ||
464 | OrInverted, | ||
465 | Nand, | ||
466 | Set | ||
467 | } tag; | ||
468 | }; | ||
469 | namespace data { | ||
470 | } | ||
471 | class StencilOps { | ||
472 | public: | ||
473 | enum class tag { | ||
474 | StencilOps | ||
475 | } tag; | ||
476 | }; | ||
477 | namespace data { | ||
478 | class StencilOps : public ::StencilOps { | ||
479 | public: | ||
480 | std::shared_ptr<::StencilOperation> frontStencilOp; | ||
481 | std::shared_ptr<::StencilOperation> backStencilOp; | ||
482 | StencilOps() { tag = tag::StencilOps; } | ||
483 | }; | ||
484 | } | ||
485 | class StencilTest { | ||
486 | public: | ||
487 | enum class tag { | ||
488 | StencilTest | ||
489 | } tag; | ||
490 | }; | ||
491 | namespace data { | ||
492 | class StencilTest : public ::StencilTest { | ||
493 | public: | ||
494 | std::shared_ptr<::ComparisonFunction> stencilComparision; | ||
495 | Int32 stencilReference; | ||
496 | Word32 stencilMask; | ||
497 | StencilTest() { tag = tag::StencilTest; } | ||
498 | }; | ||
499 | } | ||
500 | class StencilTests { | ||
501 | public: | ||
502 | enum class tag { | ||
503 | StencilTests | ||
504 | } tag; | ||
505 | }; | ||
506 | namespace data { | ||
507 | class StencilTests : public ::StencilTests { | ||
508 | public: | ||
509 | std::shared_ptr<::StencilTest> _0; | ||
510 | std::shared_ptr<::StencilTest> _1; | ||
511 | StencilTests() { tag = tag::StencilTests; } | ||
512 | }; | ||
513 | } | ||
514 | class FetchPrimitive { | ||
515 | public: | ||
516 | enum class tag { | ||
517 | Points, | ||
518 | Lines, | ||
519 | Triangles, | ||
520 | LinesAdjacency, | ||
521 | TrianglesAdjacency | ||
522 | } tag; | ||
523 | }; | ||
524 | namespace data { | ||
525 | } | ||
526 | class OutputPrimitive { | ||
527 | public: | ||
528 | enum class tag { | ||
529 | TrianglesOutput, | ||
530 | LinesOutput, | ||
531 | PointsOutput | ||
532 | } tag; | ||
533 | }; | ||
534 | namespace data { | ||
535 | } | ||
536 | class ColorArity { | ||
537 | public: | ||
538 | enum class tag { | ||
539 | Red, | ||
540 | RG, | ||
541 | RGB, | ||
542 | RGBA | ||
543 | } tag; | ||
544 | }; | ||
545 | namespace data { | ||
546 | } | ||
547 | class Blending { | ||
548 | public: | ||
549 | enum class tag { | ||
550 | NoBlending, | ||
551 | BlendLogicOp, | ||
552 | Blend | ||
553 | } tag; | ||
554 | }; | ||
555 | namespace data { | ||
556 | class BlendLogicOp : public ::Blending { | ||
557 | public: | ||
558 | std::shared_ptr<::LogicOperation> _0; | ||
559 | BlendLogicOp() { tag = tag::BlendLogicOp; } | ||
560 | }; | ||
561 | class Blend : public ::Blending { | ||
562 | public: | ||
563 | std::shared_ptr<::BlendEquation> colorEqSrc; | ||
564 | std::shared_ptr<::BlendEquation> alphaEqSrc; | ||
565 | std::shared_ptr<::BlendingFactor> colorFSrc; | ||
566 | std::shared_ptr<::BlendingFactor> colorFDst; | ||
567 | std::shared_ptr<::BlendingFactor> alphaFSrc; | ||
568 | std::shared_ptr<::BlendingFactor> alphaFDst; | ||
569 | V4F color; | ||
570 | Blend() { tag = tag::Blend; } | ||
571 | }; | ||
572 | } | ||
573 | class RasterContext { | ||
574 | public: | ||
575 | enum class tag { | ||
576 | PointCtx, | ||
577 | LineCtx, | ||
578 | TriangleCtx | ||
579 | } tag; | ||
580 | }; | ||
581 | namespace data { | ||
582 | class PointCtx : public ::RasterContext { | ||
583 | public: | ||
584 | std::shared_ptr<::PointSize> _0; | ||
585 | Float _1; | ||
586 | std::shared_ptr<::PointSpriteCoordOrigin> _2; | ||
587 | PointCtx() { tag = tag::PointCtx; } | ||
588 | }; | ||
589 | class LineCtx : public ::RasterContext { | ||
590 | public: | ||
591 | Float _0; | ||
592 | std::shared_ptr<::ProvokingVertex> _1; | ||
593 | LineCtx() { tag = tag::LineCtx; } | ||
594 | }; | ||
595 | class TriangleCtx : public ::RasterContext { | ||
596 | public: | ||
597 | std::shared_ptr<::CullMode> _0; | ||
598 | std::shared_ptr<::PolygonMode> _1; | ||
599 | std::shared_ptr<::PolygonOffset> _2; | ||
600 | std::shared_ptr<::ProvokingVertex> _3; | ||
601 | TriangleCtx() { tag = tag::TriangleCtx; } | ||
602 | }; | ||
603 | } | ||
604 | class FragmentOperation { | ||
605 | public: | ||
606 | enum class tag { | ||
607 | DepthOp, | ||
608 | StencilOp, | ||
609 | ColorOp | ||
610 | } tag; | ||
611 | }; | ||
612 | namespace data { | ||
613 | class DepthOp : public ::FragmentOperation { | ||
614 | public: | ||
615 | std::shared_ptr<::DepthFunction> _0; | ||
616 | Bool _1; | ||
617 | DepthOp() { tag = tag::DepthOp; } | ||
618 | }; | ||
619 | class StencilOp : public ::FragmentOperation { | ||
620 | public: | ||
621 | std::shared_ptr<::StencilTests> _0; | ||
622 | std::shared_ptr<::StencilOps> _1; | ||
623 | std::shared_ptr<::StencilOps> _2; | ||
624 | StencilOp() { tag = tag::StencilOp; } | ||
625 | }; | ||
626 | class ColorOp : public ::FragmentOperation { | ||
627 | public: | ||
628 | std::shared_ptr<::Blending> _0; | ||
629 | std::shared_ptr<::Value> _1; | ||
630 | ColorOp() { tag = tag::ColorOp; } | ||
631 | }; | ||
632 | } | ||
633 | class AccumulationContext { | ||
634 | public: | ||
635 | enum class tag { | ||
636 | AccumulationContext | ||
637 | } tag; | ||
638 | }; | ||
639 | namespace data { | ||
640 | class AccumulationContext : public ::AccumulationContext { | ||
641 | public: | ||
642 | Maybe<String> accViewportName; | ||
643 | std::vector<std::shared_ptr<::FragmentOperation>> accOperations; | ||
644 | AccumulationContext() { tag = tag::AccumulationContext; } | ||
645 | }; | ||
646 | } | ||
647 | class TextureDataType { | ||
648 | public: | ||
649 | enum class tag { | ||
650 | FloatT, | ||
651 | IntT, | ||
652 | WordT, | ||
653 | ShadowT | ||
654 | } tag; | ||
655 | }; | ||
656 | namespace data { | ||
657 | class FloatT : public ::TextureDataType { | ||
658 | public: | ||
659 | std::shared_ptr<::ColorArity> _0; | ||
660 | FloatT() { tag = tag::FloatT; } | ||
661 | }; | ||
662 | class IntT : public ::TextureDataType { | ||
663 | public: | ||
664 | std::shared_ptr<::ColorArity> _0; | ||
665 | IntT() { tag = tag::IntT; } | ||
666 | }; | ||
667 | class WordT : public ::TextureDataType { | ||
668 | public: | ||
669 | std::shared_ptr<::ColorArity> _0; | ||
670 | WordT() { tag = tag::WordT; } | ||
671 | }; | ||
672 | } | ||
673 | class TextureType { | ||
674 | public: | ||
675 | enum class tag { | ||
676 | Texture1D, | ||
677 | Texture2D, | ||
678 | Texture3D, | ||
679 | TextureCube, | ||
680 | TextureRect, | ||
681 | Texture2DMS, | ||
682 | TextureBuffer | ||
683 | } tag; | ||
684 | }; | ||
685 | namespace data { | ||
686 | class Texture1D : public ::TextureType { | ||
687 | public: | ||
688 | std::shared_ptr<::TextureDataType> _0; | ||
689 | Int _1; | ||
690 | Texture1D() { tag = tag::Texture1D; } | ||
691 | }; | ||
692 | class Texture2D : public ::TextureType { | ||
693 | public: | ||
694 | std::shared_ptr<::TextureDataType> _0; | ||
695 | Int _1; | ||
696 | Texture2D() { tag = tag::Texture2D; } | ||
697 | }; | ||
698 | class Texture3D : public ::TextureType { | ||
699 | public: | ||
700 | std::shared_ptr<::TextureDataType> _0; | ||
701 | Texture3D() { tag = tag::Texture3D; } | ||
702 | }; | ||
703 | class TextureCube : public ::TextureType { | ||
704 | public: | ||
705 | std::shared_ptr<::TextureDataType> _0; | ||
706 | TextureCube() { tag = tag::TextureCube; } | ||
707 | }; | ||
708 | class TextureRect : public ::TextureType { | ||
709 | public: | ||
710 | std::shared_ptr<::TextureDataType> _0; | ||
711 | TextureRect() { tag = tag::TextureRect; } | ||
712 | }; | ||
713 | class Texture2DMS : public ::TextureType { | ||
714 | public: | ||
715 | std::shared_ptr<::TextureDataType> _0; | ||
716 | Int _1; | ||
717 | Int _2; | ||
718 | Bool _3; | ||
719 | Texture2DMS() { tag = tag::Texture2DMS; } | ||
720 | }; | ||
721 | class TextureBuffer : public ::TextureType { | ||
722 | public: | ||
723 | std::shared_ptr<::TextureDataType> _0; | ||
724 | TextureBuffer() { tag = tag::TextureBuffer; } | ||
725 | }; | ||
726 | } | ||
727 | class MipMap { | ||
728 | public: | ||
729 | enum class tag { | ||
730 | Mip, | ||
731 | NoMip, | ||
732 | AutoMip | ||
733 | } tag; | ||
734 | }; | ||
735 | namespace data { | ||
736 | class Mip : public ::MipMap { | ||
737 | public: | ||
738 | Int _0; | ||
739 | Int _1; | ||
740 | Mip() { tag = tag::Mip; } | ||
741 | }; | ||
742 | class AutoMip : public ::MipMap { | ||
743 | public: | ||
744 | Int _0; | ||
745 | Int _1; | ||
746 | AutoMip() { tag = tag::AutoMip; } | ||
747 | }; | ||
748 | } | ||
749 | class Filter { | ||
750 | public: | ||
751 | enum class tag { | ||
752 | Nearest, | ||
753 | Linear, | ||
754 | NearestMipmapNearest, | ||
755 | NearestMipmapLinear, | ||
756 | LinearMipmapNearest, | ||
757 | LinearMipmapLinear | ||
758 | } tag; | ||
759 | }; | ||
760 | namespace data { | ||
761 | } | ||
762 | class EdgeMode { | ||
763 | public: | ||
764 | enum class tag { | ||
765 | Repeat, | ||
766 | MirroredRepeat, | ||
767 | ClampToEdge, | ||
768 | ClampToBorder | ||
769 | } tag; | ||
770 | }; | ||
771 | namespace data { | ||
772 | } | ||
773 | class ImageSemantic { | ||
774 | public: | ||
775 | enum class tag { | ||
776 | Depth, | ||
777 | Stencil, | ||
778 | Color | ||
779 | } tag; | ||
780 | }; | ||
781 | namespace data { | ||
782 | } | ||
783 | class ImageRef { | ||
784 | public: | ||
785 | enum class tag { | ||
786 | TextureImage, | ||
787 | Framebuffer | ||
788 | } tag; | ||
789 | }; | ||
790 | namespace data { | ||
791 | class TextureImage : public ::ImageRef { | ||
792 | public: | ||
793 | ::TextureName _0; | ||
794 | Int _1; | ||
795 | Maybe<Int> _2; | ||
796 | TextureImage() { tag = tag::TextureImage; } | ||
797 | }; | ||
798 | class Framebuffer : public ::ImageRef { | ||
799 | public: | ||
800 | std::shared_ptr<::ImageSemantic> _0; | ||
801 | Framebuffer() { tag = tag::Framebuffer; } | ||
802 | }; | ||
803 | } | ||
804 | class ClearImage { | ||
805 | public: | ||
806 | enum class tag { | ||
807 | ClearImage | ||
808 | } tag; | ||
809 | }; | ||
810 | namespace data { | ||
811 | class ClearImage : public ::ClearImage { | ||
812 | public: | ||
813 | std::shared_ptr<::ImageSemantic> imageSemantic; | ||
814 | std::shared_ptr<::Value> clearValue; | ||
815 | ClearImage() { tag = tag::ClearImage; } | ||
816 | }; | ||
817 | } | ||
818 | class Command { | ||
819 | public: | ||
820 | enum class tag { | ||
821 | SetRasterContext, | ||
822 | SetAccumulationContext, | ||
823 | SetRenderTarget, | ||
824 | SetProgram, | ||
825 | SetSamplerUniform, | ||
826 | SetTexture, | ||
827 | SetSampler, | ||
828 | RenderSlot, | ||
829 | RenderStream, | ||
830 | ClearRenderTarget, | ||
831 | GenerateMipMap, | ||
832 | SaveImage, | ||
833 | LoadImage | ||
834 | } tag; | ||
835 | }; | ||
836 | namespace data { | ||
837 | class SetRasterContext : public ::Command { | ||
838 | public: | ||
839 | std::shared_ptr<::RasterContext> _0; | ||
840 | SetRasterContext() { tag = tag::SetRasterContext; } | ||
841 | }; | ||
842 | class SetAccumulationContext : public ::Command { | ||
843 | public: | ||
844 | std::shared_ptr<::AccumulationContext> _0; | ||
845 | SetAccumulationContext() { tag = tag::SetAccumulationContext; } | ||
846 | }; | ||
847 | class SetRenderTarget : public ::Command { | ||
848 | public: | ||
849 | ::RenderTargetName _0; | ||
850 | SetRenderTarget() { tag = tag::SetRenderTarget; } | ||
851 | }; | ||
852 | class SetProgram : public ::Command { | ||
853 | public: | ||
854 | ::ProgramName _0; | ||
855 | SetProgram() { tag = tag::SetProgram; } | ||
856 | }; | ||
857 | class SetSamplerUniform : public ::Command { | ||
858 | public: | ||
859 | ::UniformName _0; | ||
860 | ::TextureUnit _1; | ||
861 | SetSamplerUniform() { tag = tag::SetSamplerUniform; } | ||
862 | }; | ||
863 | class SetTexture : public ::Command { | ||
864 | public: | ||
865 | ::TextureUnit _0; | ||
866 | ::TextureName _1; | ||
867 | SetTexture() { tag = tag::SetTexture; } | ||
868 | }; | ||
869 | class SetSampler : public ::Command { | ||
870 | public: | ||
871 | ::TextureUnit _0; | ||
872 | Maybe<::SamplerName> _1; | ||
873 | SetSampler() { tag = tag::SetSampler; } | ||
874 | }; | ||
875 | class RenderSlot : public ::Command { | ||
876 | public: | ||
877 | ::SlotName _0; | ||
878 | RenderSlot() { tag = tag::RenderSlot; } | ||
879 | }; | ||
880 | class RenderStream : public ::Command { | ||
881 | public: | ||
882 | ::StreamName _0; | ||
883 | RenderStream() { tag = tag::RenderStream; } | ||
884 | }; | ||
885 | class ClearRenderTarget : public ::Command { | ||
886 | public: | ||
887 | std::vector<std::shared_ptr<::ClearImage>> _0; | ||
888 | ClearRenderTarget() { tag = tag::ClearRenderTarget; } | ||
889 | }; | ||
890 | class GenerateMipMap : public ::Command { | ||
891 | public: | ||
892 | ::TextureUnit _0; | ||
893 | GenerateMipMap() { tag = tag::GenerateMipMap; } | ||
894 | }; | ||
895 | class SaveImage : public ::Command { | ||
896 | public: | ||
897 | ::FrameBufferComponent _0; | ||
898 | std::shared_ptr<::ImageRef> _1; | ||
899 | SaveImage() { tag = tag::SaveImage; } | ||
900 | }; | ||
901 | class LoadImage : public ::Command { | ||
902 | public: | ||
903 | std::shared_ptr<::ImageRef> _0; | ||
904 | ::FrameBufferComponent _1; | ||
905 | LoadImage() { tag = tag::LoadImage; } | ||
906 | }; | ||
907 | } | ||
908 | class SamplerDescriptor { | ||
909 | public: | ||
910 | enum class tag { | ||
911 | SamplerDescriptor | ||
912 | } tag; | ||
913 | }; | ||
914 | namespace data { | ||
915 | class SamplerDescriptor : public ::SamplerDescriptor { | ||
916 | public: | ||
917 | std::shared_ptr<::EdgeMode> samplerWrapS; | ||
918 | Maybe<std::shared_ptr<::EdgeMode>> samplerWrapT; | ||
919 | Maybe<std::shared_ptr<::EdgeMode>> samplerWrapR; | ||
920 | std::shared_ptr<::Filter> samplerMinFilter; | ||
921 | std::shared_ptr<::Filter> samplerMagFilter; | ||
922 | std::shared_ptr<::Value> samplerBorderColor; | ||
923 | Maybe<Float> samplerMinLod; | ||
924 | Maybe<Float> samplerMaxLod; | ||
925 | Float samplerLodBias; | ||
926 | Maybe<std::shared_ptr<::ComparisonFunction>> samplerCompareFunc; | ||
927 | SamplerDescriptor() { tag = tag::SamplerDescriptor; } | ||
928 | }; | ||
929 | } | ||
930 | class TextureDescriptor { | ||
931 | public: | ||
932 | enum class tag { | ||
933 | TextureDescriptor | ||
934 | } tag; | ||
935 | }; | ||
936 | namespace data { | ||
937 | class TextureDescriptor : public ::TextureDescriptor { | ||
938 | public: | ||
939 | std::shared_ptr<::TextureType> textureType; | ||
940 | std::shared_ptr<::Value> textureSize; | ||
941 | std::shared_ptr<::ImageSemantic> textureSemantic; | ||
942 | std::shared_ptr<::SamplerDescriptor> textureSampler; | ||
943 | Int textureBaseLevel; | ||
944 | Int textureMaxLevel; | ||
945 | TextureDescriptor() { tag = tag::TextureDescriptor; } | ||
946 | }; | ||
947 | } | ||
948 | class Parameter { | ||
949 | public: | ||
950 | enum class tag { | ||
951 | Parameter | ||
952 | } tag; | ||
953 | }; | ||
954 | namespace data { | ||
955 | class Parameter : public ::Parameter { | ||
956 | public: | ||
957 | String name; | ||
958 | std::shared_ptr<::InputType> ty; | ||
959 | Parameter() { tag = tag::Parameter; } | ||
960 | }; | ||
961 | } | ||
962 | class Program { | ||
963 | public: | ||
964 | enum class tag { | ||
965 | Program | ||
966 | } tag; | ||
967 | }; | ||
968 | namespace data { | ||
969 | class Program : public ::Program { | ||
970 | public: | ||
971 | std::map<::UniformName, std::shared_ptr<::InputType>> programUniforms; | ||
972 | std::map<::UniformName, std::shared_ptr<::Parameter>> programStreams; | ||
973 | std::map<::UniformName, std::shared_ptr<::InputType>> programInTextures; | ||
974 | std::vector<std::shared_ptr<::Parameter>> programOutput; | ||
975 | String vertexShader; | ||
976 | Maybe<String> geometryShader; | ||
977 | String fragmentShader; | ||
978 | Program() { tag = tag::Program; } | ||
979 | }; | ||
980 | } | ||
981 | class Slot { | ||
982 | public: | ||
983 | enum class tag { | ||
984 | Slot | ||
985 | } tag; | ||
986 | }; | ||
987 | namespace data { | ||
988 | class Slot : public ::Slot { | ||
989 | public: | ||
990 | String slotName; | ||
991 | std::map<String, std::shared_ptr<::InputType>> slotStreams; | ||
992 | std::map<::UniformName, std::shared_ptr<::InputType>> slotUniforms; | ||
993 | std::shared_ptr<::FetchPrimitive> slotPrimitive; | ||
994 | std::vector<::ProgramName> slotPrograms; | ||
995 | Slot() { tag = tag::Slot; } | ||
996 | }; | ||
997 | } | ||
998 | class StreamData { | ||
999 | public: | ||
1000 | enum class tag { | ||
1001 | StreamData | ||
1002 | } tag; | ||
1003 | }; | ||
1004 | namespace data { | ||
1005 | class StreamData : public ::StreamData { | ||
1006 | public: | ||
1007 | std::map<String, std::shared_ptr<::ArrayValue>> streamData; | ||
1008 | std::map<String, std::shared_ptr<::InputType>> streamType; | ||
1009 | std::shared_ptr<::FetchPrimitive> streamPrimitive; | ||
1010 | std::vector<::ProgramName> streamPrograms; | ||
1011 | StreamData() { tag = tag::StreamData; } | ||
1012 | }; | ||
1013 | } | ||
1014 | class TargetItem { | ||
1015 | public: | ||
1016 | enum class tag { | ||
1017 | TargetItem | ||
1018 | } tag; | ||
1019 | }; | ||
1020 | namespace data { | ||
1021 | class TargetItem : public ::TargetItem { | ||
1022 | public: | ||
1023 | std::shared_ptr<::ImageSemantic> targetSemantic; | ||
1024 | Maybe<std::shared_ptr<::ImageRef>> targetRef; | ||
1025 | TargetItem() { tag = tag::TargetItem; } | ||
1026 | }; | ||
1027 | } | ||
1028 | class RenderTarget { | ||
1029 | public: | ||
1030 | enum class tag { | ||
1031 | RenderTarget | ||
1032 | } tag; | ||
1033 | }; | ||
1034 | namespace data { | ||
1035 | class RenderTarget : public ::RenderTarget { | ||
1036 | public: | ||
1037 | std::vector<std::shared_ptr<::TargetItem>> renderTargets; | ||
1038 | RenderTarget() { tag = tag::RenderTarget; } | ||
1039 | }; | ||
1040 | } | ||
1041 | class Backend { | ||
1042 | public: | ||
1043 | enum class tag { | ||
1044 | WebGL1, | ||
1045 | OpenGL33 | ||
1046 | } tag; | ||
1047 | }; | ||
1048 | namespace data { | ||
1049 | } | ||
1050 | class Pipeline { | ||
1051 | public: | ||
1052 | enum class tag { | ||
1053 | Pipeline | ||
1054 | } tag; | ||
1055 | }; | ||
1056 | namespace data { | ||
1057 | class Pipeline : public ::Pipeline { | ||
1058 | public: | ||
1059 | String info; | ||
1060 | std::shared_ptr<::Backend> backend; | ||
1061 | std::vector<std::shared_ptr<::TextureDescriptor>> textures; | ||
1062 | std::vector<std::shared_ptr<::SamplerDescriptor>> samplers; | ||
1063 | std::vector<std::shared_ptr<::RenderTarget>> targets; | ||
1064 | std::vector<std::shared_ptr<::Program>> programs; | ||
1065 | std::vector<std::shared_ptr<::Slot>> slots; | ||
1066 | std::vector<std::shared_ptr<::StreamData>> streams; | ||
1067 | std::vector<std::shared_ptr<::Command>> commands; | ||
1068 | Pipeline() { tag = tag::Pipeline; } | ||
1069 | }; | ||
1070 | } | ||
1071 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.IR2.hpp b/ddl/out/cpp/LambdaCube.IR2.hpp new file mode 100644 index 0000000..1ef1dc2 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.IR2.hpp | |||
@@ -0,0 +1,1071 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:02.701527000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.IR_H | ||
5 | #define HEADER_LambdaCube.IR_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | |||
10 | typedef Int StreamName; | ||
11 | |||
12 | typedef Int ProgramName; | ||
13 | |||
14 | typedef Int TextureName; | ||
15 | |||
16 | typedef Int SamplerName; | ||
17 | |||
18 | typedef String UniformName; | ||
19 | |||
20 | typedef Int SlotName; | ||
21 | |||
22 | typedef Int FrameBufferComponent; | ||
23 | |||
24 | typedef Int TextureUnit; | ||
25 | |||
26 | typedef Int RenderTargetName; | ||
27 | |||
28 | typedef std::map<::UniformName, ::TextureUnit> TextureUnitMapping; | ||
29 | |||
30 | namespace data { | ||
31 | class VBoolArray { | ||
32 | public: | ||
33 | std::vector<Bool> _0; | ||
34 | }; | ||
35 | class VIntArray { | ||
36 | public: | ||
37 | std::vector<Int32> _0; | ||
38 | }; | ||
39 | class VWordArray { | ||
40 | public: | ||
41 | std::vector<Word32> _0; | ||
42 | }; | ||
43 | class VFloatArray { | ||
44 | public: | ||
45 | std::vector<Float> _0; | ||
46 | }; | ||
47 | } | ||
48 | class ArrayValue { | ||
49 | public: | ||
50 | enum class tag { | ||
51 | VBoolArray, | ||
52 | VIntArray, | ||
53 | VWordArray, | ||
54 | VFloatArray | ||
55 | } tag; | ||
56 | std::shared_ptr<data::VBoolArray> VBoolArray; | ||
57 | std::shared_ptr<data::VIntArray> VIntArray; | ||
58 | std::shared_ptr<data::VWordArray> VWordArray; | ||
59 | std::shared_ptr<data::VFloatArray> VFloatArray; | ||
60 | }; | ||
61 | namespace data { | ||
62 | class VBool { | ||
63 | public: | ||
64 | Bool _0; | ||
65 | }; | ||
66 | class VV2B { | ||
67 | public: | ||
68 | V2B _0; | ||
69 | }; | ||
70 | class VV3B { | ||
71 | public: | ||
72 | V3B _0; | ||
73 | }; | ||
74 | class VV4B { | ||
75 | public: | ||
76 | V4B _0; | ||
77 | }; | ||
78 | class VWord { | ||
79 | public: | ||
80 | Word32 _0; | ||
81 | }; | ||
82 | class VV2U { | ||
83 | public: | ||
84 | V2U _0; | ||
85 | }; | ||
86 | class VV3U { | ||
87 | public: | ||
88 | V3U _0; | ||
89 | }; | ||
90 | class VV4U { | ||
91 | public: | ||
92 | V4U _0; | ||
93 | }; | ||
94 | class VInt { | ||
95 | public: | ||
96 | Int32 _0; | ||
97 | }; | ||
98 | class VV2I { | ||
99 | public: | ||
100 | V2I _0; | ||
101 | }; | ||
102 | class VV3I { | ||
103 | public: | ||
104 | V3I _0; | ||
105 | }; | ||
106 | class VV4I { | ||
107 | public: | ||
108 | V4I _0; | ||
109 | }; | ||
110 | class VFloat { | ||
111 | public: | ||
112 | Float _0; | ||
113 | }; | ||
114 | class VV2F { | ||
115 | public: | ||
116 | V2F _0; | ||
117 | }; | ||
118 | class VV3F { | ||
119 | public: | ||
120 | V3F _0; | ||
121 | }; | ||
122 | class VV4F { | ||
123 | public: | ||
124 | V4F _0; | ||
125 | }; | ||
126 | class VM22F { | ||
127 | public: | ||
128 | M22F _0; | ||
129 | }; | ||
130 | class VM23F { | ||
131 | public: | ||
132 | M23F _0; | ||
133 | }; | ||
134 | class VM24F { | ||
135 | public: | ||
136 | M24F _0; | ||
137 | }; | ||
138 | class VM32F { | ||
139 | public: | ||
140 | M32F _0; | ||
141 | }; | ||
142 | class VM33F { | ||
143 | public: | ||
144 | M33F _0; | ||
145 | }; | ||
146 | class VM34F { | ||
147 | public: | ||
148 | M34F _0; | ||
149 | }; | ||
150 | class VM42F { | ||
151 | public: | ||
152 | M42F _0; | ||
153 | }; | ||
154 | class VM43F { | ||
155 | public: | ||
156 | M43F _0; | ||
157 | }; | ||
158 | class VM44F { | ||
159 | public: | ||
160 | M44F _0; | ||
161 | }; | ||
162 | } | ||
163 | class Value { | ||
164 | public: | ||
165 | enum class tag { | ||
166 | VBool, | ||
167 | VV2B, | ||
168 | VV3B, | ||
169 | VV4B, | ||
170 | VWord, | ||
171 | VV2U, | ||
172 | VV3U, | ||
173 | VV4U, | ||
174 | VInt, | ||
175 | VV2I, | ||
176 | VV3I, | ||
177 | VV4I, | ||
178 | VFloat, | ||
179 | VV2F, | ||
180 | VV3F, | ||
181 | VV4F, | ||
182 | VM22F, | ||
183 | VM23F, | ||
184 | VM24F, | ||
185 | VM32F, | ||
186 | VM33F, | ||
187 | VM34F, | ||
188 | VM42F, | ||
189 | VM43F, | ||
190 | VM44F | ||
191 | } tag; | ||
192 | std::shared_ptr<data::VBool> VBool; | ||
193 | std::shared_ptr<data::VV2B> VV2B; | ||
194 | std::shared_ptr<data::VV3B> VV3B; | ||
195 | std::shared_ptr<data::VV4B> VV4B; | ||
196 | std::shared_ptr<data::VWord> VWord; | ||
197 | std::shared_ptr<data::VV2U> VV2U; | ||
198 | std::shared_ptr<data::VV3U> VV3U; | ||
199 | std::shared_ptr<data::VV4U> VV4U; | ||
200 | std::shared_ptr<data::VInt> VInt; | ||
201 | std::shared_ptr<data::VV2I> VV2I; | ||
202 | std::shared_ptr<data::VV3I> VV3I; | ||
203 | std::shared_ptr<data::VV4I> VV4I; | ||
204 | std::shared_ptr<data::VFloat> VFloat; | ||
205 | std::shared_ptr<data::VV2F> VV2F; | ||
206 | std::shared_ptr<data::VV3F> VV3F; | ||
207 | std::shared_ptr<data::VV4F> VV4F; | ||
208 | std::shared_ptr<data::VM22F> VM22F; | ||
209 | std::shared_ptr<data::VM23F> VM23F; | ||
210 | std::shared_ptr<data::VM24F> VM24F; | ||
211 | std::shared_ptr<data::VM32F> VM32F; | ||
212 | std::shared_ptr<data::VM33F> VM33F; | ||
213 | std::shared_ptr<data::VM34F> VM34F; | ||
214 | std::shared_ptr<data::VM42F> VM42F; | ||
215 | std::shared_ptr<data::VM43F> VM43F; | ||
216 | std::shared_ptr<data::VM44F> VM44F; | ||
217 | }; | ||
218 | namespace data { | ||
219 | } | ||
220 | class InputType { | ||
221 | public: | ||
222 | enum class tag { | ||
223 | Bool, | ||
224 | V2B, | ||
225 | V3B, | ||
226 | V4B, | ||
227 | Word, | ||
228 | V2U, | ||
229 | V3U, | ||
230 | V4U, | ||
231 | Int, | ||
232 | V2I, | ||
233 | V3I, | ||
234 | V4I, | ||
235 | Float, | ||
236 | V2F, | ||
237 | V3F, | ||
238 | V4F, | ||
239 | M22F, | ||
240 | M23F, | ||
241 | M24F, | ||
242 | M32F, | ||
243 | M33F, | ||
244 | M34F, | ||
245 | M42F, | ||
246 | M43F, | ||
247 | M44F, | ||
248 | STexture1D, | ||
249 | STexture2D, | ||
250 | STextureCube, | ||
251 | STexture1DArray, | ||
252 | STexture2DArray, | ||
253 | STexture2DRect, | ||
254 | FTexture1D, | ||
255 | FTexture2D, | ||
256 | FTexture3D, | ||
257 | FTextureCube, | ||
258 | FTexture1DArray, | ||
259 | FTexture2DArray, | ||
260 | FTexture2DMS, | ||
261 | FTexture2DMSArray, | ||
262 | FTextureBuffer, | ||
263 | FTexture2DRect, | ||
264 | ITexture1D, | ||
265 | ITexture2D, | ||
266 | ITexture3D, | ||
267 | ITextureCube, | ||
268 | ITexture1DArray, | ||
269 | ITexture2DArray, | ||
270 | ITexture2DMS, | ||
271 | ITexture2DMSArray, | ||
272 | ITextureBuffer, | ||
273 | ITexture2DRect, | ||
274 | UTexture1D, | ||
275 | UTexture2D, | ||
276 | UTexture3D, | ||
277 | UTextureCube, | ||
278 | UTexture1DArray, | ||
279 | UTexture2DArray, | ||
280 | UTexture2DMS, | ||
281 | UTexture2DMSArray, | ||
282 | UTextureBuffer, | ||
283 | UTexture2DRect | ||
284 | } tag; | ||
285 | }; | ||
286 | namespace data { | ||
287 | } | ||
288 | class PointSpriteCoordOrigin { | ||
289 | public: | ||
290 | enum class tag { | ||
291 | LowerLeft, | ||
292 | UpperLeft | ||
293 | } tag; | ||
294 | }; | ||
295 | namespace data { | ||
296 | class PointSize { | ||
297 | public: | ||
298 | Float _0; | ||
299 | }; | ||
300 | } | ||
301 | class PointSize { | ||
302 | public: | ||
303 | enum class tag { | ||
304 | PointSize, | ||
305 | ProgramPointSize | ||
306 | } tag; | ||
307 | std::shared_ptr<data::PointSize> PointSize; | ||
308 | }; | ||
309 | namespace data { | ||
310 | class Offset { | ||
311 | public: | ||
312 | Float _0; | ||
313 | Float _1; | ||
314 | }; | ||
315 | } | ||
316 | class PolygonOffset { | ||
317 | public: | ||
318 | enum class tag { | ||
319 | NoOffset, | ||
320 | Offset | ||
321 | } tag; | ||
322 | std::shared_ptr<data::Offset> Offset; | ||
323 | }; | ||
324 | namespace data { | ||
325 | } | ||
326 | class FrontFace { | ||
327 | public: | ||
328 | enum class tag { | ||
329 | CCW, | ||
330 | CW | ||
331 | } tag; | ||
332 | }; | ||
333 | namespace data { | ||
334 | class PolygonPoint { | ||
335 | public: | ||
336 | std::shared_ptr<::PointSize> _0; | ||
337 | }; | ||
338 | class PolygonLine { | ||
339 | public: | ||
340 | Float _0; | ||
341 | }; | ||
342 | } | ||
343 | class PolygonMode { | ||
344 | public: | ||
345 | enum class tag { | ||
346 | PolygonPoint, | ||
347 | PolygonLine, | ||
348 | PolygonFill | ||
349 | } tag; | ||
350 | std::shared_ptr<data::PolygonPoint> PolygonPoint; | ||
351 | std::shared_ptr<data::PolygonLine> PolygonLine; | ||
352 | }; | ||
353 | namespace data { | ||
354 | } | ||
355 | class ProvokingVertex { | ||
356 | public: | ||
357 | enum class tag { | ||
358 | FirstVertex, | ||
359 | LastVertex | ||
360 | } tag; | ||
361 | }; | ||
362 | namespace data { | ||
363 | class CullFront { | ||
364 | public: | ||
365 | std::shared_ptr<::FrontFace> _0; | ||
366 | }; | ||
367 | class CullBack { | ||
368 | public: | ||
369 | std::shared_ptr<::FrontFace> _0; | ||
370 | }; | ||
371 | } | ||
372 | class CullMode { | ||
373 | public: | ||
374 | enum class tag { | ||
375 | CullNone, | ||
376 | CullFront, | ||
377 | CullBack | ||
378 | } tag; | ||
379 | std::shared_ptr<data::CullFront> CullFront; | ||
380 | std::shared_ptr<data::CullBack> CullBack; | ||
381 | }; | ||
382 | namespace data { | ||
383 | } | ||
384 | class ComparisonFunction { | ||
385 | public: | ||
386 | enum class tag { | ||
387 | Never, | ||
388 | Less, | ||
389 | Equal, | ||
390 | Lequal, | ||
391 | Greater, | ||
392 | Notequal, | ||
393 | Gequal, | ||
394 | Always | ||
395 | } tag; | ||
396 | }; | ||
397 | typedef ComparisonFunction DepthFunction; | ||
398 | |||
399 | namespace data { | ||
400 | } | ||
401 | class StencilOperation { | ||
402 | public: | ||
403 | enum class tag { | ||
404 | OpZero, | ||
405 | OpKeep, | ||
406 | OpReplace, | ||
407 | OpIncr, | ||
408 | OpIncrWrap, | ||
409 | OpDecr, | ||
410 | OpDecrWrap, | ||
411 | OpInvert | ||
412 | } tag; | ||
413 | }; | ||
414 | namespace data { | ||
415 | } | ||
416 | class BlendEquation { | ||
417 | public: | ||
418 | enum class tag { | ||
419 | FuncAdd, | ||
420 | FuncSubtract, | ||
421 | FuncReverseSubtract, | ||
422 | Min, | ||
423 | Max | ||
424 | } tag; | ||
425 | }; | ||
426 | namespace data { | ||
427 | } | ||
428 | class BlendingFactor { | ||
429 | public: | ||
430 | enum class tag { | ||
431 | Zero, | ||
432 | One, | ||
433 | SrcColor, | ||
434 | OneMinusSrcColor, | ||
435 | DstColor, | ||
436 | OneMinusDstColor, | ||
437 | SrcAlpha, | ||
438 | OneMinusSrcAlpha, | ||
439 | DstAlpha, | ||
440 | OneMinusDstAlpha, | ||
441 | ConstantColor, | ||
442 | OneMinusConstantColor, | ||
443 | ConstantAlpha, | ||
444 | OneMinusConstantAlpha, | ||
445 | SrcAlphaSaturate | ||
446 | } tag; | ||
447 | }; | ||
448 | namespace data { | ||
449 | } | ||
450 | class LogicOperation { | ||
451 | public: | ||
452 | enum class tag { | ||
453 | Clear, | ||
454 | And, | ||
455 | AndReverse, | ||
456 | Copy, | ||
457 | AndInverted, | ||
458 | Noop, | ||
459 | Xor, | ||
460 | Or, | ||
461 | Nor, | ||
462 | Equiv, | ||
463 | Invert, | ||
464 | OrReverse, | ||
465 | CopyInverted, | ||
466 | OrInverted, | ||
467 | Nand, | ||
468 | Set | ||
469 | } tag; | ||
470 | }; | ||
471 | namespace data { | ||
472 | class StencilOps { | ||
473 | public: | ||
474 | std::shared_ptr<::StencilOperation> frontStencilOp; | ||
475 | std::shared_ptr<::StencilOperation> backStencilOp; | ||
476 | }; | ||
477 | } | ||
478 | class StencilOps { | ||
479 | public: | ||
480 | enum class tag { | ||
481 | StencilOps | ||
482 | } tag; | ||
483 | std::shared_ptr<data::StencilOps> StencilOps; | ||
484 | }; | ||
485 | namespace data { | ||
486 | class StencilTest { | ||
487 | public: | ||
488 | std::shared_ptr<::ComparisonFunction> stencilComparision; | ||
489 | Int32 stencilReference; | ||
490 | Word32 stencilMask; | ||
491 | }; | ||
492 | } | ||
493 | class StencilTest { | ||
494 | public: | ||
495 | enum class tag { | ||
496 | StencilTest | ||
497 | } tag; | ||
498 | std::shared_ptr<data::StencilTest> StencilTest; | ||
499 | }; | ||
500 | namespace data { | ||
501 | class StencilTests { | ||
502 | public: | ||
503 | std::shared_ptr<::StencilTest> _0; | ||
504 | std::shared_ptr<::StencilTest> _1; | ||
505 | }; | ||
506 | } | ||
507 | class StencilTests { | ||
508 | public: | ||
509 | enum class tag { | ||
510 | StencilTests | ||
511 | } tag; | ||
512 | std::shared_ptr<data::StencilTests> StencilTests; | ||
513 | }; | ||
514 | namespace data { | ||
515 | } | ||
516 | class FetchPrimitive { | ||
517 | public: | ||
518 | enum class tag { | ||
519 | Points, | ||
520 | Lines, | ||
521 | Triangles, | ||
522 | LinesAdjacency, | ||
523 | TrianglesAdjacency | ||
524 | } tag; | ||
525 | }; | ||
526 | namespace data { | ||
527 | } | ||
528 | class OutputPrimitive { | ||
529 | public: | ||
530 | enum class tag { | ||
531 | TrianglesOutput, | ||
532 | LinesOutput, | ||
533 | PointsOutput | ||
534 | } tag; | ||
535 | }; | ||
536 | namespace data { | ||
537 | } | ||
538 | class ColorArity { | ||
539 | public: | ||
540 | enum class tag { | ||
541 | Red, | ||
542 | RG, | ||
543 | RGB, | ||
544 | RGBA | ||
545 | } tag; | ||
546 | }; | ||
547 | namespace data { | ||
548 | class BlendLogicOp { | ||
549 | public: | ||
550 | std::shared_ptr<::LogicOperation> _0; | ||
551 | }; | ||
552 | class Blend { | ||
553 | public: | ||
554 | std::shared_ptr<::BlendEquation> colorEqSrc; | ||
555 | std::shared_ptr<::BlendEquation> alphaEqSrc; | ||
556 | std::shared_ptr<::BlendingFactor> colorFSrc; | ||
557 | std::shared_ptr<::BlendingFactor> colorFDst; | ||
558 | std::shared_ptr<::BlendingFactor> alphaFSrc; | ||
559 | std::shared_ptr<::BlendingFactor> alphaFDst; | ||
560 | V4F color; | ||
561 | }; | ||
562 | } | ||
563 | class Blending { | ||
564 | public: | ||
565 | enum class tag { | ||
566 | NoBlending, | ||
567 | BlendLogicOp, | ||
568 | Blend | ||
569 | } tag; | ||
570 | std::shared_ptr<data::BlendLogicOp> BlendLogicOp; | ||
571 | std::shared_ptr<data::Blend> Blend; | ||
572 | }; | ||
573 | namespace data { | ||
574 | class PointCtx { | ||
575 | public: | ||
576 | std::shared_ptr<::PointSize> _0; | ||
577 | Float _1; | ||
578 | std::shared_ptr<::PointSpriteCoordOrigin> _2; | ||
579 | }; | ||
580 | class LineCtx { | ||
581 | public: | ||
582 | Float _0; | ||
583 | std::shared_ptr<::ProvokingVertex> _1; | ||
584 | }; | ||
585 | class TriangleCtx { | ||
586 | public: | ||
587 | std::shared_ptr<::CullMode> _0; | ||
588 | std::shared_ptr<::PolygonMode> _1; | ||
589 | std::shared_ptr<::PolygonOffset> _2; | ||
590 | std::shared_ptr<::ProvokingVertex> _3; | ||
591 | }; | ||
592 | } | ||
593 | class RasterContext { | ||
594 | public: | ||
595 | enum class tag { | ||
596 | PointCtx, | ||
597 | LineCtx, | ||
598 | TriangleCtx | ||
599 | } tag; | ||
600 | std::shared_ptr<data::PointCtx> PointCtx; | ||
601 | std::shared_ptr<data::LineCtx> LineCtx; | ||
602 | std::shared_ptr<data::TriangleCtx> TriangleCtx; | ||
603 | }; | ||
604 | namespace data { | ||
605 | class DepthOp { | ||
606 | public: | ||
607 | std::shared_ptr<::DepthFunction> _0; | ||
608 | Bool _1; | ||
609 | }; | ||
610 | class StencilOp { | ||
611 | public: | ||
612 | std::shared_ptr<::StencilTests> _0; | ||
613 | std::shared_ptr<::StencilOps> _1; | ||
614 | std::shared_ptr<::StencilOps> _2; | ||
615 | }; | ||
616 | class ColorOp { | ||
617 | public: | ||
618 | std::shared_ptr<::Blending> _0; | ||
619 | std::shared_ptr<::Value> _1; | ||
620 | }; | ||
621 | } | ||
622 | class FragmentOperation { | ||
623 | public: | ||
624 | enum class tag { | ||
625 | DepthOp, | ||
626 | StencilOp, | ||
627 | ColorOp | ||
628 | } tag; | ||
629 | std::shared_ptr<data::DepthOp> DepthOp; | ||
630 | std::shared_ptr<data::StencilOp> StencilOp; | ||
631 | std::shared_ptr<data::ColorOp> ColorOp; | ||
632 | }; | ||
633 | namespace data { | ||
634 | class AccumulationContext { | ||
635 | public: | ||
636 | Maybe<String> accViewportName; | ||
637 | std::vector<std::shared_ptr<::FragmentOperation>> accOperations; | ||
638 | }; | ||
639 | } | ||
640 | class AccumulationContext { | ||
641 | public: | ||
642 | enum class tag { | ||
643 | AccumulationContext | ||
644 | } tag; | ||
645 | std::shared_ptr<data::AccumulationContext> AccumulationContext; | ||
646 | }; | ||
647 | namespace data { | ||
648 | class FloatT { | ||
649 | public: | ||
650 | std::shared_ptr<::ColorArity> _0; | ||
651 | }; | ||
652 | class IntT { | ||
653 | public: | ||
654 | std::shared_ptr<::ColorArity> _0; | ||
655 | }; | ||
656 | class WordT { | ||
657 | public: | ||
658 | std::shared_ptr<::ColorArity> _0; | ||
659 | }; | ||
660 | } | ||
661 | class TextureDataType { | ||
662 | public: | ||
663 | enum class tag { | ||
664 | FloatT, | ||
665 | IntT, | ||
666 | WordT, | ||
667 | ShadowT | ||
668 | } tag; | ||
669 | std::shared_ptr<data::FloatT> FloatT; | ||
670 | std::shared_ptr<data::IntT> IntT; | ||
671 | std::shared_ptr<data::WordT> WordT; | ||
672 | }; | ||
673 | namespace data { | ||
674 | class Texture1D { | ||
675 | public: | ||
676 | std::shared_ptr<::TextureDataType> _0; | ||
677 | Int _1; | ||
678 | }; | ||
679 | class Texture2D { | ||
680 | public: | ||
681 | std::shared_ptr<::TextureDataType> _0; | ||
682 | Int _1; | ||
683 | }; | ||
684 | class Texture3D { | ||
685 | public: | ||
686 | std::shared_ptr<::TextureDataType> _0; | ||
687 | }; | ||
688 | class TextureCube { | ||
689 | public: | ||
690 | std::shared_ptr<::TextureDataType> _0; | ||
691 | }; | ||
692 | class TextureRect { | ||
693 | public: | ||
694 | std::shared_ptr<::TextureDataType> _0; | ||
695 | }; | ||
696 | class Texture2DMS { | ||
697 | public: | ||
698 | std::shared_ptr<::TextureDataType> _0; | ||
699 | Int _1; | ||
700 | Int _2; | ||
701 | Bool _3; | ||
702 | }; | ||
703 | class TextureBuffer { | ||
704 | public: | ||
705 | std::shared_ptr<::TextureDataType> _0; | ||
706 | }; | ||
707 | } | ||
708 | class TextureType { | ||
709 | public: | ||
710 | enum class tag { | ||
711 | Texture1D, | ||
712 | Texture2D, | ||
713 | Texture3D, | ||
714 | TextureCube, | ||
715 | TextureRect, | ||
716 | Texture2DMS, | ||
717 | TextureBuffer | ||
718 | } tag; | ||
719 | std::shared_ptr<data::Texture1D> Texture1D; | ||
720 | std::shared_ptr<data::Texture2D> Texture2D; | ||
721 | std::shared_ptr<data::Texture3D> Texture3D; | ||
722 | std::shared_ptr<data::TextureCube> TextureCube; | ||
723 | std::shared_ptr<data::TextureRect> TextureRect; | ||
724 | std::shared_ptr<data::Texture2DMS> Texture2DMS; | ||
725 | std::shared_ptr<data::TextureBuffer> TextureBuffer; | ||
726 | }; | ||
727 | namespace data { | ||
728 | class Mip { | ||
729 | public: | ||
730 | Int _0; | ||
731 | Int _1; | ||
732 | }; | ||
733 | class AutoMip { | ||
734 | public: | ||
735 | Int _0; | ||
736 | Int _1; | ||
737 | }; | ||
738 | } | ||
739 | class MipMap { | ||
740 | public: | ||
741 | enum class tag { | ||
742 | Mip, | ||
743 | NoMip, | ||
744 | AutoMip | ||
745 | } tag; | ||
746 | std::shared_ptr<data::Mip> Mip; | ||
747 | std::shared_ptr<data::AutoMip> AutoMip; | ||
748 | }; | ||
749 | namespace data { | ||
750 | } | ||
751 | class Filter { | ||
752 | public: | ||
753 | enum class tag { | ||
754 | Nearest, | ||
755 | Linear, | ||
756 | NearestMipmapNearest, | ||
757 | NearestMipmapLinear, | ||
758 | LinearMipmapNearest, | ||
759 | LinearMipmapLinear | ||
760 | } tag; | ||
761 | }; | ||
762 | namespace data { | ||
763 | } | ||
764 | class EdgeMode { | ||
765 | public: | ||
766 | enum class tag { | ||
767 | Repeat, | ||
768 | MirroredRepeat, | ||
769 | ClampToEdge, | ||
770 | ClampToBorder | ||
771 | } tag; | ||
772 | }; | ||
773 | namespace data { | ||
774 | } | ||
775 | class ImageSemantic { | ||
776 | public: | ||
777 | enum class tag { | ||
778 | Depth, | ||
779 | Stencil, | ||
780 | Color | ||
781 | } tag; | ||
782 | }; | ||
783 | namespace data { | ||
784 | class TextureImage { | ||
785 | public: | ||
786 | ::TextureName _0; | ||
787 | Int _1; | ||
788 | Maybe<Int> _2; | ||
789 | }; | ||
790 | class Framebuffer { | ||
791 | public: | ||
792 | std::shared_ptr<::ImageSemantic> _0; | ||
793 | }; | ||
794 | } | ||
795 | class ImageRef { | ||
796 | public: | ||
797 | enum class tag { | ||
798 | TextureImage, | ||
799 | Framebuffer | ||
800 | } tag; | ||
801 | std::shared_ptr<data::TextureImage> TextureImage; | ||
802 | std::shared_ptr<data::Framebuffer> Framebuffer; | ||
803 | }; | ||
804 | namespace data { | ||
805 | class ClearImage { | ||
806 | public: | ||
807 | std::shared_ptr<::ImageSemantic> imageSemantic; | ||
808 | std::shared_ptr<::Value> clearValue; | ||
809 | }; | ||
810 | } | ||
811 | class ClearImage { | ||
812 | public: | ||
813 | enum class tag { | ||
814 | ClearImage | ||
815 | } tag; | ||
816 | std::shared_ptr<data::ClearImage> ClearImage; | ||
817 | }; | ||
818 | namespace data { | ||
819 | class SetRasterContext { | ||
820 | public: | ||
821 | std::shared_ptr<::RasterContext> _0; | ||
822 | }; | ||
823 | class SetAccumulationContext { | ||
824 | public: | ||
825 | std::shared_ptr<::AccumulationContext> _0; | ||
826 | }; | ||
827 | class SetRenderTarget { | ||
828 | public: | ||
829 | ::RenderTargetName _0; | ||
830 | }; | ||
831 | class SetProgram { | ||
832 | public: | ||
833 | ::ProgramName _0; | ||
834 | }; | ||
835 | class SetSamplerUniform { | ||
836 | public: | ||
837 | ::UniformName _0; | ||
838 | ::TextureUnit _1; | ||
839 | }; | ||
840 | class SetTexture { | ||
841 | public: | ||
842 | ::TextureUnit _0; | ||
843 | ::TextureName _1; | ||
844 | }; | ||
845 | class SetSampler { | ||
846 | public: | ||
847 | ::TextureUnit _0; | ||
848 | Maybe<::SamplerName> _1; | ||
849 | }; | ||
850 | class RenderSlot { | ||
851 | public: | ||
852 | ::SlotName _0; | ||
853 | }; | ||
854 | class RenderStream { | ||
855 | public: | ||
856 | ::StreamName _0; | ||
857 | }; | ||
858 | class ClearRenderTarget { | ||
859 | public: | ||
860 | std::vector<std::shared_ptr<::ClearImage>> _0; | ||
861 | }; | ||
862 | class GenerateMipMap { | ||
863 | public: | ||
864 | ::TextureUnit _0; | ||
865 | }; | ||
866 | class SaveImage { | ||
867 | public: | ||
868 | ::FrameBufferComponent _0; | ||
869 | std::shared_ptr<::ImageRef> _1; | ||
870 | }; | ||
871 | class LoadImage { | ||
872 | public: | ||
873 | std::shared_ptr<::ImageRef> _0; | ||
874 | ::FrameBufferComponent _1; | ||
875 | }; | ||
876 | } | ||
877 | class Command { | ||
878 | public: | ||
879 | enum class tag { | ||
880 | SetRasterContext, | ||
881 | SetAccumulationContext, | ||
882 | SetRenderTarget, | ||
883 | SetProgram, | ||
884 | SetSamplerUniform, | ||
885 | SetTexture, | ||
886 | SetSampler, | ||
887 | RenderSlot, | ||
888 | RenderStream, | ||
889 | ClearRenderTarget, | ||
890 | GenerateMipMap, | ||
891 | SaveImage, | ||
892 | LoadImage | ||
893 | } tag; | ||
894 | std::shared_ptr<data::SetRasterContext> SetRasterContext; | ||
895 | std::shared_ptr<data::SetAccumulationContext> SetAccumulationContext; | ||
896 | std::shared_ptr<data::SetRenderTarget> SetRenderTarget; | ||
897 | std::shared_ptr<data::SetProgram> SetProgram; | ||
898 | std::shared_ptr<data::SetSamplerUniform> SetSamplerUniform; | ||
899 | std::shared_ptr<data::SetTexture> SetTexture; | ||
900 | std::shared_ptr<data::SetSampler> SetSampler; | ||
901 | std::shared_ptr<data::RenderSlot> RenderSlot; | ||
902 | std::shared_ptr<data::RenderStream> RenderStream; | ||
903 | std::shared_ptr<data::ClearRenderTarget> ClearRenderTarget; | ||
904 | std::shared_ptr<data::GenerateMipMap> GenerateMipMap; | ||
905 | std::shared_ptr<data::SaveImage> SaveImage; | ||
906 | std::shared_ptr<data::LoadImage> LoadImage; | ||
907 | }; | ||
908 | namespace data { | ||
909 | class SamplerDescriptor { | ||
910 | public: | ||
911 | std::shared_ptr<::EdgeMode> samplerWrapS; | ||
912 | Maybe<std::shared_ptr<::EdgeMode>> samplerWrapT; | ||
913 | Maybe<std::shared_ptr<::EdgeMode>> samplerWrapR; | ||
914 | std::shared_ptr<::Filter> samplerMinFilter; | ||
915 | std::shared_ptr<::Filter> samplerMagFilter; | ||
916 | std::shared_ptr<::Value> samplerBorderColor; | ||
917 | Maybe<Float> samplerMinLod; | ||
918 | Maybe<Float> samplerMaxLod; | ||
919 | Float samplerLodBias; | ||
920 | Maybe<std::shared_ptr<::ComparisonFunction>> samplerCompareFunc; | ||
921 | }; | ||
922 | } | ||
923 | class SamplerDescriptor { | ||
924 | public: | ||
925 | enum class tag { | ||
926 | SamplerDescriptor | ||
927 | } tag; | ||
928 | std::shared_ptr<data::SamplerDescriptor> SamplerDescriptor; | ||
929 | }; | ||
930 | namespace data { | ||
931 | class TextureDescriptor { | ||
932 | public: | ||
933 | std::shared_ptr<::TextureType> textureType; | ||
934 | std::shared_ptr<::Value> textureSize; | ||
935 | std::shared_ptr<::ImageSemantic> textureSemantic; | ||
936 | std::shared_ptr<::SamplerDescriptor> textureSampler; | ||
937 | Int textureBaseLevel; | ||
938 | Int textureMaxLevel; | ||
939 | }; | ||
940 | } | ||
941 | class TextureDescriptor { | ||
942 | public: | ||
943 | enum class tag { | ||
944 | TextureDescriptor | ||
945 | } tag; | ||
946 | std::shared_ptr<data::TextureDescriptor> TextureDescriptor; | ||
947 | }; | ||
948 | namespace data { | ||
949 | class Parameter { | ||
950 | public: | ||
951 | String name; | ||
952 | std::shared_ptr<::InputType> ty; | ||
953 | }; | ||
954 | } | ||
955 | class Parameter { | ||
956 | public: | ||
957 | enum class tag { | ||
958 | Parameter | ||
959 | } tag; | ||
960 | std::shared_ptr<data::Parameter> Parameter; | ||
961 | }; | ||
962 | namespace data { | ||
963 | class Program { | ||
964 | public: | ||
965 | std::map<::UniformName, std::shared_ptr<::InputType>> programUniforms; | ||
966 | std::map<::UniformName, std::shared_ptr<::Parameter>> programStreams; | ||
967 | std::map<::UniformName, std::shared_ptr<::InputType>> programInTextures; | ||
968 | std::vector<std::shared_ptr<::Parameter>> programOutput; | ||
969 | String vertexShader; | ||
970 | Maybe<String> geometryShader; | ||
971 | String fragmentShader; | ||
972 | }; | ||
973 | } | ||
974 | class Program { | ||
975 | public: | ||
976 | enum class tag { | ||
977 | Program | ||
978 | } tag; | ||
979 | std::shared_ptr<data::Program> Program; | ||
980 | }; | ||
981 | namespace data { | ||
982 | class Slot { | ||
983 | public: | ||
984 | String slotName; | ||
985 | std::map<String, std::shared_ptr<::InputType>> slotStreams; | ||
986 | std::map<::UniformName, std::shared_ptr<::InputType>> slotUniforms; | ||
987 | std::shared_ptr<::FetchPrimitive> slotPrimitive; | ||
988 | std::vector<::ProgramName> slotPrograms; | ||
989 | }; | ||
990 | } | ||
991 | class Slot { | ||
992 | public: | ||
993 | enum class tag { | ||
994 | Slot | ||
995 | } tag; | ||
996 | std::shared_ptr<data::Slot> Slot; | ||
997 | }; | ||
998 | namespace data { | ||
999 | class StreamData { | ||
1000 | public: | ||
1001 | std::map<String, std::shared_ptr<::ArrayValue>> streamData; | ||
1002 | std::map<String, std::shared_ptr<::InputType>> streamType; | ||
1003 | std::shared_ptr<::FetchPrimitive> streamPrimitive; | ||
1004 | std::vector<::ProgramName> streamPrograms; | ||
1005 | }; | ||
1006 | } | ||
1007 | class StreamData { | ||
1008 | public: | ||
1009 | enum class tag { | ||
1010 | StreamData | ||
1011 | } tag; | ||
1012 | std::shared_ptr<data::StreamData> StreamData; | ||
1013 | }; | ||
1014 | namespace data { | ||
1015 | class TargetItem { | ||
1016 | public: | ||
1017 | std::shared_ptr<::ImageSemantic> targetSemantic; | ||
1018 | Maybe<std::shared_ptr<::ImageRef>> targetRef; | ||
1019 | }; | ||
1020 | } | ||
1021 | class TargetItem { | ||
1022 | public: | ||
1023 | enum class tag { | ||
1024 | TargetItem | ||
1025 | } tag; | ||
1026 | std::shared_ptr<data::TargetItem> TargetItem; | ||
1027 | }; | ||
1028 | namespace data { | ||
1029 | class RenderTarget { | ||
1030 | public: | ||
1031 | std::vector<std::shared_ptr<::TargetItem>> renderTargets; | ||
1032 | }; | ||
1033 | } | ||
1034 | class RenderTarget { | ||
1035 | public: | ||
1036 | enum class tag { | ||
1037 | RenderTarget | ||
1038 | } tag; | ||
1039 | std::shared_ptr<data::RenderTarget> RenderTarget; | ||
1040 | }; | ||
1041 | namespace data { | ||
1042 | } | ||
1043 | class Backend { | ||
1044 | public: | ||
1045 | enum class tag { | ||
1046 | WebGL1, | ||
1047 | OpenGL33 | ||
1048 | } tag; | ||
1049 | }; | ||
1050 | namespace data { | ||
1051 | class Pipeline { | ||
1052 | public: | ||
1053 | String info; | ||
1054 | std::shared_ptr<::Backend> backend; | ||
1055 | std::vector<std::shared_ptr<::TextureDescriptor>> textures; | ||
1056 | std::vector<std::shared_ptr<::SamplerDescriptor>> samplers; | ||
1057 | std::vector<std::shared_ptr<::RenderTarget>> targets; | ||
1058 | std::vector<std::shared_ptr<::Program>> programs; | ||
1059 | std::vector<std::shared_ptr<::Slot>> slots; | ||
1060 | std::vector<std::shared_ptr<::StreamData>> streams; | ||
1061 | std::vector<std::shared_ptr<::Command>> commands; | ||
1062 | }; | ||
1063 | } | ||
1064 | class Pipeline { | ||
1065 | public: | ||
1066 | enum class tag { | ||
1067 | Pipeline | ||
1068 | } tag; | ||
1069 | std::shared_ptr<data::Pipeline> Pipeline; | ||
1070 | }; | ||
1071 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.Mesh.cpp b/ddl/out/cpp/LambdaCube.Mesh.cpp new file mode 100644 index 0000000..ae47aa3 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.Mesh.cpp | |||
@@ -0,0 +1,228 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.517567000000Z | ||
3 | |||
4 | #include "LambdaCube.Mesh.hpp" | ||
5 | template<> json toJSON<std::shared_ptr<MeshAttribute>>(std::shared_ptr<MeshAttribute> &v) { | ||
6 | json obj({}); | ||
7 | switch (v->tag) { | ||
8 | case ::MeshAttribute::tag::A_Float: | ||
9 | obj["tag"] = "A_Float"; | ||
10 | { | ||
11 | std::shared_ptr<data::A_Float> tv = std::static_pointer_cast<data::A_Float>(v); | ||
12 | obj["arg0"] = toJSON(tv->_0); | ||
13 | } | ||
14 | break; | ||
15 | case ::MeshAttribute::tag::A_V2F: | ||
16 | obj["tag"] = "A_V2F"; | ||
17 | { | ||
18 | std::shared_ptr<data::A_V2F> tv = std::static_pointer_cast<data::A_V2F>(v); | ||
19 | obj["arg0"] = toJSON(tv->_0); | ||
20 | } | ||
21 | break; | ||
22 | case ::MeshAttribute::tag::A_V3F: | ||
23 | obj["tag"] = "A_V3F"; | ||
24 | { | ||
25 | std::shared_ptr<data::A_V3F> tv = std::static_pointer_cast<data::A_V3F>(v); | ||
26 | obj["arg0"] = toJSON(tv->_0); | ||
27 | } | ||
28 | break; | ||
29 | case ::MeshAttribute::tag::A_V4F: | ||
30 | obj["tag"] = "A_V4F"; | ||
31 | { | ||
32 | std::shared_ptr<data::A_V4F> tv = std::static_pointer_cast<data::A_V4F>(v); | ||
33 | obj["arg0"] = toJSON(tv->_0); | ||
34 | } | ||
35 | break; | ||
36 | case ::MeshAttribute::tag::A_M22F: | ||
37 | obj["tag"] = "A_M22F"; | ||
38 | { | ||
39 | std::shared_ptr<data::A_M22F> tv = std::static_pointer_cast<data::A_M22F>(v); | ||
40 | obj["arg0"] = toJSON(tv->_0); | ||
41 | } | ||
42 | break; | ||
43 | case ::MeshAttribute::tag::A_M33F: | ||
44 | obj["tag"] = "A_M33F"; | ||
45 | { | ||
46 | std::shared_ptr<data::A_M33F> tv = std::static_pointer_cast<data::A_M33F>(v); | ||
47 | obj["arg0"] = toJSON(tv->_0); | ||
48 | } | ||
49 | break; | ||
50 | case ::MeshAttribute::tag::A_M44F: | ||
51 | obj["tag"] = "A_M44F"; | ||
52 | { | ||
53 | std::shared_ptr<data::A_M44F> tv = std::static_pointer_cast<data::A_M44F>(v); | ||
54 | obj["arg0"] = toJSON(tv->_0); | ||
55 | } | ||
56 | break; | ||
57 | case ::MeshAttribute::tag::A_Int: | ||
58 | obj["tag"] = "A_Int"; | ||
59 | { | ||
60 | std::shared_ptr<data::A_Int> tv = std::static_pointer_cast<data::A_Int>(v); | ||
61 | obj["arg0"] = toJSON(tv->_0); | ||
62 | } | ||
63 | break; | ||
64 | case ::MeshAttribute::tag::A_Word: | ||
65 | obj["tag"] = "A_Word"; | ||
66 | { | ||
67 | std::shared_ptr<data::A_Word> tv = std::static_pointer_cast<data::A_Word>(v); | ||
68 | obj["arg0"] = toJSON(tv->_0); | ||
69 | } | ||
70 | break; | ||
71 | } | ||
72 | return obj; | ||
73 | } | ||
74 | |||
75 | template<> std::shared_ptr<MeshAttribute> fromJSON<std::shared_ptr<MeshAttribute>>(W<std::shared_ptr<MeshAttribute>> v, json &obj) { | ||
76 | enum ::MeshAttribute::tag tagType; | ||
77 | std::string tag = obj["tag"]; | ||
78 | if (tag == "A_Float") { | ||
79 | tagType = ::MeshAttribute::tag::A_Float; | ||
80 | std::shared_ptr<data::A_Float> tv(new data::A_Float()); | ||
81 | tv->_0 = fromJSON(W<std::vector<Float>>(), obj["arg0"]); | ||
82 | return tv; | ||
83 | } | ||
84 | else if (tag == "A_V2F") { | ||
85 | tagType = ::MeshAttribute::tag::A_V2F; | ||
86 | std::shared_ptr<data::A_V2F> tv(new data::A_V2F()); | ||
87 | tv->_0 = fromJSON(W<std::vector<V2F>>(), obj["arg0"]); | ||
88 | return tv; | ||
89 | } | ||
90 | else if (tag == "A_V3F") { | ||
91 | tagType = ::MeshAttribute::tag::A_V3F; | ||
92 | std::shared_ptr<data::A_V3F> tv(new data::A_V3F()); | ||
93 | tv->_0 = fromJSON(W<std::vector<V3F>>(), obj["arg0"]); | ||
94 | return tv; | ||
95 | } | ||
96 | else if (tag == "A_V4F") { | ||
97 | tagType = ::MeshAttribute::tag::A_V4F; | ||
98 | std::shared_ptr<data::A_V4F> tv(new data::A_V4F()); | ||
99 | tv->_0 = fromJSON(W<std::vector<V4F>>(), obj["arg0"]); | ||
100 | return tv; | ||
101 | } | ||
102 | else if (tag == "A_M22F") { | ||
103 | tagType = ::MeshAttribute::tag::A_M22F; | ||
104 | std::shared_ptr<data::A_M22F> tv(new data::A_M22F()); | ||
105 | tv->_0 = fromJSON(W<std::vector<M22F>>(), obj["arg0"]); | ||
106 | return tv; | ||
107 | } | ||
108 | else if (tag == "A_M33F") { | ||
109 | tagType = ::MeshAttribute::tag::A_M33F; | ||
110 | std::shared_ptr<data::A_M33F> tv(new data::A_M33F()); | ||
111 | tv->_0 = fromJSON(W<std::vector<M33F>>(), obj["arg0"]); | ||
112 | return tv; | ||
113 | } | ||
114 | else if (tag == "A_M44F") { | ||
115 | tagType = ::MeshAttribute::tag::A_M44F; | ||
116 | std::shared_ptr<data::A_M44F> tv(new data::A_M44F()); | ||
117 | tv->_0 = fromJSON(W<std::vector<M44F>>(), obj["arg0"]); | ||
118 | return tv; | ||
119 | } | ||
120 | else if (tag == "A_Int") { | ||
121 | tagType = ::MeshAttribute::tag::A_Int; | ||
122 | std::shared_ptr<data::A_Int> tv(new data::A_Int()); | ||
123 | tv->_0 = fromJSON(W<std::vector<Int32>>(), obj["arg0"]); | ||
124 | return tv; | ||
125 | } | ||
126 | else if (tag == "A_Word") { | ||
127 | tagType = ::MeshAttribute::tag::A_Word; | ||
128 | std::shared_ptr<data::A_Word> tv(new data::A_Word()); | ||
129 | tv->_0 = fromJSON(W<std::vector<Word32>>(), obj["arg0"]); | ||
130 | return tv; | ||
131 | } | ||
132 | else throw "unknown constructor: " + tag; | ||
133 | std::shared_ptr<::MeshAttribute> o(new ::MeshAttribute()); | ||
134 | o->tag = tagType; | ||
135 | return o; | ||
136 | } | ||
137 | |||
138 | template<> json toJSON<std::shared_ptr<MeshPrimitive>>(std::shared_ptr<MeshPrimitive> &v) { | ||
139 | json obj({}); | ||
140 | switch (v->tag) { | ||
141 | case ::MeshPrimitive::tag::P_Points: | ||
142 | obj["tag"] = "P_Points"; | ||
143 | break; | ||
144 | case ::MeshPrimitive::tag::P_TriangleStrip: | ||
145 | obj["tag"] = "P_TriangleStrip"; | ||
146 | break; | ||
147 | case ::MeshPrimitive::tag::P_Triangles: | ||
148 | obj["tag"] = "P_Triangles"; | ||
149 | break; | ||
150 | case ::MeshPrimitive::tag::P_TriangleStripI: | ||
151 | obj["tag"] = "P_TriangleStripI"; | ||
152 | { | ||
153 | std::shared_ptr<data::P_TriangleStripI> tv = std::static_pointer_cast<data::P_TriangleStripI>(v); | ||
154 | obj["arg0"] = toJSON(tv->_0); | ||
155 | } | ||
156 | break; | ||
157 | case ::MeshPrimitive::tag::P_TrianglesI: | ||
158 | obj["tag"] = "P_TrianglesI"; | ||
159 | { | ||
160 | std::shared_ptr<data::P_TrianglesI> tv = std::static_pointer_cast<data::P_TrianglesI>(v); | ||
161 | obj["arg0"] = toJSON(tv->_0); | ||
162 | } | ||
163 | break; | ||
164 | } | ||
165 | return obj; | ||
166 | } | ||
167 | |||
168 | template<> std::shared_ptr<MeshPrimitive> fromJSON<std::shared_ptr<MeshPrimitive>>(W<std::shared_ptr<MeshPrimitive>> v, json &obj) { | ||
169 | enum ::MeshPrimitive::tag tagType; | ||
170 | std::string tag = obj["tag"]; | ||
171 | if (tag == "P_Points") { | ||
172 | tagType = ::MeshPrimitive::tag::P_Points; | ||
173 | } | ||
174 | else if (tag == "P_TriangleStrip") { | ||
175 | tagType = ::MeshPrimitive::tag::P_TriangleStrip; | ||
176 | } | ||
177 | else if (tag == "P_Triangles") { | ||
178 | tagType = ::MeshPrimitive::tag::P_Triangles; | ||
179 | } | ||
180 | else if (tag == "P_TriangleStripI") { | ||
181 | tagType = ::MeshPrimitive::tag::P_TriangleStripI; | ||
182 | std::shared_ptr<data::P_TriangleStripI> tv(new data::P_TriangleStripI()); | ||
183 | tv->_0 = fromJSON(W<std::vector<Int32>>(), obj["arg0"]); | ||
184 | return tv; | ||
185 | } | ||
186 | else if (tag == "P_TrianglesI") { | ||
187 | tagType = ::MeshPrimitive::tag::P_TrianglesI; | ||
188 | std::shared_ptr<data::P_TrianglesI> tv(new data::P_TrianglesI()); | ||
189 | tv->_0 = fromJSON(W<std::vector<Int32>>(), obj["arg0"]); | ||
190 | return tv; | ||
191 | } | ||
192 | else throw "unknown constructor: " + tag; | ||
193 | std::shared_ptr<::MeshPrimitive> o(new ::MeshPrimitive()); | ||
194 | o->tag = tagType; | ||
195 | return o; | ||
196 | } | ||
197 | |||
198 | template<> json toJSON<std::shared_ptr<Mesh>>(std::shared_ptr<Mesh> &v) { | ||
199 | json obj({}); | ||
200 | switch (v->tag) { | ||
201 | case ::Mesh::tag::Mesh: | ||
202 | obj["tag"] = "Mesh"; | ||
203 | { | ||
204 | std::shared_ptr<data::Mesh> tv = std::static_pointer_cast<data::Mesh>(v); | ||
205 | obj["mAttributes"] = toJSON(tv->mAttributes); | ||
206 | obj["mPrimitive"] = toJSON(tv->mPrimitive); | ||
207 | } | ||
208 | break; | ||
209 | } | ||
210 | return obj; | ||
211 | } | ||
212 | |||
213 | template<> std::shared_ptr<Mesh> fromJSON<std::shared_ptr<Mesh>>(W<std::shared_ptr<Mesh>> v, json &obj) { | ||
214 | enum ::Mesh::tag tagType; | ||
215 | std::string tag = obj["tag"]; | ||
216 | if (tag == "Mesh") { | ||
217 | tagType = ::Mesh::tag::Mesh; | ||
218 | std::shared_ptr<data::Mesh> tv(new data::Mesh()); | ||
219 | tv->mAttributes = fromJSON(W<std::map<String, std::shared_ptr<::MeshAttribute>>>(), obj["mAttributes"]); | ||
220 | tv->mPrimitive = fromJSON(W<std::shared_ptr<::MeshPrimitive>>(), obj["mPrimitive"]); | ||
221 | return tv; | ||
222 | } | ||
223 | else throw "unknown constructor: " + tag; | ||
224 | std::shared_ptr<::Mesh> o(new ::Mesh()); | ||
225 | o->tag = tagType; | ||
226 | return o; | ||
227 | } | ||
228 | |||
diff --git a/ddl/out/cpp/LambdaCube.Mesh.hpp b/ddl/out/cpp/LambdaCube.Mesh.hpp new file mode 100644 index 0000000..205cc02 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.Mesh.hpp | |||
@@ -0,0 +1,107 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.517567000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.Mesh_H | ||
5 | #define HEADER_LambdaCube.Mesh_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | |||
10 | class MeshAttribute { | ||
11 | public: | ||
12 | enum class tag { | ||
13 | A_Float, | ||
14 | A_V2F, | ||
15 | A_V3F, | ||
16 | A_V4F, | ||
17 | A_M22F, | ||
18 | A_M33F, | ||
19 | A_M44F, | ||
20 | A_Int, | ||
21 | A_Word | ||
22 | } tag; | ||
23 | }; | ||
24 | namespace data { | ||
25 | class A_Float : public ::MeshAttribute { | ||
26 | public: | ||
27 | std::vector<Float> _0; | ||
28 | A_Float() { tag = tag::A_Float; } | ||
29 | }; | ||
30 | class A_V2F : public ::MeshAttribute { | ||
31 | public: | ||
32 | std::vector<V2F> _0; | ||
33 | A_V2F() { tag = tag::A_V2F; } | ||
34 | }; | ||
35 | class A_V3F : public ::MeshAttribute { | ||
36 | public: | ||
37 | std::vector<V3F> _0; | ||
38 | A_V3F() { tag = tag::A_V3F; } | ||
39 | }; | ||
40 | class A_V4F : public ::MeshAttribute { | ||
41 | public: | ||
42 | std::vector<V4F> _0; | ||
43 | A_V4F() { tag = tag::A_V4F; } | ||
44 | }; | ||
45 | class A_M22F : public ::MeshAttribute { | ||
46 | public: | ||
47 | std::vector<M22F> _0; | ||
48 | A_M22F() { tag = tag::A_M22F; } | ||
49 | }; | ||
50 | class A_M33F : public ::MeshAttribute { | ||
51 | public: | ||
52 | std::vector<M33F> _0; | ||
53 | A_M33F() { tag = tag::A_M33F; } | ||
54 | }; | ||
55 | class A_M44F : public ::MeshAttribute { | ||
56 | public: | ||
57 | std::vector<M44F> _0; | ||
58 | A_M44F() { tag = tag::A_M44F; } | ||
59 | }; | ||
60 | class A_Int : public ::MeshAttribute { | ||
61 | public: | ||
62 | std::vector<Int32> _0; | ||
63 | A_Int() { tag = tag::A_Int; } | ||
64 | }; | ||
65 | class A_Word : public ::MeshAttribute { | ||
66 | public: | ||
67 | std::vector<Word32> _0; | ||
68 | A_Word() { tag = tag::A_Word; } | ||
69 | }; | ||
70 | } | ||
71 | class MeshPrimitive { | ||
72 | public: | ||
73 | enum class tag { | ||
74 | P_Points, | ||
75 | P_TriangleStrip, | ||
76 | P_Triangles, | ||
77 | P_TriangleStripI, | ||
78 | P_TrianglesI | ||
79 | } tag; | ||
80 | }; | ||
81 | namespace data { | ||
82 | class P_TriangleStripI : public ::MeshPrimitive { | ||
83 | public: | ||
84 | std::vector<Int32> _0; | ||
85 | P_TriangleStripI() { tag = tag::P_TriangleStripI; } | ||
86 | }; | ||
87 | class P_TrianglesI : public ::MeshPrimitive { | ||
88 | public: | ||
89 | std::vector<Int32> _0; | ||
90 | P_TrianglesI() { tag = tag::P_TrianglesI; } | ||
91 | }; | ||
92 | } | ||
93 | class Mesh { | ||
94 | public: | ||
95 | enum class tag { | ||
96 | Mesh | ||
97 | } tag; | ||
98 | }; | ||
99 | namespace data { | ||
100 | class Mesh : public ::Mesh { | ||
101 | public: | ||
102 | std::map<String, std::shared_ptr<::MeshAttribute>> mAttributes; | ||
103 | std::shared_ptr<::MeshPrimitive> mPrimitive; | ||
104 | Mesh() { tag = tag::Mesh; } | ||
105 | }; | ||
106 | } | ||
107 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.Mesh2.hpp b/ddl/out/cpp/LambdaCube.Mesh2.hpp new file mode 100644 index 0000000..fac4bcc --- /dev/null +++ b/ddl/out/cpp/LambdaCube.Mesh2.hpp | |||
@@ -0,0 +1,107 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.517567000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.Mesh_H | ||
5 | #define HEADER_LambdaCube.Mesh_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | |||
10 | namespace data { | ||
11 | class A_Float { | ||
12 | public: | ||
13 | std::vector<Float> _0; | ||
14 | }; | ||
15 | class A_V2F { | ||
16 | public: | ||
17 | std::vector<V2F> _0; | ||
18 | }; | ||
19 | class A_V3F { | ||
20 | public: | ||
21 | std::vector<V3F> _0; | ||
22 | }; | ||
23 | class A_V4F { | ||
24 | public: | ||
25 | std::vector<V4F> _0; | ||
26 | }; | ||
27 | class A_M22F { | ||
28 | public: | ||
29 | std::vector<M22F> _0; | ||
30 | }; | ||
31 | class A_M33F { | ||
32 | public: | ||
33 | std::vector<M33F> _0; | ||
34 | }; | ||
35 | class A_M44F { | ||
36 | public: | ||
37 | std::vector<M44F> _0; | ||
38 | }; | ||
39 | class A_Int { | ||
40 | public: | ||
41 | std::vector<Int32> _0; | ||
42 | }; | ||
43 | class A_Word { | ||
44 | public: | ||
45 | std::vector<Word32> _0; | ||
46 | }; | ||
47 | } | ||
48 | class MeshAttribute { | ||
49 | public: | ||
50 | enum class tag { | ||
51 | A_Float, | ||
52 | A_V2F, | ||
53 | A_V3F, | ||
54 | A_V4F, | ||
55 | A_M22F, | ||
56 | A_M33F, | ||
57 | A_M44F, | ||
58 | A_Int, | ||
59 | A_Word | ||
60 | } tag; | ||
61 | std::shared_ptr<data::A_Float> A_Float; | ||
62 | std::shared_ptr<data::A_V2F> A_V2F; | ||
63 | std::shared_ptr<data::A_V3F> A_V3F; | ||
64 | std::shared_ptr<data::A_V4F> A_V4F; | ||
65 | std::shared_ptr<data::A_M22F> A_M22F; | ||
66 | std::shared_ptr<data::A_M33F> A_M33F; | ||
67 | std::shared_ptr<data::A_M44F> A_M44F; | ||
68 | std::shared_ptr<data::A_Int> A_Int; | ||
69 | std::shared_ptr<data::A_Word> A_Word; | ||
70 | }; | ||
71 | namespace data { | ||
72 | class P_TriangleStripI { | ||
73 | public: | ||
74 | std::vector<Int32> _0; | ||
75 | }; | ||
76 | class P_TrianglesI { | ||
77 | public: | ||
78 | std::vector<Int32> _0; | ||
79 | }; | ||
80 | } | ||
81 | class MeshPrimitive { | ||
82 | public: | ||
83 | enum class tag { | ||
84 | P_Points, | ||
85 | P_TriangleStrip, | ||
86 | P_Triangles, | ||
87 | P_TriangleStripI, | ||
88 | P_TrianglesI | ||
89 | } tag; | ||
90 | std::shared_ptr<data::P_TriangleStripI> P_TriangleStripI; | ||
91 | std::shared_ptr<data::P_TrianglesI> P_TrianglesI; | ||
92 | }; | ||
93 | namespace data { | ||
94 | class Mesh { | ||
95 | public: | ||
96 | std::map<String, std::shared_ptr<::MeshAttribute>> mAttributes; | ||
97 | std::shared_ptr<::MeshPrimitive> mPrimitive; | ||
98 | }; | ||
99 | } | ||
100 | class Mesh { | ||
101 | public: | ||
102 | enum class tag { | ||
103 | Mesh | ||
104 | } tag; | ||
105 | std::shared_ptr<data::Mesh> Mesh; | ||
106 | }; | ||
107 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.PipelineSchema.cpp b/ddl/out/cpp/LambdaCube.PipelineSchema.cpp new file mode 100644 index 0000000..669576a --- /dev/null +++ b/ddl/out/cpp/LambdaCube.PipelineSchema.cpp | |||
@@ -0,0 +1,208 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.470118000000Z | ||
3 | |||
4 | #include "LambdaCube.PipelineSchema.hpp" | ||
5 | template<> json toJSON<std::shared_ptr<StreamType>>(std::shared_ptr<StreamType> &v) { | ||
6 | json obj({}); | ||
7 | switch (v->tag) { | ||
8 | case ::StreamType::tag::Attribute_Word: | ||
9 | obj["tag"] = "Attribute_Word"; | ||
10 | break; | ||
11 | case ::StreamType::tag::Attribute_V2U: | ||
12 | obj["tag"] = "Attribute_V2U"; | ||
13 | break; | ||
14 | case ::StreamType::tag::Attribute_V3U: | ||
15 | obj["tag"] = "Attribute_V3U"; | ||
16 | break; | ||
17 | case ::StreamType::tag::Attribute_V4U: | ||
18 | obj["tag"] = "Attribute_V4U"; | ||
19 | break; | ||
20 | case ::StreamType::tag::Attribute_Int: | ||
21 | obj["tag"] = "Attribute_Int"; | ||
22 | break; | ||
23 | case ::StreamType::tag::Attribute_V2I: | ||
24 | obj["tag"] = "Attribute_V2I"; | ||
25 | break; | ||
26 | case ::StreamType::tag::Attribute_V3I: | ||
27 | obj["tag"] = "Attribute_V3I"; | ||
28 | break; | ||
29 | case ::StreamType::tag::Attribute_V4I: | ||
30 | obj["tag"] = "Attribute_V4I"; | ||
31 | break; | ||
32 | case ::StreamType::tag::Attribute_Float: | ||
33 | obj["tag"] = "Attribute_Float"; | ||
34 | break; | ||
35 | case ::StreamType::tag::Attribute_V2F: | ||
36 | obj["tag"] = "Attribute_V2F"; | ||
37 | break; | ||
38 | case ::StreamType::tag::Attribute_V3F: | ||
39 | obj["tag"] = "Attribute_V3F"; | ||
40 | break; | ||
41 | case ::StreamType::tag::Attribute_V4F: | ||
42 | obj["tag"] = "Attribute_V4F"; | ||
43 | break; | ||
44 | case ::StreamType::tag::Attribute_M22F: | ||
45 | obj["tag"] = "Attribute_M22F"; | ||
46 | break; | ||
47 | case ::StreamType::tag::Attribute_M23F: | ||
48 | obj["tag"] = "Attribute_M23F"; | ||
49 | break; | ||
50 | case ::StreamType::tag::Attribute_M24F: | ||
51 | obj["tag"] = "Attribute_M24F"; | ||
52 | break; | ||
53 | case ::StreamType::tag::Attribute_M32F: | ||
54 | obj["tag"] = "Attribute_M32F"; | ||
55 | break; | ||
56 | case ::StreamType::tag::Attribute_M33F: | ||
57 | obj["tag"] = "Attribute_M33F"; | ||
58 | break; | ||
59 | case ::StreamType::tag::Attribute_M34F: | ||
60 | obj["tag"] = "Attribute_M34F"; | ||
61 | break; | ||
62 | case ::StreamType::tag::Attribute_M42F: | ||
63 | obj["tag"] = "Attribute_M42F"; | ||
64 | break; | ||
65 | case ::StreamType::tag::Attribute_M43F: | ||
66 | obj["tag"] = "Attribute_M43F"; | ||
67 | break; | ||
68 | case ::StreamType::tag::Attribute_M44F: | ||
69 | obj["tag"] = "Attribute_M44F"; | ||
70 | break; | ||
71 | } | ||
72 | return obj; | ||
73 | } | ||
74 | |||
75 | template<> std::shared_ptr<StreamType> fromJSON<std::shared_ptr<StreamType>>(W<std::shared_ptr<StreamType>> v, json &obj) { | ||
76 | enum ::StreamType::tag tagType; | ||
77 | std::string tag = obj["tag"]; | ||
78 | if (tag == "Attribute_Word") { | ||
79 | tagType = ::StreamType::tag::Attribute_Word; | ||
80 | } | ||
81 | else if (tag == "Attribute_V2U") { | ||
82 | tagType = ::StreamType::tag::Attribute_V2U; | ||
83 | } | ||
84 | else if (tag == "Attribute_V3U") { | ||
85 | tagType = ::StreamType::tag::Attribute_V3U; | ||
86 | } | ||
87 | else if (tag == "Attribute_V4U") { | ||
88 | tagType = ::StreamType::tag::Attribute_V4U; | ||
89 | } | ||
90 | else if (tag == "Attribute_Int") { | ||
91 | tagType = ::StreamType::tag::Attribute_Int; | ||
92 | } | ||
93 | else if (tag == "Attribute_V2I") { | ||
94 | tagType = ::StreamType::tag::Attribute_V2I; | ||
95 | } | ||
96 | else if (tag == "Attribute_V3I") { | ||
97 | tagType = ::StreamType::tag::Attribute_V3I; | ||
98 | } | ||
99 | else if (tag == "Attribute_V4I") { | ||
100 | tagType = ::StreamType::tag::Attribute_V4I; | ||
101 | } | ||
102 | else if (tag == "Attribute_Float") { | ||
103 | tagType = ::StreamType::tag::Attribute_Float; | ||
104 | } | ||
105 | else if (tag == "Attribute_V2F") { | ||
106 | tagType = ::StreamType::tag::Attribute_V2F; | ||
107 | } | ||
108 | else if (tag == "Attribute_V3F") { | ||
109 | tagType = ::StreamType::tag::Attribute_V3F; | ||
110 | } | ||
111 | else if (tag == "Attribute_V4F") { | ||
112 | tagType = ::StreamType::tag::Attribute_V4F; | ||
113 | } | ||
114 | else if (tag == "Attribute_M22F") { | ||
115 | tagType = ::StreamType::tag::Attribute_M22F; | ||
116 | } | ||
117 | else if (tag == "Attribute_M23F") { | ||
118 | tagType = ::StreamType::tag::Attribute_M23F; | ||
119 | } | ||
120 | else if (tag == "Attribute_M24F") { | ||
121 | tagType = ::StreamType::tag::Attribute_M24F; | ||
122 | } | ||
123 | else if (tag == "Attribute_M32F") { | ||
124 | tagType = ::StreamType::tag::Attribute_M32F; | ||
125 | } | ||
126 | else if (tag == "Attribute_M33F") { | ||
127 | tagType = ::StreamType::tag::Attribute_M33F; | ||
128 | } | ||
129 | else if (tag == "Attribute_M34F") { | ||
130 | tagType = ::StreamType::tag::Attribute_M34F; | ||
131 | } | ||
132 | else if (tag == "Attribute_M42F") { | ||
133 | tagType = ::StreamType::tag::Attribute_M42F; | ||
134 | } | ||
135 | else if (tag == "Attribute_M43F") { | ||
136 | tagType = ::StreamType::tag::Attribute_M43F; | ||
137 | } | ||
138 | else if (tag == "Attribute_M44F") { | ||
139 | tagType = ::StreamType::tag::Attribute_M44F; | ||
140 | } | ||
141 | else throw "unknown constructor: " + tag; | ||
142 | std::shared_ptr<::StreamType> o(new ::StreamType()); | ||
143 | o->tag = tagType; | ||
144 | return o; | ||
145 | } | ||
146 | |||
147 | template<> json toJSON<std::shared_ptr<ObjectArraySchema>>(std::shared_ptr<ObjectArraySchema> &v) { | ||
148 | json obj({}); | ||
149 | switch (v->tag) { | ||
150 | case ::ObjectArraySchema::tag::ObjectArraySchema: | ||
151 | obj["tag"] = "ObjectArraySchema"; | ||
152 | { | ||
153 | std::shared_ptr<data::ObjectArraySchema> tv = std::static_pointer_cast<data::ObjectArraySchema>(v); | ||
154 | obj["primitive"] = toJSON(tv->primitive); | ||
155 | obj["attributes"] = toJSON(tv->attributes); | ||
156 | } | ||
157 | break; | ||
158 | } | ||
159 | return obj; | ||
160 | } | ||
161 | |||
162 | template<> std::shared_ptr<ObjectArraySchema> fromJSON<std::shared_ptr<ObjectArraySchema>>(W<std::shared_ptr<ObjectArraySchema>> v, json &obj) { | ||
163 | enum ::ObjectArraySchema::tag tagType; | ||
164 | std::string tag = obj["tag"]; | ||
165 | if (tag == "ObjectArraySchema") { | ||
166 | tagType = ::ObjectArraySchema::tag::ObjectArraySchema; | ||
167 | std::shared_ptr<data::ObjectArraySchema> tv(new data::ObjectArraySchema()); | ||
168 | tv->primitive = fromJSON(W<std::shared_ptr<::FetchPrimitive>>(), obj["primitive"]); | ||
169 | tv->attributes = fromJSON(W<std::map<String, std::shared_ptr<::StreamType>>>(), obj["attributes"]); | ||
170 | return tv; | ||
171 | } | ||
172 | else throw "unknown constructor: " + tag; | ||
173 | std::shared_ptr<::ObjectArraySchema> o(new ::ObjectArraySchema()); | ||
174 | o->tag = tagType; | ||
175 | return o; | ||
176 | } | ||
177 | |||
178 | template<> json toJSON<std::shared_ptr<PipelineSchema>>(std::shared_ptr<PipelineSchema> &v) { | ||
179 | json obj({}); | ||
180 | switch (v->tag) { | ||
181 | case ::PipelineSchema::tag::PipelineSchema: | ||
182 | obj["tag"] = "PipelineSchema"; | ||
183 | { | ||
184 | std::shared_ptr<data::PipelineSchema> tv = std::static_pointer_cast<data::PipelineSchema>(v); | ||
185 | obj["objectArrays"] = toJSON(tv->objectArrays); | ||
186 | obj["uniforms"] = toJSON(tv->uniforms); | ||
187 | } | ||
188 | break; | ||
189 | } | ||
190 | return obj; | ||
191 | } | ||
192 | |||
193 | template<> std::shared_ptr<PipelineSchema> fromJSON<std::shared_ptr<PipelineSchema>>(W<std::shared_ptr<PipelineSchema>> v, json &obj) { | ||
194 | enum ::PipelineSchema::tag tagType; | ||
195 | std::string tag = obj["tag"]; | ||
196 | if (tag == "PipelineSchema") { | ||
197 | tagType = ::PipelineSchema::tag::PipelineSchema; | ||
198 | std::shared_ptr<data::PipelineSchema> tv(new data::PipelineSchema()); | ||
199 | tv->objectArrays = fromJSON(W<std::map<String, std::shared_ptr<::ObjectArraySchema>>>(), obj["objectArrays"]); | ||
200 | tv->uniforms = fromJSON(W<std::map<String, std::shared_ptr<::InputType>>>(), obj["uniforms"]); | ||
201 | return tv; | ||
202 | } | ||
203 | else throw "unknown constructor: " + tag; | ||
204 | std::shared_ptr<::PipelineSchema> o(new ::PipelineSchema()); | ||
205 | o->tag = tagType; | ||
206 | return o; | ||
207 | } | ||
208 | |||
diff --git a/ddl/out/cpp/LambdaCube.PipelineSchema.hpp b/ddl/out/cpp/LambdaCube.PipelineSchema.hpp new file mode 100644 index 0000000..ef1d7a3 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.PipelineSchema.hpp | |||
@@ -0,0 +1,67 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.470118000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.PipelineSchema_H | ||
5 | #define HEADER_LambdaCube.PipelineSchema_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | |||
11 | class StreamType { | ||
12 | public: | ||
13 | enum class tag { | ||
14 | Attribute_Word, | ||
15 | Attribute_V2U, | ||
16 | Attribute_V3U, | ||
17 | Attribute_V4U, | ||
18 | Attribute_Int, | ||
19 | Attribute_V2I, | ||
20 | Attribute_V3I, | ||
21 | Attribute_V4I, | ||
22 | Attribute_Float, | ||
23 | Attribute_V2F, | ||
24 | Attribute_V3F, | ||
25 | Attribute_V4F, | ||
26 | Attribute_M22F, | ||
27 | Attribute_M23F, | ||
28 | Attribute_M24F, | ||
29 | Attribute_M32F, | ||
30 | Attribute_M33F, | ||
31 | Attribute_M34F, | ||
32 | Attribute_M42F, | ||
33 | Attribute_M43F, | ||
34 | Attribute_M44F | ||
35 | } tag; | ||
36 | }; | ||
37 | namespace data { | ||
38 | } | ||
39 | class ObjectArraySchema { | ||
40 | public: | ||
41 | enum class tag { | ||
42 | ObjectArraySchema | ||
43 | } tag; | ||
44 | }; | ||
45 | namespace data { | ||
46 | class ObjectArraySchema : public ::ObjectArraySchema { | ||
47 | public: | ||
48 | std::shared_ptr<::FetchPrimitive> primitive; | ||
49 | std::map<String, std::shared_ptr<::StreamType>> attributes; | ||
50 | ObjectArraySchema() { tag = tag::ObjectArraySchema; } | ||
51 | }; | ||
52 | } | ||
53 | class PipelineSchema { | ||
54 | public: | ||
55 | enum class tag { | ||
56 | PipelineSchema | ||
57 | } tag; | ||
58 | }; | ||
59 | namespace data { | ||
60 | class PipelineSchema : public ::PipelineSchema { | ||
61 | public: | ||
62 | std::map<String, std::shared_ptr<::ObjectArraySchema>> objectArrays; | ||
63 | std::map<String, std::shared_ptr<::InputType>> uniforms; | ||
64 | PipelineSchema() { tag = tag::PipelineSchema; } | ||
65 | }; | ||
66 | } | ||
67 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.PipelineSchema2.hpp b/ddl/out/cpp/LambdaCube.PipelineSchema2.hpp new file mode 100644 index 0000000..34eb9ab --- /dev/null +++ b/ddl/out/cpp/LambdaCube.PipelineSchema2.hpp | |||
@@ -0,0 +1,67 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.470118000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.PipelineSchema_H | ||
5 | #define HEADER_LambdaCube.PipelineSchema_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | |||
11 | namespace data { | ||
12 | } | ||
13 | class StreamType { | ||
14 | public: | ||
15 | enum class tag { | ||
16 | Attribute_Word, | ||
17 | Attribute_V2U, | ||
18 | Attribute_V3U, | ||
19 | Attribute_V4U, | ||
20 | Attribute_Int, | ||
21 | Attribute_V2I, | ||
22 | Attribute_V3I, | ||
23 | Attribute_V4I, | ||
24 | Attribute_Float, | ||
25 | Attribute_V2F, | ||
26 | Attribute_V3F, | ||
27 | Attribute_V4F, | ||
28 | Attribute_M22F, | ||
29 | Attribute_M23F, | ||
30 | Attribute_M24F, | ||
31 | Attribute_M32F, | ||
32 | Attribute_M33F, | ||
33 | Attribute_M34F, | ||
34 | Attribute_M42F, | ||
35 | Attribute_M43F, | ||
36 | Attribute_M44F | ||
37 | } tag; | ||
38 | }; | ||
39 | namespace data { | ||
40 | class ObjectArraySchema { | ||
41 | public: | ||
42 | std::shared_ptr<::FetchPrimitive> primitive; | ||
43 | std::map<String, std::shared_ptr<::StreamType>> attributes; | ||
44 | }; | ||
45 | } | ||
46 | class ObjectArraySchema { | ||
47 | public: | ||
48 | enum class tag { | ||
49 | ObjectArraySchema | ||
50 | } tag; | ||
51 | std::shared_ptr<data::ObjectArraySchema> ObjectArraySchema; | ||
52 | }; | ||
53 | namespace data { | ||
54 | class PipelineSchema { | ||
55 | public: | ||
56 | std::map<String, std::shared_ptr<::ObjectArraySchema>> objectArrays; | ||
57 | std::map<String, std::shared_ptr<::InputType>> uniforms; | ||
58 | }; | ||
59 | } | ||
60 | class PipelineSchema { | ||
61 | public: | ||
62 | enum class tag { | ||
63 | PipelineSchema | ||
64 | } tag; | ||
65 | std::shared_ptr<data::PipelineSchema> PipelineSchema; | ||
66 | }; | ||
67 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.TypeInfo.cpp b/ddl/out/cpp/LambdaCube.TypeInfo.cpp new file mode 100644 index 0000000..23bdb5b --- /dev/null +++ b/ddl/out/cpp/LambdaCube.TypeInfo.cpp | |||
@@ -0,0 +1,188 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.605012000000Z | ||
3 | |||
4 | #include "LambdaCube.TypeInfo.hpp" | ||
5 | template<> json toJSON<std::shared_ptr<Range>>(std::shared_ptr<Range> &v) { | ||
6 | json obj({}); | ||
7 | switch (v->tag) { | ||
8 | case ::Range::tag::Range: | ||
9 | obj["tag"] = "Range"; | ||
10 | { | ||
11 | std::shared_ptr<data::Range> tv = std::static_pointer_cast<data::Range>(v); | ||
12 | obj["startLine"] = toJSON(tv->startLine); | ||
13 | obj["startColumn"] = toJSON(tv->startColumn); | ||
14 | obj["endLine"] = toJSON(tv->endLine); | ||
15 | obj["endColumn"] = toJSON(tv->endColumn); | ||
16 | } | ||
17 | break; | ||
18 | } | ||
19 | return obj; | ||
20 | } | ||
21 | |||
22 | template<> std::shared_ptr<Range> fromJSON<std::shared_ptr<Range>>(W<std::shared_ptr<Range>> v, json &obj) { | ||
23 | enum ::Range::tag tagType; | ||
24 | std::string tag = obj["tag"]; | ||
25 | if (tag == "Range") { | ||
26 | tagType = ::Range::tag::Range; | ||
27 | std::shared_ptr<data::Range> tv(new data::Range()); | ||
28 | tv->startLine = fromJSON(W<Int>(), obj["startLine"]); | ||
29 | tv->startColumn = fromJSON(W<Int>(), obj["startColumn"]); | ||
30 | tv->endLine = fromJSON(W<Int>(), obj["endLine"]); | ||
31 | tv->endColumn = fromJSON(W<Int>(), obj["endColumn"]); | ||
32 | return tv; | ||
33 | } | ||
34 | else throw "unknown constructor: " + tag; | ||
35 | std::shared_ptr<::Range> o(new ::Range()); | ||
36 | o->tag = tagType; | ||
37 | return o; | ||
38 | } | ||
39 | |||
40 | template<> json toJSON<std::shared_ptr<TypeInfo>>(std::shared_ptr<TypeInfo> &v) { | ||
41 | json obj({}); | ||
42 | switch (v->tag) { | ||
43 | case ::TypeInfo::tag::TypeInfo: | ||
44 | obj["tag"] = "TypeInfo"; | ||
45 | { | ||
46 | std::shared_ptr<data::TypeInfo> tv = std::static_pointer_cast<data::TypeInfo>(v); | ||
47 | obj["range"] = toJSON(tv->range); | ||
48 | obj["text"] = toJSON(tv->text); | ||
49 | } | ||
50 | break; | ||
51 | } | ||
52 | return obj; | ||
53 | } | ||
54 | |||
55 | template<> std::shared_ptr<TypeInfo> fromJSON<std::shared_ptr<TypeInfo>>(W<std::shared_ptr<TypeInfo>> v, json &obj) { | ||
56 | enum ::TypeInfo::tag tagType; | ||
57 | std::string tag = obj["tag"]; | ||
58 | if (tag == "TypeInfo") { | ||
59 | tagType = ::TypeInfo::tag::TypeInfo; | ||
60 | std::shared_ptr<data::TypeInfo> tv(new data::TypeInfo()); | ||
61 | tv->range = fromJSON(W<std::shared_ptr<::Range>>(), obj["range"]); | ||
62 | tv->text = fromJSON(W<String>(), obj["text"]); | ||
63 | return tv; | ||
64 | } | ||
65 | else throw "unknown constructor: " + tag; | ||
66 | std::shared_ptr<::TypeInfo> o(new ::TypeInfo()); | ||
67 | o->tag = tagType; | ||
68 | return o; | ||
69 | } | ||
70 | |||
71 | template<> json toJSON<std::shared_ptr<WarningInfo>>(std::shared_ptr<WarningInfo> &v) { | ||
72 | json obj({}); | ||
73 | switch (v->tag) { | ||
74 | case ::WarningInfo::tag::WarningInfo: | ||
75 | obj["tag"] = "WarningInfo"; | ||
76 | { | ||
77 | std::shared_ptr<data::WarningInfo> tv = std::static_pointer_cast<data::WarningInfo>(v); | ||
78 | obj["wRange"] = toJSON(tv->wRange); | ||
79 | obj["wText"] = toJSON(tv->wText); | ||
80 | } | ||
81 | break; | ||
82 | } | ||
83 | return obj; | ||
84 | } | ||
85 | |||
86 | template<> std::shared_ptr<WarningInfo> fromJSON<std::shared_ptr<WarningInfo>>(W<std::shared_ptr<WarningInfo>> v, json &obj) { | ||
87 | enum ::WarningInfo::tag tagType; | ||
88 | std::string tag = obj["tag"]; | ||
89 | if (tag == "WarningInfo") { | ||
90 | tagType = ::WarningInfo::tag::WarningInfo; | ||
91 | std::shared_ptr<data::WarningInfo> tv(new data::WarningInfo()); | ||
92 | tv->wRange = fromJSON(W<std::shared_ptr<::Range>>(), obj["wRange"]); | ||
93 | tv->wText = fromJSON(W<String>(), obj["wText"]); | ||
94 | return tv; | ||
95 | } | ||
96 | else throw "unknown constructor: " + tag; | ||
97 | std::shared_ptr<::WarningInfo> o(new ::WarningInfo()); | ||
98 | o->tag = tagType; | ||
99 | return o; | ||
100 | } | ||
101 | |||
102 | template<> json toJSON<std::shared_ptr<ErrorInfo>>(std::shared_ptr<ErrorInfo> &v) { | ||
103 | json obj({}); | ||
104 | switch (v->tag) { | ||
105 | case ::ErrorInfo::tag::ErrorInfo: | ||
106 | obj["tag"] = "ErrorInfo"; | ||
107 | { | ||
108 | std::shared_ptr<data::ErrorInfo> tv = std::static_pointer_cast<data::ErrorInfo>(v); | ||
109 | obj["eRange"] = toJSON(tv->eRange); | ||
110 | obj["eText"] = toJSON(tv->eText); | ||
111 | } | ||
112 | break; | ||
113 | } | ||
114 | return obj; | ||
115 | } | ||
116 | |||
117 | template<> std::shared_ptr<ErrorInfo> fromJSON<std::shared_ptr<ErrorInfo>>(W<std::shared_ptr<ErrorInfo>> v, json &obj) { | ||
118 | enum ::ErrorInfo::tag tagType; | ||
119 | std::string tag = obj["tag"]; | ||
120 | if (tag == "ErrorInfo") { | ||
121 | tagType = ::ErrorInfo::tag::ErrorInfo; | ||
122 | std::shared_ptr<data::ErrorInfo> tv(new data::ErrorInfo()); | ||
123 | tv->eRange = fromJSON(W<std::shared_ptr<::Range>>(), obj["eRange"]); | ||
124 | tv->eText = fromJSON(W<String>(), obj["eText"]); | ||
125 | return tv; | ||
126 | } | ||
127 | else throw "unknown constructor: " + tag; | ||
128 | std::shared_ptr<::ErrorInfo> o(new ::ErrorInfo()); | ||
129 | o->tag = tagType; | ||
130 | return o; | ||
131 | } | ||
132 | |||
133 | template<> json toJSON<std::shared_ptr<CompileResult>>(std::shared_ptr<CompileResult> &v) { | ||
134 | json obj({}); | ||
135 | switch (v->tag) { | ||
136 | case ::CompileResult::tag::CompileError: | ||
137 | obj["tag"] = "CompileError"; | ||
138 | { | ||
139 | std::shared_ptr<data::CompileError> tv = std::static_pointer_cast<data::CompileError>(v); | ||
140 | obj["arg0"] = toJSON(tv->_0); | ||
141 | obj["arg1"] = toJSON(tv->_1); | ||
142 | obj["arg2"] = toJSON(tv->_2); | ||
143 | obj["arg3"] = toJSON(tv->_3); | ||
144 | } | ||
145 | break; | ||
146 | case ::CompileResult::tag::Compiled: | ||
147 | obj["tag"] = "Compiled"; | ||
148 | { | ||
149 | std::shared_ptr<data::Compiled> tv = std::static_pointer_cast<data::Compiled>(v); | ||
150 | obj["arg0"] = toJSON(tv->_0); | ||
151 | obj["arg1"] = toJSON(tv->_1); | ||
152 | obj["arg2"] = toJSON(tv->_2); | ||
153 | obj["arg3"] = toJSON(tv->_3); | ||
154 | obj["arg4"] = toJSON(tv->_4); | ||
155 | } | ||
156 | break; | ||
157 | } | ||
158 | return obj; | ||
159 | } | ||
160 | |||
161 | template<> std::shared_ptr<CompileResult> fromJSON<std::shared_ptr<CompileResult>>(W<std::shared_ptr<CompileResult>> v, json &obj) { | ||
162 | enum ::CompileResult::tag tagType; | ||
163 | std::string tag = obj["tag"]; | ||
164 | if (tag == "CompileError") { | ||
165 | tagType = ::CompileResult::tag::CompileError; | ||
166 | std::shared_ptr<data::CompileError> tv(new data::CompileError()); | ||
167 | tv->_0 = fromJSON(W<String>(), obj["arg0"]); | ||
168 | tv->_1 = fromJSON(W<std::vector<std::shared_ptr<::TypeInfo>>>(), obj["arg1"]); | ||
169 | tv->_2 = fromJSON(W<std::vector<std::shared_ptr<::WarningInfo>>>(), obj["arg2"]); | ||
170 | tv->_3 = fromJSON(W<std::vector<std::shared_ptr<::ErrorInfo>>>(), obj["arg3"]); | ||
171 | return tv; | ||
172 | } | ||
173 | else if (tag == "Compiled") { | ||
174 | tagType = ::CompileResult::tag::Compiled; | ||
175 | std::shared_ptr<data::Compiled> tv(new data::Compiled()); | ||
176 | tv->_0 = fromJSON(W<String>(), obj["arg0"]); | ||
177 | tv->_1 = fromJSON(W<String>(), obj["arg1"]); | ||
178 | tv->_2 = fromJSON(W<std::shared_ptr<::Pipeline>>(), obj["arg2"]); | ||
179 | tv->_3 = fromJSON(W<std::vector<std::shared_ptr<::TypeInfo>>>(), obj["arg3"]); | ||
180 | tv->_4 = fromJSON(W<std::vector<std::shared_ptr<::WarningInfo>>>(), obj["arg4"]); | ||
181 | return tv; | ||
182 | } | ||
183 | else throw "unknown constructor: " + tag; | ||
184 | std::shared_ptr<::CompileResult> o(new ::CompileResult()); | ||
185 | o->tag = tagType; | ||
186 | return o; | ||
187 | } | ||
188 | |||
diff --git a/ddl/out/cpp/LambdaCube.TypeInfo.hpp b/ddl/out/cpp/LambdaCube.TypeInfo.hpp new file mode 100644 index 0000000..8b5e74f --- /dev/null +++ b/ddl/out/cpp/LambdaCube.TypeInfo.hpp | |||
@@ -0,0 +1,95 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.605012000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.TypeInfo_H | ||
5 | #define HEADER_LambdaCube.TypeInfo_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | |||
11 | class Range { | ||
12 | public: | ||
13 | enum class tag { | ||
14 | Range | ||
15 | } tag; | ||
16 | }; | ||
17 | namespace data { | ||
18 | class Range : public ::Range { | ||
19 | public: | ||
20 | Int startLine; | ||
21 | Int startColumn; | ||
22 | Int endLine; | ||
23 | Int endColumn; | ||
24 | Range() { tag = tag::Range; } | ||
25 | }; | ||
26 | } | ||
27 | class TypeInfo { | ||
28 | public: | ||
29 | enum class tag { | ||
30 | TypeInfo | ||
31 | } tag; | ||
32 | }; | ||
33 | namespace data { | ||
34 | class TypeInfo : public ::TypeInfo { | ||
35 | public: | ||
36 | std::shared_ptr<::Range> range; | ||
37 | String text; | ||
38 | TypeInfo() { tag = tag::TypeInfo; } | ||
39 | }; | ||
40 | } | ||
41 | class WarningInfo { | ||
42 | public: | ||
43 | enum class tag { | ||
44 | WarningInfo | ||
45 | } tag; | ||
46 | }; | ||
47 | namespace data { | ||
48 | class WarningInfo : public ::WarningInfo { | ||
49 | public: | ||
50 | std::shared_ptr<::Range> wRange; | ||
51 | String wText; | ||
52 | WarningInfo() { tag = tag::WarningInfo; } | ||
53 | }; | ||
54 | } | ||
55 | class ErrorInfo { | ||
56 | public: | ||
57 | enum class tag { | ||
58 | ErrorInfo | ||
59 | } tag; | ||
60 | }; | ||
61 | namespace data { | ||
62 | class ErrorInfo : public ::ErrorInfo { | ||
63 | public: | ||
64 | std::shared_ptr<::Range> eRange; | ||
65 | String eText; | ||
66 | ErrorInfo() { tag = tag::ErrorInfo; } | ||
67 | }; | ||
68 | } | ||
69 | class CompileResult { | ||
70 | public: | ||
71 | enum class tag { | ||
72 | CompileError, | ||
73 | Compiled | ||
74 | } tag; | ||
75 | }; | ||
76 | namespace data { | ||
77 | class CompileError : public ::CompileResult { | ||
78 | public: | ||
79 | String _0; | ||
80 | std::vector<std::shared_ptr<::TypeInfo>> _1; | ||
81 | std::vector<std::shared_ptr<::WarningInfo>> _2; | ||
82 | std::vector<std::shared_ptr<::ErrorInfo>> _3; | ||
83 | CompileError() { tag = tag::CompileError; } | ||
84 | }; | ||
85 | class Compiled : public ::CompileResult { | ||
86 | public: | ||
87 | String _0; | ||
88 | String _1; | ||
89 | std::shared_ptr<::Pipeline> _2; | ||
90 | std::vector<std::shared_ptr<::TypeInfo>> _3; | ||
91 | std::vector<std::shared_ptr<::WarningInfo>> _4; | ||
92 | Compiled() { tag = tag::Compiled; } | ||
93 | }; | ||
94 | } | ||
95 | #endif | ||
diff --git a/ddl/out/cpp/LambdaCube.TypeInfo2.hpp b/ddl/out/cpp/LambdaCube.TypeInfo2.hpp new file mode 100644 index 0000000..3016e93 --- /dev/null +++ b/ddl/out/cpp/LambdaCube.TypeInfo2.hpp | |||
@@ -0,0 +1,95 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.605012000000Z | ||
3 | |||
4 | #ifndef HEADER_LambdaCube.TypeInfo_H | ||
5 | #define HEADER_LambdaCube.TypeInfo_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | |||
11 | namespace data { | ||
12 | class Range { | ||
13 | public: | ||
14 | Int startLine; | ||
15 | Int startColumn; | ||
16 | Int endLine; | ||
17 | Int endColumn; | ||
18 | }; | ||
19 | } | ||
20 | class Range { | ||
21 | public: | ||
22 | enum class tag { | ||
23 | Range | ||
24 | } tag; | ||
25 | std::shared_ptr<data::Range> Range; | ||
26 | }; | ||
27 | namespace data { | ||
28 | class TypeInfo { | ||
29 | public: | ||
30 | std::shared_ptr<::Range> range; | ||
31 | String text; | ||
32 | }; | ||
33 | } | ||
34 | class TypeInfo { | ||
35 | public: | ||
36 | enum class tag { | ||
37 | TypeInfo | ||
38 | } tag; | ||
39 | std::shared_ptr<data::TypeInfo> TypeInfo; | ||
40 | }; | ||
41 | namespace data { | ||
42 | class WarningInfo { | ||
43 | public: | ||
44 | std::shared_ptr<::Range> wRange; | ||
45 | String wText; | ||
46 | }; | ||
47 | } | ||
48 | class WarningInfo { | ||
49 | public: | ||
50 | enum class tag { | ||
51 | WarningInfo | ||
52 | } tag; | ||
53 | std::shared_ptr<data::WarningInfo> WarningInfo; | ||
54 | }; | ||
55 | namespace data { | ||
56 | class ErrorInfo { | ||
57 | public: | ||
58 | std::shared_ptr<::Range> eRange; | ||
59 | String eText; | ||
60 | }; | ||
61 | } | ||
62 | class ErrorInfo { | ||
63 | public: | ||
64 | enum class tag { | ||
65 | ErrorInfo | ||
66 | } tag; | ||
67 | std::shared_ptr<data::ErrorInfo> ErrorInfo; | ||
68 | }; | ||
69 | namespace data { | ||
70 | class CompileError { | ||
71 | public: | ||
72 | String _0; | ||
73 | std::vector<std::shared_ptr<::TypeInfo>> _1; | ||
74 | std::vector<std::shared_ptr<::WarningInfo>> _2; | ||
75 | std::vector<std::shared_ptr<::ErrorInfo>> _3; | ||
76 | }; | ||
77 | class Compiled { | ||
78 | public: | ||
79 | String _0; | ||
80 | String _1; | ||
81 | std::shared_ptr<::Pipeline> _2; | ||
82 | std::vector<std::shared_ptr<::TypeInfo>> _3; | ||
83 | std::vector<std::shared_ptr<::WarningInfo>> _4; | ||
84 | }; | ||
85 | } | ||
86 | class CompileResult { | ||
87 | public: | ||
88 | enum class tag { | ||
89 | CompileError, | ||
90 | Compiled | ||
91 | } tag; | ||
92 | std::shared_ptr<data::CompileError> CompileError; | ||
93 | std::shared_ptr<data::Compiled> Compiled; | ||
94 | }; | ||
95 | #endif | ||
diff --git a/ddl/out/cpp/TestData.cpp b/ddl/out/cpp/TestData.cpp new file mode 100644 index 0000000..466f1a7 --- /dev/null +++ b/ddl/out/cpp/TestData.cpp | |||
@@ -0,0 +1,246 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.685172000000Z | ||
3 | |||
4 | #include "TestData.hpp" | ||
5 | template<> json toJSON<std::shared_ptr<ClientInfo>>(std::shared_ptr<ClientInfo> &v) { | ||
6 | json obj({}); | ||
7 | switch (v->tag) { | ||
8 | case ::ClientInfo::tag::ClientInfo: | ||
9 | obj["tag"] = "ClientInfo"; | ||
10 | { | ||
11 | std::shared_ptr<data::ClientInfo> tv = std::static_pointer_cast<data::ClientInfo>(v); | ||
12 | obj["clientName"] = toJSON(tv->clientName); | ||
13 | obj["clientBackend"] = toJSON(tv->clientBackend); | ||
14 | } | ||
15 | break; | ||
16 | } | ||
17 | return obj; | ||
18 | } | ||
19 | |||
20 | template<> std::shared_ptr<ClientInfo> fromJSON<std::shared_ptr<ClientInfo>>(W<std::shared_ptr<ClientInfo>> v, json &obj) { | ||
21 | enum ::ClientInfo::tag tagType; | ||
22 | std::string tag = obj["tag"]; | ||
23 | if (tag == "ClientInfo") { | ||
24 | tagType = ::ClientInfo::tag::ClientInfo; | ||
25 | std::shared_ptr<data::ClientInfo> tv(new data::ClientInfo()); | ||
26 | tv->clientName = fromJSON(W<String>(), obj["clientName"]); | ||
27 | tv->clientBackend = fromJSON(W<std::shared_ptr<::Backend>>(), obj["clientBackend"]); | ||
28 | return tv; | ||
29 | } | ||
30 | else throw "unknown constructor: " + tag; | ||
31 | std::shared_ptr<::ClientInfo> o(new ::ClientInfo()); | ||
32 | o->tag = tagType; | ||
33 | return o; | ||
34 | } | ||
35 | |||
36 | template<> json toJSON<std::shared_ptr<Frame>>(std::shared_ptr<Frame> &v) { | ||
37 | json obj({}); | ||
38 | switch (v->tag) { | ||
39 | case ::Frame::tag::Frame: | ||
40 | obj["tag"] = "Frame"; | ||
41 | { | ||
42 | std::shared_ptr<data::Frame> tv = std::static_pointer_cast<data::Frame>(v); | ||
43 | obj["renderCount"] = toJSON(tv->renderCount); | ||
44 | obj["frameUniforms"] = toJSON(tv->frameUniforms); | ||
45 | obj["frameTextures"] = toJSON(tv->frameTextures); | ||
46 | } | ||
47 | break; | ||
48 | } | ||
49 | return obj; | ||
50 | } | ||
51 | |||
52 | template<> std::shared_ptr<Frame> fromJSON<std::shared_ptr<Frame>>(W<std::shared_ptr<Frame>> v, json &obj) { | ||
53 | enum ::Frame::tag tagType; | ||
54 | std::string tag = obj["tag"]; | ||
55 | if (tag == "Frame") { | ||
56 | tagType = ::Frame::tag::Frame; | ||
57 | std::shared_ptr<data::Frame> tv(new data::Frame()); | ||
58 | tv->renderCount = fromJSON(W<Int>(), obj["renderCount"]); | ||
59 | tv->frameUniforms = fromJSON(W<std::map<String, std::shared_ptr<::Value>>>(), obj["frameUniforms"]); | ||
60 | tv->frameTextures = fromJSON(W<std::map<String, Int>>(), obj["frameTextures"]); | ||
61 | return tv; | ||
62 | } | ||
63 | else throw "unknown constructor: " + tag; | ||
64 | std::shared_ptr<::Frame> o(new ::Frame()); | ||
65 | o->tag = tagType; | ||
66 | return o; | ||
67 | } | ||
68 | |||
69 | template<> json toJSON<std::shared_ptr<Scene>>(std::shared_ptr<Scene> &v) { | ||
70 | json obj({}); | ||
71 | switch (v->tag) { | ||
72 | case ::Scene::tag::Scene: | ||
73 | obj["tag"] = "Scene"; | ||
74 | { | ||
75 | std::shared_ptr<data::Scene> tv = std::static_pointer_cast<data::Scene>(v); | ||
76 | obj["objectArrays"] = toJSON(tv->objectArrays); | ||
77 | obj["renderTargetWidth"] = toJSON(tv->renderTargetWidth); | ||
78 | obj["renderTargetHeight"] = toJSON(tv->renderTargetHeight); | ||
79 | obj["frames"] = toJSON(tv->frames); | ||
80 | } | ||
81 | break; | ||
82 | } | ||
83 | return obj; | ||
84 | } | ||
85 | |||
86 | template<> std::shared_ptr<Scene> fromJSON<std::shared_ptr<Scene>>(W<std::shared_ptr<Scene>> v, json &obj) { | ||
87 | enum ::Scene::tag tagType; | ||
88 | std::string tag = obj["tag"]; | ||
89 | if (tag == "Scene") { | ||
90 | tagType = ::Scene::tag::Scene; | ||
91 | std::shared_ptr<data::Scene> tv(new data::Scene()); | ||
92 | tv->objectArrays = fromJSON(W<std::map<String, std::vector<Int>>>(), obj["objectArrays"]); | ||
93 | tv->renderTargetWidth = fromJSON(W<Int>(), obj["renderTargetWidth"]); | ||
94 | tv->renderTargetHeight = fromJSON(W<Int>(), obj["renderTargetHeight"]); | ||
95 | tv->frames = fromJSON(W<std::vector<std::shared_ptr<::Frame>>>(), obj["frames"]); | ||
96 | return tv; | ||
97 | } | ||
98 | else throw "unknown constructor: " + tag; | ||
99 | std::shared_ptr<::Scene> o(new ::Scene()); | ||
100 | o->tag = tagType; | ||
101 | return o; | ||
102 | } | ||
103 | |||
104 | template<> json toJSON<std::shared_ptr<PipelineInfo>>(std::shared_ptr<PipelineInfo> &v) { | ||
105 | json obj({}); | ||
106 | switch (v->tag) { | ||
107 | case ::PipelineInfo::tag::PipelineInfo: | ||
108 | obj["tag"] = "PipelineInfo"; | ||
109 | { | ||
110 | std::shared_ptr<data::PipelineInfo> tv = std::static_pointer_cast<data::PipelineInfo>(v); | ||
111 | obj["pipelineName"] = toJSON(tv->pipelineName); | ||
112 | obj["pipeline"] = toJSON(tv->pipeline); | ||
113 | } | ||
114 | break; | ||
115 | } | ||
116 | return obj; | ||
117 | } | ||
118 | |||
119 | template<> std::shared_ptr<PipelineInfo> fromJSON<std::shared_ptr<PipelineInfo>>(W<std::shared_ptr<PipelineInfo>> v, json &obj) { | ||
120 | enum ::PipelineInfo::tag tagType; | ||
121 | std::string tag = obj["tag"]; | ||
122 | if (tag == "PipelineInfo") { | ||
123 | tagType = ::PipelineInfo::tag::PipelineInfo; | ||
124 | std::shared_ptr<data::PipelineInfo> tv(new data::PipelineInfo()); | ||
125 | tv->pipelineName = fromJSON(W<String>(), obj["pipelineName"]); | ||
126 | tv->pipeline = fromJSON(W<std::shared_ptr<::Pipeline>>(), obj["pipeline"]); | ||
127 | return tv; | ||
128 | } | ||
129 | else throw "unknown constructor: " + tag; | ||
130 | std::shared_ptr<::PipelineInfo> o(new ::PipelineInfo()); | ||
131 | o->tag = tagType; | ||
132 | return o; | ||
133 | } | ||
134 | |||
135 | template<> json toJSON<std::shared_ptr<RenderJob>>(std::shared_ptr<RenderJob> &v) { | ||
136 | json obj({}); | ||
137 | switch (v->tag) { | ||
138 | case ::RenderJob::tag::RenderJob: | ||
139 | obj["tag"] = "RenderJob"; | ||
140 | { | ||
141 | std::shared_ptr<data::RenderJob> tv = std::static_pointer_cast<data::RenderJob>(v); | ||
142 | obj["meshes"] = toJSON(tv->meshes); | ||
143 | obj["textures"] = toJSON(tv->textures); | ||
144 | obj["schema"] = toJSON(tv->schema); | ||
145 | obj["scenes"] = toJSON(tv->scenes); | ||
146 | obj["pipelines"] = toJSON(tv->pipelines); | ||
147 | } | ||
148 | break; | ||
149 | } | ||
150 | return obj; | ||
151 | } | ||
152 | |||
153 | template<> std::shared_ptr<RenderJob> fromJSON<std::shared_ptr<RenderJob>>(W<std::shared_ptr<RenderJob>> v, json &obj) { | ||
154 | enum ::RenderJob::tag tagType; | ||
155 | std::string tag = obj["tag"]; | ||
156 | if (tag == "RenderJob") { | ||
157 | tagType = ::RenderJob::tag::RenderJob; | ||
158 | std::shared_ptr<data::RenderJob> tv(new data::RenderJob()); | ||
159 | tv->meshes = fromJSON(W<std::vector<std::shared_ptr<::Mesh>>>(), obj["meshes"]); | ||
160 | tv->textures = fromJSON(W<std::vector<String>>(), obj["textures"]); | ||
161 | tv->schema = fromJSON(W<std::shared_ptr<::PipelineSchema>>(), obj["schema"]); | ||
162 | tv->scenes = fromJSON(W<std::vector<std::shared_ptr<::Scene>>>(), obj["scenes"]); | ||
163 | tv->pipelines = fromJSON(W<std::vector<std::shared_ptr<::PipelineInfo>>>(), obj["pipelines"]); | ||
164 | return tv; | ||
165 | } | ||
166 | else throw "unknown constructor: " + tag; | ||
167 | std::shared_ptr<::RenderJob> o(new ::RenderJob()); | ||
168 | o->tag = tagType; | ||
169 | return o; | ||
170 | } | ||
171 | |||
172 | template<> json toJSON<std::shared_ptr<FrameResult>>(std::shared_ptr<FrameResult> &v) { | ||
173 | json obj({}); | ||
174 | switch (v->tag) { | ||
175 | case ::FrameResult::tag::FrameResult: | ||
176 | obj["tag"] = "FrameResult"; | ||
177 | { | ||
178 | std::shared_ptr<data::FrameResult> tv = std::static_pointer_cast<data::FrameResult>(v); | ||
179 | obj["frRenderTimes"] = toJSON(tv->frRenderTimes); | ||
180 | obj["frImageWidth"] = toJSON(tv->frImageWidth); | ||
181 | obj["frImageHeight"] = toJSON(tv->frImageHeight); | ||
182 | } | ||
183 | break; | ||
184 | } | ||
185 | return obj; | ||
186 | } | ||
187 | |||
188 | template<> std::shared_ptr<FrameResult> fromJSON<std::shared_ptr<FrameResult>>(W<std::shared_ptr<FrameResult>> v, json &obj) { | ||
189 | enum ::FrameResult::tag tagType; | ||
190 | std::string tag = obj["tag"]; | ||
191 | if (tag == "FrameResult") { | ||
192 | tagType = ::FrameResult::tag::FrameResult; | ||
193 | std::shared_ptr<data::FrameResult> tv(new data::FrameResult()); | ||
194 | tv->frRenderTimes = fromJSON(W<std::vector<Float>>(), obj["frRenderTimes"]); | ||
195 | tv->frImageWidth = fromJSON(W<Int>(), obj["frImageWidth"]); | ||
196 | tv->frImageHeight = fromJSON(W<Int>(), obj["frImageHeight"]); | ||
197 | return tv; | ||
198 | } | ||
199 | else throw "unknown constructor: " + tag; | ||
200 | std::shared_ptr<::FrameResult> o(new ::FrameResult()); | ||
201 | o->tag = tagType; | ||
202 | return o; | ||
203 | } | ||
204 | |||
205 | template<> json toJSON<std::shared_ptr<RenderJobResult>>(std::shared_ptr<RenderJobResult> &v) { | ||
206 | json obj({}); | ||
207 | switch (v->tag) { | ||
208 | case ::RenderJobResult::tag::RenderJobResult: | ||
209 | obj["tag"] = "RenderJobResult"; | ||
210 | { | ||
211 | std::shared_ptr<data::RenderJobResult> tv = std::static_pointer_cast<data::RenderJobResult>(v); | ||
212 | obj["arg0"] = toJSON(tv->_0); | ||
213 | } | ||
214 | break; | ||
215 | case ::RenderJobResult::tag::RenderJobError: | ||
216 | obj["tag"] = "RenderJobError"; | ||
217 | { | ||
218 | std::shared_ptr<data::RenderJobError> tv = std::static_pointer_cast<data::RenderJobError>(v); | ||
219 | obj["arg0"] = toJSON(tv->_0); | ||
220 | } | ||
221 | break; | ||
222 | } | ||
223 | return obj; | ||
224 | } | ||
225 | |||
226 | template<> std::shared_ptr<RenderJobResult> fromJSON<std::shared_ptr<RenderJobResult>>(W<std::shared_ptr<RenderJobResult>> v, json &obj) { | ||
227 | enum ::RenderJobResult::tag tagType; | ||
228 | std::string tag = obj["tag"]; | ||
229 | if (tag == "RenderJobResult") { | ||
230 | tagType = ::RenderJobResult::tag::RenderJobResult; | ||
231 | std::shared_ptr<data::RenderJobResult> tv(new data::RenderJobResult()); | ||
232 | tv->_0 = fromJSON(W<std::shared_ptr<::FrameResult>>(), obj["arg0"]); | ||
233 | return tv; | ||
234 | } | ||
235 | else if (tag == "RenderJobError") { | ||
236 | tagType = ::RenderJobResult::tag::RenderJobError; | ||
237 | std::shared_ptr<data::RenderJobError> tv(new data::RenderJobError()); | ||
238 | tv->_0 = fromJSON(W<String>(), obj["arg0"]); | ||
239 | return tv; | ||
240 | } | ||
241 | else throw "unknown constructor: " + tag; | ||
242 | std::shared_ptr<::RenderJobResult> o(new ::RenderJobResult()); | ||
243 | o->tag = tagType; | ||
244 | return o; | ||
245 | } | ||
246 | |||
diff --git a/ddl/out/cpp/TestData.hpp b/ddl/out/cpp/TestData.hpp new file mode 100644 index 0000000..60d401f --- /dev/null +++ b/ddl/out/cpp/TestData.hpp | |||
@@ -0,0 +1,123 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.685172000000Z | ||
3 | |||
4 | #ifndef HEADER_TestData_H | ||
5 | #define HEADER_TestData_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | #include "LambdaCube.Mesh.hpp" | ||
11 | #include "LambdaCube.PipelineSchema.hpp" | ||
12 | |||
13 | class ClientInfo { | ||
14 | public: | ||
15 | enum class tag { | ||
16 | ClientInfo | ||
17 | } tag; | ||
18 | }; | ||
19 | namespace data { | ||
20 | class ClientInfo : public ::ClientInfo { | ||
21 | public: | ||
22 | String clientName; | ||
23 | std::shared_ptr<::Backend> clientBackend; | ||
24 | ClientInfo() { tag = tag::ClientInfo; } | ||
25 | }; | ||
26 | } | ||
27 | class Frame { | ||
28 | public: | ||
29 | enum class tag { | ||
30 | Frame | ||
31 | } tag; | ||
32 | }; | ||
33 | namespace data { | ||
34 | class Frame : public ::Frame { | ||
35 | public: | ||
36 | Int renderCount; | ||
37 | std::map<String, std::shared_ptr<::Value>> frameUniforms; | ||
38 | std::map<String, Int> frameTextures; | ||
39 | Frame() { tag = tag::Frame; } | ||
40 | }; | ||
41 | } | ||
42 | class Scene { | ||
43 | public: | ||
44 | enum class tag { | ||
45 | Scene | ||
46 | } tag; | ||
47 | }; | ||
48 | namespace data { | ||
49 | class Scene : public ::Scene { | ||
50 | public: | ||
51 | std::map<String, std::vector<Int>> objectArrays; | ||
52 | Int renderTargetWidth; | ||
53 | Int renderTargetHeight; | ||
54 | std::vector<std::shared_ptr<::Frame>> frames; | ||
55 | Scene() { tag = tag::Scene; } | ||
56 | }; | ||
57 | } | ||
58 | class PipelineInfo { | ||
59 | public: | ||
60 | enum class tag { | ||
61 | PipelineInfo | ||
62 | } tag; | ||
63 | }; | ||
64 | namespace data { | ||
65 | class PipelineInfo : public ::PipelineInfo { | ||
66 | public: | ||
67 | String pipelineName; | ||
68 | std::shared_ptr<::Pipeline> pipeline; | ||
69 | PipelineInfo() { tag = tag::PipelineInfo; } | ||
70 | }; | ||
71 | } | ||
72 | class RenderJob { | ||
73 | public: | ||
74 | enum class tag { | ||
75 | RenderJob | ||
76 | } tag; | ||
77 | }; | ||
78 | namespace data { | ||
79 | class RenderJob : public ::RenderJob { | ||
80 | public: | ||
81 | std::vector<std::shared_ptr<::Mesh>> meshes; | ||
82 | std::vector<String> textures; | ||
83 | std::shared_ptr<::PipelineSchema> schema; | ||
84 | std::vector<std::shared_ptr<::Scene>> scenes; | ||
85 | std::vector<std::shared_ptr<::PipelineInfo>> pipelines; | ||
86 | RenderJob() { tag = tag::RenderJob; } | ||
87 | }; | ||
88 | } | ||
89 | class FrameResult { | ||
90 | public: | ||
91 | enum class tag { | ||
92 | FrameResult | ||
93 | } tag; | ||
94 | }; | ||
95 | namespace data { | ||
96 | class FrameResult : public ::FrameResult { | ||
97 | public: | ||
98 | std::vector<Float> frRenderTimes; | ||
99 | Int frImageWidth; | ||
100 | Int frImageHeight; | ||
101 | FrameResult() { tag = tag::FrameResult; } | ||
102 | }; | ||
103 | } | ||
104 | class RenderJobResult { | ||
105 | public: | ||
106 | enum class tag { | ||
107 | RenderJobResult, | ||
108 | RenderJobError | ||
109 | } tag; | ||
110 | }; | ||
111 | namespace data { | ||
112 | class RenderJobResult : public ::RenderJobResult { | ||
113 | public: | ||
114 | std::shared_ptr<::FrameResult> _0; | ||
115 | RenderJobResult() { tag = tag::RenderJobResult; } | ||
116 | }; | ||
117 | class RenderJobError : public ::RenderJobResult { | ||
118 | public: | ||
119 | String _0; | ||
120 | RenderJobError() { tag = tag::RenderJobError; } | ||
121 | }; | ||
122 | } | ||
123 | #endif | ||
diff --git a/ddl/out/cpp/TestData2.hpp b/ddl/out/cpp/TestData2.hpp new file mode 100644 index 0000000..80acbba --- /dev/null +++ b/ddl/out/cpp/TestData2.hpp | |||
@@ -0,0 +1,123 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-11-11T11:17:03.685172000000Z | ||
3 | |||
4 | #ifndef HEADER_TestData_H | ||
5 | #define HEADER_TestData_H | ||
6 | |||
7 | #include "RT.hpp" | ||
8 | |||
9 | #include "LambdaCube.IR.hpp" | ||
10 | #include "LambdaCube.Mesh.hpp" | ||
11 | #include "LambdaCube.PipelineSchema.hpp" | ||
12 | |||
13 | namespace data { | ||
14 | class ClientInfo { | ||
15 | public: | ||
16 | String clientName; | ||
17 | std::shared_ptr<::Backend> clientBackend; | ||
18 | }; | ||
19 | } | ||
20 | class ClientInfo { | ||
21 | public: | ||
22 | enum class tag { | ||
23 | ClientInfo | ||
24 | } tag; | ||
25 | std::shared_ptr<data::ClientInfo> ClientInfo; | ||
26 | }; | ||
27 | namespace data { | ||
28 | class Frame { | ||
29 | public: | ||
30 | Int renderCount; | ||
31 | std::map<String, std::shared_ptr<::Value>> frameUniforms; | ||
32 | std::map<String, Int> frameTextures; | ||
33 | }; | ||
34 | } | ||
35 | class Frame { | ||
36 | public: | ||
37 | enum class tag { | ||
38 | Frame | ||
39 | } tag; | ||
40 | std::shared_ptr<data::Frame> Frame; | ||
41 | }; | ||
42 | namespace data { | ||
43 | class Scene { | ||
44 | public: | ||
45 | std::map<String, std::vector<Int>> objectArrays; | ||
46 | Int renderTargetWidth; | ||
47 | Int renderTargetHeight; | ||
48 | std::vector<std::shared_ptr<::Frame>> frames; | ||
49 | }; | ||
50 | } | ||
51 | class Scene { | ||
52 | public: | ||
53 | enum class tag { | ||
54 | Scene | ||
55 | } tag; | ||
56 | std::shared_ptr<data::Scene> Scene; | ||
57 | }; | ||
58 | namespace data { | ||
59 | class PipelineInfo { | ||
60 | public: | ||
61 | String pipelineName; | ||
62 | std::shared_ptr<::Pipeline> pipeline; | ||
63 | }; | ||
64 | } | ||
65 | class PipelineInfo { | ||
66 | public: | ||
67 | enum class tag { | ||
68 | PipelineInfo | ||
69 | } tag; | ||
70 | std::shared_ptr<data::PipelineInfo> PipelineInfo; | ||
71 | }; | ||
72 | namespace data { | ||
73 | class RenderJob { | ||
74 | public: | ||
75 | std::vector<std::shared_ptr<::Mesh>> meshes; | ||
76 | std::vector<String> textures; | ||
77 | std::shared_ptr<::PipelineSchema> schema; | ||
78 | std::vector<std::shared_ptr<::Scene>> scenes; | ||
79 | std::vector<std::shared_ptr<::PipelineInfo>> pipelines; | ||
80 | }; | ||
81 | } | ||
82 | class RenderJob { | ||
83 | public: | ||
84 | enum class tag { | ||
85 | RenderJob | ||
86 | } tag; | ||
87 | std::shared_ptr<data::RenderJob> RenderJob; | ||
88 | }; | ||
89 | namespace data { | ||
90 | class FrameResult { | ||
91 | public: | ||
92 | std::vector<Float> frRenderTimes; | ||
93 | Int frImageWidth; | ||
94 | Int frImageHeight; | ||
95 | }; | ||
96 | } | ||
97 | class FrameResult { | ||
98 | public: | ||
99 | enum class tag { | ||
100 | FrameResult | ||
101 | } tag; | ||
102 | std::shared_ptr<data::FrameResult> FrameResult; | ||
103 | }; | ||
104 | namespace data { | ||
105 | class RenderJobResult { | ||
106 | public: | ||
107 | std::shared_ptr<::FrameResult> _0; | ||
108 | }; | ||
109 | class RenderJobError { | ||
110 | public: | ||
111 | String _0; | ||
112 | }; | ||
113 | } | ||
114 | class RenderJobResult { | ||
115 | public: | ||
116 | enum class tag { | ||
117 | RenderJobResult, | ||
118 | RenderJobError | ||
119 | } tag; | ||
120 | std::shared_ptr<data::RenderJobResult> RenderJobResult; | ||
121 | std::shared_ptr<data::RenderJobError> RenderJobError; | ||
122 | }; | ||
123 | #endif | ||