diff options
Diffstat (limited to 'testclient/TestData.hs')
-rw-r--r-- | testclient/TestData.hs | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/testclient/TestData.hs b/testclient/TestData.hs new file mode 100644 index 0000000..a48dc42 --- /dev/null +++ b/testclient/TestData.hs | |||
@@ -0,0 +1,213 @@ | |||
1 | -- generated file, do not modify! | ||
2 | -- 2016-01-28T13:15:31.27456Z | ||
3 | |||
4 | {-# LANGUAGE OverloadedStrings, RecordWildCards #-} | ||
5 | module TestData where | ||
6 | |||
7 | import Data.Int | ||
8 | import Data.Word | ||
9 | import Data.Map | ||
10 | import Data.Vector (Vector(..)) | ||
11 | import LambdaCube.Linear | ||
12 | |||
13 | import Data.Text | ||
14 | import Data.Aeson hiding (Value,Bool) | ||
15 | import Data.Aeson.Types hiding (Value,Bool) | ||
16 | import Control.Monad | ||
17 | |||
18 | import LambdaCube.IR | ||
19 | import LambdaCube.Mesh | ||
20 | import LambdaCube.PipelineSchema | ||
21 | |||
22 | data ClientInfo | ||
23 | = ClientInfo | ||
24 | { clientName :: String | ||
25 | , clientBackend :: Backend | ||
26 | } | ||
27 | |||
28 | deriving (Show, Eq, Ord) | ||
29 | |||
30 | data Frame | ||
31 | = Frame | ||
32 | { renderCount :: Int | ||
33 | , frameUniforms :: Map String Value | ||
34 | , frameTextures :: Map String Int | ||
35 | } | ||
36 | |||
37 | deriving (Show, Eq, Ord) | ||
38 | |||
39 | data Scene | ||
40 | = Scene | ||
41 | { objectArrays :: Map String (Vector Int) | ||
42 | , renderTargetWidth :: Int | ||
43 | , renderTargetHeight :: Int | ||
44 | , frames :: Vector Frame | ||
45 | } | ||
46 | |||
47 | deriving (Show, Eq, Ord) | ||
48 | |||
49 | data RenderJob | ||
50 | = RenderJob | ||
51 | { meshes :: Vector Mesh | ||
52 | , textures :: Vector String | ||
53 | , schema :: PipelineSchema | ||
54 | , scenes :: Vector Scene | ||
55 | , pipelines :: Vector Pipeline | ||
56 | } | ||
57 | |||
58 | deriving (Show, Eq, Ord) | ||
59 | |||
60 | data FrameResult | ||
61 | = FrameResult | ||
62 | { frRenderTimes :: Vector Float | ||
63 | , frImageWidth :: Int | ||
64 | , frImageHeight :: Int | ||
65 | } | ||
66 | |||
67 | deriving (Show, Eq, Ord) | ||
68 | |||
69 | data RenderJobResult | ||
70 | = RenderJobResult FrameResult | ||
71 | | RenderJobError String | ||
72 | deriving (Show, Eq, Ord) | ||
73 | |||
74 | |||
75 | instance ToJSON ClientInfo where | ||
76 | toJSON v = case v of | ||
77 | ClientInfo{..} -> object | ||
78 | [ "tag" .= ("ClientInfo" :: Text) | ||
79 | , "clientName" .= clientName | ||
80 | , "clientBackend" .= clientBackend | ||
81 | ] | ||
82 | |||
83 | instance FromJSON ClientInfo where | ||
84 | parseJSON (Object obj) = do | ||
85 | tag <- obj .: "tag" | ||
86 | case tag :: Text of | ||
87 | "ClientInfo" -> do | ||
88 | clientName <- obj .: "clientName" | ||
89 | clientBackend <- obj .: "clientBackend" | ||
90 | pure $ ClientInfo | ||
91 | { clientName = clientName | ||
92 | , clientBackend = clientBackend | ||
93 | } | ||
94 | parseJSON _ = mzero | ||
95 | |||
96 | instance ToJSON Frame where | ||
97 | toJSON v = case v of | ||
98 | Frame{..} -> object | ||
99 | [ "tag" .= ("Frame" :: Text) | ||
100 | , "renderCount" .= renderCount | ||
101 | , "frameUniforms" .= frameUniforms | ||
102 | , "frameTextures" .= frameTextures | ||
103 | ] | ||
104 | |||
105 | instance FromJSON Frame where | ||
106 | parseJSON (Object obj) = do | ||
107 | tag <- obj .: "tag" | ||
108 | case tag :: Text of | ||
109 | "Frame" -> do | ||
110 | renderCount <- obj .: "renderCount" | ||
111 | frameUniforms <- obj .: "frameUniforms" | ||
112 | frameTextures <- obj .: "frameTextures" | ||
113 | pure $ Frame | ||
114 | { renderCount = renderCount | ||
115 | , frameUniforms = frameUniforms | ||
116 | , frameTextures = frameTextures | ||
117 | } | ||
118 | parseJSON _ = mzero | ||
119 | |||
120 | instance ToJSON Scene where | ||
121 | toJSON v = case v of | ||
122 | Scene{..} -> object | ||
123 | [ "tag" .= ("Scene" :: Text) | ||
124 | , "objectArrays" .= objectArrays | ||
125 | , "renderTargetWidth" .= renderTargetWidth | ||
126 | , "renderTargetHeight" .= renderTargetHeight | ||
127 | , "frames" .= frames | ||
128 | ] | ||
129 | |||
130 | instance FromJSON Scene where | ||
131 | parseJSON (Object obj) = do | ||
132 | tag <- obj .: "tag" | ||
133 | case tag :: Text of | ||
134 | "Scene" -> do | ||
135 | objectArrays <- obj .: "objectArrays" | ||
136 | renderTargetWidth <- obj .: "renderTargetWidth" | ||
137 | renderTargetHeight <- obj .: "renderTargetHeight" | ||
138 | frames <- obj .: "frames" | ||
139 | pure $ Scene | ||
140 | { objectArrays = objectArrays | ||
141 | , renderTargetWidth = renderTargetWidth | ||
142 | , renderTargetHeight = renderTargetHeight | ||
143 | , frames = frames | ||
144 | } | ||
145 | parseJSON _ = mzero | ||
146 | |||
147 | instance ToJSON RenderJob where | ||
148 | toJSON v = case v of | ||
149 | RenderJob{..} -> object | ||
150 | [ "tag" .= ("RenderJob" :: Text) | ||
151 | , "meshes" .= meshes | ||
152 | , "textures" .= textures | ||
153 | , "schema" .= schema | ||
154 | , "scenes" .= scenes | ||
155 | , "pipelines" .= pipelines | ||
156 | ] | ||
157 | |||
158 | instance FromJSON RenderJob where | ||
159 | parseJSON (Object obj) = do | ||
160 | tag <- obj .: "tag" | ||
161 | case tag :: Text of | ||
162 | "RenderJob" -> do | ||
163 | meshes <- obj .: "meshes" | ||
164 | textures <- obj .: "textures" | ||
165 | schema <- obj .: "schema" | ||
166 | scenes <- obj .: "scenes" | ||
167 | pipelines <- obj .: "pipelines" | ||
168 | pure $ RenderJob | ||
169 | { meshes = meshes | ||
170 | , textures = textures | ||
171 | , schema = schema | ||
172 | , scenes = scenes | ||
173 | , pipelines = pipelines | ||
174 | } | ||
175 | parseJSON _ = mzero | ||
176 | |||
177 | instance ToJSON FrameResult where | ||
178 | toJSON v = case v of | ||
179 | FrameResult{..} -> object | ||
180 | [ "tag" .= ("FrameResult" :: Text) | ||
181 | , "frRenderTimes" .= frRenderTimes | ||
182 | , "frImageWidth" .= frImageWidth | ||
183 | , "frImageHeight" .= frImageHeight | ||
184 | ] | ||
185 | |||
186 | instance FromJSON FrameResult where | ||
187 | parseJSON (Object obj) = do | ||
188 | tag <- obj .: "tag" | ||
189 | case tag :: Text of | ||
190 | "FrameResult" -> do | ||
191 | frRenderTimes <- obj .: "frRenderTimes" | ||
192 | frImageWidth <- obj .: "frImageWidth" | ||
193 | frImageHeight <- obj .: "frImageHeight" | ||
194 | pure $ FrameResult | ||
195 | { frRenderTimes = frRenderTimes | ||
196 | , frImageWidth = frImageWidth | ||
197 | , frImageHeight = frImageHeight | ||
198 | } | ||
199 | parseJSON _ = mzero | ||
200 | |||
201 | instance ToJSON RenderJobResult where | ||
202 | toJSON v = case v of | ||
203 | RenderJobResult arg0 -> object [ "tag" .= ("RenderJobResult" :: Text), "arg0" .= arg0] | ||
204 | RenderJobError arg0 -> object [ "tag" .= ("RenderJobError" :: Text), "arg0" .= arg0] | ||
205 | |||
206 | instance FromJSON RenderJobResult where | ||
207 | parseJSON (Object obj) = do | ||
208 | tag <- obj .: "tag" | ||
209 | case tag :: Text of | ||
210 | "RenderJobResult" -> RenderJobResult <$> obj .: "arg0" | ||
211 | "RenderJobError" -> RenderJobError <$> obj .: "arg0" | ||
212 | parseJSON _ = mzero | ||
213 | |||