@quake2ts/test-utils 0.0.773 → 0.0.774

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/dist/index.cjs CHANGED
@@ -6003,6 +6003,7 @@ __export(index_exports, {
6003
6003
  createBinaryStreamMock: () => createBinaryStreamMock,
6004
6004
  createBinaryWriterMock: () => createBinaryWriterMock,
6005
6005
  createBounds: () => createBounds,
6006
+ createCheckerboardTexture: () => createCheckerboardTexture,
6006
6007
  createCombatTestContext: () => createCombatTestContext,
6007
6008
  createComputeTestSetup: () => createComputeTestSetup,
6008
6009
  createConfigStringArrayMock: () => createConfigStringArrayMock,
@@ -6150,6 +6151,7 @@ __export(index_exports, {
6150
6151
  createRenderTestSetup: () => createRenderTestSetup,
6151
6152
  createSaveGameSnapshot: () => createSaveGameSnapshot,
6152
6153
  createServerSnapshot: () => createServerSnapshot,
6154
+ createSolidTexture: () => createSolidTexture,
6153
6155
  createSpawnTestContext: () => createSpawnTestContext,
6154
6156
  createStorageTestScenario: () => createStorageTestScenario,
6155
6157
  createSurfaceMock: () => createSurfaceMock,
@@ -8958,7 +8960,9 @@ function createHeadlessWebGL(options = {}) {
8958
8960
  // Needed for readback
8959
8961
  stencil: true,
8960
8962
  depth: true,
8961
- alpha: true
8963
+ alpha: true,
8964
+ webgl2: true
8965
+ // Request WebGL 2.0 context for GLSL 3.00 ES support
8962
8966
  });
8963
8967
  if (!glContext) {
8964
8968
  throw new Error("Failed to create headless WebGL context");
@@ -10307,6 +10311,37 @@ async function testComputeShader(name, createComputePipeline, inputData, expecte
10307
10311
  }
10308
10312
  }
10309
10313
 
10314
+ // src/engine/helpers/textures.ts
10315
+ function createCheckerboardTexture(width, height, checkSize = 32, color1 = [1, 1, 1, 1], color2 = [0, 0, 0, 1]) {
10316
+ const data = new Uint8ClampedArray(width * height * 4);
10317
+ for (let y = 0; y < height; y++) {
10318
+ for (let x = 0; x < width; x++) {
10319
+ const isCheck = (Math.floor(x / checkSize) + Math.floor(y / checkSize)) % 2 === 0;
10320
+ const color = isCheck ? color1 : color2;
10321
+ const idx = (y * width + x) * 4;
10322
+ data[idx] = Math.round(color[0] * 255);
10323
+ data[idx + 1] = Math.round(color[1] * 255);
10324
+ data[idx + 2] = Math.round(color[2] * 255);
10325
+ data[idx + 3] = Math.round(color[3] * 255);
10326
+ }
10327
+ }
10328
+ return data;
10329
+ }
10330
+ function createSolidTexture(width, height, color) {
10331
+ const data = new Uint8ClampedArray(width * height * 4);
10332
+ const r = Math.round(color[0] * 255);
10333
+ const g = Math.round(color[1] * 255);
10334
+ const b = Math.round(color[2] * 255);
10335
+ const a = Math.round(color[3] * 255);
10336
+ for (let i = 0; i < data.length; i += 4) {
10337
+ data[i] = r;
10338
+ data[i + 1] = g;
10339
+ data[i + 2] = b;
10340
+ data[i + 3] = a;
10341
+ }
10342
+ return data;
10343
+ }
10344
+
10310
10345
  // src/client/helpers/view.ts
10311
10346
  var import_gl_matrix = require("gl-matrix");
10312
10347
  var import_engine8 = require("@quake2ts/engine");
@@ -11189,6 +11224,7 @@ function createVisualTestScenario(sceneName) {
11189
11224
  createBinaryStreamMock,
11190
11225
  createBinaryWriterMock,
11191
11226
  createBounds,
11227
+ createCheckerboardTexture,
11192
11228
  createCombatTestContext,
11193
11229
  createComputeTestSetup,
11194
11230
  createConfigStringArrayMock,
@@ -11336,6 +11372,7 @@ function createVisualTestScenario(sceneName) {
11336
11372
  createRenderTestSetup,
11337
11373
  createSaveGameSnapshot,
11338
11374
  createServerSnapshot,
11375
+ createSolidTexture,
11339
11376
  createSpawnTestContext,
11340
11377
  createStorageTestScenario,
11341
11378
  createSurfaceMock,