matrix-engine-wgpu 1.4.0 → 1.4.1

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.
@@ -15,6 +15,8 @@ export var loadCameraTexture = function() {
15
15
  clearColor: {r: 0, b: 0.122, g: 0.122, a: 1}
16
16
  }, () => {
17
17
 
18
+ cameraTexture.addLight();
19
+
18
20
  addEventListener('AmmoReady', () => {
19
21
  downloadMeshes({
20
22
  welcomeText: "./res/meshes/blender/piramyd.obj",
@@ -22,7 +22,7 @@ export var loadObjFile = function() {
22
22
  downloadMeshes({
23
23
  cube: "./res/meshes/blender/cube.obj",
24
24
  }, onGround,
25
- {scale: [25, 0.1, 25]})
25
+ {scale: [20, 1, 20]})
26
26
 
27
27
  // loadObjFile.addLight();
28
28
  })
@@ -52,28 +52,28 @@ export var loadObjFile = function() {
52
52
  // console.log(`%c Loaded objs: ${key} `, LOG_MATRIX);
53
53
  }
54
54
  loadObjFile.addMeshObj({
55
- position: {x: 0, y: 2, z: -10},
55
+ position: {x: 0, y: 2, z: -20},
56
56
  rotation: {x: 0, y: 0, z: 0},
57
57
  rotationSpeed: {x: 0, y: 0, z: 0},
58
58
  texturesPaths: ['./res/meshes/blender/cube.png'],
59
59
  name: 'cube1',
60
60
  mesh: m.cube,
61
61
  physics: {
62
- enabled: true,
62
+ enabled: false,
63
63
  geometry: "Cube",
64
64
  },
65
65
  // raycast: { enabled: true , radius: 2 }
66
66
  })
67
67
 
68
68
  loadObjFile.addMeshObj({
69
- position: {x: 3, y: 2, z: -15},
69
+ position: {x: 0, y: -1, z: -20},
70
70
  rotation: {x: 0, y: 0, z: 0},
71
71
  rotationSpeed: {x: 0, y: 111, z: 0},
72
72
  texturesPaths: ['./res/meshes/blender/cube.png'],
73
73
  name: 'ball1',
74
74
  mesh: m.ball,
75
75
  physics: {
76
- enabled: true,
76
+ enabled: false,
77
77
  geometry: "Sphere"
78
78
  },
79
79
  // raycast: { enabled: true , radius: 2 }
@@ -82,7 +82,7 @@ export var loadObjFile = function() {
82
82
  var TEST = loadObjFile.getSceneObjectByName('cube2');
83
83
  console.log(`%c Test access scene ${TEST} object.`, LOG_MATRIX);
84
84
  loadObjFile.addLight();
85
- loadObjFile.addLight();
85
+ // loadObjFile.addLight();
86
86
 
87
87
  }
88
88
  })
@@ -14,6 +14,14 @@ export var loadObjsSequence = function() {
14
14
  }, () => {
15
15
 
16
16
  addEventListener('AmmoReady', () => {
17
+
18
+ // requied now
19
+ loadObjFile.addLight();
20
+
21
+ // adapt
22
+ app.lightContainer[0].position[2] = -5;
23
+ app.lightContainer[0].position[1] = 22;
24
+
17
25
  downloadMeshes(
18
26
  makeObjSeqArg({
19
27
  id: "swat-walk-pistol",
@@ -3,6 +3,7 @@ import {downloadMeshes} from '../src/engine/loader-obj.js';
3
3
  import {LOG_FUNNY, LOG_INFO, LOG_MATRIX} from "../src/engine/utils.js";
4
4
  import {addRaycastsAABBListener} from "../src/engine/raycast.js";
5
5
 
6
+ // @group(0) @binding(5) var<uniform> postFXMode: u32;
6
7
  export var loadVideoTexture = function() {
7
8
 
8
9
  let videoTexture = new MatrixEngineWGPU({
@@ -15,6 +16,11 @@ export var loadVideoTexture = function() {
15
16
  clearColor: {r: 0, b: 0.122, g: 0.122, a: 1}
16
17
  }, () => {
17
18
 
19
+ // For now one light perscene must be added.
20
+ // if you dont wanna light just use intesity = 0
21
+ // videoTexture is app main instance
22
+ videoTexture.addLight();
23
+
18
24
  addEventListener('AmmoReady', () => {
19
25
  downloadMeshes({
20
26
  welcomeText: "./res/meshes/blender/piramyd.obj",
@@ -46,13 +52,13 @@ export var loadVideoTexture = function() {
46
52
  })
47
53
 
48
54
  var TEST = videoTexture.getSceneObjectByName('MyVideoTex');
49
- setTimeout(() => {
50
- console.log(`%c Test video-texture...`, LOG_MATRIX);
51
- TEST.loadVideoTexture({
52
- type: 'video',
53
- src: 'res/videos/tunel.mp4'
54
- });
55
- }, 4000);
55
+
56
+ console.log(`%c Test video-texture...`, LOG_MATRIX);
57
+ TEST.loadVideoTexture({
58
+ type: 'video',
59
+ src: 'res/videos/tunel.mp4'
60
+ });
61
+
56
62
  }
57
63
  })
58
64
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "matrix-engine-wgpu",
3
- "version": "1.4.0",
4
- "description": "FIX npm obj sequence anim +HOTFIX raycast, webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support. Simple raycaster hit object added.",
3
+ "version": "1.4.1",
4
+ "description": "Fixed shadows casting vs camera/video texture, webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support. Simple raycaster hit object added.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "main-worker": "watchify app-worker.js -p [esmify --noImplicitAny] -o public/app-worker.js",
@@ -34,6 +34,8 @@
34
34
  "zlatnaspirala",
35
35
  "maximumroulette.com",
36
36
  "GLSL",
37
+ "Lights",
38
+ "multi-spot-lights",
37
39
  "raycast",
38
40
  "hit-3d-object",
39
41
  "hit-object",