@predy-js/render-interface 0.3.0-beta.24 → 0.3.0-beta.241
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 +70 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -35
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/MarsMaterialDataBlock.d.ts +3 -3
- package/dist/src/render/MarsRenderer.d.ts +1 -0
- package/dist/src/render/MarsTextureFactory.d.ts +1 -1
- package/dist/src/webgl/GLProgram.d.ts +2 -3
- package/dist/src/webgl/KhronosTextureContainer.d.ts +3 -3
- package/dist/src/webgl/constants.d.ts +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/Material.d.ts +4 -3
- package/dist/types/Renderer.d.ts +4 -0
- package/dist/types/Texture.d.ts +6 -5
- package/dist/types/native/DataBlockInternal.d.ts +8 -4
- package/dist/types/native/PredyNativeInternal.d.ts +52 -20
- package/dist/types/native/RendererInternal.d.ts +6 -1
- package/dist/types/native/TextureInternal.d.ts +6 -2
- package/package.json +1 -1
- package/types/Material.ts +4 -3
- package/types/Renderer.ts +4 -0
- package/types/Texture.ts +42 -41
- package/types/native/DataBlockInternal.ts +9 -4
- package/types/native/PredyNativeInternal.ts +67 -25
- package/types/native/RendererInternal.ts +6 -1
- package/types/native/TextureInternal.ts +6 -2
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.0-beta.
|
5
|
+
* Version: v0.3.0-beta.241
|
6
6
|
*/
|
7
7
|
|
8
8
|
'use strict';
|
@@ -158,21 +158,48 @@ var GPUBufferOptionsMemoryShared = 1 << 1;
|
|
158
158
|
var _a$6, _b$3;
|
159
159
|
// @ts-expect-error safe to assign
|
160
160
|
var constants = {};
|
161
|
-
{
|
162
|
-
|
163
|
-
copy(WebGL2RenderingContext);
|
164
|
-
}
|
165
|
-
else if (typeof WebGLRenderingContext !== 'undefined') {
|
166
|
-
copy(WebGLRenderingContext);
|
167
|
-
copy(WebGLRenderingContext.prototype);
|
168
|
-
}
|
169
|
-
else {
|
170
|
-
//ios 16 lockdown mode
|
171
|
-
consoleError('WebGL not in global');
|
172
|
-
}
|
161
|
+
if (typeof WebGL2RenderingContext === 'function') {
|
162
|
+
copy(WebGL2RenderingContext);
|
173
163
|
}
|
174
|
-
|
175
|
-
|
164
|
+
else if (typeof WebGLRenderingContext !== 'undefined') {
|
165
|
+
copy(WebGLRenderingContext);
|
166
|
+
copy(WebGLRenderingContext.prototype);
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
//ios 16 lockdown mode
|
170
|
+
consoleError('WebGL not in global');
|
171
|
+
}
|
172
|
+
Object.assign(constants, {
|
173
|
+
HALF_FLOAT: 5131,
|
174
|
+
COMPRESSED_RGBA_ASTC_4x4_KHR: 0x93B0,
|
175
|
+
COMPRESSED_RGBA_ASTC_5x4_KHR: 0x93B1,
|
176
|
+
COMPRESSED_RGBA_ASTC_5x5_KHR: 0x93B2,
|
177
|
+
COMPRESSED_RGBA_ASTC_6x5_KHR: 0x93B3,
|
178
|
+
COMPRESSED_RGBA_ASTC_6x6_KHR: 0x93B4,
|
179
|
+
COMPRESSED_RGBA_ASTC_8x5_KHR: 0x93B5,
|
180
|
+
COMPRESSED_RGBA_ASTC_8x6_KHR: 0x93B6,
|
181
|
+
COMPRESSED_RGBA_ASTC_8x8_KHR: 0x93B7,
|
182
|
+
COMPRESSED_RGBA_ASTC_10x5_KHR: 0x93B8,
|
183
|
+
COMPRESSED_RGBA_ASTC_10x6_KHR: 0x93B9,
|
184
|
+
COMPRESSED_RGBA_ASTC_10x8_KHR: 0x93BA,
|
185
|
+
COMPRESSED_RGBA_ASTC_10x10_KHR: 0x93BB,
|
186
|
+
COMPRESSED_RGBA_ASTC_12x10_KHR: 0x93BC,
|
187
|
+
COMPRESSED_RGBA_ASTC_12x12_KHR: 0x93BD,
|
188
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: 0x93D0,
|
189
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: 0x93D1,
|
190
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: 0x93D2,
|
191
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: 0x93D3,
|
192
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: 0x93D4,
|
193
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: 0x93D5,
|
194
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: 0x93D6,
|
195
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: 0x93D7,
|
196
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: 0x93D8,
|
197
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: 0x93D9,
|
198
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: 0x93DA,
|
199
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: 0x93DB,
|
200
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: 0x93DC,
|
201
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: 0x93DD,
|
202
|
+
});
|
176
203
|
function copy(target) {
|
177
204
|
for (var name_1 in target) {
|
178
205
|
if (/^[A-Z_]/.test(name_1)) {
|
@@ -1795,13 +1822,18 @@ var GLProgram = /** @class */ (function () {
|
|
1795
1822
|
}
|
1796
1823
|
};
|
1797
1824
|
GLProgram.prototype.getSemanticValue = function (state, semanticName) {
|
1798
|
-
|
1799
|
-
|
1800
|
-
if (renderPassSemantics.hasSemanticValue(semanticName)) {
|
1801
|
-
return renderPassSemantics.getSemanticValue(semanticName, state);
|
1825
|
+
if (typeof semanticName === 'function') {
|
1826
|
+
return semanticName(state);
|
1802
1827
|
}
|
1803
|
-
else
|
1804
|
-
|
1828
|
+
else {
|
1829
|
+
var renderPassSemantics = state.currentPass.semantics;
|
1830
|
+
var renderFrameSemantics = state.currentFrame.semantics;
|
1831
|
+
if (renderPassSemantics.hasSemanticValue(semanticName)) {
|
1832
|
+
return renderPassSemantics.getSemanticValue(semanticName, state);
|
1833
|
+
}
|
1834
|
+
else if (renderFrameSemantics.hasSemanticValue(semanticName)) {
|
1835
|
+
return renderFrameSemantics.getSemanticValue(semanticName, state);
|
1836
|
+
}
|
1805
1837
|
}
|
1806
1838
|
};
|
1807
1839
|
GLProgram.prototype.setupUniforms = function (state) {
|
@@ -3121,6 +3153,11 @@ var PredyResourceCacheStatus;
|
|
3121
3153
|
PredyResourceCacheStatus[PredyResourceCacheStatus["cached"] = 1] = "cached";
|
3122
3154
|
PredyResourceCacheStatus[PredyResourceCacheStatus["preloaded"] = 2] = "preloaded";
|
3123
3155
|
})(PredyResourceCacheStatus || (PredyResourceCacheStatus = {}));
|
3156
|
+
var PredyTextEncoding;
|
3157
|
+
(function (PredyTextEncoding) {
|
3158
|
+
PredyTextEncoding[PredyTextEncoding["utf8"] = 0] = "utf8";
|
3159
|
+
PredyTextEncoding[PredyTextEncoding["ascii"] = 1] = "ascii";
|
3160
|
+
})(PredyTextEncoding || (PredyTextEncoding = {}));
|
3124
3161
|
|
3125
3162
|
var GLRenderBuffer = /** @class */ (function () {
|
3126
3163
|
function GLRenderBuffer(renderer, options) {
|
@@ -3574,7 +3611,7 @@ var COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
|
|
3574
3611
|
var TEX_2D = 2; // uses a gl.texImage2D()
|
3575
3612
|
//const TEX_3D = 3; // uses a gl.texImage3D()
|
3576
3613
|
var KhronosTextureContainer = /** @class */ (function () {
|
3577
|
-
function KhronosTextureContainer(arrayBuffer,
|
3614
|
+
function KhronosTextureContainer(arrayBuffer, baseOffset) {
|
3578
3615
|
if (baseOffset === void 0) { baseOffset = 0; }
|
3579
3616
|
this.arrayBuffer = arrayBuffer;
|
3580
3617
|
this.baseOffset = baseOffset;
|
@@ -3594,9 +3631,9 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3594
3631
|
identifier[9] !== 0x0a ||
|
3595
3632
|
identifier[10] !== 0x1a ||
|
3596
3633
|
identifier[11] !== 0x0a) {
|
3597
|
-
throw Error('texture missing KTX identifier');
|
3634
|
+
throw Error('texture missing KTX 1.1 identifier');
|
3598
3635
|
}
|
3599
|
-
// load the reset of the header in native
|
3636
|
+
// load the reset of the header in native 32 bit uint
|
3600
3637
|
var dataSize = Uint32Array.BYTES_PER_ELEMENT;
|
3601
3638
|
var headerDataView = new DataView(this.arrayBuffer, this.baseOffset + 12, 13 * dataSize);
|
3602
3639
|
var endianness = headerDataView.getUint32(0, true);
|
@@ -3616,15 +3653,11 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3616
3653
|
// value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
|
3617
3654
|
this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
|
3618
3655
|
if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
|
3619
|
-
consoleWarn('only 2D textures currently supported');
|
3656
|
+
//consoleWarn('only 2D textures currently supported');
|
3620
3657
|
return;
|
3621
3658
|
}
|
3622
3659
|
if (this.numberOfArrayElements !== 0) {
|
3623
|
-
consoleWarn('texture arrays not currently supported');
|
3624
|
-
return;
|
3625
|
-
}
|
3626
|
-
if (this.numberOfFaces !== facesExpected) {
|
3627
|
-
consoleWarn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);
|
3660
|
+
//consoleWarn('texture arrays not currently supported');
|
3628
3661
|
return;
|
3629
3662
|
}
|
3630
3663
|
// we now have a completely validated file, so could use existence of loadType as success
|
@@ -3663,14 +3696,14 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3663
3696
|
return KhronosTextureContainer;
|
3664
3697
|
}());
|
3665
3698
|
function getCompressedTextureOptions(data) {
|
3666
|
-
var ktx = new KhronosTextureContainer(data
|
3699
|
+
var ktx = new KhronosTextureContainer(data);
|
3667
3700
|
var useMipmaps = ktx.numberOfMipmapLevels >= Math.floor(Math.log2(Math.max(ktx.pixelWidth, ktx.pixelHeight)) + 1);
|
3668
3701
|
return {
|
3669
3702
|
sourceType: exports.TextureSourceType.compressed,
|
3670
|
-
type:
|
3703
|
+
type: constants.UNSIGNED_BYTE,
|
3671
3704
|
target: ktx.numberOfFaces === 6 ? constants.TEXTURE_CUBE_MAP : constants.TEXTURE_2D,
|
3705
|
+
format: ktx.glInternalFormat,
|
3672
3706
|
internalFormat: ktx.glInternalFormat,
|
3673
|
-
format: ktx.glFormat,
|
3674
3707
|
mipmaps: ktx.mipmaps(useMipmaps),
|
3675
3708
|
};
|
3676
3709
|
}
|
@@ -4486,10 +4519,10 @@ var GLMaterial = /** @class */ (function () {
|
|
4486
4519
|
webGLState.depthFunc(currentState.depthFunc);
|
4487
4520
|
webGLState.depthRange((_a = currentState.depthRange) === null || _a === void 0 ? void 0 : _a[0], (_b = currentState.depthRange) === null || _b === void 0 ? void 0 : _b[1]);
|
4488
4521
|
}
|
4522
|
+
webGLState.frontFace(currentState.frontFace);
|
4489
4523
|
if (currentState.cullFaceEnabled) {
|
4490
4524
|
//face
|
4491
4525
|
webGLState.cullFace(currentState.cullFace);
|
4492
|
-
webGLState.frontFace(currentState.frontFace);
|
4493
4526
|
}
|
4494
4527
|
if (currentState.polygonOffsetFill) {
|
4495
4528
|
var polygonOffset = currentState.polygonOffset || [0, 0];
|
@@ -5780,6 +5813,8 @@ var MarsRenderer = /** @class */ (function () {
|
|
5780
5813
|
MarsRenderer.prototype.cancelAnimationFrame = function (id) {
|
5781
5814
|
return window.cancelAnimationFrame(id);
|
5782
5815
|
};
|
5816
|
+
MarsRenderer.prototype.resume = function () {
|
5817
|
+
};
|
5783
5818
|
MarsRenderer.prototype.getErrors = function () {
|
5784
5819
|
var gl = this.internal.gl;
|
5785
5820
|
var err = gl.getError();
|
@@ -5860,7 +5895,7 @@ var MarsSharedGeometry = /** @class */ (function (_super) {
|
|
5860
5895
|
return MarsSharedGeometry;
|
5861
5896
|
}(MarsGeometry));
|
5862
5897
|
|
5863
|
-
consoleLog('version: ' + "0.3.0-beta.
|
5898
|
+
consoleLog('version: ' + "0.3.0-beta.241");
|
5864
5899
|
var ModuleMsg = 'RI Package: @predy-js/render-interface';
|
5865
5900
|
|
5866
5901
|
var RI = /*#__PURE__*/Object.freeze({
|