matrix-engine-wgpu 1.0.4 → 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.
- package/REFERENCE.md +8 -0
- package/examples/load-obj-file.js +1 -8
- package/main.js +39 -20
- package/package.json +35 -41
- package/public/ammojs/ammo.js +957 -0
- package/public/ammojs/ammo.wasm.js +921 -0
- package/public/ammojs/ammo.wasm.wasm +0 -0
- package/public/app.js +607 -154
- package/public/css/style.css +6 -3
- package/public/empty.js +466 -84
- package/public/examples.js +466 -84
- package/public/index.html +4 -4
- package/public/res/fonts/Accuratist.ttf +0 -0
- package/public/res/fonts/Closeness.ttf +0 -0
- package/public/res/fonts/WARGAMES.TTF +0 -0
- package/public/res/fonts/readme.txt +5 -0
- package/public/res/fonts/stormfaze.ttf +0 -0
- package/public/res/meshes/blender/cube.blend +0 -0
- package/public/res/meshes/blender/cube.blend1 +0 -0
- package/public/res/meshes/blender/cube.mtl +12 -0
- package/public/res/meshes/blender/cube.obj +46 -0
- package/public/res/meshes/blender/cube.png +0 -0
- package/public/res/meshes/blender/cubeSmartUV.blend +0 -0
- package/public/res/meshes/blender/cubeSmartUV.mtl +12 -0
- package/public/res/meshes/blender/cubeSmartUV.obj +46 -0
- package/public/res/meshes/blender/lopta.mtl +10 -0
- package/public/res/meshes/blender/lopta.obj +3402 -0
- package/public/res/meshes/blender/sphepe.blend +0 -0
- package/public/res/meshes/blender/sphepe.blend1 +0 -0
- package/public/res/meshes/blender/sphere.mtl +10 -0
- package/public/res/meshes/blender/sphere.obj +3402 -0
- package/readme.md +161 -45
- package/src/engine/ball.js +3 -3
- package/src/engine/cube.js +3 -3
- package/src/engine/engine.js +2 -4
- package/src/engine/matrix-class.js +11 -6
- package/src/engine/mesh-obj.js +33 -35
- package/src/engine/mesh.js +4 -5
- package/src/engine/utils.js +347 -46
- package/src/physics/matrix-ammo.js +140 -0
- package/src/world.js +80 -84
- package/src/engine/matrix-mesh.js +0 -49
package/REFERENCE.md
CHANGED
|
@@ -51,3 +51,11 @@ Most examples that have one render pass set loadOp: 'clear' but in the example a
|
|
|
51
51
|
YEs this is happening " would erase the results from render pass 1 "
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
|
|
55
|
+
# https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
|
|
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
|
-
|
|
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,38 +1,57 @@
|
|
|
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({
|
|
5
|
-
useSingleRenderPass:
|
|
6
|
-
canvasSize: 'fullscreen'
|
|
6
|
+
useSingleRenderPass: true,
|
|
7
|
+
canvasSize: 'fullscreen',
|
|
8
|
+
mainCameraParams: {
|
|
9
|
+
type: 'WASD',
|
|
10
|
+
responseCoef: 1000
|
|
11
|
+
}
|
|
7
12
|
}, () => {
|
|
8
|
-
function onLoadObj(m) {
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
addEventListener('AmmoReady', () => {
|
|
15
|
+
downloadMeshes({
|
|
16
|
+
welcomeText: "./res/meshes/blender/piramyd.obj",
|
|
17
|
+
armor: "./res/meshes/obj/armor.obj",
|
|
18
|
+
sphere: "./res/meshes/blender/sphere.obj",
|
|
19
|
+
cube: "./res/meshes/blender/cube.obj",
|
|
20
|
+
}, onLoadObj)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
function onLoadObj(m) {
|
|
24
|
+
application.myLoadedMeshes = m;
|
|
25
|
+
for(var key in m) {
|
|
26
|
+
console.log(`%c Loaded objs: ${key} `, LOG_MATRIX);
|
|
27
|
+
}
|
|
11
28
|
|
|
12
29
|
application.addMeshObj({
|
|
13
|
-
position: {x:
|
|
30
|
+
position: {x: 0, y: 2, z: -10},
|
|
14
31
|
rotation: {x: 0, y: 0, z: 0},
|
|
15
|
-
rotationSpeed: {x: 0, y:
|
|
16
|
-
texturesPaths: ['./res/meshes/
|
|
17
|
-
name: '
|
|
18
|
-
mesh: m.
|
|
32
|
+
rotationSpeed: {x: 0, y: 0, z: 0},
|
|
33
|
+
texturesPaths: ['./res/meshes/blender/cube.png'],
|
|
34
|
+
name: 'CubePhysics',
|
|
35
|
+
mesh: m.cube,
|
|
36
|
+
physics: {
|
|
37
|
+
enabled: true,
|
|
38
|
+
geometry: "Cube"
|
|
39
|
+
}
|
|
19
40
|
})
|
|
20
41
|
|
|
21
42
|
application.addMeshObj({
|
|
22
|
-
position: {x:
|
|
23
|
-
rotation: {x:
|
|
43
|
+
position: {x: 0, y: 2, z: -10},
|
|
44
|
+
rotation: {x: 0, y: 0, z: 0},
|
|
24
45
|
rotationSpeed: {x: 0, y: 0, z: 0},
|
|
25
|
-
texturesPaths: ['./res/meshes/
|
|
26
|
-
name: '
|
|
27
|
-
mesh: m.
|
|
46
|
+
texturesPaths: ['./res/meshes/blender/cube.png'],
|
|
47
|
+
name: 'SpherePhysics',
|
|
48
|
+
mesh: m.sphere,
|
|
49
|
+
physics: {
|
|
50
|
+
enabled: true,
|
|
51
|
+
geometry: "Sphere"
|
|
52
|
+
}
|
|
28
53
|
})
|
|
29
54
|
}
|
|
30
|
-
|
|
31
|
-
downloadMeshes({
|
|
32
|
-
welcomeText: "./res/meshes/blender/piramyd.obj",
|
|
33
|
-
armor: "./res/meshes/obj/armor.obj"
|
|
34
|
-
}, onLoadObj)
|
|
35
|
-
|
|
36
55
|
})
|
|
37
56
|
|
|
38
57
|
window.app = application
|
package/package.json
CHANGED
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "matrix-engine-wgpu",
|
|
3
|
-
"version": "1.0.
|
|
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
|
-
"
|
|
17
|
-
"matrix",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
}
|