summaryrefslogtreecommitdiff
path: root/lib/RT.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/RT.hpp')
-rw-r--r--lib/RT.hpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/lib/RT.hpp b/lib/RT.hpp
index 8ecd47a..569ebf2 100644
--- a/lib/RT.hpp
+++ b/lib/RT.hpp
@@ -17,10 +17,72 @@ typedef float Float;
17typedef bool Bool; 17typedef bool Bool;
18typedef std::string String; 18typedef std::string String;
19 19
20template<typename T1>
21struct Maybe
22{
23 T1 data;
24 bool valid;
25};
26
27template<typename T>
28struct V2 { T x,y; };
29
30template<typename T>
31struct V3 { T x,y,z; };
32
33template<typename T>
34struct V4 { T x,y,z,w; };
35
36typedef struct V2<Int> V2I;
37typedef struct V2<Word> V2U;
38typedef struct V2<Float> V2F;
39typedef struct V2<Bool> V2B;
40
41typedef struct V3<Int> V3I;
42typedef struct V3<Word> V3U;
43typedef struct V3<Float> V3F;
44typedef struct V3<Bool> V3B;
45
46typedef struct V4<Int> V4I;
47typedef struct V4<Word> V4U;
48typedef struct V4<Float> V4F;
49typedef struct V4<Bool> V4B;
50
51typedef struct V2<V2F> M22F;
52typedef struct V2<V3F> M32F;
53typedef struct V2<V4F> M42F;
54typedef struct V3<V2F> M23F;
55typedef struct V3<V3F> M33F;
56typedef struct V3<V4F> M43F;
57typedef struct V4<V2F> M24F;
58typedef struct V4<V3F> M34F;
59typedef struct V4<V4F> M44F;
60
61
20template<typename T> 62template<typename T>
21json toJSON(T &v); 63json toJSON(T &v);
22 64
23template<typename any> 65template<typename any>
66json toJSON(Maybe<any> &value) {
67 return json();
68}
69
70template<typename any>
71json toJSON(V2<any> &value) {
72 return json();
73}
74
75template<typename any>
76json toJSON(V3<any> &value) {
77 return json();
78}
79
80template<typename any>
81json toJSON(V4<any> &value) {
82 return json();
83}
84
85template<typename any>
24json toJSON(std::vector<any> &v) { 86json toJSON(std::vector<any> &v) {
25 json obj = json::array(); 87 json obj = json::array();
26 for (any i : v) { 88 for (any i : v) {
@@ -38,6 +100,30 @@ template<typename T>
38T fromJSON(T &v, json &obj); 100T fromJSON(T &v, json &obj);
39 101
40template<typename any> 102template<typename any>
103Maybe<any> fromJSON(Maybe<any> &v, json &obj) {
104 Maybe<any> a;
105 return a;
106}
107
108template<typename any>
109V2<any> fromJSON(V2<any> &v, json &obj) {
110 V2<any> a;
111 return a;
112}
113
114template<typename any>
115V3<any> fromJSON(V3<any> &v, json &obj) {
116 V3<any> a;
117 return a;
118}
119
120template<typename any>
121V4<any> fromJSON(V4<any> &v, json &obj) {
122 V4<any> a;
123 return a;
124}
125
126template<typename any>
41std::vector<any> fromJSON(std::vector<any> &v, json &obj) { 127std::vector<any> fromJSON(std::vector<any> &v, json &obj) {
42 std::vector<any> a; 128 std::vector<any> a;
43 return a; 129 return a;