-
Notifications
You must be signed in to change notification settings - Fork 8
/
ingress-model-viewer.js
14961 lines (12751 loc) · 476 KB
/
ingress-model-viewer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var IMV =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 45);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @fileoverview gl-matrix - High performance matrix and vector operations
* @author Brandon Jones
* @author Colin MacKenzie IV
* @version 2.3.2
*/
/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
// END HEADER
exports.glMatrix = __webpack_require__(3);
exports.mat2 = __webpack_require__(56);
exports.mat2d = __webpack_require__(57);
exports.mat3 = __webpack_require__(27);
exports.mat4 = __webpack_require__(58);
exports.quat = __webpack_require__(59);
exports.vec2 = __webpack_require__(60);
exports.vec3 = __webpack_require__(28);
exports.vec4 = __webpack_require__(29);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _glMatrix = __webpack_require__(0);
/**
* A bunch of useful constants.
* @type {Object}
*/
var Constants = {
/**
* Short list of team colors by internal name.
* @type {Object}
*/
teamColors: {
RESISTANCE: _glMatrix.vec4.fromValues(0, 0.7607843137254902, 1, 1.0),
ENLIGHTENED: _glMatrix.vec4.fromValues(0.1568627450980392, 0.9568627450980393, 0.1568627450980392, 1.0),
NEUTRAL: _glMatrix.vec4.fromValues(0.9764705882352941, 0.9764705882352941, 0.9764705882352941, 1.0),
LOKI: _glMatrix.vec4.fromValues(1, 0.1568627450980392, 0.1568627450980392, 1.0)
},
/**
* Quality and level colors, by internal name.
* @type {Object}
*/
qualityColors: {
EXTREMELY_RARE: _glMatrix.vec4.fromValues(0.9803921568627451, 0.39215686274509803, 0.39215686274509803, 1.0),
VERY_RARE: _glMatrix.vec4.fromValues(0.9568627450980393, 0.5215686274509804, 0.9254901960784314, 1.0),
MORE_RARE: _glMatrix.vec4.fromValues(0.7647058823529411, 0, 1, 1.0),
RARE: _glMatrix.vec4.fromValues(0.6666666666666666, 0.5372549019607843, 0.984313725490196, 1.0),
LESS_COMMON: _glMatrix.vec4.fromValues(0.45098039215686275, 0.6588235294117647, 1, 1.0),
COMMON: _glMatrix.vec4.fromValues(0.5098039215686274, 0.9529411764705882, 0.7058823529411765, 1.0),
VERY_COMMON: _glMatrix.vec4.fromValues(0.6980392156862745, 0.6980392156862745, 0.6980392156862745, 1.0),
L1: _glMatrix.vec4.fromValues(0.996078431372549, 0.807843137254902, 0.35294117647058826, 1.0),
L2: _glMatrix.vec4.fromValues(1, 0.6509803921568628, 0.18823529411764706, 1.0),
L3: _glMatrix.vec4.fromValues(1, 0.45098039215686275, 0.08235294117647059, 1.0),
L4: _glMatrix.vec4.fromValues(0.8941176470588236, 0, 0, 1.0),
L5: _glMatrix.vec4.fromValues(0.9921568627450981, 0.1607843137254902, 0.5725490196078431, 1.0),
L6: _glMatrix.vec4.fromValues(0.9215686274509803, 0.14901960784313725, 0.803921568627451, 1.0),
L7: _glMatrix.vec4.fromValues(0.7568627450980392, 0.1411764705882353, 0.8784313725490196, 1.0),
L8: _glMatrix.vec4.fromValues(0.5882352941176471, 0.15294117647058825, 0.9568627450980393, 1.0)
},
/**
* Color constants for anomaly markers.
* @type {Object}
*/
anomalyColors: {
1: _glMatrix.vec4.fromValues(1.0, 0.5686274509803921, 0.21176470588235294, 1.0),
2: _glMatrix.vec4.fromValues(1.0, 0.3215686274509804, 0.9058823529411765, 1.0),
3: _glMatrix.vec4.fromValues(0.6196078431372549, 0.35294117647058826, 1.0, 1.0),
4: _glMatrix.vec4.fromValues(0.8431372549019608, 0.27058823529411763, 0.27058823529411763, 1.0),
5: _glMatrix.vec4.fromValues(1.0, 0.9450980392156862, 0.0, 1.0),
6: _glMatrix.vec4.fromValues(0.6509803921568628, 1.0, 0.9019607843137255, 1.0),
7: _glMatrix.vec4.fromValues(0.5725490196078431, 0.5803921568627451, 0.592156862745098, 1.0)
},
/**
* Glow colors for the various artifact<color>Glow decorations for shard portals and
* target portals, by series.
* @type {Object}
*/
artifactGlowColors: {
Helios: {
Red: _glMatrix.vec4.fromValues(0.92, 0.51, 0.14, 1.0),
Purple: _glMatrix.vec4.fromValues(1.0, 0.87, 0.55, 1.0),
Target: _glMatrix.vec4.fromValues(1.0, 0.72, 0.0, 1.0)
},
Amar: {
Target: _glMatrix.vec4.fromValues(0.62, 0.22, 0.62, 1.0),
Red: _glMatrix.vec4.fromValues(0.79, 0.11, 0.49, 1.0),
Purple: _glMatrix.vec4.fromValues(0.58, 0.17, 1.0, 1.0)
},
Jarvis: {
Target: _glMatrix.vec4.fromValues(0.62, 0.22, 0.62, 1.0),
Red: _glMatrix.vec4.fromValues(0.79, 0.11, 0.49, 1.0),
Purple: _glMatrix.vec4.fromValues(0.58, 0.17, 1.0, 1.0)
},
Shonin: {
Red: _glMatrix.vec4.fromValues(0.78, 0.84, 1.0, 1.0),
Purple: _glMatrix.vec4.fromValues(0.25, 0.81, 1.0, 1.0),
Target: _glMatrix.vec4.fromValues(0.70, 0.70, 0.70, 1.0)
},
Lightman: {
Red: _glMatrix.vec4.fromValues(1.0, 0.44, 0.45, 1.0),
Purple: _glMatrix.vec4.fromValues(1.0, 0.24, 0.25, 1.0),
Target: _glMatrix.vec4.fromValues(0.74, 0.0, 0.02, 1.0)
},
Abaddon1: {
Red: _glMatrix.vec4.fromValues(1.0, 0.7, 0.86, 1.0),
Purple: _glMatrix.vec4.fromValues(0.82, 0.7, 1.0, 1.0),
Target: _glMatrix.vec4.fromValues(0.0, 0.95, 0.4, 1.0)
},
Abaddon2: {
Red: _glMatrix.vec4.fromValues(0.7, 1.0, 0.87, 1.0),
Purple: _glMatrix.vec4.fromValues(0.86, 0.7, 1.0, 1.0),
Target: _glMatrix.vec4.fromValues(0.0, 0.59, 1.0, 1.0)
},
Shard2017: {
Red: _glMatrix.vec4.fromValues(0.7, 1.0, 0.87, 1.0),
Purple: _glMatrix.vec4.fromValues(0.86, 0.7, 1.0, 1.0),
Target: _glMatrix.vec4.fromValues(0.0, 0.59, 1.0, 1.0)
}
},
/**
* Constants for key locker colors. Each capsule has two colors: the 0 index
* color is for the highlight markings on the key locker; the 1 index color is
* the base color of the key locker. These correspond to u_color0 and
* u_color1.
* @type {Object}
*/
keyCapsuleColors: {
blue: [_glMatrix.vec4.fromValues(0.3686274509803921, 0.6784313725490196, 1.0, 1.0), _glMatrix.vec4.fromValues(0.3568627450980392, 0.4705882352941176, 0.6470588235294117, 1.0)],
green: [_glMatrix.vec4.fromValues(0.2117647058823529, 1.0, 0.4705882352941176, 1.0), _glMatrix.vec4.fromValues(0.2980392156862745, 0.5607843137254901, 0.4117647058823529, 1.0)],
red: [_glMatrix.vec4.fromValues(1.0, 0.0431372549019607, 0.3764705882352941, 1.0), _glMatrix.vec4.fromValues(0.6784313725490196, 0.2078431372549019, 0.3607843137254901, 1.0)],
white: [_glMatrix.vec4.fromValues(1.0, 1.0, 1.0, 1.0), _glMatrix.vec4.fromValues(0.5921568627450980, 0.5882352941176470, 0.5843137254901960, 1.0)],
yellow: [_glMatrix.vec4.fromValues(0.9019607843137254, 0.9411764705882352, 0.1647058823529411, 1.0), _glMatrix.vec4.fromValues(0.6862745098039215, 0.6509803921568627, 0.3607843137254901, 1.0)]
},
/**
* Constants for xm glow colors (for item xm cores)
* @type {Object}
*/
xmColors: {
coreGlow: _glMatrix.vec4.fromValues(0.92, 0.7, 0.89, 1.0),
coreGlowAlt: _glMatrix.vec4.fromValues(0.6, 0.4, 0.6, 0.8),
coreGlowAda: _glMatrix.vec4.fromValues(0, 0.7607843137254902, 1, 1.0),
coreGlowJarvis: _glMatrix.vec4.fromValues(0.1568627450980392, 0.9568627450980393, 0.1568627450980392, 1.0),
coreGlowChaotic: _glMatrix.vec4.fromValues(1, 0.25, 0.0, 1.0)
},
/**
* Mesh internal name constants.
* @type {Object}
*/
Mesh: {
Inventory: {
Xmp: 'XmpMesh',
XmpXm: 'XmpXMMesh',
Ultrastrike: 'UltrastrikeMesh',
UltrastrikeXm: 'UltrastrikeXMMesh',
ResShield: 'ResShieldMesh',
ResShieldXm: 'ResShieldXMMesh',
PowerCube: 'PowerCubeMesh',
PowerCubeXm: 'PowerCubeXmMesh',
LinkAmp: 'LinkAmpMesh',
LinkAmpXm: 'LinkAmpXmMesh',
UltraLinkAmp: 'UltraLinkAmpMesh',
UltraLinkAmpXm: 'UltraLinkAmpXmMesh',
HeatSink: 'HeatSinkMesh',
HeatSinkXm: 'HeatSinkXmMesh',
MultiHack: 'MultiHackMesh',
MultiHackXm: 'MultiHackXmMesh',
ForceAmp: 'ForceAmpMesh',
ForceAmpXm: 'ForceAmpXmMesh',
Turret: 'TurretMesh',
TurretXm: 'TurretXmMesh',
FlipCardAda: 'FlipCardMeshAda',
FlipCardJarvis: 'FlipCardMeshJarvis',
FlipCardXm: 'FlipCardXmMesh',
Resonator: 'ResonatorMesh',
ResonatorXm: 'ResonatorXMMesh',
Capsule: 'CapsuleMesh',
InterestCapsule: 'InterestCapsuleMesh',
KeyCapsule: 'KeyCapsuleMesh',
KeyCapsuleXm: 'KeyCapsuleXmMesh',
CapsuleXm: 'CapsuleXmMesh',
Fracker: 'FrackerMesh',
FrackerXm: 'FrackerXmMesh',
TransmuterAttack: 'TransmuterAttackMesh',
TransmuterAttackXm: 'TransmuterAttackXmMesh',
TransmuterDefense: 'TransmuterDefenseMesh',
TransmuterDefenseXm: 'TransmuterDefenseXmMesh',
Mysterious: 'MysteriousMesh',
MysteriousXm: 'MysteriousXmMesh',
Niantic: 'NianticMesh',
ExtraShield: 'ExtraShieldMesh',
BoostedPowerCube: 'BoostedPowerCubeMesh',
BoostedPowerCubeXm: 'BoostedPowerCubeXmMesh',
BoostedPowerCubeK: 'BoostedPowerCubeKMesh',
BoostedPowerCubeKXm: 'BoostedPowerCubeKXmMesh',
MediaCube: 'MediaCubeMesh',
MediaPlaneMesh: 'MediaPlaneMesh'
},
Resource: {
Xmp: 'XmpResourceUnitMesh',
PortalKeyResourceUnit: 'PortalKeyResourceUnit',
Ultrastrike: 'UltrastrikeResourceUnitMesh',
PowerCube: 'PowerCubeResourceUnitMesh',
LinkAmp: 'LinkAmpResourceUnitMesh',
UltraLinkAmp: 'UltraLinkAmpResourceUnitMesh',
HeatSink: 'HeatSinkResourceUnitMesh',
MultiHack: 'MultiHackResourceUnitMesh',
ForceAmp: 'ForceAmpResourceUnitMesh',
Turret: 'TurretResourceUnitMesh',
FlipCardAda: 'FlipCardResourceUnitMeshAda',
FlipCardJarvis: 'FlipCardResourceUnitMeshJarvis',
Resonator: 'ResonatorResourceUnitMesh',
PortalShield: 'PortalShieldResourceUnitMesh',
Capsule: 'CapsuleResourceUnitMesh',
InterestCapsule: 'InterestCapsuleResourceUnitMesh',
Fracker: 'FrackerResourceUnitMesh',
TransmuterAttack: 'TransmuterAttackResourceUnitMesh',
TransmuterDefense: 'TransmuterDefenseResourceUnitMesh',
Mysterious: 'MysteriousResourceUnitMesh',
ExtraShield: 'ExtraShieldResourceUnitMesh',
KeyCapsule: 'KeyCapsuleResourceUnitMesh',
BoostedPowerCube: 'BoostedPowerCubeResourceUnitMesh',
BoostedPowerCubeK: 'BoostedPowerCubeKResourceUnitMesh'
},
Player: {
Player: 'PlayerMesh',
PlayerEdge: 'PlayerMeshEdge',
PlayerReflection: 'PlayerMeshReflection',
PlayerGlow: 'PlayerMeshGlow',
BreadCrumb: 'BreadCrumbMesh',
Compass: 'CompassMesh'
},
Ornament: {
MeetupPoint: 'OrnamentMeetupPointMesh',
FinishPoint: 'OrnamentFinishPointMesh',
Cluster: 'OrnamentClusterMesh',
Volatile: 'OrnamentVolatileMesh'
},
World: {
Shield: 'PortalShieldMesh',
Portal: 'TexturedPortalMesh',
Waypoint: 'TexturedScannerFTMesh',
Resonator: 'ResonatorUnitLowResMesh',
XmpRing: 'XmpRingMesh',
UltraStrikeRing: 'UltraStrikeRingMesh',
UltraStrikeColumn: 'UltraStrikeColumnMesh',
ArtifactsRedGlow: 'ArtifactsRedGlow',
ArtifactsGreenGlow: 'ArtifactsGreenGlow',
ArtifactsPurpleGlow: 'ArtifactsPurpleGlow',
ArtifactsTargetGlow: 'ArtifactsTargetGlow',
SingleResonator: 'SingleResonatorMesh',
OrnamentMeetupPoint: 'OrnamentMeetupPointMesh',
OrnamentFinishPoint: 'OrnamentFinishPointMesh',
OrnamentCluster: 'OrnamentClusterMesh',
OrnamentVolatile: 'OrnamentVolatileMesh'
}
},
/**
* Program internal name constants.
* @type {Object}
*/
Program: {
Bicolored: 'bicolor_textured',
Textured: 'textured',
RegionTextured: 'region_textured',
Glowramp: 'portal_scanner',
Xm: 'xm',
ShieldEffect: 'shield',
Atmosphere: 'atmosphere',
Link: 'LinkShader',
SphericalLink: 'link3d',
ParticlePortal: 'particle_portals'
},
/**
* Texture internal name constants.
* @type {Object}
*/
Texture: {
FlipCard: 'FlipCardTexture',
Xm: 'ObjectXMTexture',
Glowramp: 'GlowrampTexture',
Media: 'MediaCubeTexture',
Waypoint: 'FtWaypointTexture',
ShieldEffect: 'PortalShieldTexture',
ColorGlow: 'ColorGlowTexture',
TargetGlow: 'TargetGlowTexture',
PortalLink: 'PortalLinkTexture',
ResonatorLink: 'ResonatorLinkTexture',
OrnamentMeetupPoint: 'OrnamentMeetupPointTexture',
OrnamentFinishPoint: 'OrnamentFinishPointTexture',
OrnamentCluster: 'OrnamentClusterTexture',
OrnamentVolatile: 'OrnamentVolatileTexture',
Particle: 'ParticleTexture'
}
};
exports.default = Constants;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _drawable = __webpack_require__(10);
var _drawable2 = _interopRequireDefault(_drawable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* A TexturedDrawable is a Drawable with a specific texture
*
* @param {String} programName Program internal name
* @param {String} meshName Mesh internal name
* @param {String} textureName Texture internal name
*/
var TexturedDrawable = function (_Drawable) {
_inherits(TexturedDrawable, _Drawable);
function TexturedDrawable(programName, meshName, textureName) {
_classCallCheck(this, TexturedDrawable);
var _this = _possibleConstructorReturn(this, (TexturedDrawable.__proto__ || Object.getPrototypeOf(TexturedDrawable)).call(this, programName, meshName));
_this.textureName = textureName;
_this.texture = null;
return _this;
}
/**
* Draw the textured object
*
* @return {void}
*/
_createClass(TexturedDrawable, [{
key: 'draw',
value: function draw() {
if (this.ready) {
this.texture.use(0);
this.uniforms.u_texture = 0;
_get(TexturedDrawable.prototype.__proto__ || Object.getPrototypeOf(TexturedDrawable.prototype), 'draw', this).call(this);
}
}
}, {
key: '_loadAssets',
value: function _loadAssets(manager) {
var _this2 = this;
var promises = _get(TexturedDrawable.prototype.__proto__ || Object.getPrototypeOf(TexturedDrawable.prototype), '_loadAssets', this).call(this, manager);
promises.push(manager.loadTexture(this.textureName).then(function (texture) {
_this2.texture = texture;
}).catch(function (err) {
console.warn('missing texture ' + _this2.textureName); // eslint-disable-line no-console
return Promise.reject(err);
}));
return promises;
}
}]);
return TexturedDrawable;
}(_drawable2.default);
exports.default = TexturedDrawable;
/***/ }),
/* 3 */
/***/ (function(module, exports) {
/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
/**
* @class Common utilities
* @name glMatrix
*/
var glMatrix = {};
// Configuration Constants
glMatrix.EPSILON = 0.000001;
glMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;
glMatrix.RANDOM = Math.random;
glMatrix.ENABLE_SIMD = false;
// Capability detection
glMatrix.SIMD_AVAILABLE = (glMatrix.ARRAY_TYPE === Float32Array) && ('SIMD' in this);
glMatrix.USE_SIMD = glMatrix.ENABLE_SIMD && glMatrix.SIMD_AVAILABLE;
/**
* Sets the type of array used when creating new vectors and matrices
*
* @param {Type} type Array type, such as Float32Array or Array
*/
glMatrix.setMatrixArrayType = function(type) {
glMatrix.ARRAY_TYPE = type;
}
var degree = Math.PI / 180;
/**
* Convert Degree To Radian
*
* @param {Number} Angle in Degrees
*/
glMatrix.toRadian = function(a){
return a * degree;
}
/**
* Tests whether or not the arguments have approximately the same value, within an absolute
* or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
* than or equal to 1.0, and a relative tolerance is used for larger values)
*
* @param {Number} a The first number to test.
* @param {Number} b The second number to test.
* @returns {Boolean} True if the numbers are approximately equal, false otherwise.
*/
glMatrix.equals = function(a, b) {
return Math.abs(a - b) <= glMatrix.EPSILON*Math.max(1.0, Math.abs(a), Math.abs(b));
}
module.exports = glMatrix;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _glBound = __webpack_require__(5);
var _glBound2 = _interopRequireDefault(_glBound);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MODE_TRIANGLES = 'triangles';
var MODE_LINES = 'lines';
/**
* Base class for all meshes
*
* @extends {GLBound}
* @param {context} gl A webgl context
* @param {Float32Array} attributes A typed array of vertex attributes
* @param {Uint16Array} faces A typed array of face indices
* @param {Uint16Array} lines A typed array of line indices
*/
var Mesh = function (_GLBound) {
_inherits(Mesh, _GLBound);
function Mesh(gl, attributes, faces, lines) {
_classCallCheck(this, Mesh);
var _this = _possibleConstructorReturn(this, (Mesh.__proto__ || Object.getPrototypeOf(Mesh)).call(this, gl));
_this.attributes = attributes;
_this.faces = faces;
_this.lines = lines;
_this.bounds = null;
_this.center = null;
return _this;
}
/**
* Given a set of locations from the currently-active shader, draw this mesh
* @param {Object} locations A hash of locations by name
* @param {String} mode (optional) The draw mode
* Either MODE_TRIANGLES or MODE_LINES
* @return {void}
*/
_createClass(Mesh, [{
key: 'draw',
value: function draw(locations, mode) {
mode = mode || MODE_TRIANGLES;
this.attributes.draw(locations);
if (mode === MODE_TRIANGLES) {
this.faces.draw();
} else if (mode === MODE_LINES) {
this.lines.draw();
}
}
/**
* Calculate the bounding box of the mesh
* @param {Number} coordAttribute Index of the attribute representing vertex position
* @return {Object} An object consisting of two arrays of the same length
* as the coordinate attribute, representing min and max
* coordinates.
*/
}, {
key: 'boundingBox',
value: function boundingBox(coordAttribute) {
if (!this.bounds) {
coordAttribute = coordAttribute === undefined ? 0 : coordAttribute;
var bounds = {
max: null,
min: null
};
this.attributes.eachAttribute(coordAttribute, function (arr) {
if (bounds.max) {
bounds.max = bounds.max.map(function (e, i) {
return Math.max(e, arr[i]);
});
} else {
bounds.max = Array.prototype.slice.call(arr);
}
if (bounds.min) {
bounds.min = bounds.min.map(function (e, i) {
return Math.min(e, arr[i]);
});
} else {
bounds.min = Array.prototype.slice.call(arr);
}
});
this.bounds = bounds;
}
return this.bounds;
}
}, {
key: 'centerOfMass',
value: function centerOfMass(coordAttribute) {
if (!this.center) {
coordAttribute = coordAttribute === undefined ? 0 : coordAttribute;
var sum = null,
count = 0;
this.attributes.eachAttribute(coordAttribute, function (arr) {
count++;
if (sum) {
sum = sum.map(function (e, i) {
return e + arr[i];
});
} else {
sum = Array.prototype.slice.call(arr);
}
});
this.center = sum.map(function (e) {
return e / count;
});
}
return this.center;
}
/**
* Calculate the center of the bounding box.
* @param {Number} coordAttribute Index of the attribute represention vertex position.
* @return {mixed} A vector of the same size as the position attribute,
* representing the center of the bounding box.
*/
}, {
key: 'boundingBoxCenter',
value: function boundingBoxCenter(coordAttribute) {
if (!this.bounds) {
this.boundingBox(coordAttribute);
}
return this.bounds.max.map(function (e, i) {
return (e - this.bounds.min[i]) / 2;
}.bind(this));
}
}]);
return Mesh;
}(_glBound2.default);
/**
* Specifies drawing in `lines` mode
* @type {String}
*/
Mesh.MODE_LINES = MODE_LINES;
/**
* Specifies drawing in `triangles` mode
* @type {String}
*/
Mesh.MODE_TRIANGLES = MODE_TRIANGLES;
exports.default = Mesh;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Base class for all things bound to a gl context.
*
* @param {context} gl A webgl context
*/
var GLBound = function GLBound(gl) {
_classCallCheck(this, GLBound);
this._gl = gl;
};
exports.default = GLBound;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _glBuffer = __webpack_require__(25);
var _glBuffer2 = _interopRequireDefault(_glBuffer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* A GLAttribute is a GLBuffer that represents vertex attributes
*
* @private
* @extends {GLBuffer}
* @chainable
* @param {context} gl WebGLContext
* @param {Array} attributes An array of VertexAttributes
* @param {ArrayBuffer} values Values to fill the buffer with
* @param {enum} usage Usage @see https://www.khronos.org/registry/webgl/specs/1.0/#5.14.5
* @return {this} The new GLAttribute
*/
var GLAttribute = function (_GLBuffer) {
_inherits(GLAttribute, _GLBuffer);
function GLAttribute(gl, attributes, values, usage) {
var _ret;
_classCallCheck(this, GLAttribute);
usage = usage || gl.STATIC_DRAW;
var _this = _possibleConstructorReturn(this, (GLAttribute.__proto__ || Object.getPrototypeOf(GLAttribute)).call(this, gl, gl.ARRAY_BUFFER, usage));
_this.attributes = attributes;
_this.values = values;
_this.size = _this.count = null;
_this._validate = false;
_this.size = 0;
_this.width = 0;
for (var i = 0, a; i < _this.attributes.length; i++) {
a = _this.attributes[i];
_this.size += 4 * a.size; // 4 because float is 4 bytes.
_this.width += a.size;
}
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
/**
* Confirms that the underlying buffer's length is an even multiple
* of total size of the attributes for the buffer
*
* Issues a warning if not.
*
* @return {void}
*/
_createClass(GLAttribute, [{
key: 'validate',
value: function validate() {
if (this._validate) {
if (this.values.length % this.width !== 0) {
console.warn('values array length is not an even multiple of the total size of the attributes'); // eslint-disable-line no-console
}
}
}
/**
* Update the values in the buffer and pushes the buffer to the gpu
*
* @chainable
* @param {ArrayBuffer} values New values to write to the buffer
*
* @return {this} Returns `this`
*/
}, {
key: 'updateValues',
value: function updateValues(values) {
this.values = values;
this.validate();
return this.update();
}
/**
* Given a set of program locations, set up the attribute pointers
*
* @chainable
* @param {Object} locations Map of attribute names to program locations
*
* @return {this} Returns `this`
*/
}, {
key: 'draw',
value: function draw(locations) {
var gl = this._gl;
var a,
s = 0;
if (!this.glBuf) {
this.update();
} else {
this.bindBuffer();
}
for (var i = 0; i < this.attributes.length; i++) {
a = this.attributes[i];
if (a.name in locations) {
gl.enableVertexAttribArray(locations[a.name]);
gl.vertexAttribPointer(locations[a.name], a.size, gl.FLOAT, false, this.size, s);
}
// I don't know if I should suppress this, but if I
// don't, it generates one warning per frame.
//console.warn('Program is missing attribute ' + a.name);
s += 4 * a.size;
}
return this; //.unbindBuffer(); // maybe?
}
/**
* Perform some operation on each set of values for some attribute
*
* @chainable
* @param {Number} attributeIndex Index of the attribute to select
* @param {Function} callback Callback
*
* @return {this} Returns `this`
*/
}, {
key: 'eachAttribute',
value: function eachAttribute(attributeIndex, callback) {
var offset = 0,
size,
i;
if (attributeIndex >= 0 && attributeIndex < this.attributes.length) {
for (i = 0; i < attributeIndex; i++) {
offset += this.attributes[i].size;
}
size = this.attributes[attributeIndex].size;
for (i = offset; i < this.values.length; i += this.width) {
callback(this.values.subarray(i, i + size));
}
}
return this;
}
}]);
return GLAttribute;
}(_glBuffer2.default);
exports.default = GLAttribute;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _glBuffer = __webpack_require__(25);
var _glBuffer2 = _interopRequireDefault(_glBuffer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* A GLIndex is a GLBuffer representing an index buffer of some kind
*
* @private
* @extends {GLBuffer}
* @chainable
* @param {context} gl WebGL context
* @param {ArrayBuffer} values Values to initialize the buffer with
* @param {enum} drawMode Draw mode @see https://www.khronos.org/registry/webgl/specs/1.0/#5.14.11
* @param {enum} usage Usage @see https://www.khronos.org/registry/webgl/specs/1.0/#5.14.5
* @return {this} The new GLIndex
*/
var GLIndex = function (_GLBuffer) {
_inherits(GLIndex, _GLBuffer);
function GLIndex(gl, values, drawMode, usage) {
var _ret;
_classCallCheck(this, GLIndex);
usage = usage || gl.STATIC_DRAW;
var _this = _possibleConstructorReturn(this, (GLIndex.__proto__ || Object.getPrototypeOf(GLIndex)).call(this, gl, gl.ELEMENT_ARRAY_BUFFER, usage));
_this.mode = drawMode;
_this.values = values;
_this.count = null;
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
/**
* Perform a draw call using this index buffer.
*
* @chainable
* @return {this} Returns `this`
*/
_createClass(GLIndex, [{
key: 'draw',
value: function draw() {
var gl = this._gl;
if (!this.glBuf) {
this.update();
} else {
this.bindBuffer();
}
gl.drawElements(this.mode, this.values.length, gl.UNSIGNED_SHORT, 0);
return this;