matrix-engine-wgpu 1.0.5 → 1.0.6

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 (36) hide show
  1. package/REFERENCE.md +5 -0
  2. package/examples/load-obj-file.js +1 -8
  3. package/main.js +27 -23
  4. package/package.json +35 -41
  5. package/public/app.js +642 -156
  6. package/public/css/style.css +6 -3
  7. package/public/empty.js +466 -84
  8. package/public/examples.js +466 -84
  9. package/public/index.html +4 -4
  10. package/public/res/fonts/Accuratist.ttf +0 -0
  11. package/public/res/fonts/Closeness.ttf +0 -0
  12. package/public/res/fonts/WARGAMES.TTF +0 -0
  13. package/public/res/fonts/readme.txt +5 -0
  14. package/public/res/fonts/stormfaze.ttf +0 -0
  15. package/public/res/meshes/blender/cube.blend +0 -0
  16. package/public/res/meshes/blender/cube.blend1 +0 -0
  17. package/public/res/meshes/blender/cube.mtl +12 -0
  18. package/public/res/meshes/blender/cube.obj +46 -0
  19. package/public/res/meshes/blender/cube.png +0 -0
  20. package/public/res/meshes/blender/cubeSmartUV.blend +0 -0
  21. package/public/res/meshes/blender/cubeSmartUV.mtl +12 -0
  22. package/public/res/meshes/blender/cubeSmartUV.obj +46 -0
  23. package/public/res/meshes/blender/sphepe.blend +0 -0
  24. package/public/res/meshes/blender/sphepe.blend1 +0 -0
  25. package/public/res/meshes/blender/sphere.mtl +10 -0
  26. package/public/res/meshes/blender/sphere.obj +3402 -0
  27. package/readme.md +72 -30
  28. package/src/engine/cube.js +0 -4
  29. package/src/engine/engine.js +2 -4
  30. package/src/engine/matrix-class.js +11 -6
  31. package/src/engine/mesh-obj.js +9 -19
  32. package/src/engine/mesh.js +476 -0
  33. package/src/engine/utils.js +63 -15
  34. package/src/physics/matrix-ammo.js +43 -22
  35. package/src/world.js +75 -62
  36. package/src/engine/matrix-mesh.js +0 -49
package/REFERENCE.md CHANGED
@@ -54,3 +54,8 @@ YEs this is happening " would erase the results from render pass 1 "
54
54
 
55
55
  # https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
56
56
 
57
+
58
+
59
+ LOOK HERE
60
+
61
+ https://glm.g-truc.net/0.9.0/api/a00184.html
@@ -22,17 +22,11 @@ export let application = new MatrixEngineWGPU({
22
22
  texturesPaths: ['./res/textures/rust.jpg']
23
23
  };
24
24
 
25
- // let mesh = adaptJSON1(stanfordDragonData)
26
- // application.addBall(o)
27
- // application.addCube(c)
28
25
  application.addCube(o)
29
26
 
30
27
  function onLoadObj(m) {
31
28
  console.log('Loaded obj:', m.armor);
32
- // console.log('APP2 ', jsonPiramyd);
33
- // jsonPiramyd.vertexNormals = jsonPiramyd.normals;
34
- // jsonPiramyd.indices = jsonPiramyd.faces;
35
- // jsonPiramyd.textures = jsonPiramyd.uvs;
29
+
36
30
  application.addMeshObj({
37
31
  position: {x: 0, y: 0, z: -5},
38
32
  texturesPaths: ['./res/meshes/obj/armor.png'],
@@ -41,7 +35,6 @@ export let application = new MatrixEngineWGPU({
41
35
  })
42
36
  }
43
37
 
44
- // downloadMeshes({armor: "./res/meshes/obj/armor.obj"}, onLoadObj)
45
38
  downloadMeshes({armor: "./res/meshes/blender/piramyd.obj"}, onLoadObj)
46
39
  })
47
40
 
package/main.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import MatrixEngineWGPU from "./src/world.js";
2
2
  import {downloadMeshes} from './src/engine/loader-obj.js';
3
+ import {LOG_FUNNY, LOG_INFO, LOG_MATRIX} from "./src/engine/utils.js";
3
4
 
4
5
  export let application = new MatrixEngineWGPU({
6
+ useSingleRenderPass: true,
5
7
  canvasSize: 'fullscreen',
6
8
  mainCameraParams: {
7
9
  type: 'WASD',
@@ -13,41 +15,43 @@ export let application = new MatrixEngineWGPU({
13
15
  downloadMeshes({
14
16
  welcomeText: "./res/meshes/blender/piramyd.obj",
15
17
  armor: "./res/meshes/obj/armor.obj",
16
- lopta: "./res/meshes/blender/lopta.obj",
18
+ sphere: "./res/meshes/blender/sphere.obj",
19
+ cube: "./res/meshes/blender/cube.obj",
17
20
  }, onLoadObj)
18
21
  })
19
22
 
20
23
  function onLoadObj(m) {
21
- // console.log('Loaded objs:', m);
22
- application.addMeshObj({
23
- position: {x: -3, y: 0, z: -5},
24
- rotation: {x: 0, y: 0, z: 0},
25
- rotationSpeed: {x: 0, y: 10, z: 0},
26
- texturesPaths: ['./res/meshes/obj/armor.png'],
27
- name: 'Armor',
28
- mesh: m.armor
29
- })
24
+ application.myLoadedMeshes = m;
25
+ for(var key in m) {
26
+ console.log(`%c Loaded objs: ${key} `, LOG_MATRIX);
27
+ }
30
28
 
31
29
  application.addMeshObj({
32
- position: {x: 1, y: 0, z: -5},
33
- rotation: {x: -90, y: 0, z: 0},
30
+ position: {x: 0, y: 2, z: -10},
31
+ rotation: {x: 0, y: 0, z: 0},
34
32
  rotationSpeed: {x: 0, y: 0, z: 0},
35
- texturesPaths: ['./res/meshes/obj/armor.png'],
36
- name: 'MyText',
37
- mesh: m.welcomeText
33
+ texturesPaths: ['./res/meshes/blender/cube.png'],
34
+ name: 'CubePhysics',
35
+ mesh: m.cube,
36
+ physics: {
37
+ enabled: true,
38
+ geometry: "Cube"
39
+ }
38
40
  })
39
41
 
40
42
  application.addMeshObj({
41
- position: {x: 1, y: 0, z: -15},
42
- rotation: {x: -90, y: 0, z: 0},
43
- rotationSpeed: {x: 0, y: 10, z: 0},
44
- texturesPaths: ['./res/meshes/obj/armor.png'],
45
- name: 'Lopta-Fizika',
46
- mesh: m.lopta,
47
- physics: {enabled: true}
43
+ position: {x: 0, y: 2, z: -10},
44
+ rotation: {x: 0, y: 0, z: 0},
45
+ rotationSpeed: {x: 0, y: 0, z: 0},
46
+ texturesPaths: ['./res/meshes/blender/cube.png'],
47
+ name: 'SpherePhysics',
48
+ mesh: m.sphere,
49
+ physics: {
50
+ enabled: true,
51
+ geometry: "Sphere"
52
+ }
48
53
  })
49
54
  }
50
-
51
55
  })
52
56
 
53
57
  window.app = application
package/package.json CHANGED
@@ -1,41 +1,35 @@
1
- {
2
- "name": "matrix-engine-wgpu",
3
- "version": "1.0.5",
4
- "description": "webGPU powered pwa application.Crazy fast rendering.",
5
- "main": "index.js",
6
- "scripts": {
7
- "main-worker": "watchify app-worker.js -p [esmify --noImplicitAny] -o public/app-worker.js",
8
- "examples": "watchify examples.js -p [esmify --noImplicitAny] -o public/examples.js",
9
- "main": "watchify main.js -p [esmify --noImplicitAny] -o public/app.js",
10
- "build-empty": "watchify empty.js -p [esmify --noImplicitAny] -o public/empty.js",
11
- "build-all": "npm run main-worker | npm run examples | npm run main | npm run build-empty"
12
- },
13
- "keywords": [
14
- "webGPU",
15
- "webGPU-scene",
16
- "webGPU-engine",
17
- "matrix",
18
- "matrix-engine",
19
- "matrix-engine-webGPU",
20
- "matrix-calculation",
21
- "modelView",
22
- "modelViewProjectionMatrix",
23
- "ProjectionMatrix",
24
- "render",
25
- "wgpu",
26
- "zlatnaspirala",
27
- "maximumroulette.com",
28
- "GLSL"
29
- ],
30
- "author": "Nikola Lukic",
31
- "license": "MIT",
32
- "devDependencies": {
33
- "browser-resolve": "^2.0.0",
34
- "browserify": "^17.0.0",
35
- "esmify": "^2.1.1",
36
- "watchify": "^4.0.0"
37
- },
38
- "dependencies": {
39
- "wgpu-matrix": "^2.5.1"
40
- }
41
- }
1
+ {
2
+ "name": "matrix-engine-wgpu",
3
+ "version": "1.0.6",
4
+ "description": "webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "main-worker": "watchify app-worker.js -p [esmify --noImplicitAny] -o public/app-worker.js",
8
+ "examples": "watchify examples.js -p [esmify --noImplicitAny] -o public/examples.js",
9
+ "main": "watchify main.js -p [esmify --noImplicitAny] -o public/app.js",
10
+ "build-empty": "watchify empty.js -p [esmify --noImplicitAny] -o public/empty.js",
11
+ "build-all": "npm run main-worker | npm run examples | npm run main | npm run build-empty"
12
+ },
13
+ "keywords": [
14
+ "3dScene", "webGPU",
15
+ "webGPU-scene", "webGPU-engine",
16
+ "matrix", "matrix-engine",
17
+ "matrix-engine-webGPU", "matrix-calculation",
18
+ "modelView", "modelViewProjectionMatrix",
19
+ "ProjectionMatrix", "render",
20
+ "wgpu", "zlatnaspirala",
21
+ "maximumroulette.com", "GLSL",
22
+ "webgpu-obj-loader"
23
+ ],
24
+ "author": "Nikola Lukic",
25
+ "license": "MIT",
26
+ "devDependencies": {
27
+ "browser-resolve": "^2.0.0",
28
+ "browserify": "^17.0.0",
29
+ "esmify": "^2.1.1",
30
+ "watchify": "^4.0.0"
31
+ },
32
+ "dependencies": {
33
+ "wgpu-matrix": "^2.5.1"
34
+ }
35
+ }