mesa: allow variable indexing into the predefined uniform variable arrays
[mesa.git] / src / mesa / shader / slang / library / slang_120_core.gc
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 2006 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 //
26 // Constructors and operators introduced in GLSL 1.20 - mostly on new
27 // (non-square) types of matrices.
28 //
29 // One important change in the language is that when a matrix is used
30 // as an argument to a matrix constructor, it must be the only argument
31 // for the constructor. The compiler takes care of it by itself and
32 // here we only care to re-introduce constructors for old (square)
33 // types of matrices.
34 //
35
36 //
37 // From Shader Spec, ver. 1.20, rev. 6
38 //
39
40 //// mat2x3: 2 columns of vec3
41
42 mat2x3 __constructor(const float f00, const float f10, const float f20,
43 const float f01, const float f11, const float f21)
44 {
45 __retVal[0].x = f00;
46 __retVal[0].y = f10;
47 __retVal[0].z = f20;
48 __retVal[1].x = f01;
49 __retVal[1].y = f11;
50 __retVal[1].z = f21;
51 }
52
53 mat2x3 __constructor(const float f)
54 {
55 __retVal = mat2x3( f, 0.0, 0.0,
56 0.0, f, 0.0);
57 }
58
59 mat2x3 __constructor(const int i)
60 {
61 const float f = float(i);
62 __retVal = mat2x3(f);
63 }
64
65 mat2x3 __constructor(const bool b)
66 {
67 const float f = float(b);
68 __retVal = mat2x3(f);
69 }
70
71 mat2x3 __constructor(const vec3 c0, const vec3 c1)
72 {
73 __retVal[0] = c0;
74 __retVal[1] = c1;
75 }
76
77
78
79 //// mat2x4: 2 columns of vec4
80
81 mat2x4 __constructor(const float f00, const float f10, const float f20, const float f30,
82 const float f01, const float f11, const float f21, const float f31)
83 {
84 __retVal[0].x = f00;
85 __retVal[0].y = f10;
86 __retVal[0].z = f20;
87 __retVal[0].w = f30;
88 __retVal[1].x = f01;
89 __retVal[1].y = f11;
90 __retVal[1].z = f21;
91 __retVal[1].w = f31;
92 }
93
94 mat2x4 __constructor(const float f)
95 {
96 __retVal = mat2x4( f, 0.0, 0.0, 0.0,
97 0.0, f, 0.0, 0.0);
98 }
99
100 mat2x4 __constructor(const int i)
101 {
102 const float f = float(i);
103 __retVal = mat2x4(f);
104 }
105
106 mat2x4 __constructor(const bool b)
107 {
108 const float f = float(b);
109 __retVal = mat2x4(f);
110 }
111
112 mat2x4 __constructor(const vec4 c0, const vec4 c1)
113 {
114 __retVal[0] = c0;
115 __retVal[1] = c1;
116 }
117
118
119
120 //// mat3x2: 3 columns of vec2
121
122 mat3x2 __constructor(const float f00, const float f10,
123 const float f01, const float f11,
124 const float f02, const float f12)
125 {
126 __retVal[0].x = f00;
127 __retVal[0].y = f10;
128 __retVal[1].x = f01;
129 __retVal[1].y = f11;
130 __retVal[2].x = f02;
131 __retVal[2].y = f12;
132 }
133
134 mat3x2 __constructor(const float f)
135 {
136 __retVal = mat3x2( f, 0.0,
137 0.0, f,
138 0.0, 0.0);
139 }
140
141 mat3x2 __constructor(const int i)
142 {
143 const float f = float(i);
144 __retVal = mat3x2(f);
145 }
146
147 mat3x2 __constructor(const bool b)
148 {
149 const float f = float(b);
150 __retVal = mat3x2(f);
151 }
152
153 mat3x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2)
154 {
155 __retVal[0] = c0;
156 __retVal[1] = c1;
157 __retVal[2] = c2;
158 }
159
160
161
162 //// mat3x4: 3 columns of vec4
163
164 mat3x4 __constructor(const float f00, const float f10, const float f20, const float f30,
165 const float f01, const float f11, const float f21, const float f31,
166 const float f02, const float f12, const float f22, const float f32)
167 {
168 __retVal[0].x = f00;
169 __retVal[0].y = f10;
170 __retVal[0].z = f20;
171 __retVal[0].w = f30;
172 __retVal[1].x = f01;
173 __retVal[1].y = f11;
174 __retVal[1].z = f21;
175 __retVal[1].w = f31;
176 __retVal[2].x = f02;
177 __retVal[2].y = f12;
178 __retVal[2].z = f22;
179 __retVal[2].w = f32;
180 }
181
182 mat3x4 __constructor(const float f)
183 {
184 __retVal = mat3x4( f, 0.0, 0.0, 0.0,
185 0.0, f, 0.0, 0.0,
186 0.0, 0.0, f, 0.0);
187 }
188
189 mat3x4 __constructor(const int i)
190 {
191 const float f = float(i);
192 __retVal = mat3x4(f);
193 }
194
195 mat3x4 __constructor(const bool b)
196 {
197 const float f = float(b);
198 __retVal = mat3x4(f);
199 }
200
201 mat3x4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2)
202 {
203 __retVal[0] = c0;
204 __retVal[1] = c1;
205 __retVal[2] = c2;
206 }
207
208
209
210 //// mat4x2: 4 columns of vec2
211
212 mat4x2 __constructor(const float f00, const float f10,
213 const float f01, const float f11,
214 const float f02, const float f12,
215 const float f03, const float f13)
216 {
217 __retVal[0].x = f00;
218 __retVal[0].y = f10;
219 __retVal[1].x = f01;
220 __retVal[1].y = f11;
221 __retVal[2].x = f02;
222 __retVal[2].y = f12;
223 __retVal[3].x = f03;
224 __retVal[3].y = f13;
225 }
226
227 mat4x2 __constructor(const float f)
228 {
229 __retVal = mat4x2( f, 0.0,
230 0.0, 4,
231 0.0, 0.0,
232 0.0, 0.0);
233 }
234
235 mat4x2 __constructor(const int i)
236 {
237 const float f = float(i);
238 __retVal = mat4x2(f);
239 }
240
241 mat4x2 __constructor(const bool b)
242 {
243 const float f = float(b);
244 __retVal = mat4x2(f);
245 }
246
247 mat4x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2, const vec2 c3)
248 {
249 __retVal[0] = c0;
250 __retVal[1] = c1;
251 __retVal[2] = c2;
252 __retVal[3] = c3;
253 }
254
255
256
257 //// mat4x3: 4 columns of vec3
258
259 mat4x3 __constructor(const float f00, const float f10, const float f20,
260 const float f01, const float f11, const float f21,
261 const float f02, const float f12, const float f22,
262 const float f03, const float f13, const float f23)
263 {
264 __retVal[0].x = f00;
265 __retVal[0].y = f10;
266 __retVal[0].z = f20;
267 __retVal[1].x = f01;
268 __retVal[1].y = f11;
269 __retVal[1].z = f21;
270 __retVal[2].x = f02;
271 __retVal[2].y = f12;
272 __retVal[2].z = f22;
273 __retVal[3].x = f03;
274 __retVal[3].y = f13;
275 __retVal[3].z = f23;
276 }
277
278 mat4x3 __constructor(const float f)
279 {
280 __retVal = mat4x3( f, 0.0, 0.0,
281 0.0, f, 0.0,
282 0.0, 0.0, f,
283 0.0, 0.0, 0.0);
284 }
285
286 mat4x3 __constructor(const int i)
287 {
288 const float f = float(i);
289 __retVal = mat4x3(f);
290 }
291
292 mat4x3 __constructor(const bool b)
293 {
294 const float f = float(b);
295 __retVal = mat4x3(f);
296 }
297
298 mat4x3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2, const vec3 c3)
299 {
300 __retVal[0] = c0;
301 __retVal[1] = c1;
302 __retVal[2] = c2;
303 __retVal[3] = c3;
304 }
305
306
307
308 //// misc assorted matrix constructors
309
310 mat2 __constructor(const mat2 m)
311 {
312 __retVal = m;
313 }
314
315 mat2 __constructor(const mat3x2 m)
316 {
317 __retVal = mat2(m[0], m[1]);
318 }
319
320 mat2 __constructor(const mat4x2 m)
321 {
322 __retVal = mat2(m[0], m[1]);
323 }
324
325 mat2 __constructor(const mat2x3 m)
326 {
327 __retVal = mat2(m[0].xy, m[1].xy);
328 }
329
330 mat2 __constructor(const mat2x4 m)
331 {
332 __retVal = mat2(m[0].xy, m[1].xy);
333 }
334
335 mat2 __constructor(const mat3 m)
336 {
337 __retVal = mat2(m[0].xy, m[1].xy);
338 }
339
340 mat2 __constructor(const mat3x4 m)
341 {
342 __retVal = mat2(m[0].xy, m[1].xy);
343 }
344
345 mat2 __constructor(const mat4x3 m)
346 {
347 __retVal = mat2(m[0].xy, m[1].xy);
348 }
349
350 mat2 __constructor(const mat4 m)
351 {
352 __retVal = mat2(m[0].xy, m[1].xy);
353 }
354
355
356
357 mat2x3 __constructor(const mat2x3 m)
358 {
359 __retVal = m;
360 }
361
362 mat2x3 __constructor(const mat3 m)
363 {
364 __retVal = mat2x3(m[0], m[1]);
365 }
366
367 mat2x3 __constructor(const mat4x3 m)
368 {
369 __retVal = mat2x3(m[0], m[1]);
370 }
371
372 mat2x3 __constructor(const mat2x4 m)
373 {
374 __retVal = mat2x3(m[0].xyz, m[1].xyz);
375 }
376
377 mat2x3 __constructor(const mat3x4 m)
378 {
379 __retVal = mat2x3(m[0].xyz, m[1].xyz);
380 }
381
382 mat2x3 __constructor(const mat4 m)
383 {
384 __retVal = mat2x3(m[0].xyz, m[1].xyz);
385 }
386
387 mat2x3 __constructor(const mat2 m)
388 {
389 __retVal = mat2x3(m[0].x, m[0].y, 0.0,
390 m[1].x, m[1].y, 0.0);
391 }
392
393 mat2x3 __constructor(const mat3x2 m)
394 {
395 __retVal = mat2x3(m[0].x, m[0].y, 0.0,
396 m[1].x, m[1].y, 0.0);
397 }
398
399 mat2x3 __constructor(const mat4x2 m)
400 {
401 __retVal = mat2x3(m[0].x, m[0].y, 0.0,
402 m[1].x, m[1].y, 0.0);
403 }
404
405
406
407 mat2x4 __constructor(const mat2x4 m)
408 {
409 __retVal = m;
410 }
411
412 mat2x4 __constructor(const mat3x4 m)
413 {
414 __retVal = mat2x4(m[0], m[1]);
415 }
416
417 mat2x4 __constructor(const mat4 m)
418 {
419 __retVal = mat2x4(m[0], m[1]);
420 }
421
422 mat2x4 __constructor(const mat2x3 m)
423 {
424 __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,
425 m[1].x, m[1].y, m[1].z, 0.0);
426 }
427
428 mat2x4 __constructor(const mat3 m)
429 {
430 __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,
431 m[1].x, m[1].y, m[1].z, 0.0);
432 }
433
434 mat2x4 __constructor(const mat4x3 m)
435 {
436 __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,
437 m[1].x, m[1].y, m[1].z, 0.0);
438 }
439
440 mat2x4 __constructor(const mat2 m)
441 {
442 __retVal = mat2x4(m[0].x, m[1].y, 0.0, 0.0,
443 m[1].x, m[1].y, 0.0, 0.0);
444 }
445
446 mat2x4 __constructor(const mat3x2 m)
447 {
448 __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0,
449 m[1].x, m[1].y, 0.0, 0.0);
450 }
451
452 mat2x4 __constructor(const mat4x2 m)
453 {
454 __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0,
455 m[1].x, m[1].y, 0.0, 0.0);
456 }
457
458
459
460 mat3x2 __constructor(const mat3x2 m)
461 {
462 __retVal = m;
463 }
464
465 mat3x2 __constructor(const mat4x2 m)
466 {
467 __retVal = mat3x2(m[0], m[1], m[2]);
468 }
469
470 mat3x2 __constructor(const mat3 m)
471 {
472 __retVal = mat3x2(m[0], m[1], m[2]);
473 }
474
475 mat3x2 __constructor(const mat3x4 m)
476 {
477 __retVal = mat3x2(m[0].x, m[0].y,
478 m[1].x, m[1].y,
479 m[2].x, m[2].y);
480 }
481
482 mat3x2 __constructor(const mat4x3 m)
483 {
484 __retVal = mat3x2(m[0].x, m[0].y,
485 m[1].x, m[1].y,
486 m[2].x, m[2].y);
487 }
488
489 mat3x2 __constructor(const mat4 m)
490 {
491 __retVal = mat3x2(m[0].x, m[0].y,
492 m[1].x, m[1].y,
493 0.0, 0.0);
494 }
495
496 mat3x2 __constructor(const mat2 m)
497 {
498 __retVal = mat3x2(m[0], m[1], vec2(0.0));
499 }
500
501 mat3x2 __constructor(const mat2x3 m)
502 {
503 __retVal = mat3x2(m[0].x, m[0].y,
504 m[1].x, m[1].y,
505 0.0, 0.0);
506 }
507
508 mat3x2 __constructor(const mat2x4 m)
509 {
510 __retVal = mat3x2(m[0].x, m[0].y,
511 m[1].x, m[1].y,
512 0.0, 0.0);
513 }
514
515
516
517
518 mat3 __constructor(const mat3 m)
519 {
520 __retVal = m;
521 }
522
523 mat3 __constructor(const mat4x3 m)
524 {
525 __retVal = mat3 (
526 m[0],
527 m[1],
528 m[2]
529 );
530 }
531
532 mat3 __constructor(const mat3x4 m)
533 {
534 __retVal = mat3 (
535 m[0].xyz,
536 m[1].xyz,
537 m[2].xyz
538 );
539 }
540
541 mat3 __constructor(const mat4 m)
542 {
543 __retVal = mat3 (
544 m[0].xyz,
545 m[1].xyz,
546 m[2].xyz
547 );
548 }
549
550 mat3 __constructor(const mat2x3 m)
551 {
552 __retVal = mat3 (
553 m[0],
554 m[1],
555 0., 0., 1.
556 );
557 }
558
559 mat3 __constructor(const mat2x4 m)
560 {
561 __retVal = mat3 (
562 m[0].xyz,
563 m[1].xyz,
564 0., 0., 1.
565 );
566 }
567
568 mat3 __constructor(const mat3x2 m)
569 {
570 __retVal = mat3 (
571 m[0], 0.,
572 m[1], 0.,
573 m[2], 1.
574 );
575 }
576
577 mat3 __constructor(const mat4x2 m)
578 {
579 __retVal = mat3 (
580 m[0], 0.,
581 m[1], 0.,
582 m[2], 1.
583 );
584 }
585
586 mat3 __constructor(const mat2 m)
587 {
588 __retVal = mat3 (
589 m[0], 0.,
590 m[1], 0.,
591 0., 0., 1.
592 );
593 }
594
595
596 mat3x4 __constructor(const mat3x4 m)
597 {
598 __retVal = m;
599 }
600
601 mat3x4 __constructor(const mat4 m)
602 {
603 __retVal = mat3x4 (
604 m[0],
605 m[1],
606 m[2]
607 );
608 }
609
610 mat3x4 __constructor(const mat3 m)
611 {
612 __retVal = mat3x4 (
613 m[0], 0.,
614 m[1], 0.,
615 m[2], 0.
616 );
617 }
618
619 mat3x4 __constructor(const mat4x3 m)
620 {
621 __retVal = mat3x4 (
622 m[0], 0.,
623 m[1], 0.,
624 m[2], 0.
625 );
626 }
627
628 mat3x4 __constructor(const mat2x4 m)
629 {
630 __retVal = mat3x4 (
631 m[0],
632 m[1],
633 0., 0., 1., 0.
634 );
635 }
636
637 mat3x4 __constructor(const mat2x3 m)
638 {
639 __retVal = mat3x4 (
640 m[0], 0.,
641 m[1], 0.,
642 0., 0., 1., 0.
643 );
644 }
645
646 mat3x4 __constructor(const mat3x2 m)
647 {
648 __retVal = mat3x4 (
649 m[0], 0., 0.,
650 m[1], 0., 0.,
651 m[2], 1., 0.
652 );
653 }
654
655 mat3x4 __constructor(const mat4x2 m)
656 {
657 __retVal = mat3x4 (
658 m[0], 0., 0.,
659 m[1], 0., 0.,
660 m[2], 1., 0.
661 );
662 }
663
664 mat3x4 __constructor(const mat2 m)
665 {
666 __retVal = mat3x4 (
667 m[0], 0., 0.,
668 m[1], 0., 0.,
669 0., 0., 1., 0.
670 );
671 }
672
673
674 mat4x2 __constructor(const mat4x2 m)
675 {
676 __retVal = m;
677 }
678
679 mat4x2 __constructor(const mat4x3 m)
680 {
681 __retVal = mat4x2 (
682 m[0].xy,
683 m[1].xy,
684 m[2].xy,
685 m[3].xy
686 );
687 }
688
689 mat4x2 __constructor(const mat4 m)
690 {
691 __retVal = mat4x2 (
692 m[0].xy,
693 m[1].xy,
694 m[2].xy,
695 m[3].xy
696 );
697 }
698
699 mat4x2 __constructor(const mat3x2 m)
700 {
701 __retVal = mat4x2 (
702 m[0],
703 m[1],
704 0., 0.
705 );
706 }
707
708 mat4x2 __constructor(const mat3 m)
709 {
710 __retVal = mat4x2 (
711 m[0].xy,
712 m[1].xy,
713 m[2].xy,
714 0., 0.
715 );
716 }
717
718 mat4x2 __constructor(const mat3x4 m)
719 {
720 __retVal = mat4x2 (
721 m[0].xy,
722 m[1].xy,
723 m[2].xy,
724 0., 0.
725 );
726 }
727
728 mat4x2 __constructor(const mat2 m)
729 {
730 __retVal = mat4x2 (
731 m[0],
732 m[1],
733 0., 0.,
734 0., 0.
735 );
736 }
737
738 mat4x2 __constructor(const mat2x3 m)
739 {
740 __retVal = mat4x2 (
741 m[0].xy,
742 m[1].xy,
743 0., 0.,
744 0., 0.
745 );
746 }
747
748 mat4x2 __constructor(const mat2x4 m)
749 {
750 __retVal = mat4x2 (
751 m[0].xy,
752 m[1].xy,
753 0., 0.,
754 0., 0.
755 );
756 }
757
758
759 mat4x3 __constructor(const mat4x3 m)
760 {
761 __retVal = m;
762 }
763
764 mat4x3 __constructor(const mat4 m)
765 {
766 __retVal = mat4x3 (
767 m[0].xyz,
768 m[1].xyz,
769 m[2].xyz,
770 m[3].xyz
771 );
772 }
773
774 mat4x3 __constructor(const mat3 m)
775 {
776 __retVal = mat4x3 (
777 m[0],
778 m[1],
779 m[2],
780 0., 0., 0.
781 );
782 }
783
784 mat4x3 __constructor(const mat3x4 m)
785 {
786 __retVal = mat4x3 (
787 m[0].xyz,
788 m[1].xyz,
789 m[2].xyz,
790 0., 0., 0.
791 );
792 }
793
794 mat4x3 __constructor(const mat4x2 m)
795 {
796 __retVal = mat4x3 (
797 m[0], 0.,
798 m[1], 0.,
799 m[2], 1.,
800 m[3], 0.
801 );
802 }
803
804 mat4x3 __constructor(const mat2x3 m)
805 {
806 __retVal = mat4x3 (
807 m[0],
808 m[1],
809 0., 0., 1.,
810 0., 0., 0.
811 );
812 }
813
814 mat4x3 __constructor(const mat3x2 m)
815 {
816 __retVal = mat4x3 (
817 m[0], 0.,
818 m[1], 0.,
819 m[2], 1.,
820 0., 0., 0.
821 );
822 }
823
824 mat4x3 __constructor(const mat2x4 m)
825 {
826 __retVal = mat4x3 (
827 m[0].xyz,
828 m[1].xyz,
829 0., 0., 1.,
830 0., 0., 0.
831 );
832 }
833
834 mat4x3 __constructor(const mat2 m)
835 {
836 __retVal = mat4x3 (
837 m[0], 0.,
838 m[1], 0.,
839 0., 0., 1.,
840 0., 0., 0.
841 );
842 }
843
844
845 mat4 __constructor(const mat4 m)
846 {
847 __retVal = m;
848 }
849
850 mat4 __constructor(const mat3x4 m)
851 {
852 __retVal = mat4 (
853 m[0],
854 m[1],
855 m[2],
856 0., 0., 0., 1.
857 );
858 }
859
860 mat4 __constructor(const mat4x3 m)
861 {
862 __retVal = mat4 (
863 m[0], 0.,
864 m[1], 0.,
865 m[2], 0.,
866 m[3], 1.
867 );
868 }
869
870 mat4 __constructor(const mat2x4 m)
871 {
872 __retVal = mat4 (
873 m[0],
874 m[1],
875 0., 0., 1., 0.,
876 0., 0., 0., 1.
877 );
878 }
879
880 mat4 __constructor(const mat4x2 m)
881 {
882 __retVal = mat4 (
883 m[0], 0., 0.,
884 m[1], 0., 0.,
885 m[2], 1., 0.,
886 m[3], 0., 1.
887 );
888 }
889
890 mat4 __constructor(const mat3 m)
891 {
892 __retVal = mat4 (
893 m[0], 0.,
894 m[1], 0.,
895 m[2], 0.,
896 0., 0., 0., 1.
897 );
898 }
899
900 mat4 __constructor(const mat2x3 m)
901 {
902 __retVal = mat4 (
903 m[0], 0.,
904 m[1], 0.,
905 0., 0., 1., 0.,
906 0., 0., 0., 1.
907 );
908 }
909
910 mat4 __constructor(const mat3x2 m)
911 {
912 __retVal = mat4 (
913 m[0], 0., 0.,
914 m[1], 0., 0.,
915 m[2], 1., 0.,
916 0., 0., 0., 1.
917 );
918 }
919
920 mat4 __constructor(const mat2 m)
921 {
922 __retVal = mat4 (
923 m[0], 0., 0.,
924 m[1], 0., 0.,
925 0., 0., 1., 0.,
926 0., 0., 0., 1.
927 );
928 }
929
930
931 void __operator += (inout mat2x3 m, const mat2x3 n) {
932 m[0] += n[0];
933 m[1] += n[1];
934 }
935
936 void __operator += (inout mat2x4 m, const mat2x4 n) {
937 m[0] += n[0];
938 m[1] += n[1];
939 }
940
941 void __operator += (inout mat3x2 m, const mat3x2 n) {
942 m[0] += n[0];
943 m[1] += n[1];
944 m[2] += n[2];
945 }
946
947 void __operator += (inout mat3x4 m, const mat3x4 n) {
948 m[0] += n[0];
949 m[1] += n[1];
950 m[2] += n[2];
951 }
952
953 void __operator += (inout mat4x2 m, const mat4x2 n) {
954 m[0] += n[0];
955 m[1] += n[1];
956 m[2] += n[2];
957 m[3] += n[3];
958 }
959
960 void __operator += (inout mat4x3 m, const mat4x3 n) {
961 m[0] += n[0];
962 m[1] += n[1];
963 m[2] += n[2];
964 m[3] += n[3];
965 }
966
967
968 void __operator -= (inout mat2x3 m, const mat2x3 n) {
969 m[0] -= n[0];
970 m[1] -= n[1];
971 }
972
973 void __operator -= (inout mat2x4 m, const mat2x4 n) {
974 m[0] -= n[0];
975 m[1] -= n[1];
976 }
977
978 void __operator -= (inout mat3x2 m, const mat3x2 n) {
979 m[0] -= n[0];
980 m[1] -= n[1];
981 m[2] -= n[2];
982 }
983
984 void __operator -= (inout mat3x4 m, const mat3x4 n) {
985 m[0] -= n[0];
986 m[1] -= n[1];
987 m[2] -= n[2];
988 }
989
990 void __operator -= (inout mat4x2 m, const mat4x2 n) {
991 m[0] -= n[0];
992 m[1] -= n[1];
993 m[2] -= n[2];
994 m[3] -= n[3];
995 }
996
997 void __operator -= (inout mat4x3 m, const mat4x3 n) {
998 m[0] -= n[0];
999 m[1] -= n[1];
1000 m[2] -= n[2];
1001 m[3] -= n[3];
1002 }
1003
1004
1005 void __operator /= (inout mat2x3 m, const mat2x3 n) {
1006 m[0] /= n[0];
1007 m[1] /= n[1];
1008 }
1009
1010 void __operator /= (inout mat2x4 m, const mat2x4 n) {
1011 m[0] /= n[0];
1012 m[1] /= n[1];
1013 }
1014
1015 void __operator /= (inout mat3x2 m, const mat3x2 n) {
1016 m[0] /= n[0];
1017 m[1] /= n[1];
1018 m[2] /= n[2];
1019 }
1020
1021 void __operator /= (inout mat3x4 m, const mat3x4 n) {
1022 m[0] /= n[0];
1023 m[1] /= n[1];
1024 m[2] /= n[2];
1025 }
1026
1027 void __operator /= (inout mat4x2 m, const mat4x2 n) {
1028 m[0] /= n[0];
1029 m[1] /= n[1];
1030 m[2] /= n[2];
1031 m[3] /= n[3];
1032 }
1033
1034 void __operator /= (inout mat4x3 m, const mat4x3 n) {
1035 m[0] /= n[0];
1036 m[1] /= n[1];
1037 m[2] /= n[2];
1038 m[3] /= n[3];
1039 }
1040
1041
1042 vec3 __operator * (const mat2x3 m, const vec2 v)
1043 {
1044 __retVal.x = v.x * m[0].x + v.y * m[1].x;
1045 __retVal.y = v.x * m[0].y + v.y * m[1].y;
1046 __retVal.z = v.x * m[0].z + v.y * m[1].z;
1047 }
1048
1049 vec4 __operator * (const mat2x4 m, const vec2 v)
1050 {
1051 __retVal.x = v.x * m[0].x + v.y * m[1].x;
1052 __retVal.y = v.x * m[0].y + v.y * m[1].y;
1053 __retVal.z = v.x * m[0].z + v.y * m[1].z;
1054 __retVal.w = v.x * m[0].w + v.y * m[1].w;
1055 }
1056
1057 vec2 __operator * (const mat3x2 m, const vec3 v)
1058 {
1059 __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x;
1060 __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y;
1061 }
1062
1063 vec4 __operator * (const mat3x4 m, const vec3 v)
1064 {
1065 __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x;
1066 __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y;
1067 __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z;
1068 __retVal.w = v.x * m[0].w + v.y * m[1].w + v.z * m[2].w;
1069 }
1070
1071 vec2 __operator * (const mat4x2 m, const vec4 v)
1072 {
1073 __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x;
1074 __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y;
1075 }
1076
1077 vec3 __operator * (const mat4x3 m, const vec4 v)
1078 {
1079 __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x;
1080 __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y;
1081 __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z;
1082 }
1083
1084
1085 mat3x2 __operator * (const mat2 m, const mat3x2 n)
1086 {
1087 //return mat3x2 (m * n[0], m * n[1], m * n[2]);
1088 __retVal[0] = m * n[0];
1089 __retVal[1] = m * n[1];
1090 __retVal[2] = m * n[2];
1091 }
1092
1093 mat4x2 __operator * (const mat2 m, const mat4x2 n)
1094 {
1095 //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]);
1096 __retVal[0] = m * n[0];
1097 __retVal[1] = m * n[1];
1098 __retVal[2] = m * n[2];
1099 __retVal[3] = m * n[3];
1100 }
1101
1102
1103 mat2x3 __operator * (const mat2x3 m, const mat2 n)
1104 {
1105 //return mat2x3 (m * n[0], m * n[1]);
1106 __retVal[0] = m * n[0];
1107 __retVal[1] = m * n[1];
1108 }
1109
1110 mat3 __operator * (const mat2x3 m, const mat3x2 n)
1111 {
1112 //return mat3 (m * n[0], m * n[1], m * n[2]);
1113 __retVal[0] = m * n[0];
1114 __retVal[1] = m * n[1];
1115 __retVal[2] = m * n[2];
1116 }
1117
1118 mat4x3 __operator * (const mat2x3 m, const mat4x2 n)
1119 {
1120 //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]);
1121 __retVal[0] = m * n[0];
1122 __retVal[1] = m * n[1];
1123 __retVal[2] = m * n[2];
1124 __retVal[3] = m * n[3];
1125 }
1126
1127
1128 mat2x4 __operator * (const mat2x4 m, const mat2 n)
1129 {
1130 //return mat2x4 (m * n[0], m * n[1]);
1131 __retVal[0] = m * n[0];
1132 __retVal[1] = m * n[1];
1133 }
1134
1135 mat3x4 __operator * (const mat2x4 m, const mat3x2 n)
1136 {
1137 //return mat3x4 (m * n[0], m * n[1], m * n[2]);
1138 __retVal[0] = m * n[0];
1139 __retVal[1] = m * n[1];
1140 __retVal[2] = m * n[2];
1141 }
1142
1143 mat4 __operator * (const mat2x4 m, const mat4x2 n)
1144 {
1145 //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);
1146 __retVal[0] = m * n[0];
1147 __retVal[1] = m * n[1];
1148 __retVal[2] = m * n[2];
1149 __retVal[3] = m * n[3];
1150 }
1151
1152
1153 mat2 __operator * (const mat3x2 m, const mat2x3 n)
1154 {
1155 //return mat2 (m * n[0], m * n[1]);
1156 __retVal[0] = m * n[0];
1157 __retVal[1] = m * n[1];
1158 }
1159
1160 mat3x2 __operator * (const mat3x2 m, const mat3 n)
1161 {
1162 //return mat3x2 (m * n[0], m * n[1], m * n[2]);
1163 __retVal[0] = m * n[0];
1164 __retVal[1] = m * n[1];
1165 __retVal[2] = m * n[2];
1166 }
1167
1168 mat4x2 __operator * (const mat3x2 m, const mat4x3 n)
1169 {
1170 //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]);
1171 __retVal[0] = m * n[0];
1172 __retVal[1] = m * n[1];
1173 __retVal[2] = m * n[2];
1174 __retVal[3] = m * n[3];
1175 }
1176
1177
1178 mat2x3 __operator * (const mat3 m, const mat2x3 n)
1179 {
1180 //return mat2x3 (m * n[0], m * n[1]);
1181 __retVal[0] = m * n[0];
1182 __retVal[1] = m * n[1];
1183 }
1184
1185 mat4x3 __operator * (const mat3 m, const mat4x3 n)
1186 {
1187 //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]);
1188 __retVal[0] = m * n[0];
1189 __retVal[1] = m * n[1];
1190 __retVal[2] = m * n[2];
1191 __retVal[3] = m * n[3];
1192 }
1193
1194
1195 mat2x4 __operator * (const mat3x4 m, const mat2x3 n)
1196 {
1197 //return mat2x4 (m * n[0], m * n[1]);
1198 __retVal[0] = m * n[0];
1199 __retVal[1] = m * n[1];
1200 }
1201
1202 mat3x4 __operator * (const mat3x4 m, const mat3 n)
1203 {
1204 //return mat3x4 (m * n[0], m * n[1], m * n[2]);
1205 __retVal[0] = m * n[0];
1206 __retVal[1] = m * n[1];
1207 __retVal[2] = m * n[2];
1208 }
1209
1210 mat4 __operator * (const mat3x4 m, const mat4x3 n)
1211 {
1212 //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);
1213 __retVal[0] = m * n[0];
1214 __retVal[1] = m * n[1];
1215 __retVal[2] = m * n[2];
1216 __retVal[3] = m * n[3];
1217 }
1218
1219
1220 mat2 __operator * (const mat4x2 m, const mat2x4 n)
1221 {
1222 //return = mat2 (m * n[0], m * n[1]);
1223 __retVal[0] = m * n[0];
1224 __retVal[1] = m * n[1];
1225 }
1226
1227 mat3x2 __operator * (const mat4x2 m, const mat3x4 n)
1228 {
1229 //return mat3x2 (m * n[0], m * n[1], m * n[2]);
1230 __retVal[0] = m * n[0];
1231 __retVal[1] = m * n[1];
1232 __retVal[2] = m * n[2];
1233 }
1234
1235 mat4x2 __operator * (const mat4x2 m, const mat4 n)
1236 {
1237 //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]);
1238 __retVal[0] = m * n[0];
1239 __retVal[1] = m * n[1];
1240 __retVal[2] = m * n[2];
1241 __retVal[3] = m * n[3];
1242 }
1243
1244
1245 mat2x3 __operator * (const mat4x3 m, const mat2x4 n)
1246 {
1247 //return mat2x3 (m * n[0], m * n[1]);
1248 __retVal[0] = m * n[0];
1249 __retVal[1] = m * n[1];
1250 }
1251
1252 mat3 __operator * (const mat4x3 m, const mat3x4 n)
1253 {
1254 //return mat3 (m * n[0], m * n[1], m * n[2]);
1255 __retVal[0] = m * n[0];
1256 __retVal[1] = m * n[1];
1257 __retVal[2] = m * n[2];
1258 }
1259
1260 mat4x3 __operator * (const mat4x3 m, const mat4 n)
1261 {
1262 //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]);
1263 __retVal[0] = m * n[0];
1264 __retVal[1] = m * n[1];
1265 __retVal[2] = m * n[2];
1266 __retVal[3] = m * n[3];
1267 }
1268
1269
1270 mat2x4 __operator * (const mat4 m, const mat2x4 n)
1271 {
1272 //return mat2x4 (m * n[0], m * n[1]);
1273 __retVal[0] = m * n[0];
1274 __retVal[1] = m * n[1];
1275 }
1276
1277 mat3x4 __operator * (const mat4 m, const mat3x4 n)
1278 {
1279 //return mat3x4 (m * n[0], m * n[1], m * n[2]);
1280 __retVal[0] = m * n[0];
1281 __retVal[1] = m * n[1];
1282 __retVal[2] = m * n[2];
1283 }
1284
1285
1286 void __operator *= (inout mat2x3 m, const mat2 n) {
1287 m = m * n;
1288 }
1289
1290 void __operator *= (inout mat2x4 m, const mat2 n) {
1291 m = m * n;
1292 }
1293
1294 void __operator *= (inout mat3x2 m, const mat3 n) {
1295 m = m * n;
1296 }
1297
1298 void __operator *= (inout mat3x4 m, const mat3 n) {
1299 m = m * n;
1300 }
1301
1302 void __operator *= (inout mat4x2 m, const mat4 n) {
1303 m = m * n;
1304 }
1305
1306 void __operator *= (inout mat4x3 m, const mat4 n) {
1307 m = m * n;
1308 }
1309
1310
1311 vec3 __operator * (const vec2 v, const mat3x2 m)
1312 {
1313 __retVal.x = dot(v, m[0]);
1314 __retVal.y = dot(v, m[1]);
1315 __retVal.z = dot(v, m[2]);
1316 }
1317
1318 vec4 __operator * (const vec2 v, const mat4x2 m)
1319 {
1320 __retVal.x = dot(v, m[0]);
1321 __retVal.y = dot(v, m[1]);
1322 __retVal.z = dot(v, m[2]);
1323 __retVal.w = dot(v, m[3]);
1324 }
1325
1326 vec2 __operator * (const vec3 v, const mat2x3 m)
1327 {
1328 __retVal.x = dot(v, m[0]);
1329 __retVal.y = dot(v, m[1]);
1330 }
1331
1332 vec4 __operator * (const vec3 v, const mat4x3 m)
1333 {
1334 __retVal.x = dot(v, m[0]);
1335 __retVal.y = dot(v, m[1]);
1336 __retVal.z = dot(v, m[2]);
1337 __retVal.w = dot(v, m[3]);
1338 }
1339
1340 vec2 __operator * (const vec4 v, const mat2x4 m)
1341 {
1342 __retVal.x = dot(v, m[0]);
1343 __retVal.y = dot(v, m[1]);
1344 }
1345
1346 vec3 __operator * (const vec4 v, const mat3x4 m)
1347 {
1348 __retVal.x = dot(v, m[0]);
1349 __retVal.y = dot(v, m[1]);
1350 __retVal.z = dot(v, m[2]);
1351 }
1352
1353
1354 void __operator += (inout mat2x3 m, const float a) {
1355 m[0] += a;
1356 m[1] += a;
1357 }
1358
1359 void __operator += (inout mat2x4 m, const float a) {
1360 m[0] += a;
1361 m[1] += a;
1362 }
1363
1364 void __operator += (inout mat3x2 m, const float a) {
1365 m[0] += a;
1366 m[1] += a;
1367 m[2] += a;
1368 }
1369
1370 void __operator += (inout mat3x4 m, const float a) {
1371 m[0] += a;
1372 m[1] += a;
1373 m[2] += a;
1374 }
1375
1376 void __operator += (inout mat4x2 m, const float a) {
1377 m[0] += a;
1378 m[1] += a;
1379 m[2] += a;
1380 m[3] += a;
1381 }
1382
1383 void __operator += (inout mat4x3 m, const float a) {
1384 m[0] += a;
1385 m[1] += a;
1386 m[2] += a;
1387 m[3] += a;
1388 }
1389
1390
1391 void __operator -= (inout mat2x3 m, const float a) {
1392 m[0] -= a;
1393 m[1] -= a;
1394 }
1395
1396 void __operator -= (inout mat2x4 m, const float a) {
1397 m[0] -= a;
1398 m[1] -= a;
1399 }
1400
1401 void __operator -= (inout mat3x2 m, const float a) {
1402 m[0] -= a;
1403 m[1] -= a;
1404 m[2] -= a;
1405 }
1406
1407 void __operator -= (inout mat3x4 m, const float a) {
1408 m[0] -= a;
1409 m[1] -= a;
1410 m[2] -= a;
1411 }
1412
1413 void __operator -= (inout mat4x2 m, const float a) {
1414 m[0] -= a;
1415 m[1] -= a;
1416 m[2] -= a;
1417 m[3] -= a;
1418 }
1419
1420 void __operator -= (inout mat4x3 m, const float a) {
1421 m[0] -= a;
1422 m[1] -= a;
1423 m[2] -= a;
1424 m[3] -= a;
1425 }
1426
1427
1428 void __operator *= (inout mat2x3 m, const float a) {
1429 m[0] *= a;
1430 m[1] *= a;
1431 }
1432
1433 void __operator *= (inout mat2x4 m, const float a) {
1434 m[0] *= a;
1435 m[1] *= a;
1436 }
1437
1438 void __operator *= (inout mat3x2 m, const float a) {
1439 m[0] *= a;
1440 m[1] *= a;
1441 m[2] *= a;
1442 }
1443
1444 void __operator *= (inout mat3x4 m, const float a) {
1445 m[0] *= a;
1446 m[1] *= a;
1447 m[2] *= a;
1448 }
1449
1450 void __operator *= (inout mat4x2 m, const float a) {
1451 m[0] *= a;
1452 m[1] *= a;
1453 m[2] *= a;
1454 m[3] *= a;
1455 }
1456
1457 void __operator *= (inout mat4x3 m, const float a) {
1458 m[0] *= a;
1459 m[1] *= a;
1460 m[2] *= a;
1461 m[3] *= a;
1462 }
1463
1464
1465 void __operator /= (inout mat2x3 m, const float a) {
1466 m[0] /= a;
1467 m[1] /= a;
1468 }
1469
1470 void __operator /= (inout mat2x4 m, const float a) {
1471 m[0] /= a;
1472 m[1] /= a;
1473 }
1474
1475 void __operator /= (inout mat3x2 m, const float a) {
1476 m[0] /= a;
1477 m[1] /= a;
1478 m[2] /= a;
1479 }
1480
1481 void __operator /= (inout mat3x4 m, const float a) {
1482 m[0] /= a;
1483 m[1] /= a;
1484 m[2] /= a;
1485 }
1486
1487 void __operator /= (inout mat4x2 m, const float a) {
1488 m[0] /= a;
1489 m[1] /= a;
1490 m[2] /= a;
1491 m[3] /= a;
1492 }
1493
1494 void __operator /= (inout mat4x3 m, const float a) {
1495 m[0] /= a;
1496 m[1] /= a;
1497 m[2] /= a;
1498 m[3] /= a;
1499 }
1500
1501
1502 mat2x3 __operator + (const mat2x3 m, const mat2x3 n) {
1503 return mat2x3 (m[0] + n[0], m[1] + n[1]);
1504 }
1505
1506 mat2x4 __operator + (const mat2x4 m, const mat2x4 n) {
1507 return mat2x4 (m[0] + n[0], m[1] + n[1]);
1508 }
1509
1510 mat3x2 __operator + (const mat3x2 m, const mat3x2 n) {
1511 return mat3x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);
1512 }
1513
1514 mat3x4 __operator + (const mat3x4 m, const mat3x4 n) {
1515 return mat3x4 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);
1516 }
1517
1518 mat4x2 __operator + (const mat4x2 m, const mat4x2 n) {
1519 return mat4x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);
1520 }
1521
1522 mat4x3 __operator + (const mat4x3 m, const mat4x3 n) {
1523 return mat4x3 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);
1524 }
1525
1526
1527 mat2x3 __operator - (const mat2x3 m, const mat2x3 n) {
1528 return mat2x3 (m[0] - n[0], m[1] - n[1]);
1529 }
1530
1531 mat2x4 __operator - (const mat2x4 m, const mat2x4 n) {
1532 return mat2x4 (m[0] - n[0], m[1] - n[1]);
1533 }
1534
1535 mat3x2 __operator - (const mat3x2 m, const mat3x2 n) {
1536 return mat3x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);
1537 }
1538
1539 mat3x4 __operator - (const mat3x4 m, const mat3x4 n) {
1540 return mat3x4 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);
1541 }
1542
1543 mat4x2 __operator - (const mat4x2 m, const mat4x2 n) {
1544 return mat4x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);
1545 }
1546
1547 mat4x3 __operator - (const mat4x3 m, const mat4x3 n) {
1548 return mat4x3 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);
1549 }
1550
1551
1552 mat2x3 __operator / (const mat2x3 m, const mat2x3 n) {
1553 return mat2x3 (m[0] / n[0], m[1] / n[1]);
1554 }
1555
1556 mat2x4 __operator / (const mat2x4 m, const mat2x4 n) {
1557 return mat2x4 (m[0] / n[0], m[1] / n[1]);
1558 }
1559
1560 mat3x2 __operator / (const mat3x2 m, const mat3x2 n) {
1561 return mat3x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);
1562 }
1563
1564 mat3x4 __operator / (const mat3x4 m, const mat3x4 n) {
1565 return mat3x4 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);
1566 }
1567
1568 mat4x2 __operator / (const mat4x2 m, const mat4x2 n) {
1569 return mat4x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);
1570 }
1571
1572 mat4x3 __operator / (const mat4x3 m, const mat4x3 n) {
1573 return mat4x3 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);
1574 }
1575
1576
1577 mat2x3 __operator + (const float a, const mat2x3 n) {
1578 return mat2x3 (a + n[0], a + n[1]);
1579 }
1580
1581 mat2x3 __operator + (const mat2x3 m, const float b) {
1582 return mat2x3 (m[0] + b, m[1] + b);
1583 }
1584
1585 mat2x4 __operator + (const float a, const mat2x4 n) {
1586 return mat2x4 (a + n[0], a + n[1]);
1587 }
1588
1589 mat2x4 __operator + (const mat2x4 m, const float b) {
1590 return mat2x4 (m[0] + b, m[1] + b);
1591 }
1592
1593 mat3x2 __operator + (const float a, const mat3x2 n) {
1594 return mat3x2 (a + n[0], a + n[1], a + n[2]);
1595 }
1596
1597 mat3x2 __operator + (const mat3x2 m, const float b) {
1598 return mat3x2 (m[0] + b, m[1] + b, m[2] + b);
1599 }
1600
1601 mat3x4 __operator + (const float a, const mat3x4 n) {
1602 return mat3x4 (a + n[0], a + n[1], a + n[2]);
1603 }
1604
1605 mat3x4 __operator + (const mat3x4 m, const float b) {
1606 return mat3x4 (m[0] + b, m[1] + b, m[2] + b);
1607 }
1608
1609 mat4x2 __operator + (const mat4x2 m, const float b) {
1610 return mat4x2 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);
1611 }
1612
1613 mat4x2 __operator + (const float a, const mat4x2 n) {
1614 return mat4x2 (a + n[0], a + n[1], a + n[2], a + n[3]);
1615 }
1616
1617 mat4x3 __operator + (const mat4x3 m, const float b) {
1618 return mat4x3 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);
1619 }
1620
1621 mat4x3 __operator + (const float a, const mat4x3 n) {
1622 return mat4x3 (a + n[0], a + n[1], a + n[2], a + n[3]);
1623 }
1624
1625
1626 mat2x3 __operator - (const float a, const mat2x3 n) {
1627 return mat2x3 (a - n[0], a - n[1]);
1628 }
1629
1630 mat2x3 __operator - (const mat2x3 m, const float b) {
1631 return mat2x3 (m[0] - b, m[1] - b);
1632 }
1633
1634 mat2x4 __operator - (const float a, const mat2x4 n) {
1635 return mat2x4 (a - n[0], a - n[1]);
1636 }
1637
1638 mat2x4 __operator - (const mat2x4 m, const float b) {
1639 return mat2x4 (m[0] - b, m[1] - b);
1640 }
1641
1642 mat3x2 __operator - (const float a, const mat3x2 n) {
1643 return mat3x2 (a - n[0], a - n[1], a - n[2]);
1644 }
1645
1646 mat3x2 __operator - (const mat3x2 m, const float b) {
1647 return mat3x2 (m[0] - b, m[1] - b, m[2] - b);
1648 }
1649
1650 mat3x4 __operator - (const float a, const mat3x4 n) {
1651 return mat3x4 (a - n[0], a - n[1], a - n[2]);
1652 }
1653
1654 mat3x4 __operator - (const mat3x4 m, const float b) {
1655 return mat3x4 (m[0] - b, m[1] - b, m[2] - b);
1656 }
1657
1658 mat4x2 __operator - (const mat4x2 m, const float b) {
1659 return mat4x2 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);
1660 }
1661
1662 mat4x2 __operator - (const float a, const mat4x2 n) {
1663 return mat4x2 (a - n[0], a - n[1], a - n[2], a - n[3]);
1664 }
1665
1666 mat4x3 __operator - (const mat4x3 m, const float b) {
1667 return mat4x3 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);
1668 }
1669
1670 mat4x3 __operator - (const float a, const mat4x3 n) {
1671 return mat4x3 (a - n[0], a - n[1], a - n[2], a - n[3]);
1672 }
1673
1674
1675 mat2x3 __operator * (const float a, const mat2x3 n)
1676 {
1677 //return mat2x3 (a * n[0], a * n[1]);
1678 __retVal[0] = a * n[0];
1679 __retVal[1] = a * n[1];
1680 }
1681
1682 mat2x3 __operator * (const mat2x3 m, const float b)
1683 {
1684 //return mat2x3 (m[0] * b, m[1] * b);
1685 __retVal[0] = m[0] * b;
1686 __retVal[1] = m[1] * b;
1687 }
1688
1689 mat2x4 __operator * (const float a, const mat2x4 n)
1690 {
1691 //return mat2x4 (a * n[0], a * n[1]);
1692 __retVal[0] = a * n[0];
1693 __retVal[1] = a * n[1];
1694 }
1695
1696 mat2x4 __operator * (const mat2x4 m, const float b)
1697 {
1698 //return mat2x4 (m[0] * b, m[1] * b);
1699 __retVal[0] = m[0] * b;
1700 __retVal[1] = m[1] * b;
1701 }
1702
1703 mat3x2 __operator * (const float a, const mat3x2 n)
1704 {
1705 //return mat3x2 (a * n[0], a * n[1], a * n[2]);
1706 __retVal[0] = a * n[0];
1707 __retVal[1] = a * n[1];
1708 __retVal[2] = a * n[2];
1709 }
1710
1711 mat3x2 __operator * (const mat3x2 m, const float b)
1712 {
1713 //return mat3x2 (m[0] * b, m[1] * b, m[2] * b);
1714 __retVal[0] = m[0] * b;
1715 __retVal[1] = m[1] * b;
1716 __retVal[2] = m[2] * b;
1717 }
1718
1719 mat3x4 __operator * (const float a, const mat3x4 n)
1720 {
1721 //return mat3x4 (a * n[0], a * n[1], a * n[2]);
1722 __retVal[0] = a * n[0];
1723 __retVal[1] = a * n[1];
1724 __retVal[2] = a * n[2];
1725 }
1726
1727 mat3x4 __operator * (const mat3x4 m, const float b)
1728 {
1729 //return mat3x4 (m[0] * b, m[1] * b, m[2] * b);
1730 __retVal[0] = m[0] * b;
1731 __retVal[1] = m[1] * b;
1732 __retVal[2] = m[2] * b;
1733 }
1734
1735 mat4x2 __operator * (const mat4x2 m, const float b)
1736 {
1737 //return mat4x2 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);
1738 __retVal[0] = m[0] * b;
1739 __retVal[1] = m[1] * b;
1740 __retVal[2] = m[2] * b;
1741 __retVal[3] = m[3] * b;
1742 }
1743
1744 mat4x2 __operator * (const float a, const mat4x2 n)
1745 {
1746 //return mat4x2 (a * n[0], a * n[1], a * n[2], a * n[3]);
1747 __retVal[0] = a * n[0];
1748 __retVal[1] = a * n[1];
1749 __retVal[2] = a * n[2];
1750 __retVal[3] = a * n[3];
1751 }
1752
1753 mat4x3 __operator * (const mat4x3 m, const float b)
1754 {
1755 //return mat4x3 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);
1756 __retVal[0] = m[0] * b;
1757 __retVal[1] = m[1] * b;
1758 __retVal[2] = m[2] * b;
1759 __retVal[3] = m[3] * b;
1760 }
1761
1762 mat4x3 __operator * (const float a, const mat4x3 n)
1763 {
1764 //return mat4x3 (a * n[0], a * n[1], a * n[2], a * n[3]);
1765 __retVal[0] = a * n[0];
1766 __retVal[1] = a * n[1];
1767 __retVal[2] = a * n[2];
1768 __retVal[3] = a * n[3];
1769 }
1770
1771
1772 mat2x3 __operator / (const float a, const mat2x3 n)
1773 {
1774 //return mat2x3 (a / n[0], a / n[1]);
1775 const float inv = 1.0 / a;
1776 __retVal[0] = inv * n[0];
1777 __retVal[1] = inv * n[1];
1778 }
1779
1780 mat2x3 __operator / (const mat2x3 m, const float b)
1781 {
1782 //return mat2x3 (m[0] / b, m[1] / b);
1783 const float inv = 1.0 / b;
1784 __retVal[0] = m[0] * inv;
1785 __retVal[1] = m[1] * inv;
1786 }
1787
1788 mat2x4 __operator / (const float a, const mat2x4 n)
1789 {
1790 //return mat2x4 (a / n[0], a / n[1]);
1791 const float inv = 1.0 / a;
1792 __retVal[0] = inv * n[0];
1793 __retVal[1] = inv * n[1];
1794 }
1795
1796 mat2x4 __operator / (const mat2x4 m, const float b)
1797 {
1798 //return mat2x4 (m[0] / b, m[1] / b);
1799 const float inv = 1.0 / b;
1800 __retVal[0] = m[0] * inv;
1801 __retVal[1] = m[1] * inv;
1802 }
1803
1804 mat3x2 __operator / (const float a, const mat3x2 n)
1805 {
1806 //return mat3x2 (a / n[0], a / n[1], a / n[2]);
1807 const float inv = 1.0 / a;
1808 __retVal[0] = inv * n[0];
1809 __retVal[1] = inv * n[1];
1810 __retVal[2] = inv * n[2];
1811 }
1812
1813 mat3x2 __operator / (const mat3x2 m, const float b)
1814 {
1815 //return mat3x2 (m[0] / b, m[1] / b, m[2] / b);
1816 const float inv = 1.0 / b;
1817 __retVal[0] = m[0] * inv;
1818 __retVal[1] = m[1] * inv;
1819 __retVal[2] = m[2] * inv;
1820 }
1821
1822 mat3x4 __operator / (const float a, const mat3x4 n)
1823 {
1824 //return mat3x4 (a / n[0], a / n[1], a / n[2]);
1825 const float inv = 1.0 / a;
1826 __retVal[0] = inv * n[0];
1827 __retVal[1] = inv * n[1];
1828 __retVal[2] = inv * n[2];
1829 }
1830
1831 mat3x4 __operator / (const mat3x4 m, const float b)
1832 {
1833 //return mat3x4 (m[0] / b, m[1] / b, m[2] / b);
1834 const float inv = 1.0 / b;
1835 __retVal[0] = m[0] * inv;
1836 __retVal[1] = m[1] * inv;
1837 __retVal[2] = m[2] * inv;
1838 }
1839
1840 mat4x2 __operator / (const mat4x2 m, const float b)
1841 {
1842 //return mat4x2 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);
1843 const float inv = 1.0 / b;
1844 __retVal[0] = m[0] * inv;
1845 __retVal[1] = m[1] * inv;
1846 __retVal[2] = m[2] * inv;
1847 __retVal[3] = m[3] * inv;
1848 }
1849
1850 mat4x2 __operator / (const float a, const mat4x2 n)
1851 {
1852 //return mat4x2 (a / n[0], a / n[1], a / n[2], a / n[3]);
1853 const float inv = 1.0 / a;
1854 __retVal[0] = inv * n[0];
1855 __retVal[1] = inv * n[1];
1856 __retVal[2] = inv * n[2];
1857 __retVal[3] = inv * n[3];
1858 }
1859
1860 mat4x3 __operator / (const mat4x3 m, const float b)
1861 {
1862 //return mat4x3 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);
1863 const float inv = 1.0 / b;
1864 __retVal[0] = m[0] * inv;
1865 __retVal[1] = m[1] * inv;
1866 __retVal[2] = m[2] * inv;
1867 __retVal[3] = m[3] * inv;
1868 }
1869
1870 mat4x3 __operator / (const float a, const mat4x3 n)
1871 {
1872 //return mat4x3 (a / n[0], a / n[1], a / n[2], a / n[3]);
1873 const float inv = 1.0 / a;
1874 __retVal[0] = inv * n[0];
1875 __retVal[1] = inv * n[1];
1876 __retVal[2] = inv * n[2];
1877 __retVal[3] = inv * n[3];
1878 }
1879
1880
1881 mat2x3 __operator - (const mat2x3 m) {
1882 return mat2x3 (-m[0], -m[1]);
1883 }
1884
1885 mat2x4 __operator - (const mat2x4 m) {
1886 return mat2x4 (-m[0], -m[1]);
1887 }
1888
1889 mat3x2 __operator - (const mat3x2 m) {
1890 return mat3x2 (-m[0], -m[1], -m[2]);
1891 }
1892
1893 mat3x4 __operator - (const mat3x4 m) {
1894 return mat3x4 (-m[0], -m[1], -m[2]);
1895 }
1896
1897 mat4x2 __operator - (const mat4x2 m) {
1898 return mat4x2 (-m[0], -m[1], -m[2], -m[3]);
1899 }
1900
1901 mat4x3 __operator - (const mat4x3 m) {
1902 return mat4x3 (-m[0], -m[1], -m[2], -m[3]);
1903 }
1904
1905
1906 void __operator -- (inout mat2x3 m) {
1907 --m[0];
1908 --m[1];
1909 }
1910
1911 void __operator -- (inout mat2x4 m) {
1912 --m[0];
1913 --m[1];
1914 }
1915
1916 void __operator -- (inout mat3x2 m) {
1917 --m[0];
1918 --m[1];
1919 --m[2];
1920 }
1921
1922 void __operator -- (inout mat3x4 m) {
1923 --m[0];
1924 --m[1];
1925 --m[2];
1926 }
1927
1928 void __operator -- (inout mat4x2 m) {
1929 --m[0];
1930 --m[1];
1931 --m[2];
1932 --m[3];
1933 }
1934
1935 void __operator -- (inout mat4x3 m) {
1936 --m[0];
1937 --m[1];
1938 --m[2];
1939 --m[3];
1940 }
1941
1942
1943 void __operator ++ (inout mat2x3 m) {
1944 ++m[0];
1945 ++m[1];
1946 }
1947
1948 void __operator ++ (inout mat2x4 m) {
1949 ++m[0];
1950 ++m[1];
1951 }
1952
1953 void __operator ++ (inout mat3x2 m) {
1954 ++m[0];
1955 ++m[1];
1956 ++m[2];
1957 }
1958
1959 void __operator ++ (inout mat3x4 m) {
1960 ++m[0];
1961 ++m[1];
1962 ++m[2];
1963 }
1964
1965 void __operator ++ (inout mat4x2 m) {
1966 ++m[0];
1967 ++m[1];
1968 ++m[2];
1969 ++m[3];
1970 }
1971
1972 void __operator ++ (inout mat4x3 m) {
1973 ++m[0];
1974 ++m[1];
1975 ++m[2];
1976 ++m[3];
1977 }
1978