matrix-engine-wgpu 1.0.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.
- package/LICENSE +21 -0
- package/REFERENCE.md +7 -0
- package/index.js +11 -0
- package/main.js +21 -0
- package/non-project-files/cubebuffer-example.js +51 -0
- package/package.json +32 -0
- package/public/app.js +6597 -0
- package/public/css/style.css +279 -0
- package/public/index.html +25 -0
- package/public/manifest.web +25 -0
- package/public/res/icons/512.png +0 -0
- package/public/res/icons/webgpu-horizontal.svg +45 -0
- package/public/res/textures/default.png +0 -0
- package/public/res/textures/rust.jpg +0 -0
- package/public/res/textures/tex1.jpg +0 -0
- package/readme.md +74 -0
- package/src/engine/ball.js +456 -0
- package/src/engine/cube.js +454 -0
- package/src/engine/matrix-class.js +171 -0
- package/src/engine/utils.js +353 -0
- package/src/libs/mat.js +0 -0
- package/src/meWGPU.js +92 -0
- package/src/shaders/shaders.js +171 -0
- package/src/shaders/standard-matrix-engine-shaders/standard-matrix-engine-fs.glsl +56 -0
- package/src/shaders/standard-matrix-engine-shaders/standard-matrix-engine-vs.glsl +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nikola
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/REFERENCE.md
ADDED
package/index.js
ADDED
package/main.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MatrixEngineWGPU from "./src/meWGPU";
|
|
2
|
+
|
|
3
|
+
let application = new MatrixEngineWGPU(()=> {
|
|
4
|
+
|
|
5
|
+
let c = {
|
|
6
|
+
position: { x: -1, y: 3, z: -10},
|
|
7
|
+
texturesPaths: ['./res/textures/rust.jpg']
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let o = {
|
|
11
|
+
position: { x: 5, y: 2, z: -10},
|
|
12
|
+
texturesPaths: ['./res/textures/rust.jpg']
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
application.addCube(c)
|
|
16
|
+
application.addBall(o)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
window.app = application
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const cubeVertexSize = 4 * 10; // Byte size of one cube vertex.
|
|
2
|
+
export const cubePositionOffset = 0;
|
|
3
|
+
export const cubeColorOffset = 4 * 4; // Byte offset of cube vertex color attribute.
|
|
4
|
+
export const cubeUVOffset = 4 * 8;
|
|
5
|
+
export const cubeVertexCount = 36;
|
|
6
|
+
|
|
7
|
+
// prettier-ignore
|
|
8
|
+
export const cubeVertexArray = new Float32Array([
|
|
9
|
+
// float4 position, float4 color, float2 uv,
|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1, 1, 1, 1, 1, 1, 1, 0, 1,
|
|
39
|
+
-1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
|
|
40
|
+
-1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
|
|
41
|
+
-1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
|
|
42
|
+
1, -1, 1, 1, 1, 0, 1, 1, 0, 0,
|
|
43
|
+
1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
|
|
44
|
+
|
|
45
|
+
1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
|
|
46
|
+
-1, -1, -1, 1, 0, 0, 0, 1, 1, 1,
|
|
47
|
+
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
|
48
|
+
1, 1, -1, 1, 1, 1, 0, 1, 0, 0,
|
|
49
|
+
1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
|
|
50
|
+
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
|
51
|
+
]);
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "matrix-engine-wgpu",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "webGPU powered pwa application.Crazy fast rendering.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"main": "watchify main.js -p [esmify --noImplicitAny] -o public/app.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"webGPU",
|
|
11
|
+
"matrix",
|
|
12
|
+
"matrix-engine",
|
|
13
|
+
"matrix-engine-webGPU",
|
|
14
|
+
"matrix-calculation",
|
|
15
|
+
"render",
|
|
16
|
+
"wgpu",
|
|
17
|
+
"zlatnaspirala",
|
|
18
|
+
"maximumroulette.com",
|
|
19
|
+
"GLSL"
|
|
20
|
+
],
|
|
21
|
+
"author": "Nikola Lukic",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"browser-resolve": "^2.0.0",
|
|
25
|
+
"browserify": "^17.0.0",
|
|
26
|
+
"esmify": "^2.1.1",
|
|
27
|
+
"watchify": "^4.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"wgpu-matrix": "^2.5.1"
|
|
31
|
+
}
|
|
32
|
+
}
|