diff options
Diffstat (limited to 'ddl/out/purescript/TestData.purs')
-rw-r--r-- | ddl/out/purescript/TestData.purs | 246 |
1 files changed, 246 insertions, 0 deletions
diff --git a/ddl/out/purescript/TestData.purs b/ddl/out/purescript/TestData.purs new file mode 100644 index 0000000..c8af32b --- /dev/null +++ b/ddl/out/purescript/TestData.purs | |||
@@ -0,0 +1,246 @@ | |||
1 | -- generated file, do not modify! | ||
2 | -- 2016-11-12T12:49:00.081060000000Z | ||
3 | |||
4 | module TestData where | ||
5 | import Prelude | ||
6 | import Data.Generic | ||
7 | import Data.Either (Either(..)) | ||
8 | import Data.Maybe (Maybe(..)) | ||
9 | import Data.StrMap (StrMap(..)) | ||
10 | import Data.Map (Map(..)) | ||
11 | import Data.List (List(..)) | ||
12 | import LinearBase | ||
13 | |||
14 | import Data.Argonaut.Encode.Combinators ((~>), (:=)) | ||
15 | import Data.Argonaut.Decode.Combinators ((.?)) | ||
16 | import Data.Argonaut.Core (jsonEmptyObject) | ||
17 | import Data.Argonaut.Printer (printJson) | ||
18 | import Data.Argonaut.Encode (class EncodeJson, encodeJson) | ||
19 | import Data.Argonaut.Decode (class DecodeJson, decodeJson) | ||
20 | |||
21 | import LambdaCube.IR | ||
22 | import LambdaCube.Mesh | ||
23 | import LambdaCube.PipelineSchema | ||
24 | |||
25 | data ClientInfo | ||
26 | = ClientInfo | ||
27 | { clientName :: String | ||
28 | , clientBackend :: Backend | ||
29 | } | ||
30 | |||
31 | |||
32 | data Frame | ||
33 | = Frame | ||
34 | { renderCount :: Int | ||
35 | , frameUniforms :: StrMap Value | ||
36 | , frameTextures :: StrMap Int | ||
37 | } | ||
38 | |||
39 | |||
40 | data Scene | ||
41 | = Scene | ||
42 | { objectArrays :: StrMap (Array Int) | ||
43 | , renderTargetWidth :: Int | ||
44 | , renderTargetHeight :: Int | ||
45 | , frames :: Array Frame | ||
46 | } | ||
47 | |||
48 | |||
49 | data PipelineInfo | ||
50 | = PipelineInfo | ||
51 | { pipelineName :: String | ||
52 | , pipeline :: Pipeline | ||
53 | } | ||
54 | |||
55 | |||
56 | data RenderJob | ||
57 | = RenderJob | ||
58 | { meshes :: Array Mesh | ||
59 | , textures :: Array String | ||
60 | , schema :: PipelineSchema | ||
61 | , scenes :: Array Scene | ||
62 | , pipelines :: Array PipelineInfo | ||
63 | } | ||
64 | |||
65 | |||
66 | data FrameResult | ||
67 | = FrameResult | ||
68 | { frRenderTimes :: Array Float | ||
69 | , frImageWidth :: Int | ||
70 | , frImageHeight :: Int | ||
71 | } | ||
72 | |||
73 | |||
74 | data RenderJobResult | ||
75 | = RenderJobResult FrameResult | ||
76 | | RenderJobError String | ||
77 | |||
78 | |||
79 | |||
80 | instance encodeJsonClientInfo :: EncodeJson ClientInfo where | ||
81 | encodeJson v = case v of | ||
82 | ClientInfo r -> | ||
83 | "tag" := "ClientInfo" ~> | ||
84 | "clientName" := r.clientName ~> | ||
85 | "clientBackend" := r.clientBackend ~> | ||
86 | jsonEmptyObject | ||
87 | |||
88 | instance decodeJsonClientInfo :: DecodeJson ClientInfo where | ||
89 | decodeJson json = do | ||
90 | obj <- decodeJson json | ||
91 | tag <- obj .? "tag" | ||
92 | case tag of | ||
93 | "ClientInfo" -> do | ||
94 | clientName <- obj .? "clientName" | ||
95 | clientBackend <- obj .? "clientBackend" | ||
96 | pure $ ClientInfo | ||
97 | { clientName:clientName | ||
98 | , clientBackend:clientBackend | ||
99 | } | ||
100 | _ -> Left ("decodeJsonClientInfo - unknown tag: " <> tag) | ||
101 | |||
102 | instance encodeJsonFrame :: EncodeJson Frame where | ||
103 | encodeJson v = case v of | ||
104 | Frame r -> | ||
105 | "tag" := "Frame" ~> | ||
106 | "renderCount" := r.renderCount ~> | ||
107 | "frameUniforms" := r.frameUniforms ~> | ||
108 | "frameTextures" := r.frameTextures ~> | ||
109 | jsonEmptyObject | ||
110 | |||
111 | instance decodeJsonFrame :: DecodeJson Frame where | ||
112 | decodeJson json = do | ||
113 | obj <- decodeJson json | ||
114 | tag <- obj .? "tag" | ||
115 | case tag of | ||
116 | "Frame" -> do | ||
117 | renderCount <- obj .? "renderCount" | ||
118 | frameUniforms <- obj .? "frameUniforms" | ||
119 | frameTextures <- obj .? "frameTextures" | ||
120 | pure $ Frame | ||
121 | { renderCount:renderCount | ||
122 | , frameUniforms:frameUniforms | ||
123 | , frameTextures:frameTextures | ||
124 | } | ||
125 | _ -> Left ("decodeJsonFrame - unknown tag: " <> tag) | ||
126 | |||
127 | instance encodeJsonScene :: EncodeJson Scene where | ||
128 | encodeJson v = case v of | ||
129 | Scene r -> | ||
130 | "tag" := "Scene" ~> | ||
131 | "objectArrays" := r.objectArrays ~> | ||
132 | "renderTargetWidth" := r.renderTargetWidth ~> | ||
133 | "renderTargetHeight" := r.renderTargetHeight ~> | ||
134 | "frames" := r.frames ~> | ||
135 | jsonEmptyObject | ||
136 | |||
137 | instance decodeJsonScene :: DecodeJson Scene where | ||
138 | decodeJson json = do | ||
139 | obj <- decodeJson json | ||
140 | tag <- obj .? "tag" | ||
141 | case tag of | ||
142 | "Scene" -> do | ||
143 | objectArrays <- obj .? "objectArrays" | ||
144 | renderTargetWidth <- obj .? "renderTargetWidth" | ||
145 | renderTargetHeight <- obj .? "renderTargetHeight" | ||
146 | frames <- obj .? "frames" | ||
147 | pure $ Scene | ||
148 | { objectArrays:objectArrays | ||
149 | , renderTargetWidth:renderTargetWidth | ||
150 | , renderTargetHeight:renderTargetHeight | ||
151 | , frames:frames | ||
152 | } | ||
153 | _ -> Left ("decodeJsonScene - unknown tag: " <> tag) | ||
154 | |||
155 | instance encodeJsonPipelineInfo :: EncodeJson PipelineInfo where | ||
156 | encodeJson v = case v of | ||
157 | PipelineInfo r -> | ||
158 | "tag" := "PipelineInfo" ~> | ||
159 | "pipelineName" := r.pipelineName ~> | ||
160 | "pipeline" := r.pipeline ~> | ||
161 | jsonEmptyObject | ||
162 | |||
163 | instance decodeJsonPipelineInfo :: DecodeJson PipelineInfo where | ||
164 | decodeJson json = do | ||
165 | obj <- decodeJson json | ||
166 | tag <- obj .? "tag" | ||
167 | case tag of | ||
168 | "PipelineInfo" -> do | ||
169 | pipelineName <- obj .? "pipelineName" | ||
170 | pipeline <- obj .? "pipeline" | ||
171 | pure $ PipelineInfo | ||
172 | { pipelineName:pipelineName | ||
173 | , pipeline:pipeline | ||
174 | } | ||
175 | _ -> Left ("decodeJsonPipelineInfo - unknown tag: " <> tag) | ||
176 | |||
177 | instance encodeJsonRenderJob :: EncodeJson RenderJob where | ||
178 | encodeJson v = case v of | ||
179 | RenderJob r -> | ||
180 | "tag" := "RenderJob" ~> | ||
181 | "meshes" := r.meshes ~> | ||
182 | "textures" := r.textures ~> | ||
183 | "schema" := r.schema ~> | ||
184 | "scenes" := r.scenes ~> | ||
185 | "pipelines" := r.pipelines ~> | ||
186 | jsonEmptyObject | ||
187 | |||
188 | instance decodeJsonRenderJob :: DecodeJson RenderJob where | ||
189 | decodeJson json = do | ||
190 | obj <- decodeJson json | ||
191 | tag <- obj .? "tag" | ||
192 | case tag of | ||
193 | "RenderJob" -> do | ||
194 | meshes <- obj .? "meshes" | ||
195 | textures <- obj .? "textures" | ||
196 | schema <- obj .? "schema" | ||
197 | scenes <- obj .? "scenes" | ||
198 | pipelines <- obj .? "pipelines" | ||
199 | pure $ RenderJob | ||
200 | { meshes:meshes | ||
201 | , textures:textures | ||
202 | , schema:schema | ||
203 | , scenes:scenes | ||
204 | , pipelines:pipelines | ||
205 | } | ||
206 | _ -> Left ("decodeJsonRenderJob - unknown tag: " <> tag) | ||
207 | |||
208 | instance encodeJsonFrameResult :: EncodeJson FrameResult where | ||
209 | encodeJson v = case v of | ||
210 | FrameResult r -> | ||
211 | "tag" := "FrameResult" ~> | ||
212 | "frRenderTimes" := r.frRenderTimes ~> | ||
213 | "frImageWidth" := r.frImageWidth ~> | ||
214 | "frImageHeight" := r.frImageHeight ~> | ||
215 | jsonEmptyObject | ||
216 | |||
217 | instance decodeJsonFrameResult :: DecodeJson FrameResult where | ||
218 | decodeJson json = do | ||
219 | obj <- decodeJson json | ||
220 | tag <- obj .? "tag" | ||
221 | case tag of | ||
222 | "FrameResult" -> do | ||
223 | frRenderTimes <- obj .? "frRenderTimes" | ||
224 | frImageWidth <- obj .? "frImageWidth" | ||
225 | frImageHeight <- obj .? "frImageHeight" | ||
226 | pure $ FrameResult | ||
227 | { frRenderTimes:frRenderTimes | ||
228 | , frImageWidth:frImageWidth | ||
229 | , frImageHeight:frImageHeight | ||
230 | } | ||
231 | _ -> Left ("decodeJsonFrameResult - unknown tag: " <> tag) | ||
232 | |||
233 | instance encodeJsonRenderJobResult :: EncodeJson RenderJobResult where | ||
234 | encodeJson v = case v of | ||
235 | RenderJobResult arg0 -> "tag" := "RenderJobResult" ~> "arg0" := arg0 ~> jsonEmptyObject | ||
236 | RenderJobError arg0 -> "tag" := "RenderJobError" ~> "arg0" := arg0 ~> jsonEmptyObject | ||
237 | |||
238 | instance decodeJsonRenderJobResult :: DecodeJson RenderJobResult where | ||
239 | decodeJson json = do | ||
240 | obj <- decodeJson json | ||
241 | tag <- obj .? "tag" | ||
242 | case tag of | ||
243 | "RenderJobResult" -> RenderJobResult <$> obj .? "arg0" | ||
244 | "RenderJobError" -> RenderJobError <$> obj .? "arg0" | ||
245 | _ -> Left ("decodeJsonRenderJobResult - unknown tag: " <> tag) | ||
246 | |||