minecraft-renderer 0.1.38 → 0.1.39

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.
@@ -7,16 +7,16 @@
7
7
  * Input: Serialized chunk data as TypedArrays
8
8
  * Output: Geometry data (positions, normals, colors, uvs, indices)
9
9
  */
10
- export function generate_geometry(section_x: number, section_y: number, section_z: number, section_height: number, world_min_y: number, world_max_y: number, block_states: Uint16Array, block_light: Uint8Array, sky_light: Uint8Array, biomes: Uint8Array, invisible_blocks: Uint16Array, transparent_blocks: Uint16Array, no_ao_blocks: Uint16Array, cull_identical_blocks: Uint16Array, occluding_blocks: Uint16Array, enable_lighting: boolean, smooth_lighting: boolean, sky_light_value: number): any;
10
+ export function generate_geometry(section_x: number, section_y: number, section_z: number, section_height: number, world_min_y: number, world_max_y: number, section_data_start_y: number, block_states: Uint16Array, block_light: Uint8Array, sky_light: Uint8Array, biomes: Uint8Array, invisible_blocks: Uint16Array, transparent_blocks: Uint16Array, no_ao_blocks: Uint16Array, cull_identical_blocks: Uint16Array, occluding_blocks: Uint16Array, enable_lighting: boolean, smooth_lighting: boolean, sky_light_value: number): any;
11
11
 
12
- export function generate_geometry_multi(section_x: number, section_y: number, section_z: number, section_height: number, world_min_y: number, world_max_y: number, chunk_xs: Int32Array, chunk_zs: Int32Array, block_states: Uint16Array, block_light: Uint8Array, sky_light: Uint8Array, biomes: Uint8Array, invisible_blocks: Uint16Array, transparent_blocks: Uint16Array, no_ao_blocks: Uint16Array, cull_identical_blocks: Uint16Array, occluding_blocks: Uint16Array, enable_lighting: boolean, smooth_lighting: boolean, sky_light_value: number): any;
12
+ export function generate_geometry_multi(section_x: number, section_y: number, section_z: number, section_height: number, world_min_y: number, world_max_y: number, section_data_start_y: number, chunk_xs: Int32Array, chunk_zs: Int32Array, block_states: Uint16Array, block_light: Uint8Array, sky_light: Uint8Array, biomes: Uint8Array, invisible_blocks: Uint16Array, transparent_blocks: Uint16Array, no_ao_blocks: Uint16Array, cull_identical_blocks: Uint16Array, occluding_blocks: Uint16Array, enable_lighting: boolean, smooth_lighting: boolean, sky_light_value: number): any;
13
13
 
14
14
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
15
15
 
16
16
  export interface InitOutput {
17
17
  readonly memory: WebAssembly.Memory;
18
- readonly generate_geometry: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number) => any;
19
- readonly generate_geometry_multi: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number) => any;
18
+ readonly generate_geometry: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number) => any;
19
+ readonly generate_geometry_multi: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number) => any;
20
20
  readonly __wbindgen_malloc: (a: number, b: number) => number;
21
21
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
22
22
  readonly __wbindgen_externrefs: WebAssembly.Table;
@@ -1,15 +1,5 @@
1
1
  let wasm;
2
2
 
3
- function _assertBoolean(n) {
4
- if (typeof(n) !== 'boolean') {
5
- throw new Error(`expected a boolean argument, found ${typeof(n)}`);
6
- }
7
- }
8
-
9
- function _assertNum(n) {
10
- if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
11
- }
12
-
13
3
  function debugString(val) {
14
4
  // primitive types
15
5
  const type = typeof val;
@@ -112,22 +102,6 @@ function getUint8ArrayMemory0() {
112
102
  return cachedUint8ArrayMemory0;
113
103
  }
114
104
 
115
- function logError(f, args) {
116
- try {
117
- return f.apply(this, args);
118
- } catch (e) {
119
- let error = (function () {
120
- try {
121
- return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
122
- } catch(_) {
123
- return "<failed to stringify thrown value>";
124
- }
125
- }());
126
- console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
127
- throw e;
128
- }
129
- }
130
-
131
105
  function passArray16ToWasm0(arg, malloc) {
132
106
  const ptr = malloc(arg.length * 2, 2) >>> 0;
133
107
  getUint16ArrayMemory0().set(arg, ptr / 2);
@@ -150,7 +124,6 @@ function passArray8ToWasm0(arg, malloc) {
150
124
  }
151
125
 
152
126
  function passStringToWasm0(arg, malloc, realloc) {
153
- if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
154
127
  if (realloc === undefined) {
155
128
  const buf = cachedTextEncoder.encode(arg);
156
129
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -178,7 +151,7 @@ function passStringToWasm0(arg, malloc, realloc) {
178
151
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
179
152
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
180
153
  const ret = cachedTextEncoder.encodeInto(arg, view);
181
- if (ret.read !== arg.length) throw new Error('failed to pass whole string');
154
+
182
155
  offset += ret.written;
183
156
  ptr = realloc(ptr, len, offset, 1) >>> 0;
184
157
  }
@@ -227,6 +200,7 @@ let WASM_VECTOR_LEN = 0;
227
200
  * @param {number} section_height
228
201
  * @param {number} world_min_y
229
202
  * @param {number} world_max_y
203
+ * @param {number} section_data_start_y
230
204
  * @param {Uint16Array} block_states
231
205
  * @param {Uint8Array} block_light
232
206
  * @param {Uint8Array} sky_light
@@ -241,13 +215,7 @@ let WASM_VECTOR_LEN = 0;
241
215
  * @param {number} sky_light_value
242
216
  * @returns {any}
243
217
  */
244
- export function generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
245
- _assertNum(section_x);
246
- _assertNum(section_y);
247
- _assertNum(section_z);
248
- _assertNum(section_height);
249
- _assertNum(world_min_y);
250
- _assertNum(world_max_y);
218
+ export function generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
251
219
  const ptr0 = passArray16ToWasm0(block_states, wasm.__wbindgen_malloc);
252
220
  const len0 = WASM_VECTOR_LEN;
253
221
  const ptr1 = passArray8ToWasm0(block_light, wasm.__wbindgen_malloc);
@@ -266,10 +234,7 @@ export function generate_geometry(section_x, section_y, section_z, section_heigh
266
234
  const len7 = WASM_VECTOR_LEN;
267
235
  const ptr8 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
268
236
  const len8 = WASM_VECTOR_LEN;
269
- _assertBoolean(enable_lighting);
270
- _assertBoolean(smooth_lighting);
271
- _assertNum(sky_light_value);
272
- const ret = wasm.generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, enable_lighting, smooth_lighting, sky_light_value);
237
+ const ret = wasm.generate_geometry(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, enable_lighting, smooth_lighting, sky_light_value);
273
238
  return ret;
274
239
  }
275
240
 
@@ -280,6 +245,7 @@ export function generate_geometry(section_x, section_y, section_z, section_heigh
280
245
  * @param {number} section_height
281
246
  * @param {number} world_min_y
282
247
  * @param {number} world_max_y
248
+ * @param {number} section_data_start_y
283
249
  * @param {Int32Array} chunk_xs
284
250
  * @param {Int32Array} chunk_zs
285
251
  * @param {Uint16Array} block_states
@@ -296,13 +262,7 @@ export function generate_geometry(section_x, section_y, section_z, section_heigh
296
262
  * @param {number} sky_light_value
297
263
  * @returns {any}
298
264
  */
299
- export function generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, chunk_xs, chunk_zs, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
300
- _assertNum(section_x);
301
- _assertNum(section_y);
302
- _assertNum(section_z);
303
- _assertNum(section_height);
304
- _assertNum(world_min_y);
305
- _assertNum(world_max_y);
265
+ export function generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, chunk_xs, chunk_zs, block_states, block_light, sky_light, biomes, invisible_blocks, transparent_blocks, no_ao_blocks, cull_identical_blocks, occluding_blocks, enable_lighting, smooth_lighting, sky_light_value) {
306
266
  const ptr0 = passArray32ToWasm0(chunk_xs, wasm.__wbindgen_malloc);
307
267
  const len0 = WASM_VECTOR_LEN;
308
268
  const ptr1 = passArray32ToWasm0(chunk_zs, wasm.__wbindgen_malloc);
@@ -325,10 +285,7 @@ export function generate_geometry_multi(section_x, section_y, section_z, section
325
285
  const len9 = WASM_VECTOR_LEN;
326
286
  const ptr10 = passArray16ToWasm0(occluding_blocks, wasm.__wbindgen_malloc);
327
287
  const len10 = WASM_VECTOR_LEN;
328
- _assertBoolean(enable_lighting);
329
- _assertBoolean(smooth_lighting);
330
- _assertNum(sky_light_value);
331
- const ret = wasm.generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, enable_lighting, smooth_lighting, sky_light_value);
288
+ const ret = wasm.generate_geometry_multi(section_x, section_y, section_z, section_height, world_min_y, world_max_y, section_data_start_y, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, enable_lighting, smooth_lighting, sky_light_value);
332
289
  return ret;
333
290
  }
334
291
 
@@ -367,10 +324,10 @@ async function __wbg_load(module, imports) {
367
324
  function __wbg_get_imports() {
368
325
  const imports = {};
369
326
  imports.wbg = {};
370
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function() { return logError(function (arg0, arg1) {
327
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
371
328
  const ret = Error(getStringFromWasm0(arg0, arg1));
372
329
  return ret;
373
- }, arguments) };
330
+ };
374
331
  imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
375
332
  const ret = debugString(arg1);
376
333
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -381,35 +338,35 @@ function __wbg_get_imports() {
381
338
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
382
339
  throw new Error(getStringFromWasm0(arg0, arg1));
383
340
  };
384
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() { return logError(function () {
341
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
385
342
  const ret = new Object();
386
343
  return ret;
387
- }, arguments) };
388
- imports.wbg.__wbg_new_25f239778d6112b9 = function() { return logError(function () {
344
+ };
345
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
389
346
  const ret = new Array();
390
347
  return ret;
391
- }, arguments) };
392
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function() { return logError(function (arg0, arg1, arg2) {
348
+ };
349
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
393
350
  arg0[arg1] = arg2;
394
- }, arguments) };
395
- imports.wbg.__wbg_set_7df433eea03a5c14 = function() { return logError(function (arg0, arg1, arg2) {
351
+ };
352
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
396
353
  arg0[arg1 >>> 0] = arg2;
397
- }, arguments) };
398
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function() { return logError(function (arg0, arg1) {
354
+ };
355
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
399
356
  // Cast intrinsic for `Ref(String) -> Externref`.
400
357
  const ret = getStringFromWasm0(arg0, arg1);
401
358
  return ret;
402
- }, arguments) };
403
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function() { return logError(function (arg0) {
359
+ };
360
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
404
361
  // Cast intrinsic for `U64 -> Externref`.
405
362
  const ret = BigInt.asUintN(64, arg0);
406
363
  return ret;
407
- }, arguments) };
408
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function() { return logError(function (arg0) {
364
+ };
365
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
409
366
  // Cast intrinsic for `F64 -> Externref`.
410
367
  const ret = arg0;
411
368
  return ret;
412
- }, arguments) };
369
+ };
413
370
  imports.wbg.__wbindgen_init_externref_table = function() {
414
371
  const table = wasm.__wbindgen_externrefs;
415
372
  const offset = table.grow(4);
Binary file
@@ -0,0 +1,9 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const generate_geometry: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number) => any;
5
+ export const generate_geometry_multi: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number) => any;
6
+ export const __wbindgen_malloc: (a: number, b: number) => number;
7
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
+ export const __wbindgen_externrefs: WebAssembly.Table;
9
+ export const __wbindgen_start: () => void;