model-manager 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. package/administration/insert.js +179 -0
  2. package/administration/insert_one.js +33 -0
  3. package/administration/test_data.js +46 -0
  4. package/administration.html +76 -0
  5. package/app-update.yml +0 -0
  6. package/assets/css/admin.css +79 -0
  7. package/assets/css/basic.css +474 -0
  8. package/assets/css/checkout.css +517 -0
  9. package/assets/css/dialog.css +158 -0
  10. package/assets/css/dialog_checkout.css +156 -0
  11. package/assets/css/info.css +10 -0
  12. package/assets/logo.png +0 -0
  13. package/assets/partnerart.png +0 -0
  14. package/assets/spinner.gif +0 -0
  15. package/assets/three/GLTFLoader.js +4448 -0
  16. package/assets/three/ModelLoader.js +58 -0
  17. package/assets/three/OrbitControls.js +1252 -0
  18. package/assets/three/three.js +36819 -0
  19. package/assets/three/three.module.js +50708 -0
  20. package/assets/white/add_white_24dp.svg +1 -0
  21. package/assets/white/admin/person_add_FILL0_wght400_GRAD0_opsz48.svg +1 -0
  22. package/assets/white/admin/person_remove_FILL0_wght400_GRAD0_opsz48.svg +1 -0
  23. package/assets/white/admin.svg +1 -0
  24. package/assets/white/arrow_forward.svg +1 -0
  25. package/assets/white/brush_white_24dp.svg +1 -0
  26. package/assets/white/close_white_24dp.svg +1 -0
  27. package/assets/white/code_white_24dp.svg +1 -0
  28. package/assets/white/dashboard_white_24dp.svg +1 -0
  29. package/assets/white/done_white_24dp.svg +1 -0
  30. package/assets/white/emoji_people_white_24dp.svg +1 -0
  31. package/assets/white/filter_list_white_24dp.svg +1 -0
  32. package/assets/white/info_white_24dp.svg +1 -0
  33. package/assets/white/minimize_white_24dp.svg +1 -0
  34. package/assets/white/receipt_white_24dp.svg +1 -0
  35. package/assets/white/rocket_launch_white_24dp.svg +1 -0
  36. package/assets/white/search_black_24dp.svg +1 -0
  37. package/assets/white/search_white_24dp.svg +1 -0
  38. package/assets/white/settings_white_24dp.svg +1 -0
  39. package/assets/white/shopping_cart_white_24dp.svg +1 -0
  40. package/assets/white/store_white_24dp.svg +1 -0
  41. package/assets/white/timeline_white_24dp.svg +1 -0
  42. package/assets/white/view_in_ar_white_24dp.svg +1 -0
  43. package/checkout.html +131 -0
  44. package/checkout_admin.html +140 -0
  45. package/icon.png +0 -0
  46. package/imgs/armchair.png +0 -0
  47. package/imgs/arrow_tnt.png +0 -0
  48. package/imgs/bed_wnm.png +0 -0
  49. package/imgs/big_bed.png +0 -0
  50. package/imgs/birdscythe.png +0 -0
  51. package/imgs/blue_tnt.png +0 -0
  52. package/imgs/bull.png +0 -0
  53. package/imgs/carpet.png +0 -0
  54. package/imgs/chest.png +0 -0
  55. package/imgs/coin_stash.png +0 -0
  56. package/imgs/creeper_tnt.png +0 -0
  57. package/imgs/garbage_can.png +0 -0
  58. package/imgs/generator.png +0 -0
  59. package/imgs/golden_sword.png +0 -0
  60. package/imgs/highbed.png +0 -0
  61. package/imgs/jetpack1.png +0 -0
  62. package/imgs/jetpack2.png +0 -0
  63. package/imgs/jetpack3.png +0 -0
  64. package/imgs/jetpack4.png +0 -0
  65. package/imgs/jetpack5.png +0 -0
  66. package/imgs/jetpack6.png +0 -0
  67. package/imgs/karmincross.png +0 -0
  68. package/imgs/light_tnt.png +0 -0
  69. package/imgs/lucky_block.png +0 -0
  70. package/imgs/lucky_block_2.png +0 -0
  71. package/imgs/mega_tnt.png +0 -0
  72. package/imgs/modern_lamp.png +0 -0
  73. package/imgs/multiply_tnt.png +0 -0
  74. package/imgs/nuke.png +0 -0
  75. package/imgs/oak_tree.png +0 -0
  76. package/imgs/oak_tree_2.png +0 -0
  77. package/imgs/old_globe.png +0 -0
  78. package/imgs/scificannon_1.png +0 -0
  79. package/imgs/scificannon_10.png +0 -0
  80. package/imgs/scificannon_11.png +0 -0
  81. package/imgs/scificannon_12.png +0 -0
  82. package/imgs/scificannon_13.png +0 -0
  83. package/imgs/scificannon_14.png +0 -0
  84. package/imgs/scificannon_2.png +0 -0
  85. package/imgs/scificannon_3.png +0 -0
  86. package/imgs/scificannon_4.png +0 -0
  87. package/imgs/scificannon_5.png +0 -0
  88. package/imgs/scificannon_6.png +0 -0
  89. package/imgs/scificannon_7.png +0 -0
  90. package/imgs/scificannon_8.png +0 -0
  91. package/imgs/scificannon_9.png +0 -0
  92. package/imgs/simple_chair.png +0 -0
  93. package/imgs/small_car.png +0 -0
  94. package/imgs/small_modern_lamp.png +0 -0
  95. package/imgs/small_wardrobe.png +0 -0
  96. package/imgs/small_wooden_table.png +0 -0
  97. package/imgs/spike_sword.png +0 -0
  98. package/imgs/stone_holder.png +0 -0
  99. package/imgs/stone_sword.png +0 -0
  100. package/imgs/street_lamp.png +0 -0
  101. package/imgs/sword_1.png +0 -0
  102. package/imgs/sword_with_hole.png +0 -0
  103. package/imgs/testing.png +0 -0
  104. package/imgs/timer_tnt.png +0 -0
  105. package/imgs/tiny_tnt.png +0 -0
  106. package/imgs/tnt_cannon.png +0 -0
  107. package/imgs/wing_tnt.png +0 -0
  108. package/imgs/wooden_stool.png +0 -0
  109. package/imgs/wooden_wardrobe.png +0 -0
  110. package/index.html +178 -0
  111. package/index_admin.html +188 -0
  112. package/js/db/push_model.js +30 -0
  113. package/js/dialoges.js +23 -0
  114. package/js/item_functionality.js +7 -0
  115. package/js/load_cart.js +76 -0
  116. package/js/load_items.js +480 -0
  117. package/js/update.js +35 -0
  118. package/login.html +289 -0
  119. package/main.js +277 -0
  120. package/models/armchair.gltf +1 -0
  121. package/models/arrow_tnt.gltf +1 -0
  122. package/models/bedwnm.gltf +1 -0
  123. package/models/big_bed.gltf +1 -0
  124. package/models/birdscythe.gltf +1 -0
  125. package/models/blue_tnt.gltf +1 -0
  126. package/models/bull.gltf +1 -0
  127. package/models/carpet.gltf +1 -0
  128. package/models/chest.gltf +1 -0
  129. package/models/coin_stash.gltf +1 -0
  130. package/models/creeper_tnt.gltf +1 -0
  131. package/models/garbage_can.gltf +1 -0
  132. package/models/generator.gltf +1 -0
  133. package/models/golden_sword.gltf +1 -0
  134. package/models/highbed.gltf +1 -0
  135. package/models/jetpack1.gltf +1 -0
  136. package/models/jetpack2.gltf +1 -0
  137. package/models/jetpack3.gltf +1 -0
  138. package/models/jetpack4.gltf +1 -0
  139. package/models/jetpack5.gltf +1 -0
  140. package/models/jetpack6.gltf +1 -0
  141. package/models/karmincross.gltf +1 -0
  142. package/models/light_tnt.gltf +1 -0
  143. package/models/lucky_block.gltf +1 -0
  144. package/models/lucky_block_2.gltf +1 -0
  145. package/models/mega_tnt.gltf +1 -0
  146. package/models/modern_lamp.gltf +1 -0
  147. package/models/multiply_tnt.gltf +1 -0
  148. package/models/nuke.gltf +1 -0
  149. package/models/oak_tree.gltf +1 -0
  150. package/models/oak_tree_2.gltf +1 -0
  151. package/models/old globe.gltf +1 -0
  152. package/models/scificannon_1.gltf +1 -0
  153. package/models/scificannon_10.gltf +1 -0
  154. package/models/scificannon_11.gltf +1 -0
  155. package/models/scificannon_12.gltf +1 -0
  156. package/models/scificannon_13.gltf +1 -0
  157. package/models/scificannon_14.gltf +1 -0
  158. package/models/scificannon_2.gltf +1 -0
  159. package/models/scificannon_3.gltf +1 -0
  160. package/models/scificannon_4.gltf +1 -0
  161. package/models/scificannon_5.gltf +1 -0
  162. package/models/scificannon_6.gltf +1 -0
  163. package/models/scificannon_7.gltf +1 -0
  164. package/models/scificannon_8.gltf +1 -0
  165. package/models/scificannon_9.gltf +1 -0
  166. package/models/simple_chair.gltf +1 -0
  167. package/models/small_car.gltf +1 -0
  168. package/models/small_modern_lamp.gltf +1 -0
  169. package/models/small_wardrobe.gltf +1 -0
  170. package/models/small_wooden_table.gltf +1 -0
  171. package/models/spike_sword.gltf +1 -0
  172. package/models/stone_holder.gltf +1 -0
  173. package/models/stone_sword.gltf +1 -0
  174. package/models/street_lamp.gltf +1 -0
  175. package/models/sword_1.gltf +1 -0
  176. package/models/sword_with_hole.gltf +1 -0
  177. package/models/timer_tnt.gltf +1 -0
  178. package/models/tiny_tnt.gltf +1 -0
  179. package/models/tnt_cannon.gltf +1 -0
  180. package/models/wing_tnt.gltf +1 -0
  181. package/models/wooden_stool.gltf +1 -0
  182. package/models/wooden_wardrobe.gltf +1 -0
  183. package/package.json +47 -0
  184. package/preload.js +26 -0
  185. package/update.html +48 -0
@@ -0,0 +1,480 @@
1
+ import { GLTFLoader } from '../assets/three/GLTFLoader.js'
2
+ import { OrbitControls } from '../assets/three/OrbitControls.js'
3
+ window.api.send("database_request", "rqID");
4
+
5
+ const items = []
6
+ window.api.receive('item_channel', function (data, evt) {
7
+
8
+ items.push(data)
9
+ var item = document.createElement('div');
10
+ item.className = "grid-item";
11
+ item.dataset.identifier = data[0].count;
12
+ // grid picture div
13
+ var grid_pic = document.createElement('div');
14
+ grid_pic.className = "grid-picture";
15
+ var grid_pic_img = document.createElement('img');
16
+ // get img path
17
+ grid_pic_img.src = data[0].thumbnail;
18
+ grid_pic_img.width = 190;
19
+ grid_pic.appendChild(grid_pic_img);
20
+ item.appendChild(grid_pic);
21
+
22
+
23
+ // grid label
24
+ var grid_label = document.createElement('h4');
25
+ grid_label.className = "grid-label"
26
+ grid_label.innerText = data[0].modelname
27
+ item.appendChild(grid_label)
28
+ // grid data
29
+ var grid_data = document.createElement('div');
30
+ grid_data.className = "grid-data"
31
+ // span textures
32
+ var grid_textures = document.createElement('div');
33
+ grid_textures.className = "grid-textures";
34
+ var span_textures = document.createElement('span');
35
+ // span_textures.dataset.tooltip = "Textures";
36
+ span_textures.dataset.flow = "bottom";
37
+ var img_textures = document.createElement('img');
38
+ if (data[0].has_textures === true) {
39
+
40
+ img_textures.src = "assets/white/brush_white_24dp.svg";
41
+ span_textures.appendChild(img_textures);
42
+ grid_textures.appendChild(span_textures);
43
+ grid_data.appendChild(grid_textures);
44
+ }
45
+ // span anims
46
+ var grid_anims = document.createElement('div');
47
+ grid_anims.className = "grid-anims";
48
+ var span_anims = document.createElement('span');
49
+ // span_anims.dataset.tooltip = "Animations";
50
+ span_anims.dataset.flow = "bottom";
51
+ var img_anims = document.createElement('img');
52
+ if (data[0].has_animations === true) {
53
+ img_anims.src = "assets/white/emoji_people_white_24dp.svg";
54
+ span_anims.appendChild(img_anims);
55
+ grid_anims.appendChild(span_anims);
56
+ grid_data.appendChild(grid_anims);
57
+ }
58
+ var grid_behavior = document.createElement('div');
59
+ grid_behavior.className = "grid-behavior";
60
+ var span_behavior = document.createElement('span');
61
+ // span_behavior.dataset.tooltip = "Behavior";
62
+ span_behavior.dataset.flow = "bottom";
63
+ var img_behavior = document.createElement('img');
64
+ // span behavior
65
+ if (data[0].bp === true) {
66
+ img_behavior.src = "assets/white/code_white_24dp.svg";
67
+
68
+ }
69
+ span_behavior.appendChild(img_behavior);
70
+ grid_behavior.appendChild(span_behavior);
71
+ grid_data.appendChild(grid_behavior);
72
+ // span vr
73
+ var grid_view_vr = document.createElement('div');
74
+ grid_view_vr.className = "grid-view-vr";
75
+ var span_vr = document.createElement('span');
76
+ // span_vr.dataset.tooltip = "3D View";
77
+ span_vr.dataset.flow = "bottom";
78
+ var img_vr = document.createElement('img');
79
+ img_vr.src = "assets/white/view_in_ar_white_24dp.svg";
80
+ span_vr.appendChild(img_vr);
81
+ grid_view_vr.appendChild(span_vr);
82
+ grid_data.appendChild(grid_view_vr);
83
+ // finalize
84
+ grid_data.appendChild(grid_textures);
85
+ grid_data.appendChild(grid_anims);
86
+ grid_data.appendChild(grid_behavior);
87
+ grid_data.appendChild(grid_view_vr);
88
+ item.appendChild(grid_data);
89
+ // add item to items sections
90
+ document.getElementById('items').appendChild(item);
91
+ item.dataset.modelname = data[0].modelname
92
+ item.dataset.modelcreator = data[0].modelcreator
93
+ item.dataset.modelpath = data[0].model_path
94
+
95
+
96
+ // set item data so we can work with it later
97
+ item.dataset.behaviors = data[0].behaviors
98
+ item.dataset.textures = data[0].textures
99
+ item.dataset.animation = data[0].animations
100
+ item.dataset.tags = data[0].tags
101
+
102
+ document.querySelectorAll('.grid-item').forEach(function(item) {
103
+ item.addEventListener('click', function() {
104
+ document.getElementById("item-dialog").classList.add("visable");
105
+ document.getElementById("body-overlay").classList.add("visable");
106
+
107
+ // iterate over dataset array and place all the checklist items
108
+ var animationsArray = item.dataset.animation.split(",");
109
+ // clear the list first
110
+ document.getElementById("animation_listing").innerHTML = ""
111
+ animationsArray.forEach(function (animation) {
112
+ // create elements
113
+ var checkListItem = document.createElement('label');
114
+ checkListItem.classList = "control control-checkbox";
115
+ checkListItem.innerHTML = animation;
116
+ var inputCheckbox = document.createElement('input');
117
+ inputCheckbox.type = "checkbox";
118
+ var control_indicator = document.createElement("div");
119
+ control_indicator.classList = "control_indicator";
120
+
121
+ // append items
122
+ checkListItem.append(inputCheckbox);
123
+ checkListItem.append(control_indicator);
124
+
125
+ // append behavior item to behavior list
126
+ document.getElementById("animation_listing").append(checkListItem)
127
+ });
128
+
129
+ // iterate over dataset array and place all the checklist items
130
+ var texturesArray = item.dataset.textures.split(",");
131
+ // clear the list first
132
+ document.getElementById("textures_listing").innerHTML = ""
133
+ texturesArray.forEach(function (textures) {
134
+ // create elements
135
+ var checkListItem = document.createElement('label');
136
+ checkListItem.classList = "control control-checkbox";
137
+ checkListItem.innerHTML = textures;
138
+ var inputCheckbox = document.createElement('input');
139
+ inputCheckbox.type = "checkbox";
140
+ var control_indicator = document.createElement("div");
141
+ control_indicator.classList = "control_indicator";
142
+
143
+ // append items
144
+ checkListItem.append(inputCheckbox);
145
+ checkListItem.append(control_indicator);
146
+
147
+ // append behavior item to behavior list
148
+ document.getElementById("textures_listing").append(checkListItem)
149
+ });
150
+
151
+ // iterate over dataset array and place all the checklist items
152
+ var behaviorsArray = item.dataset.behaviors.split(",");
153
+ // clear the list first
154
+ document.getElementById("behavior_listing").innerHTML = ""
155
+ behaviorsArray.forEach(function (behavior) {
156
+ // create elements
157
+ var checkListItem = document.createElement('label');
158
+ checkListItem.classList = "control control-checkbox";
159
+ checkListItem.innerHTML = behavior;
160
+ var inputCheckbox = document.createElement('input');
161
+ inputCheckbox.type = "checkbox";
162
+ var control_indicator = document.createElement("div");
163
+ control_indicator.classList = "control_indicator";
164
+
165
+ // append items
166
+ checkListItem.append(inputCheckbox);
167
+ checkListItem.append(control_indicator);
168
+
169
+ // append behavior item to behavior list
170
+ document.getElementById("behavior_listing").append(checkListItem)
171
+ });
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ // reset the button
181
+ document.getElementById("addtocart").dataset.id = item.dataset.modelname;
182
+ document.getElementById("addtocart").addEventListener('click', event => {
183
+ window.api.send("storage_request", document.getElementById("addtocart").dataset.id)
184
+ //! close dialog
185
+ document.getElementById("item-dialog").classList.remove("visable");
186
+ document.getElementById("body-overlay").classList.remove("visable");
187
+ });
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ document.getElementById("item-dialog-name").innerText = item.dataset.modelname
205
+ document.getElementById("item-dialog-creator").innerText = "by " + item.dataset.modelcreator
206
+
207
+ var scene = new THREE.Scene();
208
+ var camera = new THREE.PerspectiveCamera(
209
+ 70,
210
+ 350/350,
211
+ .03,
212
+ 1000
213
+ );
214
+ var renderer = new THREE.WebGLRenderer();
215
+ renderer.setSize(350,350);
216
+ document.getElementById("model-view").innerHTML = ""
217
+
218
+ // text here
219
+ var model_view_text = document.createElement('div');
220
+ document.getElementById("model-view").appendChild(model_view_text)
221
+ document.getElementById("model-view").appendChild(renderer.domElement)
222
+
223
+
224
+ var loader = new GLTFLoader();
225
+ var obj;
226
+ loader.load(item.dataset.modelpath, function(gltf) {
227
+ obj = gltf.scene;
228
+ obj.position.y = -1.3
229
+ obj.rotation.y = -1.57
230
+ scene.add(obj);
231
+ });
232
+
233
+
234
+ const size = 10;
235
+ const divisions = 10;
236
+
237
+ const gridHelper = new THREE.GridHelper( size, divisions );
238
+ gridHelper.position.set(0, -1.3, 0)
239
+ scene.add( gridHelper );
240
+
241
+ var ambient = new THREE.AmbientLight(0xffffff, 1);
242
+ ambient.position.set(0,1,0);
243
+ ambient.castShadow = true;
244
+ scene.add(ambient);
245
+ renderer.outputEncoding = THREE.sRGBEncoding;
246
+ scene.background = new THREE.Color("rgb(45, 48, 52);")
247
+
248
+ const controls = new OrbitControls(camera,renderer.domElement);
249
+
250
+
251
+ function resizeCanvasToDisplaySize() {
252
+ const canvas = renderer.domElement;
253
+ const width = canvas.clientWidth;
254
+ const height = canvas.clientHeight;
255
+ if (canvas.width !== width ||canvas.height !== height) {
256
+ // you must pass false here or three.js sadly fights the browser
257
+ renderer.setSize(width, height, false);
258
+ camera.aspect = width / height;
259
+ camera.updateProjectionMatrix();
260
+
261
+ // set render target sizes here
262
+ }
263
+ }
264
+
265
+
266
+ camera.position.y = 1;
267
+ camera.position.x = 3;
268
+ function animate() {
269
+ requestAnimationFrame(animate);
270
+ renderer.render(scene,camera);
271
+ //obj.rotation.y += 0.003;
272
+ controls.update()
273
+ }
274
+ animate();
275
+ });
276
+ });
277
+ });
278
+
279
+
280
+ window.api.receive('renderer', function (data, evt) {
281
+ if(data = "stop-spinner") {
282
+ document.getElementById("loading").remove()
283
+ }
284
+ });
285
+
286
+
287
+ document.querySelector("[data-search]").addEventListener("input", (e) => {
288
+ const value = e.target.value;
289
+
290
+ var itemCopy = [...items];
291
+ if (value != "") {
292
+ for(var i = 0; i < items.length; i++) {
293
+ var cube = items[i];
294
+ for(var j = 0; j < cube.length; j++) {
295
+ var obj = cube[j];
296
+ if (obj.modelname.toLowerCase().includes(value.toLowerCase())) {
297
+ } else {
298
+ itemCopy[i] = undefined;
299
+ }
300
+ }
301
+ }
302
+ }
303
+
304
+ var filtered = itemCopy.filter(function (el) {
305
+ return el != null;
306
+ });
307
+
308
+
309
+ // display filtered
310
+ document.getElementById("items").innerHTML = "";
311
+ for(var i = 0; i < filtered.length; i++) {
312
+ var cube = filtered[i];
313
+ if (cube == undefined) {
314
+ break;
315
+ }
316
+ for(var j = 0; j < cube.length; j++) {
317
+ var obj = cube[j];
318
+ var item = document.createElement('div');
319
+ item.className = "grid-item";
320
+ item.dataset.identifier = obj.count;
321
+ // grid picture div
322
+ var grid_pic = document.createElement('div');
323
+ grid_pic.className = "grid-picture";
324
+ var grid_pic_img = document.createElement('img');
325
+ grid_pic_img.src = obj.thumbnail;
326
+ grid_pic_img.width = 190;
327
+ grid_pic.appendChild(grid_pic_img);
328
+ item.appendChild(grid_pic);
329
+ // grid label
330
+ var grid_label = document.createElement('h4');
331
+ grid_label.className = "grid-label"
332
+ grid_label.innerText = obj.modelname
333
+ item.appendChild(grid_label)
334
+ // grid data
335
+ var grid_data = document.createElement('div');
336
+ grid_data.className = "grid-data"
337
+ // span textures
338
+ var grid_textures = document.createElement('div');
339
+ grid_textures.className = "grid-textures";
340
+ var span_textures = document.createElement('span');
341
+ // span_textures.dataset.tooltip = "Textures";
342
+ span_textures.dataset.flow = "bottom";
343
+ var img_textures = document.createElement('img');
344
+ if (obj.has_textures === true) {
345
+
346
+ img_textures.src = "assets/white/brush_white_24dp.svg";
347
+ span_textures.appendChild(img_textures);
348
+ grid_textures.appendChild(span_textures);
349
+ grid_data.appendChild(grid_textures);
350
+ }
351
+ // span anims
352
+ var grid_anims = document.createElement('div');
353
+ grid_anims.className = "grid-anims";
354
+ var span_anims = document.createElement('span');
355
+ // span_anims.dataset.tooltip = "Animations";
356
+ span_anims.dataset.flow = "bottom";
357
+ var img_anims = document.createElement('img');
358
+ if (obj.has_animations === true) {
359
+ img_anims.src = "assets/white/emoji_people_white_24dp.svg";
360
+ span_anims.appendChild(img_anims);
361
+ grid_anims.appendChild(span_anims);
362
+ grid_data.appendChild(grid_anims);
363
+ }
364
+ var grid_behavior = document.createElement('div');
365
+ grid_behavior.className = "grid-behavior";
366
+ var span_behavior = document.createElement('span');
367
+ // span_behavior.dataset.tooltip = "Behavior";
368
+ span_behavior.dataset.flow = "bottom";
369
+ var img_behavior = document.createElement('img');
370
+ // span behavior
371
+ if (obj.bp === true) {
372
+ img_behavior.src = "assets/white/code_white_24dp.svg";
373
+
374
+ }
375
+ span_behavior.appendChild(img_behavior);
376
+ grid_behavior.appendChild(span_behavior);
377
+ grid_data.appendChild(grid_behavior);
378
+ // span vr
379
+ var grid_view_vr = document.createElement('div');
380
+ grid_view_vr.className = "grid-view-vr";
381
+ var span_vr = document.createElement('span');
382
+ // span_vr.dataset.tooltip = "3D View";
383
+ span_vr.dataset.flow = "bottom";
384
+ var img_vr = document.createElement('img');
385
+ img_vr.src = "assets/white/view_in_ar_white_24dp.svg";
386
+ span_vr.appendChild(img_vr);
387
+ grid_view_vr.appendChild(span_vr);
388
+ grid_data.appendChild(grid_view_vr);
389
+ // finalize
390
+ grid_data.appendChild(grid_textures);
391
+ grid_data.appendChild(grid_anims);
392
+ grid_data.appendChild(grid_behavior);
393
+ grid_data.appendChild(grid_view_vr);
394
+ item.appendChild(grid_data);
395
+ // add item to items sections
396
+ document.getElementById('items').appendChild(item);
397
+ item.dataset.modelname = obj.modelname
398
+ item.dataset.modelcreator = obj.modelcreator
399
+ item.dataset.modelpath = obj.model_path
400
+
401
+ document.querySelectorAll('.grid-item').forEach(function(item) {
402
+ item.addEventListener('click', function() {
403
+ document.getElementById("item-dialog").classList.add("visable");
404
+ document.getElementById("body-overlay").classList.add("visable");
405
+ document.getElementById("item-dialog-name").innerText = item.dataset.modelname
406
+ document.getElementById("item-dialog-creator").innerText = "by " + item.dataset.modelcreator
407
+
408
+ var scene = new THREE.Scene();
409
+ var camera = new THREE.PerspectiveCamera(
410
+ 70,
411
+ 350/350,
412
+ .03,
413
+ 1000
414
+ );
415
+ var renderer = new THREE.WebGLRenderer();
416
+ renderer.setSize(350,350);
417
+ document.getElementById("model-view").innerHTML = ""
418
+
419
+ // text here
420
+ var model_view_text = document.createElement('div');
421
+
422
+ document.getElementById("model-view").appendChild(model_view_text)
423
+ document.getElementById("model-view").appendChild(renderer.domElement)
424
+
425
+
426
+ var loader = new GLTFLoader();
427
+ var obj;
428
+ loader.load(item.dataset.modelpath, function(gltf) {
429
+ obj = gltf.scene;
430
+ obj.position.y = -1.3
431
+ obj.rotation.y = -1.57
432
+ scene.add(obj);
433
+ });
434
+
435
+
436
+ var ambient = new THREE.AmbientLight(0xffffff, 1);
437
+ ambient.position.set(0,1,0);
438
+ ambient.castShadow = true;
439
+ scene.add(ambient);
440
+ renderer.outputEncoding = THREE.sRGBEncoding;
441
+ scene.background = new THREE.Color("rgb(45, 48, 52);");
442
+
443
+ const controls = new OrbitControls(camera,renderer.domElement);
444
+
445
+ const size = 10;
446
+ const divisions = 10;
447
+
448
+ const gridHelper = new THREE.GridHelper( size, divisions );
449
+ gridHelper.position.set(0, -1.3, 0)
450
+ scene.add( gridHelper );
451
+
452
+ function resizeCanvasToDisplaySize() {
453
+ const canvas = renderer.domElement;
454
+ const width = canvas.clientWidth;
455
+ const height = canvas.clientHeight;
456
+ if (canvas.width !== width ||canvas.height !== height) {
457
+ // you must pass false here or three.js sadly fights the browser
458
+ renderer.setSize(width, height, false);
459
+ camera.aspect = width / height;
460
+ camera.updateProjectionMatrix();
461
+
462
+ // set render target sizes here
463
+ }
464
+ }
465
+
466
+
467
+ camera.position.y = 1;
468
+ camera.position.x = 3;
469
+ function animate() {
470
+ requestAnimationFrame(animate);
471
+ renderer.render(scene,camera);
472
+ //obj.rotation.y += 0.003;
473
+ controls.update()
474
+ }
475
+ animate();
476
+ });
477
+ });
478
+ }
479
+ }
480
+ });
package/js/update.js ADDED
@@ -0,0 +1,35 @@
1
+ const uaup = require('uaup-js');
2
+
3
+ const defaultStages = {
4
+ Checking: "Checking For Updates!", // When Checking For Updates.
5
+ Found: "Update Found!", // If an Update is Found.
6
+ NotFound: "No Update Found.", // If an Update is Not Found.
7
+ Downloading: "Downloading...", // When Downloading Update.
8
+ Unzipping: "Installing...", // When Unzipping the Archive into the Application Directory.
9
+ Cleaning: "Finalizing...", // When Removing Temp Directories and Files (ex: update archive and tmp directory).
10
+ Launch: "Launching..." // When Launching the Application.
11
+ };
12
+
13
+
14
+ const updateOptions = {
15
+ useGithub: true,
16
+ gitRepo: "Mine-North-Model-Tool",
17
+ gitUsername: "Mine-North",
18
+ isGitRepoPrivate: true,
19
+ gitRepoToken: "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",
20
+
21
+ appName: "model-tool",
22
+ appExecutableName: "model-manager.exe",
23
+
24
+ progressBar: document.getElementById("download"),
25
+ label: document.getElementById("download-label"),
26
+ stageTitles: defaultStages
27
+ };
28
+
29
+ uaup.Update(updateOptions);
30
+
31
+ const progressbar = document.getElementById("download");
32
+
33
+ while (progressbar.value == 100) {
34
+ alert("t")
35
+ }