matrix-engine-wgpu 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.codesandbox/tasks.json +46 -0
  2. package/.devcontainer/devcontainer.json +22 -0
  3. package/.github/dependabot.yml +12 -0
  4. package/REFERENCE.md +5 -2
  5. package/dev.md +460 -0
  6. package/empty.js +7 -6
  7. package/examples/games/jamb/jamb.js +1127 -0
  8. package/examples/load-obj-file.js +67 -37
  9. package/examples/unlit-textures.js +26 -23
  10. package/examples.js +35 -3
  11. package/main.js +441 -43
  12. package/non-project-files/dev.txt +21 -0
  13. package/non-project-files/image1.png +0 -0
  14. package/non-project-files/image6.png +0 -0
  15. package/package.json +50 -41
  16. package/public/app.js +11409 -8893
  17. package/public/css/style.css +376 -112
  18. package/public/empty.html +1 -1
  19. package/public/empty.js +9890 -8885
  20. package/public/examples.html +10 -8
  21. package/public/examples.js +945 -203
  22. package/public/index.html +5 -7
  23. package/public/manifest copy.web +35 -0
  24. package/public/res/audios/block.mp3 +0 -0
  25. package/public/res/audios/dice1.mp3 +0 -0
  26. package/public/res/audios/dice2.mp3 +0 -0
  27. package/public/res/audios/start.mp3 +0 -0
  28. package/public/res/fonts/Accuratist.ttf +0 -0
  29. package/public/res/fonts/Closeness.ttf +0 -0
  30. package/public/res/fonts/WARGAMES.TTF +0 -0
  31. package/public/res/fonts/readme.txt +5 -0
  32. package/public/res/fonts/stormfaze.ttf +0 -0
  33. package/public/res/meshes/blender/cube.blend +0 -0
  34. package/public/res/meshes/blender/cube.blend1 +0 -0
  35. package/public/res/meshes/blender/cube.mtl +12 -0
  36. package/public/res/meshes/blender/cube.obj +46 -0
  37. package/public/res/meshes/blender/cube.png +0 -0
  38. package/public/res/meshes/blender/cubeSmartUV.blend +0 -0
  39. package/public/res/meshes/blender/cubeSmartUV.mtl +12 -0
  40. package/public/res/meshes/blender/cubeSmartUV.obj +46 -0
  41. package/public/res/meshes/blender/sphepe.blend +0 -0
  42. package/public/res/meshes/blender/sphepe.blend1 +0 -0
  43. package/public/res/meshes/blender/sphere.mtl +10 -0
  44. package/public/res/meshes/blender/sphere.obj +3402 -0
  45. package/public/res/meshes/jamb/bg.blend +0 -0
  46. package/public/res/meshes/jamb/bg.blend1 +0 -0
  47. package/public/res/meshes/jamb/bg.mtl +12 -0
  48. package/public/res/meshes/jamb/bg.obj +17 -0
  49. package/public/res/meshes/jamb/bg.png +0 -0
  50. package/public/res/meshes/jamb/dice-default.png +0 -0
  51. package/public/res/meshes/jamb/dice-mark.png +0 -0
  52. package/public/res/meshes/jamb/dice.mtl +12 -0
  53. package/public/res/meshes/jamb/dice.obj +40 -0
  54. package/public/res/meshes/jamb/dice.png +0 -0
  55. package/public/res/meshes/jamb/jamb-title.mtl +12 -0
  56. package/public/res/meshes/jamb/jamb-title.obj +26008 -0
  57. package/public/res/meshes/jamb/jamb.blend +0 -0
  58. package/public/res/meshes/jamb/jamb.blend1 +0 -0
  59. package/public/res/meshes/jamb/logo.png +0 -0
  60. package/public/res/meshes/jamb/nidzaDice.blend +0 -0
  61. package/public/res/meshes/jamb/nidzaDice.blend1 +0 -0
  62. package/public/res/meshes/jamb/pile.blend +0 -0
  63. package/public/res/meshes/jamb/simpleCube.blend +0 -0
  64. package/public/res/meshes/jamb/simpleCube.blend1 +0 -0
  65. package/public/res/meshes/jamb/sounds/roll1.wav +0 -0
  66. package/public/res/meshes/jamb/text.png +0 -0
  67. package/public/res/multilang/en.json +27 -0
  68. package/public/res/multilang/sr.json +27 -0
  69. package/public/test.html +636 -0
  70. package/public/three-test.js +165 -0
  71. package/public/worker.html +1 -1
  72. package/readme.md +232 -116
  73. package/src/engine/cube.js +10 -5
  74. package/src/engine/engine.js +3 -9
  75. package/src/engine/loader-obj.js +9 -6
  76. package/src/engine/matrix-class.js +240 -202
  77. package/src/engine/mesh-obj.js +605 -525
  78. package/src/engine/mesh.js +476 -0
  79. package/src/engine/raycast-test.js +93 -0
  80. package/src/engine/utils.js +129 -15
  81. package/src/multilang/lang.js +35 -0
  82. package/src/physics/matrix-ammo.js +204 -30
  83. package/src/shaders/fragment.wgsl.js +4 -2
  84. package/src/shaders/shaders.js +1 -1
  85. package/src/shaders/vertexShadow.wgsl.js +1 -1
  86. package/src/sounds/sounds.js +47 -0
  87. package/src/world.js +312 -236
  88. package/src/engine/matrix-mesh.js +0 -49
package/public/index.html CHANGED
@@ -2,24 +2,22 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <link rel="manifest" href="manifest.web" />
5
- <title>Matrix Engine webGPU variant. Created by Nikola Lukic zlatnaspirala@gmail.com </title>
6
- <meta name="description" content="The benefits of this project is offering an overview of the entire application logic, easy native implementations (hybrid app), object structural. " />
5
+ <title>Matrix Engine webGPU variant. Created by Nikola Lukic zlatnaspirala@gmail.com 2024</title>
6
+ <meta name="description" content="WebGPU open source Project" />
7
7
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
8
8
  <link defer rel="stylesheet" href="css/style.css" />
9
9
  <link rel="apple-touch-icon" href="res/icons/512.png" />
10
- <meta name="apple-mobile-web-app-capable" content="yes" />
10
+ <meta name="mobile-web-app-capable" content="yes" />
11
11
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
12
12
  <meta name="theme-color" content="#000000" />
13
- <!-- <script src="../../builds/ammo.js"></script> -->
14
13
  <meta name="viewport" content="width=device-width,initial-scale=1.0,minimal-ui" />
15
14
  <!-- <link rel="icon" type="image/png" sizes="96x96" href="res/icons/favicon-96x96.png" /> -->
16
15
  <link rel="icon" type="image/png" sizes="512x512" href="res/icons/512.png" />
17
16
  <!-- <link rel="icon" href="res/icons/favicon.ico" type="image/x-icon" /> -->
18
17
  <!-- <meta name="msapplication-TileImage" content="res/icons/ms-icon.png" /> -->
19
- <!-- <script src="https://webglfundamentals.org/webgl/resources/m4.js"></script> -->
20
18
  </head>
21
- <body allow="autoplay">
22
- <div id="shaders"></div>
19
+ <body allow="autoplay" class="meBody">
23
20
  <script src="app.js"></script>
21
+ <div id="msgBox" class="msg-box animate1" onclick="mb.copy()"></div>
24
22
  </body>
25
23
  </html>
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "Matrix Engine webGPU",
3
+ "short_name": "matrix-engine-wgpu",
4
+ "start_url": "build.html",
5
+ "orientation": "any",
6
+ "theme_color": "lime",
7
+ "background_color": "black",
8
+ "description": "PWA fully solution with static, dynamic cache, add to home page. The benefits of this project is offering an overview of the entire application logic, easy native implementations (hybrid app), object structural.",
9
+ "display": "standalone",
10
+ "lang": "en-US",
11
+ "icons": [
12
+ {
13
+ "src": "res/icons/512.png",
14
+ "sizes": "512x512",
15
+ "type": "image/png",
16
+ "purpose": "any maskable"
17
+ },
18
+ {
19
+ "src": "res/icons/favicon-96x96.png",
20
+ "sizes": "96x96",
21
+ "type": "image/png"
22
+ },
23
+ {
24
+ "src": "res/icons/apple-icon.png",
25
+ "sizes": "192x192",
26
+ "type": "image/png"
27
+ }
28
+ ],
29
+ "author": {
30
+ "name": "Nikola Lukic",
31
+ "website": "https://maximumroulette.com",
32
+ "github": "https://github.com/zlatnaspirala",
33
+ "source-repo": "https://github.com/zlatnaspirala/matrix-engine-wgpu"
34
+ }
35
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ Have a free font, Jerk!
2
+ Check out my other fonts..
3
+ http://www.cheapskatefonts/
4
+ feel free to distribute this font as long as you include this readme file.
5
+ Thanx, enjoy the font!
Binary file
@@ -0,0 +1,12 @@
1
+ # Blender MTL File: 'cube.blend'
2
+ # Material Count: 1
3
+
4
+ newmtl Material
5
+ Ns 96.078431
6
+ Ka 1.000000 1.000000 1.000000
7
+ Kd 0.640000 0.640000 0.640000
8
+ Ks 0.500000 0.500000 0.500000
9
+ Ke 0.000000 0.000000 0.000000
10
+ Ni 1.000000
11
+ d 1.000000
12
+ illum 2
@@ -0,0 +1,46 @@
1
+ # Blender v2.79 (sub 0) OBJ File: 'cube.blend'
2
+ # www.blender.org
3
+ mtllib cube.mtl
4
+ o Cube
5
+ v 1.000000 -1.000000 -1.000000
6
+ v 1.000000 -1.000000 1.000000
7
+ v -1.000000 -1.000000 1.000000
8
+ v -1.000000 -1.000000 -1.000000
9
+ v 1.000000 1.000000 -0.999999
10
+ v 0.999999 1.000000 1.000001
11
+ v -1.000000 1.000000 1.000000
12
+ v -1.000000 1.000000 -1.000000
13
+ vt 0.000000 0.000000
14
+ vt 1.000000 0.000000
15
+ vt 1.000000 1.000000
16
+ vt 0.000000 1.000000
17
+ vt 0.000000 0.000000
18
+ vt 1.000000 0.000000
19
+ vt 1.000000 1.000000
20
+ vt 0.000000 1.000000
21
+ vt 1.000000 0.000000
22
+ vt 1.000000 1.000000
23
+ vt 0.000000 1.000000
24
+ vt 0.000000 0.000000
25
+ vt 1.000000 0.000000
26
+ vt 0.000000 1.000000
27
+ vt 0.000000 0.000000
28
+ vt 1.000000 0.000000
29
+ vt 1.000000 1.000000
30
+ vt 1.000000 0.000000
31
+ vt 1.000000 1.000000
32
+ vt 0.000000 1.000000
33
+ vn 0.0000 -1.0000 0.0000
34
+ vn 0.0000 1.0000 0.0000
35
+ vn 1.0000 0.0000 0.0000
36
+ vn -0.0000 -0.0000 1.0000
37
+ vn -1.0000 -0.0000 -0.0000
38
+ vn 0.0000 0.0000 -1.0000
39
+ usemtl Material
40
+ s off
41
+ f 1/1/1 2/2/1 3/3/1 4/4/1
42
+ f 5/5/2 8/6/2 7/7/2 6/8/2
43
+ f 1/1/3 5/9/3 6/10/3 2/11/3
44
+ f 2/12/4 6/13/4 7/7/4 3/14/4
45
+ f 3/15/5 7/16/5 8/17/5 4/4/5
46
+ f 5/5/6 1/18/6 4/19/6 8/20/6
@@ -0,0 +1,12 @@
1
+ # Blender MTL File: 'cubeSmartUV.blend'
2
+ # Material Count: 1
3
+
4
+ newmtl Material
5
+ Ns 96.078431
6
+ Ka 1.000000 1.000000 1.000000
7
+ Kd 0.640000 0.640000 0.640000
8
+ Ks 0.500000 0.500000 0.500000
9
+ Ke 0.000000 0.000000 0.000000
10
+ Ni 1.000000
11
+ d 1.000000
12
+ illum 2
@@ -0,0 +1,46 @@
1
+ # Blender v2.79 (sub 0) OBJ File: 'cubeSmartUV.blend'
2
+ # www.blender.org
3
+ mtllib cubeSmartUV.mtl
4
+ o Cube
5
+ v 1.000000 -1.000000 -1.000000
6
+ v 1.000000 -1.000000 1.000000
7
+ v -1.000000 -1.000000 1.000000
8
+ v -1.000000 -1.000000 -1.000000
9
+ v 1.000000 1.000000 -0.999999
10
+ v 0.999999 1.000000 1.000001
11
+ v -1.000000 1.000000 1.000000
12
+ v -1.000000 1.000000 -1.000000
13
+ vt 0.000000 0.666667
14
+ vt 0.333333 0.666667
15
+ vt 0.333333 1.000000
16
+ vt 0.000000 1.000000
17
+ vt 0.333333 0.333333
18
+ vt 0.333333 0.666667
19
+ vt 0.000000 0.666667
20
+ vt 0.000000 0.333333
21
+ vt 0.666667 0.333333
22
+ vt 0.333333 0.000000
23
+ vt 0.666667 0.000000
24
+ vt 0.000000 0.333333
25
+ vt 0.000000 0.000000
26
+ vt 0.333333 0.000000
27
+ vt 0.333333 0.333333
28
+ vt 1.000000 0.333333
29
+ vt 0.666667 0.333333
30
+ vt 0.666667 0.000000
31
+ vt 1.000000 0.000000
32
+ vt 0.666667 0.666667
33
+ vn 0.0000 -1.0000 0.0000
34
+ vn 0.0000 1.0000 0.0000
35
+ vn 1.0000 0.0000 0.0000
36
+ vn -0.0000 -0.0000 1.0000
37
+ vn -1.0000 -0.0000 -0.0000
38
+ vn 0.0000 0.0000 -1.0000
39
+ usemtl Material
40
+ s off
41
+ f 1/1/1 2/2/1 3/3/1 4/4/1
42
+ f 5/5/2 8/6/2 7/7/2 6/8/2
43
+ f 1/9/3 5/5/3 6/10/3 2/11/3
44
+ f 2/12/4 6/13/4 7/14/4 3/15/4
45
+ f 3/16/5 7/17/5 8/18/5 4/19/5
46
+ f 5/5/6 1/9/6 4/20/6 8/6/6
@@ -0,0 +1,10 @@
1
+ # Blender MTL File: 'sphepe.blend'
2
+ # Material Count: 1
3
+
4
+ newmtl None
5
+ Ns 0
6
+ Ka 0.000000 0.000000 0.000000
7
+ Kd 0.8 0.8 0.8
8
+ Ks 0.8 0.8 0.8
9
+ d 1
10
+ illum 2