Cesium for Unity 1.15.2
Loading...
Searching...
No Matches
CesiumIntMatN.cs
Go to the documentation of this file.
1using System.Diagnostics;
2using System;
3using Unity.Mathematics;
4
5namespace CesiumForUnity
6{
16 internal struct CesiumIntMat2x2
17 {
18 public CesiumMetadataComponentType componentType
19 {
20 get; private set;
21 }
22
23 // Column-major order
24 public CesiumIntVec2 c0
25 {
26 get; private set;
27 }
28 public CesiumIntVec2 c1
29 {
30 get; private set;
31 }
32
33 public CesiumIntMat2x2(CesiumIntVec2 v0, CesiumIntVec2 v1)
34 {
35 Debug.Assert(v0.componentType == v1.componentType);
36 this.componentType = v0.componentType;
37 this.c0 = v0;
38 this.c1 = v1;
39 }
40 public CesiumIntMat2x2(int2 v0, int2 v1)
41 {
42 this.componentType = CesiumMetadataComponentType.Int32;
43 this.c0 = new CesiumIntVec2(v0);
44 this.c1 = new CesiumIntVec2(v1);
45 }
46
47 public CesiumIntVec2 this[int index]
48 {
49 get
50 {
51 switch (index)
52 {
53 case 0:
54 return this.c0;
55 case 1:
56 return this.c1;
57 default:
58 throw new System.IndexOutOfRangeException();
59 }
60 }
61 }
62 }
63
73 internal struct CesiumIntMat3x3
74 {
75 public CesiumMetadataComponentType componentType
76 {
77 get; private set;
78 }
79
80 // Column-major order
81 public CesiumIntVec3 c0
82 {
83 get; private set;
84 }
85 public CesiumIntVec3 c1
86 {
87 get; private set;
88 }
89 public CesiumIntVec3 c2
90 {
91 get; private set;
92 }
93
94 public CesiumIntMat3x3(CesiumIntVec3 v0, CesiumIntVec3 v1, CesiumIntVec3 v2)
95 {
96 Debug.Assert(v0.componentType == v1.componentType && v1.componentType == v2.componentType);
97 this.componentType = v0.componentType;
98 this.c0 = v0;
99 this.c1 = v1;
100 this.c2 = v2;
101 }
102
103 public CesiumIntMat3x3(int3 v0, int3 v1, int3 v2)
104 {
105 this.componentType = CesiumMetadataComponentType.Int32;
106 this.c0 = new CesiumIntVec3(v0);
107 this.c1 = new CesiumIntVec3(v1);
108 this.c2 = new CesiumIntVec3(v2);
109 }
110
111 public CesiumIntVec3 this[int index]
112 {
113 get
114 {
115 switch (index)
116 {
117 case 0:
118 return this.c0;
119 case 1:
120 return this.c1;
121 case 2:
122 return this.c2;
123 default:
124 throw new System.IndexOutOfRangeException();
125 }
126 }
127 }
128 }
129
139 internal struct CesiumIntMat4x4
140 {
141 public CesiumMetadataComponentType componentType
142 {
143 get; private set;
144 }
145
146 // Column-major order
147 public CesiumIntVec4 c0
148 {
149 get; private set;
150 }
151 public CesiumIntVec4 c1
152 {
153 get; private set;
154 }
155 public CesiumIntVec4 c2
156 {
157 get; private set;
158 }
159 public CesiumIntVec4 c3
160 {
161 get; private set;
162 }
163
164 public CesiumIntMat4x4(CesiumIntVec4 v0, CesiumIntVec4 v1, CesiumIntVec4 v2, CesiumIntVec4 v3)
165 {
166 Debug.Assert(v0.componentType == v1.componentType && v1.componentType == v2.componentType && v2.componentType == v3.componentType);
167 this.componentType = v0.componentType;
168 this.c0 = v0;
169 this.c1 = v1;
170 this.c2 = v2;
171 this.c3 = v3;
172 }
173
174 public CesiumIntMat4x4(int4 v0, int4 v1, int4 v2, int4 v3)
175 {
176 this.componentType = CesiumMetadataComponentType.Int32;
177 this.c0 = new CesiumIntVec4(v0);
178 this.c1 = new CesiumIntVec4(v1);
179 this.c2 = new CesiumIntVec4(v2);
180 this.c3 = new CesiumIntVec4(v3);
181 }
182
183 public CesiumIntVec4 this[int index]
184 {
185 get
186 {
187 switch (index)
188 {
189 case 0:
190 return this.c0;
191 case 1:
192 return this.c1;
193 case 2:
194 return this.c2;
195 case 3:
196 return this.c3;
197 default:
198 throw new System.IndexOutOfRangeException();
199 }
200 }
201 }
202 }
203
212 internal struct CesiumUintMat2x2
213 {
214 public CesiumMetadataComponentType componentType
215 {
216 get; private set;
217 }
218
219 // Column-major order
220 public CesiumUintVec2 c0
221 {
222 get; private set;
223 }
224 public CesiumUintVec2 c1
225 {
226 get; private set;
227 }
228
229 public CesiumUintMat2x2(CesiumUintVec2 v0, CesiumUintVec2 v1)
230 {
231 Debug.Assert(v0.componentType == v1.componentType);
232 this.componentType = v0.componentType;
233 this.c0 = v0;
234 this.c1 = v1;
235 }
236
237 public CesiumUintMat2x2(uint2 v0, uint2 v1)
238 {
239 this.componentType = CesiumMetadataComponentType.Uint32;
240 this.c0 = new CesiumUintVec2(v0);
241 this.c1 = new CesiumUintVec2(v1);
242 }
243
244 public CesiumUintVec2 this[int index]
245 {
246 get
247 {
248 switch (index)
249 {
250 case 0:
251 return c0;
252 case 1:
253 return c1;
254 default:
255 throw new System.IndexOutOfRangeException();
256 }
257 }
258 }
259 }
260
269 internal struct CesiumUintMat3x3
270 {
271 public CesiumMetadataComponentType componentType
272 {
273 get; private set;
274 }
275
276 // Column-major order
277 public CesiumUintVec3 c0
278 {
279 get; private set;
280 }
281 public CesiumUintVec3 c1
282 {
283 get; private set;
284 }
285 public CesiumUintVec3 c2
286 {
287 get; private set;
288 }
289
290 public CesiumUintMat3x3(CesiumUintVec3 v0, CesiumUintVec3 v1, CesiumUintVec3 v2)
291 {
292 Debug.Assert(v0.componentType == v1.componentType && v1.componentType == v2.componentType);
293 this.componentType = v0.componentType;
294 this.c0 = v0;
295 this.c1 = v1;
296 this.c2 = v2;
297 }
298
299 public CesiumUintMat3x3(uint3 v0, uint3 v1, uint3 v2)
300 {
301 this.componentType = CesiumMetadataComponentType.Uint32;
302 this.c0 = new CesiumUintVec3(v0);
303 this.c1 = new CesiumUintVec3(v1);
304 this.c2 = new CesiumUintVec3(v2);
305 }
306
307 public CesiumUintVec3 this[int index]
308 {
309 get
310 {
311 switch (index)
312 {
313 case 0:
314 return this.c0;
315 case 1:
316 return this.c1;
317 case 2:
318 return this.c2;
319 default:
320 throw new System.IndexOutOfRangeException();
321 }
322 }
323 }
324 }
325
334 internal struct CesiumUintMat4x4
335 {
336 public CesiumMetadataComponentType componentType
337 {
338 get; private set;
339 }
340
341 // Column-major order
342 public CesiumUintVec4 c0
343 {
344 get; private set;
345 }
346 public CesiumUintVec4 c1
347 {
348 get; private set;
349 }
350 public CesiumUintVec4 c2
351 {
352 get; private set;
353 }
354 public CesiumUintVec4 c3
355 {
356 get; private set;
357 }
358
359 public CesiumUintMat4x4(CesiumUintVec4 v0, CesiumUintVec4 v1, CesiumUintVec4 v2, CesiumUintVec4 v3)
360 {
361 Debug.Assert(v0.componentType == v1.componentType && v1.componentType == v2.componentType && v2.componentType == v3.componentType);
362 this.componentType = v0.componentType;
363 this.c0 = v0;
364 this.c1 = v1;
365 this.c2 = v2;
366 this.c3 = v3;
367 }
368
369 public CesiumUintMat4x4(uint4 v0, uint4 v1, uint4 v2, uint4 v3)
370 {
371 this.componentType = CesiumMetadataComponentType.Uint32;
372 this.c0 = new CesiumUintVec4(v0);
373 this.c1 = new CesiumUintVec4(v1);
374 this.c2 = new CesiumUintVec4(v2);
375 this.c3 = new CesiumUintVec4(v3);
376 }
377
378 public CesiumUintVec4 this[int index]
379 {
380 get
381 {
382 switch (index)
383 {
384 case 0:
385 return this.c0;
386 case 1:
387 return this.c1;
388 case 2:
389 return this.c2;
390 case 3:
391 return this.c3;
392 default:
393 throw new System.IndexOutOfRangeException();
394 }
395 }
396 }
397 }
398}
CesiumMetadataComponentType
Identifies the component type of a property in EXT_structural_metadata.