matrix-engine-wgpu 1.3.2 → 1.3.3
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.
- package/package.json +1 -1
- package/src/engine/mesh-obj.js +4 -1
- package/src/world.js +9 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matrix-engine-wgpu",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "obj sequence anim +HOTFIX raycast, webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support. Simple raycaster hit object added.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
package/src/engine/mesh-obj.js
CHANGED
|
@@ -25,6 +25,9 @@ export default class MEMeshObj {
|
|
|
25
25
|
this.context = context;
|
|
26
26
|
this.entityArgPass = o.entityArgPass;
|
|
27
27
|
|
|
28
|
+
// comes from engine not from args
|
|
29
|
+
this.clearColor = "red";
|
|
30
|
+
|
|
28
31
|
// Mesh stuff - for single mesh or t-posed (fiktive-first in loading order)
|
|
29
32
|
this.mesh = o.mesh;
|
|
30
33
|
this.mesh.uvs = this.mesh.textures;
|
|
@@ -310,7 +313,7 @@ export default class MEMeshObj {
|
|
|
310
313
|
{
|
|
311
314
|
// view is acquired and set in render loop.
|
|
312
315
|
view: undefined,
|
|
313
|
-
clearValue:
|
|
316
|
+
clearValue: this.clearColor,
|
|
314
317
|
loadOp: 'clear', // load old fix for FF
|
|
315
318
|
storeOp: 'store',
|
|
316
319
|
},
|
package/src/world.js
CHANGED
|
@@ -39,10 +39,14 @@ export default class MatrixEngineWGPU {
|
|
|
39
39
|
mainCameraParams: {
|
|
40
40
|
type: 'WASD',
|
|
41
41
|
responseCoef: 2000
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
clearColor: {r: 0.584, g: 0, b: 0.239, a: 1.0}
|
|
43
44
|
}
|
|
44
45
|
callback = options;
|
|
45
46
|
}
|
|
47
|
+
if(typeof options.clearColor === 'undefined') {
|
|
48
|
+
options.clearColor = {r: 0.584, g: 0, b: 0.239, a: 1.0};
|
|
49
|
+
}
|
|
46
50
|
if(typeof options.canvasId === 'undefined') {
|
|
47
51
|
options.canvasId = 'canvas1';
|
|
48
52
|
}
|
|
@@ -251,7 +255,7 @@ export default class MatrixEngineWGPU {
|
|
|
251
255
|
this.mainRenderBundle.push(myMesh1);
|
|
252
256
|
}
|
|
253
257
|
|
|
254
|
-
addMeshObj = (o) => {
|
|
258
|
+
addMeshObj = (o , clearColor=this.options.clearColor) => {
|
|
255
259
|
if(typeof o.name === 'undefined') {o.name = genName(9)}
|
|
256
260
|
if(typeof o.position === 'undefined') {o.position = {x: 0, y: 0, z: -4}}
|
|
257
261
|
if(typeof o.rotation === 'undefined') {o.rotation = {x: 0, y: 0, z: 0}}
|
|
@@ -285,18 +289,8 @@ export default class MatrixEngineWGPU {
|
|
|
285
289
|
if(typeof o.objAnim == 'undefined' || typeof o.objAnim == null) {
|
|
286
290
|
o.objAnim = null;
|
|
287
291
|
} else {
|
|
288
|
-
console.log('o.anim', o.objAnim)
|
|
289
|
-
// o.objAnim = {
|
|
290
|
-
// id: o.objAnim.id,
|
|
291
|
-
// sumOfAniFrames: o.objAnim.sumOfAniFrames,
|
|
292
|
-
// currentAni: o.objAnim.currentAni,
|
|
293
|
-
// speed: o.objAnim.speed,
|
|
294
|
-
// currentDraws: 0
|
|
295
|
-
// };
|
|
296
|
-
|
|
292
|
+
// console.log('o.anim', o.objAnim)
|
|
297
293
|
if(typeof o.objAnim.animations !== 'undefined') {
|
|
298
|
-
// o.objAnim.animation.anims = o.objAnim.animations;
|
|
299
|
-
console.log('o.o.objAnim.animations ', o.objAnim.animations )
|
|
300
294
|
o.objAnim.play = play;
|
|
301
295
|
}
|
|
302
296
|
// no need for single test it in future
|
|
@@ -314,7 +308,8 @@ export default class MatrixEngineWGPU {
|
|
|
314
308
|
}
|
|
315
309
|
}
|
|
316
310
|
}
|
|
317
|
-
let myMesh1 = new MEMeshObj(this.canvas, this.device, this.context, o)
|
|
311
|
+
let myMesh1 = new MEMeshObj(this.canvas, this.device, this.context, o);
|
|
312
|
+
myMesh1.clearColor = clearColor;
|
|
318
313
|
if(o.physics.enabled == true) {
|
|
319
314
|
this.matrixAmmo.addPhysics(myMesh1, o.physics)
|
|
320
315
|
}
|