@predy-js/render-interface 0.3.4-beta.6 → 0.3.4-beta.60

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.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.4-beta.6
5
+ * Version: v0.3.4-beta.60
6
6
  */
7
7
 
8
8
  /******************************************************************************
@@ -2620,6 +2620,15 @@ var GLTexture = /** @class */ (function () {
2620
2620
  if (target === gl_1.TEXTURE_2D) {
2621
2621
  var mipmaps = source.mipmaps;
2622
2622
  var gpuMipmaps_1 = this.gpuInfo[3];
2623
+ width_1 = mipmaps[0].width;
2624
+ height_1 = mipmaps[0].height;
2625
+ if (source.generateMipmap) {
2626
+ if ((isPowerOfTwo(width_1) && isPowerOfTwo(height_1)) || renderer.level == 2) {
2627
+ gl_1.texImage2D(target, 0, internalFormat_1, width_1, height_1, 0, format_1, type_1, null);
2628
+ gl_1.generateMipmap(target);
2629
+ this._mipmapUsed = true;
2630
+ }
2631
+ }
2623
2632
  mipmaps.forEach(function (mipmap, level) {
2624
2633
  if ('data' in mipmap) {
2625
2634
  ret_3 = _this.texImage2DData(gl_1, target, level, internalFormat_1, format_1, type_1, mipmap);
@@ -2628,15 +2637,23 @@ var GLTexture = /** @class */ (function () {
2628
2637
  ret_3 = _this.texImage2D(gl_1, target, level, internalFormat_1, format_1, type_1, mipmap);
2629
2638
  }
2630
2639
  gpuMipmaps_1[level] = [ret_3[0], ret_3[1]];
2631
- if (level === 0) {
2632
- width_1 = ret_3[0], height_1 = ret_3[1];
2633
- }
2634
2640
  });
2635
2641
  this._mipmapUsed = mipmaps.length > 1;
2636
2642
  }
2637
2643
  else if (target === gl_1.TEXTURE_CUBE_MAP) {
2638
2644
  var mipmaps = source.mipmaps;
2639
2645
  var gpuMipmaps_2 = this.gpuInfo[3];
2646
+ width_1 = mipmaps[0][0].width;
2647
+ height_1 = mipmaps[0][0].height;
2648
+ if (source.generateMipmap) {
2649
+ if ((isPowerOfTwo(width_1) && isPowerOfTwo(height_1)) || renderer.level == 2) {
2650
+ for (var cubeIndex = 0; cubeIndex < 6; ++cubeIndex) {
2651
+ gl_1.texImage2D(gl_1.TEXTURE_CUBE_MAP_POSITIVE_X + cubeIndex, 0, internalFormat_1, width_1, height_1, 0, format_1, type_1, null);
2652
+ }
2653
+ gl_1.generateMipmap(target);
2654
+ this._mipmapUsed = true;
2655
+ }
2656
+ }
2640
2657
  mipmaps.forEach(function (mipmap, level) {
2641
2658
  mipmap.forEach(function (face, key) {
2642
2659
  if ('data' in face) {
@@ -2646,12 +2663,20 @@ var GLTexture = /** @class */ (function () {
2646
2663
  ret_3 = _this.texImage2D(gl_1, gl_1.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat_1, format_1, type_1, face);
2647
2664
  }
2648
2665
  gpuMipmaps_2[level] = [ret_3[0], ret_3[1]];
2649
- if (level === 0) {
2650
- width_1 = ret_3[0], height_1 = ret_3[1];
2651
- }
2652
2666
  });
2653
2667
  });
2654
- this._mipmapUsed = mipmaps.length > 1;
2668
+ }
2669
+ if (this._mipmapUsed) {
2670
+ var mipmapSizes = [[width_1, height_1]];
2671
+ var startWidth = width_1 / 2;
2672
+ var startHeight = height_1 / 2;
2673
+ while (startWidth >= 2 && startHeight >= 2) {
2674
+ mipmapSizes.push([startWidth, startHeight]);
2675
+ startWidth = Math.round(startWidth / 2);
2676
+ startHeight = Math.round(startHeight / 2);
2677
+ }
2678
+ mipmapSizes.push([1, 1]);
2679
+ this.gpuInfo[3] = mipmapSizes;
2655
2680
  }
2656
2681
  }
2657
2682
  else if (sourceType === TextureSourceType.compressed) {
@@ -5909,7 +5934,7 @@ var MarsSharedGeometry = /** @class */ (function (_super) {
5909
5934
  return MarsSharedGeometry;
5910
5935
  }(MarsGeometry));
5911
5936
 
5912
- consoleLog('version: ' + "0.3.4-beta.6");
5937
+ consoleLog('version: ' + "0.3.4-beta.60");
5913
5938
  var ModuleMsg = 'RI Package: @predy-js/render-interface';
5914
5939
 
5915
5940
  var RI = /*#__PURE__*/Object.freeze({