@pixagram/renderart 0.4.5 → 1.0.0

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.
Files changed (47) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +171 -67
  3. package/dist/crt-gpu.d.ts +30 -0
  4. package/dist/crt-gpu.d.ts.map +1 -0
  5. package/dist/crt-gpu.js +282 -0
  6. package/dist/crt-gpu.js.map +1 -0
  7. package/dist/hex-gpu.d.ts +35 -0
  8. package/dist/hex-gpu.d.ts.map +1 -0
  9. package/dist/hex-gpu.js +382 -0
  10. package/dist/hex-gpu.js.map +1 -0
  11. package/dist/index.d.ts +21 -300
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +36 -963
  14. package/dist/index.js.map +1 -1
  15. package/dist/types.d.ts +84 -0
  16. package/dist/types.d.ts.map +1 -0
  17. package/dist/types.js +7 -0
  18. package/dist/types.js.map +1 -0
  19. package/dist/wasm-wrapper.d.ts +71 -0
  20. package/dist/wasm-wrapper.d.ts.map +1 -0
  21. package/dist/wasm-wrapper.js +76 -0
  22. package/dist/wasm-wrapper.js.map +1 -0
  23. package/dist/xbrz-gpu.d.ts +34 -0
  24. package/dist/xbrz-gpu.d.ts.map +1 -0
  25. package/dist/xbrz-gpu.js +640 -0
  26. package/dist/xbrz-gpu.js.map +1 -0
  27. package/package.json +48 -35
  28. package/src/crt-gpu.ts +313 -0
  29. package/src/hex-gpu.ts +426 -0
  30. package/src/index.ts +52 -0
  31. package/src/types.ts +90 -0
  32. package/src/wasm/crt.rs +181 -0
  33. package/src/wasm/hex.rs +324 -0
  34. package/src/wasm/lib.rs +285 -0
  35. package/src/wasm/xbrz.rs +262 -0
  36. package/src/wasm-wrapper.ts +195 -0
  37. package/src/xbrz-gpu.ts +671 -0
  38. package/dist/index.d.mts +0 -305
  39. package/dist/index.mjs +0 -948
  40. package/dist/index.mjs.map +0 -1
  41. package/pkg/LICENSE +0 -21
  42. package/pkg/README.md +0 -117
  43. package/pkg/renderart_wasm.d.ts +0 -52
  44. package/pkg/renderart_wasm.js +0 -5
  45. package/pkg/renderart_wasm_bg.js +0 -283
  46. package/pkg/renderart_wasm_bg.wasm +0 -0
  47. package/pkg/renderart_wasm_bg.wasm.d.ts +0 -24
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Hexagonal GPU Renderer using WebGL2
3
+ *
4
+ * High-performance hexagonal pixel grid transformation using fragment shaders.
5
+ */
6
+ // Vertex shader
7
+ const VERTEX_SHADER = `#version 300 es
8
+ layout(location = 0) in vec2 position;
9
+ out vec2 vUv;
10
+
11
+ void main() {
12
+ vUv = position * 0.5 + 0.5;
13
+ gl_Position = vec4(position, 0.0, 1.0);
14
+ }`;
15
+ // Fragment shader for hexagonal rendering
16
+ const FRAGMENT_SHADER = `#version 300 es
17
+ precision highp float;
18
+
19
+ uniform sampler2D uTex;
20
+ uniform vec2 uOutputRes;
21
+ uniform vec2 uInputRes;
22
+ uniform float uScale;
23
+ uniform int uOrientation; // 0 = flat-top, 1 = pointy-top
24
+ uniform int uDrawBorders;
25
+ uniform vec4 uBorderColor;
26
+ uniform float uBorderThickness;
27
+ uniform vec4 uBackgroundColor;
28
+
29
+ in vec2 vUv;
30
+ out vec4 outColor;
31
+
32
+ const float SQRT3 = 1.732050808;
33
+ const float INV_SQRT3 = 0.577350269;
34
+
35
+ // Convert output pixel to hex coordinate (flat-top)
36
+ vec2 pixelToHexFlat(vec2 pos, float scale) {
37
+ float hSpacing = scale * 1.5;
38
+ float vSpacing = scale * SQRT3;
39
+
40
+ float col = pos.x / hSpacing;
41
+ int colInt = int(floor(col));
42
+
43
+ // Check if odd column (offset)
44
+ bool isOffset = (colInt & 1) == 1;
45
+ float yOffset = isOffset ? vSpacing * 0.5 : 0.0;
46
+
47
+ float row = (pos.y - yOffset) / vSpacing;
48
+ int rowInt = int(floor(row));
49
+
50
+ // Refine with corner detection
51
+ float cellX = pos.x - float(colInt) * hSpacing;
52
+ float cellY = pos.y - float(rowInt) * vSpacing - yOffset;
53
+
54
+ float quarterW = scale * 0.5;
55
+ float halfH = vSpacing * 0.5;
56
+
57
+ if (cellX < quarterW) {
58
+ float distFromCenter = abs(cellY - halfH);
59
+ float edgeX = distFromCenter * INV_SQRT3;
60
+
61
+ if (cellX < quarterW - edgeX) {
62
+ if (cellY < halfH) {
63
+ rowInt -= 1;
64
+ }
65
+ colInt -= 1;
66
+ }
67
+ }
68
+
69
+ return vec2(float(colInt), float(rowInt));
70
+ }
71
+
72
+ // Convert output pixel to hex coordinate (pointy-top)
73
+ vec2 pixelToHexPointy(vec2 pos, float scale) {
74
+ float hSpacing = scale * SQRT3;
75
+ float vSpacing = scale * 1.5;
76
+
77
+ float row = pos.y / vSpacing;
78
+ int rowInt = int(floor(row));
79
+
80
+ // Check if odd row (offset)
81
+ bool isOffset = (rowInt & 1) == 1;
82
+ float xOffset = isOffset ? hSpacing * 0.5 : 0.0;
83
+
84
+ float col = (pos.x - xOffset) / hSpacing;
85
+ int colInt = int(floor(col));
86
+
87
+ // Refine with corner detection
88
+ float cellX = pos.x - float(colInt) * hSpacing - xOffset;
89
+ float cellY = pos.y - float(rowInt) * vSpacing;
90
+
91
+ float halfW = hSpacing * 0.5;
92
+ float quarterH = scale * 0.5;
93
+
94
+ if (cellY < quarterH) {
95
+ float distFromCenter = abs(cellX - halfW);
96
+ float edgeY = distFromCenter * SQRT3;
97
+
98
+ if (cellY < edgeY) {
99
+ if (cellX < halfW && isOffset) {
100
+ colInt -= 1;
101
+ }
102
+ rowInt -= 1;
103
+ }
104
+ }
105
+
106
+ return vec2(float(colInt), float(rowInt));
107
+ }
108
+
109
+ // Check if pixel is on hex border
110
+ bool isBorderPixel(vec2 pos, float scale, int orientation, float thickness) {
111
+ for (float dy = -thickness; dy <= thickness; dy += 1.0) {
112
+ for (float dx = -thickness; dx <= thickness; dx += 1.0) {
113
+ if (dx == 0.0 && dy == 0.0) continue;
114
+
115
+ vec2 h1 = orientation == 0
116
+ ? pixelToHexFlat(pos, scale)
117
+ : pixelToHexPointy(pos, scale);
118
+ vec2 h2 = orientation == 0
119
+ ? pixelToHexFlat(pos + vec2(dx, dy), scale)
120
+ : pixelToHexPointy(pos + vec2(dx, dy), scale);
121
+
122
+ if (h1 != h2) return true;
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+
128
+ void main() {
129
+ vec2 pixelPos = vUv * uOutputRes;
130
+
131
+ // Get hex coordinate
132
+ vec2 hexCoord = uOrientation == 0
133
+ ? pixelToHexFlat(pixelPos, uScale)
134
+ : pixelToHexPointy(pixelPos, uScale);
135
+
136
+ // Check bounds
137
+ if (hexCoord.x < 0.0 || hexCoord.y < 0.0 ||
138
+ hexCoord.x >= uInputRes.x || hexCoord.y >= uInputRes.y) {
139
+ outColor = uBackgroundColor;
140
+ return;
141
+ }
142
+
143
+ // Check for border
144
+ if (uDrawBorders == 1 && uBorderThickness > 0.0) {
145
+ if (isBorderPixel(pixelPos, uScale, uOrientation, uBorderThickness)) {
146
+ outColor = uBorderColor;
147
+ return;
148
+ }
149
+ }
150
+
151
+ // Sample source pixel (add 0.5 for pixel center)
152
+ vec2 texCoord = (hexCoord + 0.5) / uInputRes;
153
+ outColor = texture(uTex, texCoord);
154
+ }`;
155
+ /** Parse color from CSS string or number */
156
+ function parseColor(color, defaultColor) {
157
+ if (color === undefined)
158
+ return defaultColor;
159
+ if (typeof color === 'number') {
160
+ return [
161
+ ((color >> 24) & 0xFF) / 255,
162
+ ((color >> 16) & 0xFF) / 255,
163
+ ((color >> 8) & 0xFF) / 255,
164
+ (color & 0xFF) / 255,
165
+ ];
166
+ }
167
+ // Parse CSS color
168
+ if (color === 'transparent')
169
+ return [0, 0, 0, 0];
170
+ // Parse hex color
171
+ if (color.startsWith('#')) {
172
+ const hex = color.slice(1);
173
+ if (hex.length === 6) {
174
+ return [
175
+ parseInt(hex.slice(0, 2), 16) / 255,
176
+ parseInt(hex.slice(2, 4), 16) / 255,
177
+ parseInt(hex.slice(4, 6), 16) / 255,
178
+ 1,
179
+ ];
180
+ }
181
+ if (hex.length === 8) {
182
+ return [
183
+ parseInt(hex.slice(0, 2), 16) / 255,
184
+ parseInt(hex.slice(2, 4), 16) / 255,
185
+ parseInt(hex.slice(4, 6), 16) / 255,
186
+ parseInt(hex.slice(6, 8), 16) / 255,
187
+ ];
188
+ }
189
+ }
190
+ return defaultColor;
191
+ }
192
+ /** Calculate output dimensions for hex rendering */
193
+ export function hexGetDimensions(srcWidth, srcHeight, scale, orientation = 'flat-top') {
194
+ const SQRT3 = 1.732050808;
195
+ if (orientation === 'flat-top') {
196
+ const hSpacing = scale * 1.5;
197
+ const vSpacing = scale * SQRT3;
198
+ const cellWidth = scale * 2;
199
+ const cellHeight = scale * SQRT3;
200
+ return {
201
+ width: Math.ceil(srcWidth * hSpacing + cellWidth),
202
+ height: Math.ceil(srcHeight * vSpacing + cellHeight),
203
+ };
204
+ }
205
+ else {
206
+ const hSpacing = scale * SQRT3;
207
+ const vSpacing = scale * 1.5;
208
+ const cellWidth = scale * SQRT3;
209
+ const cellHeight = scale * 2;
210
+ return {
211
+ width: Math.ceil(srcWidth * hSpacing + cellWidth),
212
+ height: Math.ceil(srcHeight * vSpacing + cellHeight),
213
+ };
214
+ }
215
+ }
216
+ /** HEX GPU Renderer */
217
+ export class HexGpuRenderer {
218
+ gl = null;
219
+ canvas = null;
220
+ program = null;
221
+ texture = null;
222
+ uniforms = {};
223
+ initialized = false;
224
+ currentCanvasSize = { width: 0, height: 0 };
225
+ currentTexSize = { width: 0, height: 0 };
226
+ /** Create a new HEX GPU renderer */
227
+ static create() {
228
+ const renderer = new HexGpuRenderer();
229
+ renderer.init();
230
+ return renderer;
231
+ }
232
+ init() {
233
+ if (typeof OffscreenCanvas === 'undefined') {
234
+ throw new Error('OffscreenCanvas not supported');
235
+ }
236
+ this.canvas = new OffscreenCanvas(1, 1);
237
+ this.gl = this.canvas.getContext('webgl2', {
238
+ alpha: true,
239
+ premultipliedAlpha: false,
240
+ desynchronized: true,
241
+ powerPreference: 'high-performance',
242
+ antialias: false,
243
+ });
244
+ if (!this.gl) {
245
+ throw new Error('WebGL2 not supported');
246
+ }
247
+ const gl = this.gl;
248
+ // Create shaders
249
+ const vs = this.createShader(gl.VERTEX_SHADER, VERTEX_SHADER);
250
+ const fs = this.createShader(gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
251
+ // Create program
252
+ this.program = gl.createProgram();
253
+ gl.attachShader(this.program, vs);
254
+ gl.attachShader(this.program, fs);
255
+ gl.linkProgram(this.program);
256
+ if (!gl.getProgramParameter(this.program, gl.LINK_STATUS)) {
257
+ throw new Error('Shader program link failed: ' + gl.getProgramInfoLog(this.program));
258
+ }
259
+ gl.useProgram(this.program);
260
+ // Get uniform locations
261
+ this.uniforms = {
262
+ uTex: gl.getUniformLocation(this.program, 'uTex'),
263
+ uOutputRes: gl.getUniformLocation(this.program, 'uOutputRes'),
264
+ uInputRes: gl.getUniformLocation(this.program, 'uInputRes'),
265
+ uScale: gl.getUniformLocation(this.program, 'uScale'),
266
+ uOrientation: gl.getUniformLocation(this.program, 'uOrientation'),
267
+ uDrawBorders: gl.getUniformLocation(this.program, 'uDrawBorders'),
268
+ uBorderColor: gl.getUniformLocation(this.program, 'uBorderColor'),
269
+ uBorderThickness: gl.getUniformLocation(this.program, 'uBorderThickness'),
270
+ uBackgroundColor: gl.getUniformLocation(this.program, 'uBackgroundColor'),
271
+ };
272
+ gl.uniform1i(this.uniforms.uTex, 0);
273
+ // Setup geometry
274
+ const buf = gl.createBuffer();
275
+ gl.bindBuffer(gl.ARRAY_BUFFER, buf);
276
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);
277
+ gl.enableVertexAttribArray(0);
278
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
279
+ // Create texture
280
+ this.texture = gl.createTexture();
281
+ gl.bindTexture(gl.TEXTURE_2D, this.texture);
282
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
283
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
284
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
285
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
286
+ gl.clearColor(0.0, 0.0, 0.0, 0.0);
287
+ this.initialized = true;
288
+ }
289
+ createShader(type, source) {
290
+ const gl = this.gl;
291
+ const shader = gl.createShader(type);
292
+ gl.shaderSource(shader, source);
293
+ gl.compileShader(shader);
294
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
295
+ const info = gl.getShaderInfoLog(shader);
296
+ gl.deleteShader(shader);
297
+ throw new Error('Shader compile failed: ' + info);
298
+ }
299
+ return shader;
300
+ }
301
+ /** Check if renderer is ready */
302
+ isReady() {
303
+ return this.initialized;
304
+ }
305
+ /** Render hexagonal effect */
306
+ render(input, options = {}) {
307
+ if (!this.initialized || !this.gl || !this.canvas) {
308
+ throw new Error('Renderer not initialized');
309
+ }
310
+ const gl = this.gl;
311
+ const data = input instanceof ImageData ? input.data : input.data;
312
+ const width = input.width;
313
+ const height = input.height;
314
+ const scale = Math.min(32, Math.max(2, options.scale ?? 16));
315
+ const orientation = options.orientation ?? 'flat-top';
316
+ const { width: outWidth, height: outHeight } = hexGetDimensions(width, height, scale, orientation);
317
+ // Resize canvas if needed
318
+ if (this.currentCanvasSize.width !== outWidth || this.currentCanvasSize.height !== outHeight) {
319
+ this.canvas.width = outWidth;
320
+ this.canvas.height = outHeight;
321
+ this.currentCanvasSize = { width: outWidth, height: outHeight };
322
+ gl.viewport(0, 0, outWidth, outHeight);
323
+ }
324
+ // Update uniforms
325
+ gl.uniform2f(this.uniforms.uOutputRes, outWidth, outHeight);
326
+ gl.uniform2f(this.uniforms.uInputRes, width, height);
327
+ gl.uniform1f(this.uniforms.uScale, scale);
328
+ gl.uniform1i(this.uniforms.uOrientation, orientation === 'flat-top' ? 0 : 1);
329
+ gl.uniform1i(this.uniforms.uDrawBorders, options.drawBorders ? 1 : 0);
330
+ gl.uniform1f(this.uniforms.uBorderThickness, options.borderThickness ?? 1);
331
+ const borderColor = parseColor(options.borderColor, [0.16, 0.16, 0.16, 1]);
332
+ gl.uniform4f(this.uniforms.uBorderColor, ...borderColor);
333
+ const bgColor = parseColor(options.backgroundColor, [0, 0, 0, 0]);
334
+ gl.uniform4f(this.uniforms.uBackgroundColor, ...bgColor);
335
+ // Update texture
336
+ gl.bindTexture(gl.TEXTURE_2D, this.texture);
337
+ if (this.currentTexSize.width !== width || this.currentTexSize.height !== height) {
338
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
339
+ this.currentTexSize = { width, height };
340
+ }
341
+ else {
342
+ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, data);
343
+ }
344
+ // Render
345
+ gl.clear(gl.COLOR_BUFFER_BIT);
346
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
347
+ // Read pixels
348
+ const pixels = new Uint8ClampedArray(outWidth * outHeight * 4);
349
+ gl.readPixels(0, 0, outWidth, outHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
350
+ return {
351
+ data: pixels,
352
+ width: outWidth,
353
+ height: outHeight,
354
+ };
355
+ }
356
+ /** Dispose resources */
357
+ dispose() {
358
+ if (this.gl) {
359
+ if (this.texture)
360
+ this.gl.deleteTexture(this.texture);
361
+ if (this.program)
362
+ this.gl.deleteProgram(this.program);
363
+ this.gl = null;
364
+ }
365
+ this.canvas = null;
366
+ this.initialized = false;
367
+ }
368
+ }
369
+ /** HEX presets */
370
+ export const HEX_PRESETS = {
371
+ default: {},
372
+ bordered: {
373
+ drawBorders: true,
374
+ borderColor: '#282828',
375
+ borderThickness: 1,
376
+ },
377
+ pointy: {
378
+ orientation: 'pointy-top',
379
+ drawBorders: false,
380
+ },
381
+ };
382
+ //# sourceMappingURL=hex-gpu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hex-gpu.js","sourceRoot":"","sources":["../src/hex-gpu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,gBAAgB;AAChB,MAAM,aAAa,GAAG;;;;;;;EAOpB,CAAC;AAEH,0CAA0C;AAC1C,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0ItB,CAAC;AAEH,4CAA4C;AAC5C,SAAS,UAAU,CAAC,KAAkC,EAAE,YAA8C;IACpG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC;IAE7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACL,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;YAC5B,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;YAC5B,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;YAC3B,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG;SACrB,CAAC;IACJ,CAAC;IAED,kBAAkB;IAClB,IAAI,KAAK,KAAK,aAAa;QAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAEjD,kBAAkB;IAClB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,GAAG,CAA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