@predy-js/render-interface 0.3.0-beta.23 → 0.3.0-beta.230
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 +68 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -35
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/MarsMaterialDataBlock.d.ts +3 -3
- 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/Texture.d.ts +6 -5
- package/dist/types/native/DataBlockInternal.d.ts +15 -0
- package/dist/types/native/PredyNativeInternal.d.ts +47 -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/Texture.ts +42 -41
- package/types/native/DataBlockInternal.ts +17 -0
- package/types/native/PredyNativeInternal.ts +62 -26
- package/types/native/RendererInternal.ts +6 -1
- package/types/native/TextureInternal.ts +6 -2
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.0-beta.
|
5
|
+
* Version: v0.3.0-beta.230
|
6
6
|
*/
|
7
7
|
|
8
8
|
/******************************************************************************
|
@@ -154,21 +154,48 @@ var GPUBufferOptionsMemoryShared = 1 << 1;
|
|
154
154
|
var _a$6, _b$3;
|
155
155
|
// @ts-expect-error safe to assign
|
156
156
|
var constants = {};
|
157
|
-
{
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
consoleError('WebGL not in global');
|
168
|
-
}
|
157
|
+
if (typeof WebGL2RenderingContext === 'function') {
|
158
|
+
copy(WebGL2RenderingContext);
|
159
|
+
}
|
160
|
+
else if (typeof WebGLRenderingContext !== 'undefined') {
|
161
|
+
copy(WebGLRenderingContext);
|
162
|
+
copy(WebGLRenderingContext.prototype);
|
163
|
+
}
|
164
|
+
else {
|
165
|
+
//ios 16 lockdown mode
|
166
|
+
consoleError('WebGL not in global');
|
169
167
|
}
|
170
|
-
|
171
|
-
|
168
|
+
Object.assign(constants, {
|
169
|
+
HALF_FLOAT: 5131,
|
170
|
+
COMPRESSED_RGBA_ASTC_4x4_KHR: 0x93B0,
|
171
|
+
COMPRESSED_RGBA_ASTC_5x4_KHR: 0x93B1,
|
172
|
+
COMPRESSED_RGBA_ASTC_5x5_KHR: 0x93B2,
|
173
|
+
COMPRESSED_RGBA_ASTC_6x5_KHR: 0x93B3,
|
174
|
+
COMPRESSED_RGBA_ASTC_6x6_KHR: 0x93B4,
|
175
|
+
COMPRESSED_RGBA_ASTC_8x5_KHR: 0x93B5,
|
176
|
+
COMPRESSED_RGBA_ASTC_8x6_KHR: 0x93B6,
|
177
|
+
COMPRESSED_RGBA_ASTC_8x8_KHR: 0x93B7,
|
178
|
+
COMPRESSED_RGBA_ASTC_10x5_KHR: 0x93B8,
|
179
|
+
COMPRESSED_RGBA_ASTC_10x6_KHR: 0x93B9,
|
180
|
+
COMPRESSED_RGBA_ASTC_10x8_KHR: 0x93BA,
|
181
|
+
COMPRESSED_RGBA_ASTC_10x10_KHR: 0x93BB,
|
182
|
+
COMPRESSED_RGBA_ASTC_12x10_KHR: 0x93BC,
|
183
|
+
COMPRESSED_RGBA_ASTC_12x12_KHR: 0x93BD,
|
184
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: 0x93D0,
|
185
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: 0x93D1,
|
186
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: 0x93D2,
|
187
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: 0x93D3,
|
188
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: 0x93D4,
|
189
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: 0x93D5,
|
190
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: 0x93D6,
|
191
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: 0x93D7,
|
192
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: 0x93D8,
|
193
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: 0x93D9,
|
194
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: 0x93DA,
|
195
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: 0x93DB,
|
196
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: 0x93DC,
|
197
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: 0x93DD,
|
198
|
+
});
|
172
199
|
function copy(target) {
|
173
200
|
for (var name_1 in target) {
|
174
201
|
if (/^[A-Z_]/.test(name_1)) {
|
@@ -1791,13 +1818,18 @@ var GLProgram = /** @class */ (function () {
|
|
1791
1818
|
}
|
1792
1819
|
};
|
1793
1820
|
GLProgram.prototype.getSemanticValue = function (state, semanticName) {
|
1794
|
-
|
1795
|
-
|
1796
|
-
if (renderPassSemantics.hasSemanticValue(semanticName)) {
|
1797
|
-
return renderPassSemantics.getSemanticValue(semanticName, state);
|
1821
|
+
if (typeof semanticName === 'function') {
|
1822
|
+
return semanticName(state);
|
1798
1823
|
}
|
1799
|
-
else
|
1800
|
-
|
1824
|
+
else {
|
1825
|
+
var renderPassSemantics = state.currentPass.semantics;
|
1826
|
+
var renderFrameSemantics = state.currentFrame.semantics;
|
1827
|
+
if (renderPassSemantics.hasSemanticValue(semanticName)) {
|
1828
|
+
return renderPassSemantics.getSemanticValue(semanticName, state);
|
1829
|
+
}
|
1830
|
+
else if (renderFrameSemantics.hasSemanticValue(semanticName)) {
|
1831
|
+
return renderFrameSemantics.getSemanticValue(semanticName, state);
|
1832
|
+
}
|
1801
1833
|
}
|
1802
1834
|
};
|
1803
1835
|
GLProgram.prototype.setupUniforms = function (state) {
|
@@ -3117,6 +3149,11 @@ var PredyResourceCacheStatus;
|
|
3117
3149
|
PredyResourceCacheStatus[PredyResourceCacheStatus["cached"] = 1] = "cached";
|
3118
3150
|
PredyResourceCacheStatus[PredyResourceCacheStatus["preloaded"] = 2] = "preloaded";
|
3119
3151
|
})(PredyResourceCacheStatus || (PredyResourceCacheStatus = {}));
|
3152
|
+
var PredyTextEncoding;
|
3153
|
+
(function (PredyTextEncoding) {
|
3154
|
+
PredyTextEncoding[PredyTextEncoding["utf8"] = 0] = "utf8";
|
3155
|
+
PredyTextEncoding[PredyTextEncoding["ascii"] = 1] = "ascii";
|
3156
|
+
})(PredyTextEncoding || (PredyTextEncoding = {}));
|
3120
3157
|
|
3121
3158
|
var GLRenderBuffer = /** @class */ (function () {
|
3122
3159
|
function GLRenderBuffer(renderer, options) {
|
@@ -3570,7 +3607,7 @@ var COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
|
|
3570
3607
|
var TEX_2D = 2; // uses a gl.texImage2D()
|
3571
3608
|
//const TEX_3D = 3; // uses a gl.texImage3D()
|
3572
3609
|
var KhronosTextureContainer = /** @class */ (function () {
|
3573
|
-
function KhronosTextureContainer(arrayBuffer,
|
3610
|
+
function KhronosTextureContainer(arrayBuffer, baseOffset) {
|
3574
3611
|
if (baseOffset === void 0) { baseOffset = 0; }
|
3575
3612
|
this.arrayBuffer = arrayBuffer;
|
3576
3613
|
this.baseOffset = baseOffset;
|
@@ -3590,9 +3627,9 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3590
3627
|
identifier[9] !== 0x0a ||
|
3591
3628
|
identifier[10] !== 0x1a ||
|
3592
3629
|
identifier[11] !== 0x0a) {
|
3593
|
-
throw Error('texture missing KTX identifier');
|
3630
|
+
throw Error('texture missing KTX 1.1 identifier');
|
3594
3631
|
}
|
3595
|
-
// load the reset of the header in native
|
3632
|
+
// load the reset of the header in native 32 bit uint
|
3596
3633
|
var dataSize = Uint32Array.BYTES_PER_ELEMENT;
|
3597
3634
|
var headerDataView = new DataView(this.arrayBuffer, this.baseOffset + 12, 13 * dataSize);
|
3598
3635
|
var endianness = headerDataView.getUint32(0, true);
|
@@ -3612,15 +3649,11 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3612
3649
|
// value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
|
3613
3650
|
this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
|
3614
3651
|
if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
|
3615
|
-
consoleWarn('only 2D textures currently supported');
|
3652
|
+
//consoleWarn('only 2D textures currently supported');
|
3616
3653
|
return;
|
3617
3654
|
}
|
3618
3655
|
if (this.numberOfArrayElements !== 0) {
|
3619
|
-
consoleWarn('texture arrays not currently supported');
|
3620
|
-
return;
|
3621
|
-
}
|
3622
|
-
if (this.numberOfFaces !== facesExpected) {
|
3623
|
-
consoleWarn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);
|
3656
|
+
//consoleWarn('texture arrays not currently supported');
|
3624
3657
|
return;
|
3625
3658
|
}
|
3626
3659
|
// we now have a completely validated file, so could use existence of loadType as success
|
@@ -3659,14 +3692,14 @@ var KhronosTextureContainer = /** @class */ (function () {
|
|
3659
3692
|
return KhronosTextureContainer;
|
3660
3693
|
}());
|
3661
3694
|
function getCompressedTextureOptions(data) {
|
3662
|
-
var ktx = new KhronosTextureContainer(data
|
3695
|
+
var ktx = new KhronosTextureContainer(data);
|
3663
3696
|
var useMipmaps = ktx.numberOfMipmapLevels >= Math.floor(Math.log2(Math.max(ktx.pixelWidth, ktx.pixelHeight)) + 1);
|
3664
3697
|
return {
|
3665
3698
|
sourceType: TextureSourceType.compressed,
|
3666
|
-
type:
|
3699
|
+
type: constants.UNSIGNED_BYTE,
|
3667
3700
|
target: ktx.numberOfFaces === 6 ? constants.TEXTURE_CUBE_MAP : constants.TEXTURE_2D,
|
3701
|
+
format: ktx.glInternalFormat,
|
3668
3702
|
internalFormat: ktx.glInternalFormat,
|
3669
|
-
format: ktx.glFormat,
|
3670
3703
|
mipmaps: ktx.mipmaps(useMipmaps),
|
3671
3704
|
};
|
3672
3705
|
}
|
@@ -4482,10 +4515,10 @@ var GLMaterial = /** @class */ (function () {
|
|
4482
4515
|
webGLState.depthFunc(currentState.depthFunc);
|
4483
4516
|
webGLState.depthRange((_a = currentState.depthRange) === null || _a === void 0 ? void 0 : _a[0], (_b = currentState.depthRange) === null || _b === void 0 ? void 0 : _b[1]);
|
4484
4517
|
}
|
4518
|
+
webGLState.frontFace(currentState.frontFace);
|
4485
4519
|
if (currentState.cullFaceEnabled) {
|
4486
4520
|
//face
|
4487
4521
|
webGLState.cullFace(currentState.cullFace);
|
4488
|
-
webGLState.frontFace(currentState.frontFace);
|
4489
4522
|
}
|
4490
4523
|
if (currentState.polygonOffsetFill) {
|
4491
4524
|
var polygonOffset = currentState.polygonOffset || [0, 0];
|
@@ -5856,7 +5889,7 @@ var MarsSharedGeometry = /** @class */ (function (_super) {
|
|
5856
5889
|
return MarsSharedGeometry;
|
5857
5890
|
}(MarsGeometry));
|
5858
5891
|
|
5859
|
-
consoleLog('version: ' + "0.3.0-beta.
|
5892
|
+
consoleLog('version: ' + "0.3.0-beta.230");
|
5860
5893
|
var ModuleMsg = 'RI Package: @predy-js/render-interface';
|
5861
5894
|
|
5862
5895
|
var RI = /*#__PURE__*/Object.freeze({
|