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.
@@ -0,0 +1,279 @@
1
+
2
+ @font-face {
3
+ font-family: stormfaze;
4
+ src: url(../res/fonts/stormfaze.ttf);
5
+ }
6
+
7
+ @font-face {
8
+ font-family: wargames;
9
+ src: url(../res/fonts/wargames.ttf);
10
+ }
11
+
12
+ body {
13
+ color: lime;
14
+ background-color:black;
15
+ font-family: "Courier New";
16
+ font-size: 14px;
17
+ background-color: black;
18
+ margin: 0;
19
+ padding: 0;
20
+ overflow: hidden;
21
+ text-align: center;
22
+ }
23
+
24
+
25
+ .noselection {
26
+ -webkit-touch-callout: none; /* Safari */
27
+ user-select: none; /* standard syntax */
28
+ -webkit-user-select: none; /* webkit (safari, chrome) browsers */
29
+ -moz-user-select: none; /* mozilla browsers */
30
+ -khtml-user-select: none; /* webkit (konqueror) browsers */
31
+ -ms-user-select: none; /* IE10+ */
32
+ }
33
+
34
+ *::-webkit-media-controls-panel {
35
+ display: none !important;
36
+ -webkit-appearance: none;
37
+ }
38
+
39
+ /* Old shadow dom for play button */
40
+ *::-webkit-media-controls-play-button {
41
+ display: none !important;
42
+ -webkit-appearance: none;
43
+ }
44
+
45
+ /* This one works! */
46
+ *::-webkit-media-controls-start-playback-button {
47
+ display: none !important;
48
+ -webkit-appearance: none;
49
+ }
50
+
51
+ ::-webkit-scrollbar {
52
+ width: 5px;
53
+ }
54
+
55
+ ::-webkit-scrollbar-track {
56
+ box-shadow: inset 0 0 5px rgb(102, 102, 102);
57
+ border-radius: 8px;
58
+ }
59
+
60
+ body::-webkit-scrollbar-thumb {
61
+ background: rgba(0, 0, 0, 0.1);
62
+ border-radius: 9px;
63
+ }
64
+
65
+ body::-webkit-scrollbar-thumb:hover {
66
+ background: rgba(0, 0, 0, 0.6);
67
+ }
68
+
69
+
70
+ textarea:focus, input:focus {
71
+ outline: none;
72
+ }
73
+
74
+ a {
75
+ font-family: "Courier New";
76
+ color: #0080ff;
77
+ }
78
+
79
+ iframe {
80
+ border: none;
81
+ }
82
+
83
+ .noselect {
84
+ -webkit-touch-callout: none; /* iOS Safari */
85
+ -webkit-user-select: none; /* Safari */
86
+ -khtml-user-select: none; /* Konqueror HTML */
87
+ -moz-user-select: none; /* Old versions of Firefox */
88
+ -ms-user-select: none; /* Internet Explorer/Edge */
89
+ user-select: none; /* Non-prefixed version, currently
90
+ supported by Chrome, Edge, Opera and Firefox */
91
+ }
92
+
93
+ #matrix-editor {
94
+ position: absolute;
95
+ left: 0;
96
+ top:0;
97
+ width: 400px;
98
+ }
99
+
100
+ .btnShadow {
101
+ /* -webkit-box-shadow: inset 0px 1px 0px 0px rgb(52, 253, 189);
102
+ -moz-box-shadow: inset 0px 1px 0px 0px rgb(52, 253, 189);
103
+ box-shadow: inset 0px 1px 0px 0px rgb(52, 253, 189); */
104
+ cursor: pointer;
105
+ /* color: rgb(0, 255, 10);
106
+ text-shadow: 0px 0px 7px #80ffe0; */
107
+ font-family: stormfaze;
108
+ }
109
+
110
+ div.btnShadow:hover {
111
+ opacity: 1;
112
+ background-color: rgb(78, 255, 190);
113
+ color:rgb(0, 0, 0);
114
+ text-shadow: 0px 0px 20px #0dfdc1;
115
+ }
116
+
117
+ .debugBox {
118
+ position:absolute;
119
+ left:5px;
120
+ bottom:0;
121
+ font-size: 12px;
122
+ width:200px;
123
+ height: 15px;
124
+ background-color: black;
125
+ color: lime;
126
+ }
127
+
128
+ .textEditor {
129
+ font-size: 10px;
130
+ width : 100%;
131
+ max-width: 850px !important;
132
+ min-width: 550px !important;
133
+ }
134
+
135
+ textarea {
136
+ -webkit-box-shadow: inset 0px 0px 22px 2px rgba(0,255,30,1);
137
+ -moz-box-shadow: inset 0px 0px 22px 2px rgba(0,255,30,1);
138
+ box-shadow: inset 0px 0px 22px 1px rgba(0,255,30,1);
139
+ background-color: black;
140
+ color: lime;
141
+ }
142
+
143
+ .textureCanvas2d {
144
+ display:none;
145
+ position:absolute;
146
+ left:-3000px;
147
+ top:0px;
148
+ width:512px;
149
+ height:512px;
150
+ }
151
+
152
+ .add-button {
153
+ text-align: center;
154
+ text-decoration: none;
155
+ display: inline-block;
156
+ font-size: 16px;
157
+ margin: 2px 2px;
158
+ transition-duration: 0.4s;
159
+ cursor: pointer;
160
+ width:100%;
161
+ width: -webkit-fill-available;
162
+ height:30%;
163
+ background-color: rgb(27, 27, 27);
164
+ font-family: "stormfaze";
165
+ border-radius: 15px;
166
+ }
167
+
168
+ .button1 {
169
+ background-color: rgb(27, 27, 27);;
170
+ color: rgb(255, 255, 255);
171
+ border: 2px solid #80004b;
172
+ }
173
+
174
+ .button1:hover {
175
+ background-color: #710243;
176
+ color: white;
177
+ }
178
+
179
+ .button2 {
180
+ background-color: rgb(27, 27, 27);;
181
+ color: white;
182
+ border: 2px solid #4CAF50;
183
+ }
184
+
185
+ .button2:hover {
186
+ background-color: #95af4c;
187
+ color: white;
188
+ }
189
+
190
+ /** Style for UI system hud controls */
191
+
192
+ .matrixTagHolder {
193
+ display:flex;
194
+ flex-direction: column;
195
+ position: absolute;
196
+ left:0;top:0;
197
+ background-color: black;
198
+ color: #0080ff;
199
+ font-family: stormfaze;
200
+ }
201
+
202
+ span {
203
+ cursor: default;
204
+ width: 100px;
205
+ }
206
+
207
+ .mLightInput {
208
+ width: 150px;
209
+ font-size: 26px;
210
+ }
211
+
212
+ .mLightCom {
213
+ display: flex;
214
+ flex-direction: row;
215
+ text-align: center;
216
+ align-items: center;
217
+ border: solid #0c2540 3px;
218
+ }
219
+
220
+ #matrix-net {
221
+ position: absolute;
222
+ display: none;
223
+ right: 0;
224
+ height: 100%;
225
+ width: 40vh;
226
+ font-family: stormfaze;
227
+ background-color: crimson;
228
+ }
229
+
230
+ .timeLine {
231
+ display: flex;
232
+ position: absolute;
233
+ left: 5%;
234
+ top:85%;
235
+ width:90%;
236
+ flex-direction: column;
237
+ }
238
+
239
+
240
+ .timeLineSlider {
241
+ display:flex;
242
+ flex-direction: row;
243
+ }
244
+ .timeLineSlider, p {
245
+ background: rgba(12, 122, 22, 0.5);
246
+ width:100%;
247
+ margin: 5px 5px 5px 5px;
248
+ }
249
+
250
+ /* For animation Line */
251
+ .slider {
252
+ -webkit-appearance: none;
253
+ width: 100%;
254
+ height: 15px;
255
+ border-radius: 5px;
256
+ background: #d3d3d3;
257
+ outline: none;
258
+ opacity: 0.7;
259
+ -webkit-transition: .2s;
260
+ transition: opacity .2s;
261
+ }
262
+
263
+ .slider::-webkit-slider-thumb {
264
+ -webkit-appearance: none;
265
+ appearance: none;
266
+ width: 25px;
267
+ height: 25px;
268
+ border-radius: 50%;
269
+ background: #04AA6D;
270
+ cursor: pointer;
271
+ }
272
+
273
+ .slider::-moz-range-thumb {
274
+ width: 25px;
275
+ height: 25px;
276
+ border-radius: 50%;
277
+ background: #04AA6D;
278
+ cursor: pointer;
279
+ }
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <link rel="manifest" href="manifest.web" />
5
+ <title>Matrix Engine webGPU variant. Created by Nikola Lukic zlatnaspirala@gmail.com </title>
6
+ <meta name="description" content="The benefits of this project is offering an overview of the entire application logic, easy native implementations (hybrid app), object structural. " />
7
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
8
+ <link defer rel="stylesheet" href="css/style.css" />
9
+ <link rel="apple-touch-icon" href="res/icons/512.png" />
10
+ <meta name="apple-mobile-web-app-capable" content="yes" />
11
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
12
+ <meta name="theme-color" content="#000000" />
13
+ <!-- <script defer src="./lib/gl-matrix-min.js"></script> -->
14
+ <meta name="viewport" content="width=device-width,initial-scale=1.0,minimal-ui" />
15
+ <!-- <link rel="icon" type="image/png" sizes="96x96" href="res/icons/favicon-96x96.png" /> -->
16
+ <link rel="icon" type="image/png" sizes="512x512" href="res/icons/512.png" />
17
+ <!-- <link rel="icon" href="res/icons/favicon.ico" type="image/x-icon" /> -->
18
+ <!-- <meta name="msapplication-TileImage" content="res/icons/ms-icon.png" /> -->
19
+ <!-- <script src="https://webglfundamentals.org/webgl/resources/m4.js"></script> -->
20
+ </head>
21
+ <body allow="autoplay">
22
+ <div id="shaders"></div>
23
+ <script src="app.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "Matrix Engine wGpu",
3
+ "short_name": "matrix-wgpu",
4
+ "start_url": "build.html",
5
+ "orientation": "any",
6
+ "theme_color": "lime",
7
+ "background_color": "black",
8
+ "description": "Welcome here !",
9
+ "display": "standalone",
10
+ "lang": "en-US",
11
+ "icons": [
12
+ {
13
+ "src": "res/icons/512.png",
14
+ "sizes": "512x512",
15
+ "type": "image/png",
16
+ "purpose": "any maskable"
17
+ }
18
+ ],
19
+ "author": {
20
+ "name": "Nikola Lukic",
21
+ "website": "https://maximumroulette.com",
22
+ "github": "https://github.com/zlatnaspirala",
23
+ "source-repo": "https://github.com/zlatnaspirala/matrix-engine"
24
+ }
25
+ }
Binary file
@@ -0,0 +1,45 @@
1
+ <svg id="Logo" xmlns="http://www.w3.org/2000/svg" width="932" height="315" viewBox="0 0 932 315">
2
+ <defs>
3
+ <style>
4
+ .cls-1, .cls-2, .cls-3, .cls-4, .cls-5 {
5
+ fill-rule: evenodd;
6
+ stroke-linejoin: round;
7
+ }
8
+
9
+ .cls-6 {
10
+ fill-rule: evenodd;
11
+ }
12
+
13
+ .cls-1 {
14
+ fill: #005a9c;
15
+ stroke: #005a9c;
16
+ }
17
+
18
+ .cls-2 {
19
+ fill: #0066b0;
20
+ stroke: #0066b0;
21
+ }
22
+
23
+ .cls-3 {
24
+ fill: #0076cc;
25
+ stroke: #0076cc;
26
+ }
27
+
28
+ .cls-4 {
29
+ fill: #0086e8;
30
+ stroke: #0086e8;
31
+ }
32
+
33
+ .cls-5 {
34
+ fill: #0093ff;
35
+ stroke: #0093ff;
36
+ }
37
+ </style>
38
+ </defs>
39
+ <path id="Triangle_4" data-name="Triangle 4" class="cls-4" d="m298.4 134.84-24.6-42.609h49.269z"/>
40
+ <path id="Triangle_5" data-name="Triangle 5" class="cls-5" d="m298.4 49.619-24.6 42.609h49.269z"/>
41
+ <path id="Triangle_3" data-name="Triangle 3" class="cls-3" d="m249.2 220.06-49.2-85.218 98.4-8.1e-4z"/>
42
+ <path id="Triangle_2" data-name="Triangle 2" class="cls-2" d="m249.2 49.619-49.2 85.218 98.4-8.1e-4z"/>
43
+ <path id="Triangle_1" data-name="Triangle 1" class="cls-1" d="m150.8 220.06-98.4-170.44h196.8z"/>
44
+ <path id="WebGPU" class="cls-6" d="M397.927,170a46.383,46.383,0,0,0-5.459-22.594A39.579,39.579,0,0,0,376.929,131.7a46.217,46.217,0,0,0-23.182-5.711,47.758,47.758,0,0,0-23.77,5.8,40.1,40.1,0,0,0-16.042,16.547q-5.714,10.752-5.712,25.029t5.88,25.114a41.6,41.6,0,0,0,16.21,16.714,46.512,46.512,0,0,0,23.434,5.88q16.461,0,27.55-8.315a39.574,39.574,0,0,0,14.782-21.586H379.617a24.465,24.465,0,0,1-9.323,12.347q-6.639,4.621-16.547,4.619a29.643,29.643,0,0,1-20.578-7.643q-8.484-7.642-9.323-21.25h73.577a89.923,89.923,0,0,0,.5-9.239h0Zm-15.791-3.192H324.014q1.173-13.1,9.323-20.494a28.334,28.334,0,0,1,19.738-7.391,32.751,32.751,0,0,1,14.7,3.275,25.147,25.147,0,0,1,10.5,9.575,28.21,28.21,0,0,1,3.863,15.035h0Zm51.235-22.174V95.246H418.084V219.554h15.287V202.588a35.4,35.4,0,0,0,13.523,13.27,40.941,40.941,0,0,0,20.914,5.208,41.875,41.875,0,0,0,37.964-23.014,52.851,52.851,0,0,0,5.712-24.862q0-14.111-5.712-24.777a41.653,41.653,0,0,0-15.622-16.547,42.965,42.965,0,0,0-22.342-5.879,40.763,40.763,0,0,0-20.662,5.207,36.146,36.146,0,0,0-13.775,13.439h0Zm62.49,28.557a38.312,38.312,0,0,1-4.2,18.4,29.535,29.535,0,0,1-11.338,11.927,30.887,30.887,0,0,1-15.707,4.115,30.558,30.558,0,0,1-15.539-4.115,30.072,30.072,0,0,1-11.422-11.927,40.557,40.557,0,0,1,0-36.285,30.092,30.092,0,0,1,11.422-11.927,30.578,30.578,0,0,1,15.539-4.115,31.4,31.4,0,0,1,15.707,4.031,29.1,29.1,0,0,1,11.338,11.759,37.449,37.449,0,0,1,4.2,18.142h0ZM638.647,136.4a52.884,52.884,0,0,0-20.914-26.038q-14.362-9.236-33.009-9.239a59.092,59.092,0,0,0-29.733,7.643,55.959,55.959,0,0,0-21.25,21.334,61.09,61.09,0,0,0-7.812,30.826,60.623,60.623,0,0,0,7.812,30.741,56.1,56.1,0,0,0,21.25,21.25,59.062,59.062,0,0,0,29.733,7.643,56.956,56.956,0,0,0,28.053-6.971A56.042,56.042,0,0,0,633.1,194.608a58.17,58.17,0,0,0,9.071-26.457V156.392H579.181v12.431h46.7q-1.849,17.472-12.935,27.717t-28.221,10.247a43.634,43.634,0,0,1-22.09-5.627,39.861,39.861,0,0,1-15.454-16.043q-5.631-10.413-5.628-24.189t5.628-24.274a39.769,39.769,0,0,1,15.454-16.127,43.654,43.654,0,0,1,22.09-5.627,40.52,40.52,0,0,1,21.5,5.627A36.445,36.445,0,0,1,620.337,136.4h18.31Zm101.967,0.336q0-15.118-10.332-24.694t-30.153-9.575h-37.8V219.554h15.286V170.671h22.51q20.493,0,30.489-9.659t10-24.274h0Zm-40.485,21.334h-22.51v-43h22.51q24.859,0,24.862,21.67,0,10.248-6.047,15.79t-18.815,5.544h0Zm59.13-55.6v73.913q0,14.614,5.795,24.61a36.391,36.391,0,0,0,15.791,14.866,54.05,54.05,0,0,0,44.852,0,36.911,36.911,0,0,0,15.874-14.866q5.878-9.993,5.88-24.61V102.469H832.164V176.55q0,15.623-7.643,23.182t-21.082,7.559q-13.606,0-21.25-7.559t-7.643-23.182V102.469H759.259Z"/>
45
+ </svg>
Binary file
Binary file
Binary file
package/readme.md ADDED
@@ -0,0 +1,74 @@
1
+ # matrix-wgpu
2
+ ## [underconstruct - not fully operative for now - deeply WIP]
3
+ ## Author Nikola Lukic zlatnaspirala@gmail.com 2024
4
+
5
+
6
+ ## Logo:
7
+
8
+ <img width="350" height="350" src="https://github.com/zlatnaspirala/matrix-engine-wgpu/blob/main/public/res/icons/512.png?raw=true" />
9
+
10
+ ### In logo i used webGPU logo from:
11
+ <span>WebGPU logo by <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a></span>.
12
+ The logos are licensed under Creative Commons Attribution 4.0 International.
13
+ Download from https://www.w3.org/2023/02/webgpu-logos.html
14
+
15
+ Used npm package `wgpu-matrix` for replacment of glmatrix library.
16
+
17
+ I publish (this repo) npm package with name `matrix-engine-wgpu`.
18
+
19
+
20
+ ## Objective
21
+ - scene objects feature [objects/scene/transformation]
22
+ - Make it similar to the matrix-engine webGL features.
23
+
24
+ For now i will use `createRenderBundleEncoder` for multi object scene draws.
25
+
26
+ Main instance script:
27
+ ```js
28
+ let application = new MatrixEngineWGPU(()=> {
29
+
30
+ let c = {
31
+ position: { x: -5, y: 3, z: -10}
32
+ };
33
+
34
+ let o = {
35
+ position: { x: 5, y: 2, z: -10}
36
+ };
37
+
38
+ application.addCube(c)
39
+ application.addBall(o)
40
+
41
+ })
42
+ ```
43
+
44
+ Not the best solution but works for now.
45
+ Next level is draw in one scene different shaders different pipline...
46
+
47
+ System draws func:
48
+ ```js
49
+ frame = () => {
50
+ let commandEncoder = this.device.createCommandEncoder();
51
+ this.rbContainer = [];
52
+
53
+ let passEncoder;
54
+
55
+ this.mainRenderBundle.forEach((meItem, index) => {
56
+ meItem.draw();
57
+ this.rbContainer.push(meItem.renderBundle)
58
+ if(index == 0) passEncoder = commandEncoder.beginRenderPass(meItem.renderPassDescriptor);
59
+ })
60
+
61
+ // passEncoder.executeBundles([NIK.renderBundle, NIK2.renderBundle]);
62
+ passEncoder.executeBundles(this.rbContainer);
63
+ passEncoder.end();
64
+ this.device.queue.submit([commandEncoder.finish()]);
65
+
66
+ requestAnimationFrame(this.frame);
67
+ }
68
+ ```
69
+
70
+ ## LICENCE
71
+
72
+ - MIT LICENCE - Nikola Lukic zlatnaspirala@gmail.com 2024
73
+ - Structural shema for project and personal learning inspired by:
74
+ https://webgpu.github.io/webgpu-samples/samples/renderBundles