@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.js 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
  'use strict';
@@ -2624,6 +2624,15 @@ var GLTexture = /** @class */ (function () {
2624
2624
  if (target === gl_1.TEXTURE_2D) {
2625
2625
  var mipmaps = source.mipmaps;
2626
2626
  var gpuMipmaps_1 = this.gpuInfo[3];
2627
+ width_1 = mipmaps[0].width;
2628
+ height_1 = mipmaps[0].height;
2629
+ if (source.generateMipmap) {
2630
+ if ((isPowerOfTwo(width_1) && isPowerOfTwo(height_1)) || renderer.level == 2) {
2631
+ gl_1.texImage2D(target, 0, internalFormat_1, width_1, height_1, 0, format_1, type_1, null);
2632
+ gl_1.generateMipmap(target);
2633
+ this._mipmapUsed = true;
2634
+ }
2635
+ }
2627
2636
  mipmaps.forEach(function (mipmap, level) {
2628
2637
  if ('data' in mipmap) {
2629
2638
  ret_3 = _this.texImage2DData(gl_1, target, level, internalFormat_1, format_1, type_1, mipmap);
@@ -2632,15 +2641,23 @@ var GLTexture = /** @class */ (function () {
2632
2641
  ret_3 = _this.texImage2D(gl_1, target, level, internalFormat_1, format_1, type_1, mipmap);
2633
2642
  }
2634
2643
  gpuMipmaps_1[level] = [ret_3[0], ret_3[1]];
2635
- if (level === 0) {
2636
- width_1 = ret_3[0], height_1 = ret_3[1];
2637
- }
2638
2644
  });
2639
2645
  this._mipmapUsed = mipmaps.length > 1;
2640
2646
  }
2641
2647
  else if (target === gl_1.TEXTURE_CUBE_MAP) {
2642
2648
  var mipmaps = source.mipmaps;
2643
2649
  var gpuMipmaps_2 = this.gpuInfo[3];
2650
+ width_1 = mipmaps[0][0].width;
2651
+ height_1 = mipmaps[0][0].height;
2652
+ if (source.generateMipmap) {
2653
+ if ((isPowerOfTwo(width_1) && isPowerOfTwo(height_1)) || renderer.level == 2) {
2654
+ for (var cubeIndex = 0; cubeIndex < 6; ++cubeIndex) {
2655
+ gl_1.texImage2D(gl_1.TEXTURE_CUBE_MAP_POSITIVE_X + cubeIndex, 0, internalFormat_1, width_1, height_1, 0, format_1, type_1, null);
2656
+ }
2657
+ gl_1.generateMipmap(target);
2658
+ this._mipmapUsed = true;
2659
+ }
2660
+ }
2644
2661
  mipmaps.forEach(function (mipmap, level) {
2645
2662
  mipmap.forEach(function (face, key) {
2646
2663
  if ('data' in face) {
@@ -2650,12 +2667,20 @@ var GLTexture = /** @class */ (function () {
2650
2667
  ret_3 = _this.texImage2D(gl_1, gl_1.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat_1, format_1, type_1, face);
2651
2668
  }
2652
2669
  gpuMipmaps_2[level] = [ret_3[0], ret_3[1]];
2653
- if (level === 0) {
2654
- width_1 = ret_3[0], height_1 = ret_3[1];
2655
- }
2656
2670
  });
2657
2671
  });
2658
- this._mipmapUsed = mipmaps.length > 1;
2672
+ }
2673
+ if (this._mipmapUsed) {
2674
+ var mipmapSizes = [[width_1, height_1]];
2675
+ var startWidth = width_1 / 2;
2676
+ var startHeight = height_1 / 2;
2677
+ while (startWidth >= 2 && startHeight >= 2) {
2678
+ mipmapSizes.push([startWidth, startHeight]);
2679
+ startWidth = Math.round(startWidth / 2);
2680
+ startHeight = Math.round(startHeight / 2);
2681
+ }
2682
+ mipmapSizes.push([1, 1]);
2683
+ this.gpuInfo[3] = mipmapSizes;
2659
2684
  }
2660
2685
  }
2661
2686
  else if (sourceType === exports.TextureSourceType.compressed) {
@@ -5913,7 +5938,7 @@ var MarsSharedGeometry = /** @class */ (function (_super) {
5913
5938
  return MarsSharedGeometry;
5914
5939
  }(MarsGeometry));
5915
5940
 
5916
- consoleLog('version: ' + "0.3.4-beta.6");
5941
+ consoleLog('version: ' + "0.3.4-beta.60");
5917
5942
  var ModuleMsg = 'RI Package: @predy-js/render-interface';
5918
5943
 
5919
5944
  var RI = /*#__PURE__*/Object.freeze({