@rings-webgpu/core 1.0.25 → 1.0.27
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/rings.es.js +213 -211
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +1091 -30
- package/dist/rings.umd.js +215 -213
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +1095 -29
- package/dist/types/assets/Res.d.ts +2 -0
- package/dist/types/core/geometry/GeometryBase.d.ts +1 -0
- package/dist/types/gfx/graphics/webGpu/core/texture/Texture.d.ts +2 -0
- package/dist/types/gfx/graphics/webGpu/shader/Shader.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/loader/parser/b3dm/FeatureTable.d.ts +1 -0
- package/dist/types/loader/parser/ply/PlyLoader.d.ts +6 -2
- package/dist/types/loader/parser/ply/PlyParser.d.ts +7 -0
- package/dist/types/loader/parser/ply/PlyTypes.d.ts +25 -0
- package/dist/types/loader/parser/tileRenderer/TilesRenderer.d.ts +1 -1
- package/dist/types/materials/Material.d.ts +1 -0
- package/dist/types/textures/BitmapTexture2D.d.ts +1 -0
- package/package.json +1 -1
package/dist/rings.es.max.js
CHANGED
|
@@ -16785,6 +16785,10 @@ class Texture {
|
|
|
16785
16785
|
name;
|
|
16786
16786
|
url;
|
|
16787
16787
|
gpuTexture;
|
|
16788
|
+
_isDestroyed = false;
|
|
16789
|
+
get isDestroyed() {
|
|
16790
|
+
return this._isDestroyed;
|
|
16791
|
+
}
|
|
16788
16792
|
pid;
|
|
16789
16793
|
view;
|
|
16790
16794
|
// Assigned later
|
|
@@ -17013,6 +17017,14 @@ class Texture {
|
|
|
17013
17017
|
this.textureDescriptor = null;
|
|
17014
17018
|
this.gpuTexture.destroy();
|
|
17015
17019
|
this.gpuTexture = null;
|
|
17020
|
+
this._isDestroyed = true;
|
|
17021
|
+
}
|
|
17022
|
+
if (this._sourceImageData && this._sourceImageData instanceof ImageBitmap) {
|
|
17023
|
+
try {
|
|
17024
|
+
this._sourceImageData.close();
|
|
17025
|
+
} catch (e) {
|
|
17026
|
+
}
|
|
17027
|
+
this._sourceImageData = null;
|
|
17016
17028
|
}
|
|
17017
17029
|
this._stateChangeRef.clear();
|
|
17018
17030
|
}
|
|
@@ -20276,9 +20288,13 @@ class Reference {
|
|
|
20276
20288
|
* @param target reference parent
|
|
20277
20289
|
*/
|
|
20278
20290
|
detached(ref, target) {
|
|
20291
|
+
if (!this.reference) return;
|
|
20279
20292
|
let refMap = this.reference.get(ref);
|
|
20280
20293
|
if (refMap) {
|
|
20281
20294
|
refMap.delete(target);
|
|
20295
|
+
if (refMap.size === 0) {
|
|
20296
|
+
this.reference.delete(ref);
|
|
20297
|
+
}
|
|
20282
20298
|
}
|
|
20283
20299
|
}
|
|
20284
20300
|
/**
|
|
@@ -22507,23 +22523,36 @@ class RenderNode extends ComponentBase {
|
|
|
22507
22523
|
}
|
|
22508
22524
|
}
|
|
22509
22525
|
beforeDestroy(force) {
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
this._geometry
|
|
22526
|
+
if (this._geometry) {
|
|
22527
|
+
Reference.getInstance().detached(this._geometry, this);
|
|
22528
|
+
if (!Reference.getInstance().hasReference(this._geometry)) {
|
|
22529
|
+
this._geometry.destroy(force);
|
|
22530
|
+
}
|
|
22513
22531
|
}
|
|
22514
22532
|
for (let i = 0; i < this._materials.length; i++) {
|
|
22515
22533
|
const mat = this._materials[i];
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22534
|
+
if (mat) {
|
|
22535
|
+
Reference.getInstance().detached(mat, this);
|
|
22536
|
+
if (!Reference.getInstance().hasReference(mat)) {
|
|
22537
|
+
mat.destroy(force);
|
|
22538
|
+
}
|
|
22519
22539
|
}
|
|
22520
22540
|
}
|
|
22541
|
+
if (this._computes) {
|
|
22542
|
+
this._computes.length = 0;
|
|
22543
|
+
}
|
|
22544
|
+
this.detachSceneOctree();
|
|
22521
22545
|
super.beforeDestroy(force);
|
|
22522
22546
|
}
|
|
22523
22547
|
destroy(force) {
|
|
22524
22548
|
super.destroy(force);
|
|
22525
22549
|
this._geometry = void 0;
|
|
22526
22550
|
this._materials.length = 0;
|
|
22551
|
+
this._computes = null;
|
|
22552
|
+
if (this._passInit) {
|
|
22553
|
+
this._passInit.clear();
|
|
22554
|
+
this._passInit = null;
|
|
22555
|
+
}
|
|
22527
22556
|
this._combineShaderRefection = void 0;
|
|
22528
22557
|
}
|
|
22529
22558
|
}
|
|
@@ -22543,6 +22572,7 @@ class Material {
|
|
|
22543
22572
|
enable = true;
|
|
22544
22573
|
_defaultSubShader;
|
|
22545
22574
|
_shader;
|
|
22575
|
+
_isDestroyed = false;
|
|
22546
22576
|
constructor() {
|
|
22547
22577
|
this.instanceID = UUID();
|
|
22548
22578
|
}
|
|
@@ -22657,10 +22687,17 @@ class Material {
|
|
|
22657
22687
|
return newMat;
|
|
22658
22688
|
}
|
|
22659
22689
|
destroy(force) {
|
|
22690
|
+
if (this._isDestroyed) {
|
|
22691
|
+
return;
|
|
22692
|
+
}
|
|
22660
22693
|
this.name = null;
|
|
22661
22694
|
this.instanceID = null;
|
|
22662
|
-
this._shader
|
|
22663
|
-
|
|
22695
|
+
if (this._shader) {
|
|
22696
|
+
this._shader.destroy(force);
|
|
22697
|
+
this._shader = null;
|
|
22698
|
+
}
|
|
22699
|
+
this._defaultSubShader = null;
|
|
22700
|
+
this._isDestroyed = true;
|
|
22664
22701
|
}
|
|
22665
22702
|
setDefine(define, value) {
|
|
22666
22703
|
this.shader.setDefine(define, value);
|
|
@@ -23165,8 +23202,15 @@ class Shader {
|
|
|
23165
23202
|
}
|
|
23166
23203
|
}
|
|
23167
23204
|
}
|
|
23168
|
-
destroy() {
|
|
23169
|
-
this.
|
|
23205
|
+
destroy(force) {
|
|
23206
|
+
for (const pass of this.passShader) {
|
|
23207
|
+
for (const rd of pass[1]) {
|
|
23208
|
+
rd.destroy(force);
|
|
23209
|
+
}
|
|
23210
|
+
}
|
|
23211
|
+
this.passShader.clear();
|
|
23212
|
+
this.passShader = null;
|
|
23213
|
+
this.computes = null;
|
|
23170
23214
|
}
|
|
23171
23215
|
clone() {
|
|
23172
23216
|
let newShader = new Shader();
|
|
@@ -23658,6 +23702,7 @@ class GeometryBase {
|
|
|
23658
23702
|
_vertexBuffer;
|
|
23659
23703
|
_onChange = true;
|
|
23660
23704
|
_wireframeLines;
|
|
23705
|
+
_isDestroyed = false;
|
|
23661
23706
|
constructor() {
|
|
23662
23707
|
this.instanceID = UUID();
|
|
23663
23708
|
this._attributeMap = /* @__PURE__ */ new Map();
|
|
@@ -23904,18 +23949,40 @@ class GeometryBase {
|
|
|
23904
23949
|
return false;
|
|
23905
23950
|
}
|
|
23906
23951
|
destroy(force) {
|
|
23952
|
+
if (this._isDestroyed) {
|
|
23953
|
+
return;
|
|
23954
|
+
}
|
|
23907
23955
|
this.instanceID = null;
|
|
23908
23956
|
this.name = null;
|
|
23909
23957
|
this.subGeometries = null;
|
|
23910
23958
|
this.morphTargetDictionary = null;
|
|
23911
|
-
this.
|
|
23912
|
-
this.
|
|
23913
|
-
this.
|
|
23959
|
+
this.skinNames = null;
|
|
23960
|
+
this.bindPose = null;
|
|
23961
|
+
this.blendShapeData = null;
|
|
23962
|
+
this._wireframeLines = null;
|
|
23963
|
+
if (this._bounds) {
|
|
23964
|
+
this._bounds.destroy();
|
|
23965
|
+
this._bounds = null;
|
|
23966
|
+
}
|
|
23967
|
+
if (this._attributeMap) {
|
|
23968
|
+
this._attributeMap.forEach((vertexInfo) => {
|
|
23969
|
+
if (vertexInfo && vertexInfo.data) {
|
|
23970
|
+
vertexInfo.data = null;
|
|
23971
|
+
}
|
|
23972
|
+
});
|
|
23973
|
+
this._attributeMap.clear();
|
|
23974
|
+
this._attributeMap = null;
|
|
23975
|
+
}
|
|
23914
23976
|
this._attributes = null;
|
|
23915
|
-
this._indicesBuffer
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23977
|
+
if (this._indicesBuffer) {
|
|
23978
|
+
this._indicesBuffer.destroy();
|
|
23979
|
+
this._indicesBuffer = null;
|
|
23980
|
+
}
|
|
23981
|
+
if (this._vertexBuffer) {
|
|
23982
|
+
this._vertexBuffer.destroy();
|
|
23983
|
+
this._vertexBuffer = null;
|
|
23984
|
+
}
|
|
23985
|
+
this._isDestroyed = true;
|
|
23919
23986
|
}
|
|
23920
23987
|
}
|
|
23921
23988
|
|
|
@@ -25316,10 +25383,22 @@ class Entity extends CEventDispatcher {
|
|
|
25316
25383
|
c.destroy(force);
|
|
25317
25384
|
});
|
|
25318
25385
|
this.components.clear();
|
|
25319
|
-
this.
|
|
25320
|
-
|
|
25321
|
-
|
|
25322
|
-
|
|
25386
|
+
this.components.clear();
|
|
25387
|
+
if (this.entityChildren) {
|
|
25388
|
+
this.entityChildren.forEach((c) => {
|
|
25389
|
+
c.destroy(force);
|
|
25390
|
+
});
|
|
25391
|
+
this.removeAllChild();
|
|
25392
|
+
this.entityChildren = [];
|
|
25393
|
+
}
|
|
25394
|
+
if (this._bound && this._bound.destroy) {
|
|
25395
|
+
this._bound.destroy();
|
|
25396
|
+
this._bound = null;
|
|
25397
|
+
}
|
|
25398
|
+
if (this._boundWorld && this._boundWorld.destroy) {
|
|
25399
|
+
this._boundWorld.destroy();
|
|
25400
|
+
this._boundWorld = null;
|
|
25401
|
+
}
|
|
25323
25402
|
this.transform.parent = null;
|
|
25324
25403
|
this._dispose = true;
|
|
25325
25404
|
super.destroy();
|
|
@@ -25591,6 +25670,16 @@ let Object3D = class extends Entity {
|
|
|
25591
25670
|
this.onTransformLocalChange,
|
|
25592
25671
|
this
|
|
25593
25672
|
);
|
|
25673
|
+
const batchTable = this.batchTable;
|
|
25674
|
+
if (batchTable && typeof batchTable.destroy === "function") {
|
|
25675
|
+
batchTable.destroy();
|
|
25676
|
+
this.batchTable = null;
|
|
25677
|
+
}
|
|
25678
|
+
const featureTable = this.featureTable;
|
|
25679
|
+
if (featureTable && typeof featureTable.destroy === "function") {
|
|
25680
|
+
featureTable.destroy();
|
|
25681
|
+
this.featureTable = null;
|
|
25682
|
+
}
|
|
25594
25683
|
super.destroy(force);
|
|
25595
25684
|
}
|
|
25596
25685
|
};
|
|
@@ -32905,6 +32994,12 @@ class BitmapTexture2D extends Texture {
|
|
|
32905
32994
|
return this._source;
|
|
32906
32995
|
}
|
|
32907
32996
|
set source(value) {
|
|
32997
|
+
if (this._source && this._source instanceof ImageBitmap) {
|
|
32998
|
+
try {
|
|
32999
|
+
this._source.close();
|
|
33000
|
+
} catch (e) {
|
|
33001
|
+
}
|
|
33002
|
+
}
|
|
32908
33003
|
this._source = value;
|
|
32909
33004
|
if (this._source instanceof HTMLImageElement) {
|
|
32910
33005
|
this._source.decode().then(async () => {
|
|
@@ -32972,17 +33067,32 @@ class BitmapTexture2D extends Texture {
|
|
|
32972
33067
|
if (imageBitmap.width < 32 || imageBitmap.height < 32) {
|
|
32973
33068
|
let width = Math.max(imageBitmap.width, 32);
|
|
32974
33069
|
let height = Math.max(imageBitmap.height, 32);
|
|
33070
|
+
const oldImageBitmap = imageBitmap;
|
|
32975
33071
|
imageBitmap = await createImageBitmap(imageBitmap, {
|
|
32976
33072
|
resizeWidth: width,
|
|
32977
33073
|
resizeHeight: height,
|
|
32978
33074
|
imageOrientation: this.flipY ? "flipY" : "from-image",
|
|
32979
33075
|
premultiplyAlpha: "none"
|
|
32980
33076
|
});
|
|
33077
|
+
try {
|
|
33078
|
+
oldImageBitmap.close();
|
|
33079
|
+
} catch (e) {
|
|
33080
|
+
}
|
|
32981
33081
|
}
|
|
32982
33082
|
this.format = GPUTextureFormat.rgba8unorm;
|
|
32983
33083
|
this.generate(imageBitmap);
|
|
32984
33084
|
return true;
|
|
32985
33085
|
}
|
|
33086
|
+
destroy(force) {
|
|
33087
|
+
if (this._source && this._source instanceof ImageBitmap) {
|
|
33088
|
+
try {
|
|
33089
|
+
this._source.close();
|
|
33090
|
+
} catch (e) {
|
|
33091
|
+
}
|
|
33092
|
+
this._source = null;
|
|
33093
|
+
}
|
|
33094
|
+
super.destroy(force);
|
|
33095
|
+
}
|
|
32986
33096
|
}
|
|
32987
33097
|
|
|
32988
33098
|
class LoaderBase {
|
|
@@ -36230,6 +36340,7 @@ class GLBParser extends ParserBase {
|
|
|
36230
36340
|
this._gltf,
|
|
36231
36341
|
this._gltf.scene
|
|
36232
36342
|
);
|
|
36343
|
+
subParser.destroy();
|
|
36233
36344
|
if (nodes) {
|
|
36234
36345
|
this.data = nodes.rootNode;
|
|
36235
36346
|
return nodes.rootNode;
|
|
@@ -36267,6 +36378,7 @@ class GLBParser extends ParserBase {
|
|
|
36267
36378
|
this._gltf,
|
|
36268
36379
|
this._gltf.scene
|
|
36269
36380
|
);
|
|
36381
|
+
subParser.destroy();
|
|
36270
36382
|
if (nodes) {
|
|
36271
36383
|
this.data = nodes.rootNode;
|
|
36272
36384
|
return nodes.rootNode;
|
|
@@ -39067,6 +39179,12 @@ class FeatureTable {
|
|
|
39067
39179
|
return data;
|
|
39068
39180
|
}
|
|
39069
39181
|
}
|
|
39182
|
+
destroy() {
|
|
39183
|
+
this.buffer = null;
|
|
39184
|
+
this.header = null;
|
|
39185
|
+
this.binOffset = null;
|
|
39186
|
+
this.binLength = null;
|
|
39187
|
+
}
|
|
39070
39188
|
}
|
|
39071
39189
|
class BatchTable extends FeatureTable {
|
|
39072
39190
|
batchSize;
|
|
@@ -40992,6 +41110,25 @@ class Res {
|
|
|
40992
41110
|
this._texturePool.set(url, texture);
|
|
40993
41111
|
return texture;
|
|
40994
41112
|
}
|
|
41113
|
+
destroyTexture(url) {
|
|
41114
|
+
const texture = this._texturePool.get(url);
|
|
41115
|
+
if (texture) {
|
|
41116
|
+
if (!Reference.getInstance().hasReference(texture)) {
|
|
41117
|
+
if (!texture.isDestroyed) {
|
|
41118
|
+
texture.destroy();
|
|
41119
|
+
}
|
|
41120
|
+
this._texturePool.delete(url);
|
|
41121
|
+
return true;
|
|
41122
|
+
}
|
|
41123
|
+
return false;
|
|
41124
|
+
}
|
|
41125
|
+
return false;
|
|
41126
|
+
}
|
|
41127
|
+
destroyTextureAllUnUsed() {
|
|
41128
|
+
for (const [url, texture] of this._texturePool.entries()) {
|
|
41129
|
+
this.destroyTexture(url);
|
|
41130
|
+
}
|
|
41131
|
+
}
|
|
40995
41132
|
async loadTextureCount(urls, count, loaderFunctions, flipY) {
|
|
40996
41133
|
return new Promise(async (suc, fail) => {
|
|
40997
41134
|
let total = 0;
|
|
@@ -41288,7 +41425,7 @@ class PostProcessingComponent extends ComponentBase {
|
|
|
41288
41425
|
}
|
|
41289
41426
|
}
|
|
41290
41427
|
|
|
41291
|
-
const version = "1.0.
|
|
41428
|
+
const version = "1.0.26";
|
|
41292
41429
|
|
|
41293
41430
|
class Engine3D {
|
|
41294
41431
|
/**
|
|
@@ -59000,6 +59137,15 @@ function detectGSplatFormat(buffer) {
|
|
|
59000
59137
|
return "unknown" /* UNKNOWN */;
|
|
59001
59138
|
}
|
|
59002
59139
|
|
|
59140
|
+
var PlyMode = /* @__PURE__ */ ((PlyMode2) => {
|
|
59141
|
+
PlyMode2[PlyMode2["Splat"] = 0] = "Splat";
|
|
59142
|
+
PlyMode2[PlyMode2["PointCloud"] = 1] = "PointCloud";
|
|
59143
|
+
PlyMode2[PlyMode2["Mesh"] = 2] = "Mesh";
|
|
59144
|
+
return PlyMode2;
|
|
59145
|
+
})(PlyMode || {});
|
|
59146
|
+
const splatProperties = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
|
|
59147
|
+
const splatColorProperties = ["red", "green", "blue", "f_dc_0", "f_dc_1", "f_dc_2"];
|
|
59148
|
+
|
|
59003
59149
|
function byteSizeOfType(t) {
|
|
59004
59150
|
switch (t) {
|
|
59005
59151
|
case "char":
|
|
@@ -59075,34 +59221,85 @@ function parsePlyHeader(buffer) {
|
|
|
59075
59221
|
const lines = headerText.split(/\r?\n/);
|
|
59076
59222
|
let format = "";
|
|
59077
59223
|
let vertexCount = 0;
|
|
59224
|
+
let faceCount = 0;
|
|
59078
59225
|
const properties = [];
|
|
59226
|
+
const faceProperties = [];
|
|
59227
|
+
const textureFiles = [];
|
|
59079
59228
|
let inVertexElement = false;
|
|
59229
|
+
let inFaceElement = false;
|
|
59080
59230
|
for (const line of lines) {
|
|
59081
59231
|
if (line.startsWith("format ")) {
|
|
59082
59232
|
format = line.split(/\s+/)[1];
|
|
59233
|
+
} else if (line.startsWith("comment TextureFile ")) {
|
|
59234
|
+
const texturePath = line.substring("comment TextureFile ".length).trim();
|
|
59235
|
+
if (texturePath) {
|
|
59236
|
+
textureFiles.push(texturePath);
|
|
59237
|
+
}
|
|
59083
59238
|
} else if (line.startsWith("element ")) {
|
|
59084
59239
|
const toks = line.split(/\s+/);
|
|
59085
59240
|
inVertexElement = toks[1] === "vertex";
|
|
59086
|
-
|
|
59241
|
+
inFaceElement = toks[1] === "face";
|
|
59242
|
+
if (inVertexElement) {
|
|
59243
|
+
vertexCount = parseInt(toks[2]);
|
|
59244
|
+
inFaceElement = false;
|
|
59245
|
+
}
|
|
59246
|
+
if (inFaceElement) {
|
|
59247
|
+
faceCount = parseInt(toks[2]);
|
|
59248
|
+
inVertexElement = false;
|
|
59249
|
+
}
|
|
59087
59250
|
} else if (inVertexElement && line.startsWith("property ")) {
|
|
59088
59251
|
const toks = line.split(/\s+/);
|
|
59089
59252
|
const type = toks[1];
|
|
59090
59253
|
const name = toks[2];
|
|
59091
59254
|
properties.push({ name, type });
|
|
59255
|
+
} else if (inFaceElement && line.startsWith("property ")) {
|
|
59256
|
+
const toks = line.split(/\s+/);
|
|
59257
|
+
if (toks[1] === "list") {
|
|
59258
|
+
const countType = toks[2];
|
|
59259
|
+
const itemType = toks[3];
|
|
59260
|
+
const name = toks[4];
|
|
59261
|
+
faceProperties.push({ name, type: `list ${countType} ${itemType}` });
|
|
59262
|
+
} else {
|
|
59263
|
+
const type = toks[1];
|
|
59264
|
+
const name = toks[2];
|
|
59265
|
+
faceProperties.push({ name, type });
|
|
59266
|
+
}
|
|
59092
59267
|
}
|
|
59093
59268
|
}
|
|
59094
|
-
if (format !== "binary_little_endian") {
|
|
59095
|
-
throw new Error(
|
|
59269
|
+
if (format !== "binary_little_endian" && format !== "ascii") {
|
|
59270
|
+
throw new Error(`PLY: Unsupported format: ${format}. Only binary_little_endian and ascii are supported.`);
|
|
59271
|
+
}
|
|
59272
|
+
let splatPropertyCount = 0;
|
|
59273
|
+
let splatPropertyColorCount = 0;
|
|
59274
|
+
for (const property of properties) {
|
|
59275
|
+
if (splatProperties.includes(property.name)) {
|
|
59276
|
+
splatPropertyCount++;
|
|
59277
|
+
}
|
|
59278
|
+
if (splatColorProperties.includes(property.name)) {
|
|
59279
|
+
splatPropertyColorCount++;
|
|
59280
|
+
}
|
|
59096
59281
|
}
|
|
59097
59282
|
return {
|
|
59098
59283
|
format,
|
|
59099
59284
|
vertexCount,
|
|
59285
|
+
faceCount,
|
|
59100
59286
|
properties,
|
|
59101
|
-
|
|
59287
|
+
faceProperties: faceProperties.length > 0 ? faceProperties : void 0,
|
|
59288
|
+
textureFiles,
|
|
59289
|
+
headerByteLength: headerText.length,
|
|
59290
|
+
mode: faceCount ? PlyMode.Mesh : splatPropertyCount === splatProperties.length && splatPropertyColorCount === 3 ? PlyMode.Splat : PlyMode.PointCloud
|
|
59102
59291
|
};
|
|
59103
59292
|
}
|
|
59104
59293
|
function parsePlyGaussianSplat(buffer) {
|
|
59105
59294
|
const header = parsePlyHeader(buffer);
|
|
59295
|
+
const { format } = header;
|
|
59296
|
+
if (format === "ascii") {
|
|
59297
|
+
return parsePlyGaussianSplatASCII(buffer, header);
|
|
59298
|
+
} else {
|
|
59299
|
+
return parsePlyGaussianSplatBinary(buffer, header);
|
|
59300
|
+
}
|
|
59301
|
+
}
|
|
59302
|
+
function parsePlyGaussianSplatBinary(buffer, header) {
|
|
59106
59303
|
const { vertexCount, properties, headerByteLength } = header;
|
|
59107
59304
|
const payload = new DataView(buffer, headerByteLength);
|
|
59108
59305
|
const has = (n) => properties.find((p) => p.name === n) != null;
|
|
@@ -59224,6 +59421,743 @@ function parsePlyGaussianSplat(buffer) {
|
|
|
59224
59421
|
sh: hasSH && shCoeffs ? { order: shOrder, coeffs: shCoeffs } : void 0
|
|
59225
59422
|
};
|
|
59226
59423
|
}
|
|
59424
|
+
function parsePlyGaussianSplatASCII(buffer, header) {
|
|
59425
|
+
const { vertexCount, properties } = header;
|
|
59426
|
+
const text = new TextDecoder("utf-8").decode(buffer);
|
|
59427
|
+
const headerEnd = text.indexOf("end_header");
|
|
59428
|
+
if (headerEnd < 0) {
|
|
59429
|
+
throw new Error("PLY: Invalid PLY header");
|
|
59430
|
+
}
|
|
59431
|
+
let bodyStart = headerEnd + "end_header".length;
|
|
59432
|
+
while (bodyStart < text.length && (text[bodyStart] === " " || text[bodyStart] === "\n" || text[bodyStart] === "\r")) {
|
|
59433
|
+
bodyStart++;
|
|
59434
|
+
}
|
|
59435
|
+
const bodyText = text.substring(bodyStart);
|
|
59436
|
+
const tokens = bodyText.split(/\s+/).filter((token) => token.length > 0);
|
|
59437
|
+
let tokenIndex = 0;
|
|
59438
|
+
const has = (n) => properties.find((p) => p.name === n) != null;
|
|
59439
|
+
const propIndex = (n) => properties.findIndex((p) => p.name === n);
|
|
59440
|
+
const parseASCIINumber = (type) => {
|
|
59441
|
+
if (tokenIndex >= tokens.length) {
|
|
59442
|
+
throw new Error("PLY: Unexpected end of file");
|
|
59443
|
+
}
|
|
59444
|
+
const value = tokens[tokenIndex++];
|
|
59445
|
+
switch (type) {
|
|
59446
|
+
case "char":
|
|
59447
|
+
case "uchar":
|
|
59448
|
+
case "short":
|
|
59449
|
+
case "ushort":
|
|
59450
|
+
case "int":
|
|
59451
|
+
case "uint":
|
|
59452
|
+
case "int8":
|
|
59453
|
+
case "uint8":
|
|
59454
|
+
case "int16":
|
|
59455
|
+
case "uint16":
|
|
59456
|
+
case "int32":
|
|
59457
|
+
case "uint32":
|
|
59458
|
+
return parseInt(value);
|
|
59459
|
+
case "float":
|
|
59460
|
+
case "double":
|
|
59461
|
+
case "float32":
|
|
59462
|
+
case "float64":
|
|
59463
|
+
return parseFloat(value);
|
|
59464
|
+
default:
|
|
59465
|
+
return parseFloat(value);
|
|
59466
|
+
}
|
|
59467
|
+
};
|
|
59468
|
+
const position = new Float32Array(vertexCount * 3);
|
|
59469
|
+
const scale = has("scale_0") ? new Float32Array(vertexCount * 3) : void 0;
|
|
59470
|
+
const rotation = has("rot_0") ? new Float32Array(vertexCount * 4) : void 0;
|
|
59471
|
+
const opacity = has("opacity") ? new Float32Array(vertexCount) : void 0;
|
|
59472
|
+
const dcIdx = [propIndex("f_dc_0"), propIndex("f_dc_1"), propIndex("f_dc_2")];
|
|
59473
|
+
const restIndices = [];
|
|
59474
|
+
for (let i = 0; i < properties.length; i++) {
|
|
59475
|
+
if (properties[i].name.startsWith("f_rest_")) restIndices.push(i);
|
|
59476
|
+
}
|
|
59477
|
+
const hasSH = dcIdx[0] >= 0 && dcIdx[1] >= 0 && dcIdx[2] >= 0;
|
|
59478
|
+
let shCoeffs = void 0;
|
|
59479
|
+
let shOrder = 0;
|
|
59480
|
+
if (hasSH) {
|
|
59481
|
+
const coeffsPerColor = 1 + restIndices.length / 3;
|
|
59482
|
+
shOrder = inferSHOrder(coeffsPerColor);
|
|
59483
|
+
shCoeffs = new Float32Array(vertexCount * coeffsPerColor * 3);
|
|
59484
|
+
}
|
|
59485
|
+
const ix = propIndex("x");
|
|
59486
|
+
const iy = propIndex("y");
|
|
59487
|
+
const iz = propIndex("z");
|
|
59488
|
+
if (ix < 0 || iy < 0 || iz < 0) {
|
|
59489
|
+
throw new Error("PLY: Missing x/y/z for vertex");
|
|
59490
|
+
}
|
|
59491
|
+
const s0 = scale ? propIndex("scale_0") : -1;
|
|
59492
|
+
const s1 = scale ? propIndex("scale_1") : -1;
|
|
59493
|
+
const s2 = scale ? propIndex("scale_2") : -1;
|
|
59494
|
+
const r0 = rotation ? propIndex("rot_0") : -1;
|
|
59495
|
+
const r1 = rotation ? propIndex("rot_1") : -1;
|
|
59496
|
+
const r2 = rotation ? propIndex("rot_2") : -1;
|
|
59497
|
+
const r3 = rotation ? propIndex("rot_3") : -1;
|
|
59498
|
+
const oi = opacity ? propIndex("opacity") : -1;
|
|
59499
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
59500
|
+
for (let pIdx = 0; pIdx < properties.length; pIdx++) {
|
|
59501
|
+
const prop = properties[pIdx];
|
|
59502
|
+
const value = parseASCIINumber(prop.type);
|
|
59503
|
+
if (pIdx === ix) {
|
|
59504
|
+
position[v * 3 + 0] = value;
|
|
59505
|
+
} else if (pIdx === iy) {
|
|
59506
|
+
position[v * 3 + 1] = value;
|
|
59507
|
+
} else if (pIdx === iz) {
|
|
59508
|
+
position[v * 3 + 2] = value;
|
|
59509
|
+
}
|
|
59510
|
+
if (scale && pIdx === s0) {
|
|
59511
|
+
scale[v * 3 + 0] = value;
|
|
59512
|
+
} else if (scale && pIdx === s1) {
|
|
59513
|
+
scale[v * 3 + 1] = value;
|
|
59514
|
+
} else if (scale && pIdx === s2) {
|
|
59515
|
+
scale[v * 3 + 2] = value;
|
|
59516
|
+
}
|
|
59517
|
+
if (rotation && pIdx === r0) {
|
|
59518
|
+
rotation[v * 4 + 3] = value;
|
|
59519
|
+
} else if (rotation && pIdx === r1) {
|
|
59520
|
+
rotation[v * 4 + 0] = value;
|
|
59521
|
+
} else if (rotation && pIdx === r2) {
|
|
59522
|
+
rotation[v * 4 + 1] = value;
|
|
59523
|
+
} else if (rotation && pIdx === r3) {
|
|
59524
|
+
rotation[v * 4 + 2] = value;
|
|
59525
|
+
}
|
|
59526
|
+
if (opacity && pIdx === oi) {
|
|
59527
|
+
opacity[v] = value;
|
|
59528
|
+
}
|
|
59529
|
+
if (hasSH && shCoeffs) {
|
|
59530
|
+
const coeffsPerColor = 1 + restIndices.length / 3;
|
|
59531
|
+
const baseIndex = v * coeffsPerColor * 3;
|
|
59532
|
+
if (pIdx === dcIdx[0]) {
|
|
59533
|
+
shCoeffs[baseIndex + 0] = value;
|
|
59534
|
+
} else if (pIdx === dcIdx[1]) {
|
|
59535
|
+
shCoeffs[baseIndex + coeffsPerColor + 0] = value;
|
|
59536
|
+
} else if (pIdx === dcIdx[2]) {
|
|
59537
|
+
shCoeffs[baseIndex + 2 * coeffsPerColor + 0] = value;
|
|
59538
|
+
}
|
|
59539
|
+
for (let i = 0; i < restIndices.length; i += 3) {
|
|
59540
|
+
const ri = restIndices[i + 0];
|
|
59541
|
+
const gi = restIndices[i + 1];
|
|
59542
|
+
const bi = restIndices[i + 2];
|
|
59543
|
+
if (pIdx === ri) {
|
|
59544
|
+
shCoeffs[baseIndex + (i / 3 + 1)] = value;
|
|
59545
|
+
} else if (pIdx === gi) {
|
|
59546
|
+
shCoeffs[baseIndex + coeffsPerColor + (i / 3 + 1)] = value;
|
|
59547
|
+
} else if (pIdx === bi) {
|
|
59548
|
+
shCoeffs[baseIndex + 2 * coeffsPerColor + (i / 3 + 1)] = value;
|
|
59549
|
+
}
|
|
59550
|
+
}
|
|
59551
|
+
}
|
|
59552
|
+
}
|
|
59553
|
+
}
|
|
59554
|
+
return {
|
|
59555
|
+
vertexCount,
|
|
59556
|
+
position,
|
|
59557
|
+
scale,
|
|
59558
|
+
rotation,
|
|
59559
|
+
opacity,
|
|
59560
|
+
sh: hasSH && shCoeffs ? { order: shOrder, coeffs: shCoeffs } : void 0
|
|
59561
|
+
};
|
|
59562
|
+
}
|
|
59563
|
+
function parsePlyMesh(buffer) {
|
|
59564
|
+
const header = parsePlyHeader(buffer);
|
|
59565
|
+
const { format, vertexCount, faceCount, properties, faceProperties, textureFiles, headerByteLength } = header;
|
|
59566
|
+
if (format === "ascii") {
|
|
59567
|
+
return parsePlyMeshASCII(buffer, header);
|
|
59568
|
+
} else {
|
|
59569
|
+
return parsePlyMeshBinary(buffer, header);
|
|
59570
|
+
}
|
|
59571
|
+
}
|
|
59572
|
+
function parsePlyMeshBinary(buffer, header) {
|
|
59573
|
+
const { vertexCount, faceCount, properties, faceProperties, textureFiles, headerByteLength } = header;
|
|
59574
|
+
const payload = new DataView(buffer, headerByteLength);
|
|
59575
|
+
const has = (n) => properties.find((p) => p.name === n) != null;
|
|
59576
|
+
const propIndex = (n) => properties.findIndex((p) => p.name === n);
|
|
59577
|
+
const hasTexcoord = faceProperties?.some((p) => p.name === "texcoord") || false;
|
|
59578
|
+
const hasTexnumber = faceProperties?.some((p) => p.name === "texnumber") || false;
|
|
59579
|
+
faceProperties?.find((p) => p.name === "texcoord");
|
|
59580
|
+
faceProperties?.find((p) => p.name === "texnumber");
|
|
59581
|
+
const position = new Float32Array(vertexCount * 3);
|
|
59582
|
+
const hasNormalData = has("nx") && has("ny") && has("nz");
|
|
59583
|
+
const normal = hasNormalData ? new Float32Array(vertexCount * 3) : new Float32Array(vertexCount * 3);
|
|
59584
|
+
const color = (has("red") || has("r")) && (has("green") || has("g")) && (has("blue") || has("b")) ? new Float32Array(vertexCount * 3) : void 0;
|
|
59585
|
+
const hasVertexUV = (has("u") || has("s")) && (has("v") || has("t"));
|
|
59586
|
+
const uv = hasVertexUV || hasTexcoord ? new Float32Array(vertexCount * 2) : void 0;
|
|
59587
|
+
const faceTexcoords = /* @__PURE__ */ new Map();
|
|
59588
|
+
const faceTexnumbers = hasTexnumber ? new Array(faceCount) : [];
|
|
59589
|
+
const propOffsets = [];
|
|
59590
|
+
let stride = 0;
|
|
59591
|
+
for (const p of properties) {
|
|
59592
|
+
propOffsets.push(stride);
|
|
59593
|
+
stride += byteSizeOfType(p.type);
|
|
59594
|
+
}
|
|
59595
|
+
let base = 0;
|
|
59596
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
59597
|
+
const vOffset = base;
|
|
59598
|
+
const ix = propIndex("x");
|
|
59599
|
+
const iy = propIndex("y");
|
|
59600
|
+
const iz = propIndex("z");
|
|
59601
|
+
if (ix < 0 || iy < 0 || iz < 0) {
|
|
59602
|
+
throw new Error("PLY: Missing x/y/z for vertex");
|
|
59603
|
+
}
|
|
59604
|
+
position[v * 3 + 0] = readByType(payload, vOffset + propOffsets[ix], properties[ix].type);
|
|
59605
|
+
position[v * 3 + 1] = readByType(payload, vOffset + propOffsets[iy], properties[iy].type);
|
|
59606
|
+
position[v * 3 + 2] = readByType(payload, vOffset + propOffsets[iz], properties[iz].type);
|
|
59607
|
+
if (hasNormalData) {
|
|
59608
|
+
const nx = propIndex("nx");
|
|
59609
|
+
const ny = propIndex("ny");
|
|
59610
|
+
const nz = propIndex("nz");
|
|
59611
|
+
normal[v * 3 + 0] = readByType(payload, vOffset + propOffsets[nx], properties[nx].type);
|
|
59612
|
+
normal[v * 3 + 1] = readByType(payload, vOffset + propOffsets[ny], properties[ny].type);
|
|
59613
|
+
normal[v * 3 + 2] = readByType(payload, vOffset + propOffsets[nz], properties[nz].type);
|
|
59614
|
+
}
|
|
59615
|
+
if (color) {
|
|
59616
|
+
const rIdx = propIndex("red") >= 0 ? propIndex("red") : propIndex("r");
|
|
59617
|
+
const gIdx = propIndex("green") >= 0 ? propIndex("green") : propIndex("g");
|
|
59618
|
+
const bIdx = propIndex("blue") >= 0 ? propIndex("blue") : propIndex("b");
|
|
59619
|
+
if (rIdx >= 0 && gIdx >= 0 && bIdx >= 0) {
|
|
59620
|
+
let r = readByType(payload, vOffset + propOffsets[rIdx], properties[rIdx].type);
|
|
59621
|
+
let g = readByType(payload, vOffset + propOffsets[gIdx], properties[gIdx].type);
|
|
59622
|
+
let b = readByType(payload, vOffset + propOffsets[bIdx], properties[bIdx].type);
|
|
59623
|
+
if (properties[rIdx].type === "uchar" || properties[rIdx].type === "uint8") {
|
|
59624
|
+
r /= 255;
|
|
59625
|
+
g /= 255;
|
|
59626
|
+
b /= 255;
|
|
59627
|
+
}
|
|
59628
|
+
color[v * 3 + 0] = r;
|
|
59629
|
+
color[v * 3 + 1] = g;
|
|
59630
|
+
color[v * 3 + 2] = b;
|
|
59631
|
+
}
|
|
59632
|
+
}
|
|
59633
|
+
if (uv) {
|
|
59634
|
+
const uIdx = propIndex("u") >= 0 ? propIndex("u") : propIndex("s");
|
|
59635
|
+
const vIdx = propIndex("v") >= 0 ? propIndex("v") : propIndex("t");
|
|
59636
|
+
if (uIdx >= 0 && vIdx >= 0) {
|
|
59637
|
+
uv[v * 2 + 0] = readByType(payload, vOffset + propOffsets[uIdx], properties[uIdx].type);
|
|
59638
|
+
uv[v * 2 + 1] = readByType(payload, vOffset + propOffsets[vIdx], properties[vIdx].type);
|
|
59639
|
+
}
|
|
59640
|
+
}
|
|
59641
|
+
base += stride;
|
|
59642
|
+
}
|
|
59643
|
+
const indices = [];
|
|
59644
|
+
const triangleTexnumbers = [];
|
|
59645
|
+
const faceVertexUvs = [];
|
|
59646
|
+
let faceBase = base;
|
|
59647
|
+
uv && !hasVertexUV && !hasTexcoord ? new Array(vertexCount).fill(false) : null;
|
|
59648
|
+
for (let f = 0; f < faceCount; f++) {
|
|
59649
|
+
let currentOffset = faceBase;
|
|
59650
|
+
let faceIndices = [];
|
|
59651
|
+
let faceTexcoordArray = void 0;
|
|
59652
|
+
let faceTexnum = 0;
|
|
59653
|
+
let vertexCountInFace = 0;
|
|
59654
|
+
if (!faceProperties || faceProperties.length === 0) {
|
|
59655
|
+
throw new Error("PLY: Face element must have properties");
|
|
59656
|
+
}
|
|
59657
|
+
for (const prop of faceProperties) {
|
|
59658
|
+
if (prop.name === "vertex_indices") {
|
|
59659
|
+
const parts = prop.type.split(" ");
|
|
59660
|
+
if (parts.length !== 3 || parts[0] !== "list") {
|
|
59661
|
+
throw new Error(`PLY: Invalid vertex_indices property type: ${prop.type}`);
|
|
59662
|
+
}
|
|
59663
|
+
const countType = parts[1];
|
|
59664
|
+
const itemType = parts[2];
|
|
59665
|
+
vertexCountInFace = readByType(payload, currentOffset, countType);
|
|
59666
|
+
currentOffset += byteSizeOfType(countType);
|
|
59667
|
+
if (vertexCountInFace < 3) {
|
|
59668
|
+
throw new Error(`PLY: Face ${f} has less than 3 vertices`);
|
|
59669
|
+
}
|
|
59670
|
+
const indexSize = byteSizeOfType(itemType);
|
|
59671
|
+
faceIndices = [];
|
|
59672
|
+
for (let i = 0; i < vertexCountInFace; i++) {
|
|
59673
|
+
const idx = readByType(payload, currentOffset, itemType);
|
|
59674
|
+
faceIndices.push(idx);
|
|
59675
|
+
currentOffset += indexSize;
|
|
59676
|
+
}
|
|
59677
|
+
} else if (prop.name === "texcoord") {
|
|
59678
|
+
const parts = prop.type.split(" ");
|
|
59679
|
+
if (parts.length !== 3 || parts[0] !== "list") {
|
|
59680
|
+
throw new Error(`PLY: Invalid texcoord property type: ${prop.type}`);
|
|
59681
|
+
}
|
|
59682
|
+
const countType = parts[1];
|
|
59683
|
+
const itemType = parts[2];
|
|
59684
|
+
const texcoordCount = readByType(payload, currentOffset, countType);
|
|
59685
|
+
currentOffset += byteSizeOfType(countType);
|
|
59686
|
+
const itemSize = byteSizeOfType(itemType);
|
|
59687
|
+
faceTexcoordArray = new Float32Array(texcoordCount);
|
|
59688
|
+
for (let i = 0; i < texcoordCount; i++) {
|
|
59689
|
+
faceTexcoordArray[i] = readByType(payload, currentOffset, itemType);
|
|
59690
|
+
currentOffset += itemSize;
|
|
59691
|
+
}
|
|
59692
|
+
faceTexcoords.set(f, faceTexcoordArray);
|
|
59693
|
+
} else if (prop.name === "texnumber") {
|
|
59694
|
+
faceTexnum = readByType(payload, currentOffset, prop.type);
|
|
59695
|
+
currentOffset += byteSizeOfType(prop.type);
|
|
59696
|
+
faceTexnumbers[f] = faceTexnum;
|
|
59697
|
+
} else {
|
|
59698
|
+
if (prop.type.startsWith("list ")) {
|
|
59699
|
+
const parts = prop.type.split(" ");
|
|
59700
|
+
if (parts.length === 3) {
|
|
59701
|
+
const countType = parts[1];
|
|
59702
|
+
const itemType = parts[2];
|
|
59703
|
+
const count = readByType(payload, currentOffset, countType);
|
|
59704
|
+
currentOffset += byteSizeOfType(countType);
|
|
59705
|
+
const itemSize = byteSizeOfType(itemType);
|
|
59706
|
+
currentOffset += count * itemSize;
|
|
59707
|
+
}
|
|
59708
|
+
} else {
|
|
59709
|
+
currentOffset += byteSizeOfType(prop.type);
|
|
59710
|
+
}
|
|
59711
|
+
}
|
|
59712
|
+
}
|
|
59713
|
+
faceBase = currentOffset;
|
|
59714
|
+
const texnum = hasTexnumber ? faceTexnumbers[f] ?? 0 : 0;
|
|
59715
|
+
if (vertexCountInFace === 3) {
|
|
59716
|
+
indices.push(faceIndices[0], faceIndices[1], faceIndices[2]);
|
|
59717
|
+
if (hasTexnumber) {
|
|
59718
|
+
triangleTexnumbers.push(texnum);
|
|
59719
|
+
}
|
|
59720
|
+
if (hasTexcoord && faceTexcoordArray && faceTexcoordArray.length >= 6) {
|
|
59721
|
+
faceVertexUvs.push(
|
|
59722
|
+
faceTexcoordArray[0],
|
|
59723
|
+
1 - faceTexcoordArray[1],
|
|
59724
|
+
// vertex 0
|
|
59725
|
+
faceTexcoordArray[2],
|
|
59726
|
+
1 - faceTexcoordArray[3],
|
|
59727
|
+
// vertex 1
|
|
59728
|
+
faceTexcoordArray[4],
|
|
59729
|
+
1 - faceTexcoordArray[5]
|
|
59730
|
+
// vertex 2
|
|
59731
|
+
);
|
|
59732
|
+
}
|
|
59733
|
+
} else {
|
|
59734
|
+
for (let i = 1; i < vertexCountInFace - 1; i++) {
|
|
59735
|
+
indices.push(faceIndices[0], faceIndices[i], faceIndices[i + 1]);
|
|
59736
|
+
if (hasTexnumber) {
|
|
59737
|
+
triangleTexnumbers.push(texnum);
|
|
59738
|
+
}
|
|
59739
|
+
if (hasTexcoord && faceTexcoordArray && faceTexcoordArray.length >= vertexCountInFace * 2) {
|
|
59740
|
+
faceVertexUvs.push(
|
|
59741
|
+
faceTexcoordArray[0],
|
|
59742
|
+
1 - faceTexcoordArray[1],
|
|
59743
|
+
// vertex 0 (center of fan)
|
|
59744
|
+
faceTexcoordArray[i * 2 + 0],
|
|
59745
|
+
1 - faceTexcoordArray[i * 2 + 1],
|
|
59746
|
+
// vertex i
|
|
59747
|
+
faceTexcoordArray[(i + 1) * 2 + 0],
|
|
59748
|
+
1 - faceTexcoordArray[(i + 1) * 2 + 1]
|
|
59749
|
+
// vertex i+1
|
|
59750
|
+
);
|
|
59751
|
+
}
|
|
59752
|
+
}
|
|
59753
|
+
}
|
|
59754
|
+
}
|
|
59755
|
+
if (!hasNormalData) {
|
|
59756
|
+
for (let i = 0; i < vertexCount * 3; i++) {
|
|
59757
|
+
normal[i] = 0;
|
|
59758
|
+
}
|
|
59759
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
59760
|
+
const i0 = indices[i];
|
|
59761
|
+
const i1 = indices[i + 1];
|
|
59762
|
+
const i2 = indices[i + 2];
|
|
59763
|
+
const v0x = position[i0 * 3 + 0];
|
|
59764
|
+
const v0y = position[i0 * 3 + 1];
|
|
59765
|
+
const v0z = position[i0 * 3 + 2];
|
|
59766
|
+
const v1x = position[i1 * 3 + 0];
|
|
59767
|
+
const v1y = position[i1 * 3 + 1];
|
|
59768
|
+
const v1z = position[i1 * 3 + 2];
|
|
59769
|
+
const v2x = position[i2 * 3 + 0];
|
|
59770
|
+
const v2y = position[i2 * 3 + 1];
|
|
59771
|
+
const v2z = position[i2 * 3 + 2];
|
|
59772
|
+
const edge1x = v1x - v0x;
|
|
59773
|
+
const edge1y = v1y - v0y;
|
|
59774
|
+
const edge1z = v1z - v0z;
|
|
59775
|
+
const edge2x = v2x - v0x;
|
|
59776
|
+
const edge2y = v2y - v0y;
|
|
59777
|
+
const edge2z = v2z - v0z;
|
|
59778
|
+
const nx = edge1y * edge2z - edge1z * edge2y;
|
|
59779
|
+
const ny = edge1z * edge2x - edge1x * edge2z;
|
|
59780
|
+
const nz = edge1x * edge2y - edge1y * edge2x;
|
|
59781
|
+
normal[i0 * 3 + 0] += nx;
|
|
59782
|
+
normal[i0 * 3 + 1] += ny;
|
|
59783
|
+
normal[i0 * 3 + 2] += nz;
|
|
59784
|
+
normal[i1 * 3 + 0] += nx;
|
|
59785
|
+
normal[i1 * 3 + 1] += ny;
|
|
59786
|
+
normal[i1 * 3 + 2] += nz;
|
|
59787
|
+
normal[i2 * 3 + 0] += nx;
|
|
59788
|
+
normal[i2 * 3 + 1] += ny;
|
|
59789
|
+
normal[i2 * 3 + 2] += nz;
|
|
59790
|
+
}
|
|
59791
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
59792
|
+
const nx = normal[v * 3 + 0];
|
|
59793
|
+
const ny = normal[v * 3 + 1];
|
|
59794
|
+
const nz = normal[v * 3 + 2];
|
|
59795
|
+
const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
59796
|
+
if (length > 1e-5) {
|
|
59797
|
+
normal[v * 3 + 0] = nx / length;
|
|
59798
|
+
normal[v * 3 + 1] = ny / length;
|
|
59799
|
+
normal[v * 3 + 2] = nz / length;
|
|
59800
|
+
} else {
|
|
59801
|
+
normal[v * 3 + 0] = 0;
|
|
59802
|
+
normal[v * 3 + 1] = 1;
|
|
59803
|
+
normal[v * 3 + 2] = 0;
|
|
59804
|
+
}
|
|
59805
|
+
}
|
|
59806
|
+
}
|
|
59807
|
+
let finalPosition = position;
|
|
59808
|
+
let finalNormal = normal;
|
|
59809
|
+
let finalColor = color;
|
|
59810
|
+
let finalUv = void 0;
|
|
59811
|
+
let finalIndices = void 0;
|
|
59812
|
+
if (hasTexcoord && faceVertexUvs.length > 0) {
|
|
59813
|
+
const triangleCount = indices.length / 3;
|
|
59814
|
+
const expandedPosition = new Float32Array(triangleCount * 3 * 3);
|
|
59815
|
+
const expandedNormal = new Float32Array(triangleCount * 3 * 3);
|
|
59816
|
+
const expandedColor = color ? new Float32Array(triangleCount * 3 * 3) : void 0;
|
|
59817
|
+
finalUv = new Float32Array(faceVertexUvs);
|
|
59818
|
+
for (let i = 0; i < triangleCount; i++) {
|
|
59819
|
+
const baseIdx = i * 3;
|
|
59820
|
+
const i0 = indices[baseIdx + 0];
|
|
59821
|
+
const i1 = indices[baseIdx + 1];
|
|
59822
|
+
const i2 = indices[baseIdx + 2];
|
|
59823
|
+
expandedPosition[i * 9 + 0] = position[i0 * 3 + 0];
|
|
59824
|
+
expandedPosition[i * 9 + 1] = position[i0 * 3 + 1];
|
|
59825
|
+
expandedPosition[i * 9 + 2] = position[i0 * 3 + 2];
|
|
59826
|
+
expandedPosition[i * 9 + 3] = position[i1 * 3 + 0];
|
|
59827
|
+
expandedPosition[i * 9 + 4] = position[i1 * 3 + 1];
|
|
59828
|
+
expandedPosition[i * 9 + 5] = position[i1 * 3 + 2];
|
|
59829
|
+
expandedPosition[i * 9 + 6] = position[i2 * 3 + 0];
|
|
59830
|
+
expandedPosition[i * 9 + 7] = position[i2 * 3 + 1];
|
|
59831
|
+
expandedPosition[i * 9 + 8] = position[i2 * 3 + 2];
|
|
59832
|
+
expandedNormal[i * 9 + 0] = normal[i0 * 3 + 0];
|
|
59833
|
+
expandedNormal[i * 9 + 1] = normal[i0 * 3 + 1];
|
|
59834
|
+
expandedNormal[i * 9 + 2] = normal[i0 * 3 + 2];
|
|
59835
|
+
expandedNormal[i * 9 + 3] = normal[i1 * 3 + 0];
|
|
59836
|
+
expandedNormal[i * 9 + 4] = normal[i1 * 3 + 1];
|
|
59837
|
+
expandedNormal[i * 9 + 5] = normal[i1 * 3 + 2];
|
|
59838
|
+
expandedNormal[i * 9 + 6] = normal[i2 * 3 + 0];
|
|
59839
|
+
expandedNormal[i * 9 + 7] = normal[i2 * 3 + 1];
|
|
59840
|
+
expandedNormal[i * 9 + 8] = normal[i2 * 3 + 2];
|
|
59841
|
+
if (expandedColor && color) {
|
|
59842
|
+
expandedColor[i * 9 + 0] = color[i0 * 3 + 0];
|
|
59843
|
+
expandedColor[i * 9 + 1] = color[i0 * 3 + 1];
|
|
59844
|
+
expandedColor[i * 9 + 2] = color[i0 * 3 + 2];
|
|
59845
|
+
expandedColor[i * 9 + 3] = color[i1 * 3 + 0];
|
|
59846
|
+
expandedColor[i * 9 + 4] = color[i1 * 3 + 1];
|
|
59847
|
+
expandedColor[i * 9 + 5] = color[i1 * 3 + 2];
|
|
59848
|
+
expandedColor[i * 9 + 6] = color[i2 * 3 + 0];
|
|
59849
|
+
expandedColor[i * 9 + 7] = color[i2 * 3 + 1];
|
|
59850
|
+
expandedColor[i * 9 + 8] = color[i2 * 3 + 2];
|
|
59851
|
+
}
|
|
59852
|
+
}
|
|
59853
|
+
finalPosition = expandedPosition;
|
|
59854
|
+
finalNormal = expandedNormal;
|
|
59855
|
+
finalColor = expandedColor;
|
|
59856
|
+
const sequentialIndices = new Uint32Array(triangleCount * 3);
|
|
59857
|
+
for (let i = 0; i < triangleCount * 3; i++) {
|
|
59858
|
+
sequentialIndices[i] = i;
|
|
59859
|
+
}
|
|
59860
|
+
finalIndices = sequentialIndices;
|
|
59861
|
+
} else {
|
|
59862
|
+
finalIndices = new Uint32Array(indices);
|
|
59863
|
+
finalUv = uv;
|
|
59864
|
+
}
|
|
59865
|
+
return {
|
|
59866
|
+
vertexCount: hasTexcoord && faceVertexUvs.length > 0 ? finalPosition.length / 3 : vertexCount,
|
|
59867
|
+
faceCount,
|
|
59868
|
+
position: finalPosition,
|
|
59869
|
+
normal: finalNormal,
|
|
59870
|
+
color: finalColor,
|
|
59871
|
+
uv: finalUv,
|
|
59872
|
+
indices: finalIndices,
|
|
59873
|
+
textureFiles: textureFiles.length > 0 ? textureFiles : void 0,
|
|
59874
|
+
triangleTexnumbers: triangleTexnumbers.length > 0 ? triangleTexnumbers : void 0
|
|
59875
|
+
};
|
|
59876
|
+
}
|
|
59877
|
+
function parsePlyMeshASCII(buffer, header) {
|
|
59878
|
+
const { vertexCount, faceCount, properties, faceProperties, textureFiles, headerByteLength } = header;
|
|
59879
|
+
const text = new TextDecoder("utf-8").decode(buffer);
|
|
59880
|
+
const headerEnd = text.indexOf("end_header");
|
|
59881
|
+
if (headerEnd < 0) {
|
|
59882
|
+
throw new Error("PLY: Invalid PLY header");
|
|
59883
|
+
}
|
|
59884
|
+
let bodyStart = headerEnd + "end_header".length;
|
|
59885
|
+
while (bodyStart < text.length && (text[bodyStart] === " " || text[bodyStart] === "\n" || text[bodyStart] === "\r")) {
|
|
59886
|
+
bodyStart++;
|
|
59887
|
+
}
|
|
59888
|
+
const bodyText = text.substring(bodyStart);
|
|
59889
|
+
const tokens = bodyText.split(/\s+/).filter((token) => token.length > 0);
|
|
59890
|
+
let tokenIndex = 0;
|
|
59891
|
+
const has = (n) => properties.find((p) => p.name === n) != null;
|
|
59892
|
+
const parseASCIINumber = (type) => {
|
|
59893
|
+
if (tokenIndex >= tokens.length) {
|
|
59894
|
+
throw new Error("PLY: Unexpected end of file");
|
|
59895
|
+
}
|
|
59896
|
+
const value = tokens[tokenIndex++];
|
|
59897
|
+
switch (type) {
|
|
59898
|
+
case "char":
|
|
59899
|
+
case "uchar":
|
|
59900
|
+
case "short":
|
|
59901
|
+
case "ushort":
|
|
59902
|
+
case "int":
|
|
59903
|
+
case "uint":
|
|
59904
|
+
case "int8":
|
|
59905
|
+
case "uint8":
|
|
59906
|
+
case "int16":
|
|
59907
|
+
case "uint16":
|
|
59908
|
+
case "int32":
|
|
59909
|
+
case "uint32":
|
|
59910
|
+
return parseInt(value);
|
|
59911
|
+
case "float":
|
|
59912
|
+
case "double":
|
|
59913
|
+
case "float32":
|
|
59914
|
+
case "float64":
|
|
59915
|
+
return parseFloat(value);
|
|
59916
|
+
default:
|
|
59917
|
+
return parseFloat(value);
|
|
59918
|
+
}
|
|
59919
|
+
};
|
|
59920
|
+
const position = new Float32Array(vertexCount * 3);
|
|
59921
|
+
const hasNormalData = has("nx") && has("ny") && has("nz");
|
|
59922
|
+
const normal = hasNormalData ? new Float32Array(vertexCount * 3) : new Float32Array(vertexCount * 3);
|
|
59923
|
+
const color = (has("red") || has("r")) && (has("green") || has("g")) && (has("blue") || has("b")) ? new Float32Array(vertexCount * 3) : void 0;
|
|
59924
|
+
const hasVertexUV = (has("u") || has("s")) && (has("v") || has("t"));
|
|
59925
|
+
const hasTexcoord = faceProperties?.some((p) => p.name === "texcoord") || false;
|
|
59926
|
+
const uv = hasVertexUV || hasTexcoord ? new Float32Array(vertexCount * 2) : void 0;
|
|
59927
|
+
const faceTexcoords = /* @__PURE__ */ new Map();
|
|
59928
|
+
const hasTexnumber = faceProperties?.some((p) => p.name === "texnumber") || false;
|
|
59929
|
+
const faceTexnumbers = hasTexnumber ? new Array(faceCount) : [];
|
|
59930
|
+
const indices = [];
|
|
59931
|
+
const triangleTexnumbers = [];
|
|
59932
|
+
const faceVertexUvs = [];
|
|
59933
|
+
const propIndex = (n) => properties.findIndex((p) => p.name === n);
|
|
59934
|
+
const xIdx = propIndex("x");
|
|
59935
|
+
const yIdx = propIndex("y");
|
|
59936
|
+
const zIdx = propIndex("z");
|
|
59937
|
+
const nxIdx = hasNormalData ? propIndex("nx") : -1;
|
|
59938
|
+
const nyIdx = hasNormalData ? propIndex("ny") : -1;
|
|
59939
|
+
const nzIdx = hasNormalData ? propIndex("nz") : -1;
|
|
59940
|
+
const rIdx = color ? propIndex("red") >= 0 ? propIndex("red") : propIndex("r") : -1;
|
|
59941
|
+
const gIdx = color ? propIndex("green") >= 0 ? propIndex("green") : propIndex("g") : -1;
|
|
59942
|
+
const bIdx = color ? propIndex("blue") >= 0 ? propIndex("blue") : propIndex("b") : -1;
|
|
59943
|
+
const uIdx = uv && hasVertexUV ? propIndex("u") >= 0 ? propIndex("u") : propIndex("s") : -1;
|
|
59944
|
+
const vIdx = uv && hasVertexUV ? propIndex("v") >= 0 ? propIndex("v") : propIndex("t") : -1;
|
|
59945
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
59946
|
+
for (let pIdx = 0; pIdx < properties.length; pIdx++) {
|
|
59947
|
+
const prop = properties[pIdx];
|
|
59948
|
+
const value = parseASCIINumber(prop.type);
|
|
59949
|
+
if (pIdx === xIdx) {
|
|
59950
|
+
position[v * 3 + 0] = value;
|
|
59951
|
+
} else if (pIdx === yIdx) {
|
|
59952
|
+
position[v * 3 + 1] = value;
|
|
59953
|
+
} else if (pIdx === zIdx) {
|
|
59954
|
+
position[v * 3 + 2] = value;
|
|
59955
|
+
} else if (pIdx === nxIdx) {
|
|
59956
|
+
normal[v * 3 + 0] = value;
|
|
59957
|
+
} else if (pIdx === nyIdx) {
|
|
59958
|
+
normal[v * 3 + 1] = value;
|
|
59959
|
+
} else if (pIdx === nzIdx) {
|
|
59960
|
+
normal[v * 3 + 2] = value;
|
|
59961
|
+
} else if (pIdx === rIdx && color) {
|
|
59962
|
+
color[v * 3 + 0] = prop.type === "uchar" || prop.type === "uint8" ? value / 255 : value;
|
|
59963
|
+
} else if (pIdx === gIdx && color) {
|
|
59964
|
+
color[v * 3 + 1] = prop.type === "uchar" || prop.type === "uint8" ? value / 255 : value;
|
|
59965
|
+
} else if (pIdx === bIdx && color) {
|
|
59966
|
+
color[v * 3 + 2] = prop.type === "uchar" || prop.type === "uint8" ? value / 255 : value;
|
|
59967
|
+
} else if (pIdx === uIdx && uv) {
|
|
59968
|
+
uv[v * 2 + 0] = value;
|
|
59969
|
+
} else if (pIdx === vIdx && uv) {
|
|
59970
|
+
uv[v * 2 + 1] = value;
|
|
59971
|
+
}
|
|
59972
|
+
}
|
|
59973
|
+
}
|
|
59974
|
+
for (let f = 0; f < faceCount; f++) {
|
|
59975
|
+
let faceIndices = [];
|
|
59976
|
+
let faceTexcoordArray = void 0;
|
|
59977
|
+
let faceTexnum = 0;
|
|
59978
|
+
for (const prop of faceProperties || []) {
|
|
59979
|
+
if (prop.name === "vertex_indices") {
|
|
59980
|
+
const parts = prop.type.split(" ");
|
|
59981
|
+
const countType = parts[1];
|
|
59982
|
+
const itemType = parts[2];
|
|
59983
|
+
const vertexCountInFace2 = parseASCIINumber(countType);
|
|
59984
|
+
faceIndices = [];
|
|
59985
|
+
for (let i = 0; i < vertexCountInFace2; i++) {
|
|
59986
|
+
faceIndices.push(parseASCIINumber(itemType));
|
|
59987
|
+
}
|
|
59988
|
+
} else if (prop.name === "texcoord") {
|
|
59989
|
+
const parts = prop.type.split(" ");
|
|
59990
|
+
const countType = parts[1];
|
|
59991
|
+
const itemType = parts[2];
|
|
59992
|
+
const texcoordCount = parseASCIINumber(countType);
|
|
59993
|
+
faceTexcoordArray = new Float32Array(texcoordCount);
|
|
59994
|
+
for (let i = 0; i < texcoordCount; i++) {
|
|
59995
|
+
faceTexcoordArray[i] = parseASCIINumber(itemType);
|
|
59996
|
+
}
|
|
59997
|
+
faceTexcoords.set(f, faceTexcoordArray);
|
|
59998
|
+
} else if (prop.name === "texnumber") {
|
|
59999
|
+
faceTexnum = parseASCIINumber(prop.type);
|
|
60000
|
+
faceTexnumbers[f] = faceTexnum;
|
|
60001
|
+
}
|
|
60002
|
+
}
|
|
60003
|
+
const vertexCountInFace = faceIndices.length;
|
|
60004
|
+
const texnum = hasTexnumber ? faceTexnumbers[f] ?? 0 : 0;
|
|
60005
|
+
if (vertexCountInFace === 3) {
|
|
60006
|
+
indices.push(faceIndices[0], faceIndices[1], faceIndices[2]);
|
|
60007
|
+
if (hasTexnumber) {
|
|
60008
|
+
triangleTexnumbers.push(texnum);
|
|
60009
|
+
}
|
|
60010
|
+
if (hasTexcoord && faceTexcoordArray && faceTexcoordArray.length >= 6) {
|
|
60011
|
+
faceVertexUvs.push(
|
|
60012
|
+
faceTexcoordArray[0],
|
|
60013
|
+
1 - faceTexcoordArray[1],
|
|
60014
|
+
faceTexcoordArray[2],
|
|
60015
|
+
1 - faceTexcoordArray[3],
|
|
60016
|
+
faceTexcoordArray[4],
|
|
60017
|
+
1 - faceTexcoordArray[5]
|
|
60018
|
+
);
|
|
60019
|
+
}
|
|
60020
|
+
} else {
|
|
60021
|
+
for (let i = 1; i < vertexCountInFace - 1; i++) {
|
|
60022
|
+
indices.push(faceIndices[0], faceIndices[i], faceIndices[i + 1]);
|
|
60023
|
+
if (hasTexnumber) {
|
|
60024
|
+
triangleTexnumbers.push(texnum);
|
|
60025
|
+
}
|
|
60026
|
+
if (hasTexcoord && faceTexcoordArray && faceTexcoordArray.length >= vertexCountInFace * 2) {
|
|
60027
|
+
faceVertexUvs.push(
|
|
60028
|
+
faceTexcoordArray[0],
|
|
60029
|
+
1 - faceTexcoordArray[1],
|
|
60030
|
+
faceTexcoordArray[i * 2 + 0],
|
|
60031
|
+
1 - faceTexcoordArray[i * 2 + 1],
|
|
60032
|
+
faceTexcoordArray[(i + 1) * 2 + 0],
|
|
60033
|
+
1 - faceTexcoordArray[(i + 1) * 2 + 1]
|
|
60034
|
+
);
|
|
60035
|
+
}
|
|
60036
|
+
}
|
|
60037
|
+
}
|
|
60038
|
+
}
|
|
60039
|
+
if (!hasNormalData) {
|
|
60040
|
+
for (let i = 0; i < vertexCount * 3; i++) {
|
|
60041
|
+
normal[i] = 0;
|
|
60042
|
+
}
|
|
60043
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
60044
|
+
const i0 = indices[i];
|
|
60045
|
+
const i1 = indices[i + 1];
|
|
60046
|
+
const i2 = indices[i + 2];
|
|
60047
|
+
const v0x = position[i0 * 3 + 0];
|
|
60048
|
+
const v0y = position[i0 * 3 + 1];
|
|
60049
|
+
const v0z = position[i0 * 3 + 2];
|
|
60050
|
+
const v1x = position[i1 * 3 + 0];
|
|
60051
|
+
const v1y = position[i1 * 3 + 1];
|
|
60052
|
+
const v1z = position[i1 * 3 + 2];
|
|
60053
|
+
const v2x = position[i2 * 3 + 0];
|
|
60054
|
+
const v2y = position[i2 * 3 + 1];
|
|
60055
|
+
const v2z = position[i2 * 3 + 2];
|
|
60056
|
+
const edge1x = v1x - v0x;
|
|
60057
|
+
const edge1y = v1y - v0y;
|
|
60058
|
+
const edge1z = v1z - v0z;
|
|
60059
|
+
const edge2x = v2x - v0x;
|
|
60060
|
+
const edge2y = v2y - v0y;
|
|
60061
|
+
const edge2z = v2z - v0z;
|
|
60062
|
+
const nx = edge1y * edge2z - edge1z * edge2y;
|
|
60063
|
+
const ny = edge1z * edge2x - edge1x * edge2z;
|
|
60064
|
+
const nz = edge1x * edge2y - edge1y * edge2x;
|
|
60065
|
+
normal[i0 * 3 + 0] += nx;
|
|
60066
|
+
normal[i0 * 3 + 1] += ny;
|
|
60067
|
+
normal[i0 * 3 + 2] += nz;
|
|
60068
|
+
normal[i1 * 3 + 0] += nx;
|
|
60069
|
+
normal[i1 * 3 + 1] += ny;
|
|
60070
|
+
normal[i1 * 3 + 2] += nz;
|
|
60071
|
+
normal[i2 * 3 + 0] += nx;
|
|
60072
|
+
normal[i2 * 3 + 1] += ny;
|
|
60073
|
+
normal[i2 * 3 + 2] += nz;
|
|
60074
|
+
}
|
|
60075
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
60076
|
+
const nx = normal[v * 3 + 0];
|
|
60077
|
+
const ny = normal[v * 3 + 1];
|
|
60078
|
+
const nz = normal[v * 3 + 2];
|
|
60079
|
+
const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
60080
|
+
if (length > 1e-5) {
|
|
60081
|
+
normal[v * 3 + 0] = nx / length;
|
|
60082
|
+
normal[v * 3 + 1] = ny / length;
|
|
60083
|
+
normal[v * 3 + 2] = nz / length;
|
|
60084
|
+
} else {
|
|
60085
|
+
normal[v * 3 + 0] = 0;
|
|
60086
|
+
normal[v * 3 + 1] = 1;
|
|
60087
|
+
normal[v * 3 + 2] = 0;
|
|
60088
|
+
}
|
|
60089
|
+
}
|
|
60090
|
+
}
|
|
60091
|
+
let finalPosition = position;
|
|
60092
|
+
let finalNormal = normal;
|
|
60093
|
+
let finalColor = color;
|
|
60094
|
+
let finalUv = void 0;
|
|
60095
|
+
let finalIndices = void 0;
|
|
60096
|
+
if (hasTexcoord && faceVertexUvs.length > 0) {
|
|
60097
|
+
const triangleCount = indices.length / 3;
|
|
60098
|
+
const expandedPosition = new Float32Array(triangleCount * 3 * 3);
|
|
60099
|
+
const expandedNormal = new Float32Array(triangleCount * 3 * 3);
|
|
60100
|
+
const expandedColor = color ? new Float32Array(triangleCount * 3 * 3) : void 0;
|
|
60101
|
+
finalUv = new Float32Array(faceVertexUvs);
|
|
60102
|
+
for (let i = 0; i < triangleCount; i++) {
|
|
60103
|
+
const baseIdx = i * 3;
|
|
60104
|
+
const i0 = indices[baseIdx + 0];
|
|
60105
|
+
const i1 = indices[baseIdx + 1];
|
|
60106
|
+
const i2 = indices[baseIdx + 2];
|
|
60107
|
+
expandedPosition[i * 9 + 0] = position[i0 * 3 + 0];
|
|
60108
|
+
expandedPosition[i * 9 + 1] = position[i0 * 3 + 1];
|
|
60109
|
+
expandedPosition[i * 9 + 2] = position[i0 * 3 + 2];
|
|
60110
|
+
expandedPosition[i * 9 + 3] = position[i1 * 3 + 0];
|
|
60111
|
+
expandedPosition[i * 9 + 4] = position[i1 * 3 + 1];
|
|
60112
|
+
expandedPosition[i * 9 + 5] = position[i1 * 3 + 2];
|
|
60113
|
+
expandedPosition[i * 9 + 6] = position[i2 * 3 + 0];
|
|
60114
|
+
expandedPosition[i * 9 + 7] = position[i2 * 3 + 1];
|
|
60115
|
+
expandedPosition[i * 9 + 8] = position[i2 * 3 + 2];
|
|
60116
|
+
expandedNormal[i * 9 + 0] = normal[i0 * 3 + 0];
|
|
60117
|
+
expandedNormal[i * 9 + 1] = normal[i0 * 3 + 1];
|
|
60118
|
+
expandedNormal[i * 9 + 2] = normal[i0 * 3 + 2];
|
|
60119
|
+
expandedNormal[i * 9 + 3] = normal[i1 * 3 + 0];
|
|
60120
|
+
expandedNormal[i * 9 + 4] = normal[i1 * 3 + 1];
|
|
60121
|
+
expandedNormal[i * 9 + 5] = normal[i1 * 3 + 2];
|
|
60122
|
+
expandedNormal[i * 9 + 6] = normal[i2 * 3 + 0];
|
|
60123
|
+
expandedNormal[i * 9 + 7] = normal[i2 * 3 + 1];
|
|
60124
|
+
expandedNormal[i * 9 + 8] = normal[i2 * 3 + 2];
|
|
60125
|
+
if (expandedColor && color) {
|
|
60126
|
+
expandedColor[i * 9 + 0] = color[i0 * 3 + 0];
|
|
60127
|
+
expandedColor[i * 9 + 1] = color[i0 * 3 + 1];
|
|
60128
|
+
expandedColor[i * 9 + 2] = color[i0 * 3 + 2];
|
|
60129
|
+
expandedColor[i * 9 + 3] = color[i1 * 3 + 0];
|
|
60130
|
+
expandedColor[i * 9 + 4] = color[i1 * 3 + 1];
|
|
60131
|
+
expandedColor[i * 9 + 5] = color[i1 * 3 + 2];
|
|
60132
|
+
expandedColor[i * 9 + 6] = color[i2 * 3 + 0];
|
|
60133
|
+
expandedColor[i * 9 + 7] = color[i2 * 3 + 1];
|
|
60134
|
+
expandedColor[i * 9 + 8] = color[i2 * 3 + 2];
|
|
60135
|
+
}
|
|
60136
|
+
}
|
|
60137
|
+
finalPosition = expandedPosition;
|
|
60138
|
+
finalNormal = expandedNormal;
|
|
60139
|
+
finalColor = expandedColor;
|
|
60140
|
+
const sequentialIndices = new Uint32Array(triangleCount * 3);
|
|
60141
|
+
for (let i = 0; i < triangleCount * 3; i++) {
|
|
60142
|
+
sequentialIndices[i] = i;
|
|
60143
|
+
}
|
|
60144
|
+
finalIndices = sequentialIndices;
|
|
60145
|
+
} else {
|
|
60146
|
+
finalIndices = new Uint32Array(indices);
|
|
60147
|
+
finalUv = uv;
|
|
60148
|
+
}
|
|
60149
|
+
return {
|
|
60150
|
+
vertexCount: hasTexcoord && faceVertexUvs.length > 0 ? finalPosition.length / 3 : vertexCount,
|
|
60151
|
+
faceCount,
|
|
60152
|
+
position: finalPosition,
|
|
60153
|
+
normal: finalNormal,
|
|
60154
|
+
color: finalColor,
|
|
60155
|
+
uv: finalUv,
|
|
60156
|
+
indices: finalIndices,
|
|
60157
|
+
textureFiles: textureFiles.length > 0 ? textureFiles : void 0,
|
|
60158
|
+
triangleTexnumbers: triangleTexnumbers.length > 0 ? triangleTexnumbers : void 0
|
|
60159
|
+
};
|
|
60160
|
+
}
|
|
59227
60161
|
|
|
59228
60162
|
class GaussianSplatParser extends ParserBase {
|
|
59229
60163
|
static format = ParserFormat.BIN;
|
|
@@ -59332,6 +60266,133 @@ class KHR_lights_punctual {
|
|
|
59332
60266
|
class KHR_materials_ior {
|
|
59333
60267
|
}
|
|
59334
60268
|
|
|
60269
|
+
class PlyParser extends ParserBase {
|
|
60270
|
+
static format = ParserFormat.BIN;
|
|
60271
|
+
async parseBuffer(buffer) {
|
|
60272
|
+
const header = parsePlyHeader(buffer);
|
|
60273
|
+
switch (header.mode) {
|
|
60274
|
+
case PlyMode.Splat: {
|
|
60275
|
+
const plyData = parsePlyGaussianSplat(buffer);
|
|
60276
|
+
const asset = {
|
|
60277
|
+
count: plyData.vertexCount,
|
|
60278
|
+
position: plyData.position,
|
|
60279
|
+
rotation: plyData.rotation,
|
|
60280
|
+
scale: plyData.scale,
|
|
60281
|
+
opacity: plyData.opacity,
|
|
60282
|
+
sh: plyData.sh
|
|
60283
|
+
};
|
|
60284
|
+
asset.bbox = computeAABBFromPositions(plyData.position);
|
|
60285
|
+
const gsplatObj = new Object3D();
|
|
60286
|
+
gsplatObj.name = "GaussianSplat";
|
|
60287
|
+
const renderer = gsplatObj.addComponent(GSplatRenderer);
|
|
60288
|
+
renderer.initAsset(asset);
|
|
60289
|
+
this.data = gsplatObj;
|
|
60290
|
+
break;
|
|
60291
|
+
}
|
|
60292
|
+
case PlyMode.PointCloud: {
|
|
60293
|
+
break;
|
|
60294
|
+
}
|
|
60295
|
+
case PlyMode.Mesh: {
|
|
60296
|
+
const plyData = parsePlyMesh(buffer);
|
|
60297
|
+
const rootObj = new Object3D();
|
|
60298
|
+
rootObj.name = "PLYMesh";
|
|
60299
|
+
const textureGroups = /* @__PURE__ */ new Map();
|
|
60300
|
+
if (plyData.triangleTexnumbers && plyData.triangleTexnumbers.length > 0) {
|
|
60301
|
+
for (let i = 0; i < plyData.triangleTexnumbers.length; i++) {
|
|
60302
|
+
const texnum = plyData.triangleTexnumbers[i];
|
|
60303
|
+
if (!textureGroups.has(texnum)) {
|
|
60304
|
+
textureGroups.set(texnum, []);
|
|
60305
|
+
}
|
|
60306
|
+
textureGroups.get(texnum).push(i);
|
|
60307
|
+
}
|
|
60308
|
+
} else {
|
|
60309
|
+
const triangleCount = plyData.indices.length / 3;
|
|
60310
|
+
const allTriangles = [];
|
|
60311
|
+
for (let i = 0; i < triangleCount; i++) {
|
|
60312
|
+
allTriangles.push(i);
|
|
60313
|
+
}
|
|
60314
|
+
textureGroups.set(0, allTriangles);
|
|
60315
|
+
}
|
|
60316
|
+
const materials = /* @__PURE__ */ new Map();
|
|
60317
|
+
if (plyData.textureFiles && plyData.textureFiles.length > 0) {
|
|
60318
|
+
const promiseList = [];
|
|
60319
|
+
for (let texnum = 0; texnum < plyData.textureFiles.length; texnum++) {
|
|
60320
|
+
const material = new LitMaterial();
|
|
60321
|
+
const texturePath = StringUtil.normalizePath(
|
|
60322
|
+
this.baseUrl + plyData.textureFiles[texnum]
|
|
60323
|
+
);
|
|
60324
|
+
promiseList.push(Engine3D.res.loadTexture(texturePath).then((texture) => {
|
|
60325
|
+
material.baseMap = texture;
|
|
60326
|
+
materials.set(texnum, material);
|
|
60327
|
+
}));
|
|
60328
|
+
}
|
|
60329
|
+
await Promise.all(promiseList);
|
|
60330
|
+
}
|
|
60331
|
+
if (materials.size === 0) {
|
|
60332
|
+
materials.set(0, new LitMaterial());
|
|
60333
|
+
}
|
|
60334
|
+
for (const [texnum, triangleIndices] of textureGroups) {
|
|
60335
|
+
const groupIndices = [];
|
|
60336
|
+
for (const triIdx of triangleIndices) {
|
|
60337
|
+
const baseIdx = triIdx * 3;
|
|
60338
|
+
groupIndices.push(
|
|
60339
|
+
plyData.indices[baseIdx + 0],
|
|
60340
|
+
plyData.indices[baseIdx + 1],
|
|
60341
|
+
plyData.indices[baseIdx + 2]
|
|
60342
|
+
);
|
|
60343
|
+
}
|
|
60344
|
+
const geometry = new GeometryBase();
|
|
60345
|
+
geometry.setAttribute(
|
|
60346
|
+
VertexAttributeName.position,
|
|
60347
|
+
plyData.position
|
|
60348
|
+
);
|
|
60349
|
+
geometry.setAttribute(
|
|
60350
|
+
VertexAttributeName.normal,
|
|
60351
|
+
plyData.normal
|
|
60352
|
+
);
|
|
60353
|
+
if (plyData.uv) {
|
|
60354
|
+
geometry.setAttribute(
|
|
60355
|
+
VertexAttributeName.uv,
|
|
60356
|
+
plyData.uv
|
|
60357
|
+
);
|
|
60358
|
+
}
|
|
60359
|
+
if (plyData.color) {
|
|
60360
|
+
geometry.setAttribute(
|
|
60361
|
+
VertexAttributeName.color,
|
|
60362
|
+
plyData.color
|
|
60363
|
+
);
|
|
60364
|
+
}
|
|
60365
|
+
geometry.setIndices(new Uint32Array(groupIndices));
|
|
60366
|
+
geometry.addSubGeometry({
|
|
60367
|
+
indexStart: 0,
|
|
60368
|
+
indexCount: groupIndices.length,
|
|
60369
|
+
vertexStart: 0,
|
|
60370
|
+
vertexCount: 0,
|
|
60371
|
+
firstStart: 0,
|
|
60372
|
+
index: 0,
|
|
60373
|
+
topology: 0
|
|
60374
|
+
});
|
|
60375
|
+
let material = materials.get(texnum);
|
|
60376
|
+
if (!material) {
|
|
60377
|
+
material = materials.values().next().value || new LitMaterial();
|
|
60378
|
+
}
|
|
60379
|
+
const meshObj = new Object3D();
|
|
60380
|
+
meshObj.name = `PLYMesh_Texture_${texnum}`;
|
|
60381
|
+
const renderer = meshObj.addComponent(MeshRenderer);
|
|
60382
|
+
renderer.geometry = geometry;
|
|
60383
|
+
renderer.material = material;
|
|
60384
|
+
rootObj.addChild(meshObj);
|
|
60385
|
+
}
|
|
60386
|
+
this.data = rootObj;
|
|
60387
|
+
break;
|
|
60388
|
+
}
|
|
60389
|
+
}
|
|
60390
|
+
}
|
|
60391
|
+
verification() {
|
|
60392
|
+
return !!this.data;
|
|
60393
|
+
}
|
|
60394
|
+
}
|
|
60395
|
+
|
|
59335
60396
|
class PrefabBoneData {
|
|
59336
60397
|
boneName;
|
|
59337
60398
|
bonePath;
|
|
@@ -62520,7 +63581,7 @@ class TilesRenderer {
|
|
|
62520
63581
|
if (sceneObj.parent) {
|
|
62521
63582
|
sceneObj.parent.object3D.removeChild(sceneObj);
|
|
62522
63583
|
}
|
|
62523
|
-
sceneObj.destroy();
|
|
63584
|
+
sceneObj.destroy(true);
|
|
62524
63585
|
tileItem.cached.scene = null;
|
|
62525
63586
|
}
|
|
62526
63587
|
tileItem.loadingState = UNLOADED;
|
|
@@ -62834,7 +63895,7 @@ class TilesRenderer {
|
|
|
62834
63895
|
/**
|
|
62835
63896
|
* Clean up resources
|
|
62836
63897
|
*/
|
|
62837
|
-
dispose() {
|
|
63898
|
+
dispose(force) {
|
|
62838
63899
|
const plugins = [...this.plugins];
|
|
62839
63900
|
plugins.forEach((plugin) => this.unregisterPlugin(plugin));
|
|
62840
63901
|
this.lruCache.clear();
|
|
@@ -62846,7 +63907,7 @@ class TilesRenderer {
|
|
|
62846
63907
|
this.frameCount = 0;
|
|
62847
63908
|
this.isLoading = false;
|
|
62848
63909
|
this.resetCacheStats();
|
|
62849
|
-
this.group.destroy();
|
|
63910
|
+
this.group.destroy(force);
|
|
62850
63911
|
}
|
|
62851
63912
|
/**
|
|
62852
63913
|
* Rings-specific: Add camera
|
|
@@ -68907,4 +69968,4 @@ const __viteBrowserExternal = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.def
|
|
|
68907
69968
|
__proto__: null
|
|
68908
69969
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
68909
69970
|
|
|
68910
|
-
export { AccelerateDecelerateInterpolator, AccelerateInterpolator, AnimationCurve, AnimationCurveT, AnimationMonitor, AnimatorComponent, AnimatorEventKeyframe, AnticipateInterpolator, AnticipateOvershootInterpolator, ArrayHas, ArrayItemIndex, AtlasParser, AtmosphericComponent, AtmosphericScatteringSky, AtmosphericScatteringSkySetting, AtmosphericScatteringSky_shader, AttributeAnimCurve, AxisObject, B3DMLoader, B3DMLoaderBase, B3DMParseUtil, B3DMParser, BRDFLUT, BRDFLUTGenerate, BRDF_frag, BatchTable, BiMap, BillboardComponent, BillboardType, BitUtil, BitmapTexture2D, BitmapTexture2DArray, BitmapTextureCube, Blend, BlendFactor, BlendMode, BlendShapeData, BlendShapePropertyData, BloomPost, BlurEffectCreatorBlur_cs, BlurEffectCreatorSample_cs, BlurTexture2DBufferCreator, BounceInterpolator, BoundUtil, BoundingBox, BoundingSphere, BoundingVolume, BoxColliderShape, BoxGeometry, BrdfLut_frag, BsDF_frag, BxDF_frag, BxdfDebug_frag, BytesArray, CEvent, CEventDispatcher, CEventListener, CResizeEvent, CSM, Camera3D, CameraControllerBase, CameraType, CameraUtil, CapsuleColliderShape, CastPointShadowMaterialPass, CastShadowMaterialPass, Clearcoat_frag, ClusterBoundsSource_cs, ClusterConfig, ClusterDebug_frag, ClusterLight, ClusterLightingBuffer, ClusterLightingRender, ClusterLighting_cs, CollectInfo, ColliderComponent, ColliderShape, ColliderShapeType, Color, ColorGradient, ColorLitMaterial, ColorLitShader, ColorPassFragmentOutput, ColorPassRenderer, ColorUtil, ComData, Combine_cs, Common_frag, Common_vert, ComponentBase, ComponentCollect, ComputeGPUBuffer, ComputeShader, Context3D, CubeCamera, CubeMapFaceEnum, CubeSky_Shader, CubicBezierCurve, CubicBezierPath, CubicBezierType, CycleInterpolator, CylinderGeometry, DDGIIrradianceComputePass, DDGIIrradianceGPUBufferReader, DDGIIrradianceVolume, DDGIIrradiance_shader, DDGILightingPass, DDGILighting_shader, DDGIMultiBouncePass, DDGIProbeRenderer, DEGREES_TO_RADIANS, DRACO_DECODER_GLTF_JS, DecelerateInterpolator, Denoising_cs, Depth2DTextureArray, DepthCubeArrayTexture, DepthMaterialPass, DepthOfFieldPost, DepthOfView_cs, DirectLight, DoubleArray, EditorInspector, Engine3D, Entity, EntityBatchCollect, EntityCollect, EnvMap_frag, ErpImage2CubeMap, ErpImage2CubeMapCreateCube_cs, ErpImage2CubeMapRgbe2rgba_cs, ExtrudeGeometry, FAILED, FASTFLOOR, FXAAPost, FXAAShader, FastMathShader, FatLineGeometry, FatLineMaterial, FatLineRenderer, FatLineShader, FatLine_FS, FatLine_VS, FeatureTable, FileLoader, FirstPersonCameraController, Float16ArrayTexture, Float32ArrayTexture, FlyCameraController, FontChar, FontInfo, FontPage, FontParser, ForwardRenderJob, FragmentOutput, FragmentVarying, FrameCache, Frustum, FrustumCSM, FrustumCulling_cs, FullQuad_vert_wgsl, GBufferFrame, GBufferPass, GBufferPost, GBufferStand, GBuffer_pass, GILighting, GIProbeMaterial, GIProbeMaterialType, GIProbeShader, GIRenderCompleteEvent, GIRenderStartEvent, GLBChunk, GLBHeader, GLBParser, GLSLLexer, GLSLLexerToken, GLSLPreprocessor, GLSLSyntax, GLTFBinaryExtension, GLTFMaterial, GLTFParser, GLTFSubParser, GLTFSubParserCamera, GLTFSubParserConverter, GLTFSubParserMaterial, GLTFSubParserMesh, GLTFSubParserSkeleton, GLTFSubParserSkin, GLTFType, GLTF_Accessors, GLTF_Info, GLTF_Light, GLTF_Mesh, GLTF_Node, GLTF_Primitives, GLTF_Scene, GPUAddressMode, GPUBlendFactor, GPUBufferBase, GPUBufferType, GPUCompareFunction, GPUContext, GPUCullMode, GPUFilterMode, GPUPrimitiveTopology, GPUTextureFormat, GPUVertexFormat, GPUVertexStepMode, GSplatFormat, GSplatGeometry, GSplatMaterial, GSplatRenderer, GSplatShader, GSplat_FS, GSplat_VS, GTAOPost, GTAO_cs, GUIAtlasTexture, GUICanvas, GUIConfig, GUIGeometry, GUIGeometryRebuild, GUIMaterial, GUIPassRenderer, GUIPick, GUIPickHelper, GUIQuad, GUIQuadAttrEnum, GUIRenderer, GUIShader, GUISpace, GUISprite, GUITexture, GaussianSplatParser, GenerayRandomDir, GeoJsonParser, GeoJsonUtil, GeoType, GeometryBase, GeometryIndicesBuffer, GeometryUtil, GeometryVertexBuffer, GeometryVertexType, GetComponentClass, GetCountInstanceID, GetRepeat, GetShader, GlassShader, GlobalBindGroup, GlobalBindGroupLayout, GlobalFog, GlobalFog_shader, GlobalIlluminationComponent, GlobalUniform, GlobalUniformGroup, GodRayPost, GodRay_cs, GridObject, HDRTexture, HDRTextureCube, Hair_frag, Hair_shader_op, Hair_shader_tr, HaltonSeq, Horizontal, HoverCameraController, I3DMLoader, I3DMLoaderBase, I3DMParser, IBLEnvMapCreator, IBLEnvMapCreator_cs, IESProfiles, IESProfiles_frag, IKDTreeUserData, ImageType, IndicesGPUBuffer, Inline_vert, InputSystem, InstanceDrawComponent, InstanceUniform, InstancedMesh, Interpolator, InterpolatorEnum, IrradianceDataReaderCompleteEvent, IrradianceVolumeData_frag, Irradiance_frag, IsEditorInspector, IsNonSerialize, Joint, JointPose, JumperInterpolator, KDTreeEntity, KDTreeNode, KDTreeRange, KDTreeSpace, KDTreeUUID, KHR_draco_mesh_compression, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_emissive_strength, KHR_materials_ior, KHR_materials_unlit, KMZParser, KV, KelvinUtil, KeyCode, KeyEvent, Keyframe, KeyframeT, LDRTextureCube, LOADED, LOADING, LRUCache, LambertMaterial, Lambert_shader, Light, LightBase, LightData, LightEntries, LightType, LightingFunction_frag, Line, LineClassification, LinearInterpolator, LitMaterial, LitSSSShader, LitShader, Lit_shader, LoaderBase, LoaderEvent, LoaderManager, MAX_VALUE, MIN_VALUE, Material, MaterialDataUniformGPUBuffer, MaterialUtilities, MathShader, MathUtil, Matrix3, Matrix4, MatrixBindGroup, MatrixGPUBuffer, MatrixShader, MemoryDO, MemoryInfo, MergeRGBACreator, MergeRGBA_cs, MeshColliderShape, MeshFilter, MeshRenderer, MinMaxAnimationCurves, MinMaxCurve, MinMaxCurveState, MinMaxPolyCurves, MorePassParser, MorePassShader, MorphTargetBlender, MorphTargetData, MorphTargetFrame, MorphTargetTransformKey, MorphTarget_shader, MouseCode, MultiBouncePass_cs, Navi3DAstar, Navi3DConst, Navi3DEdge, Navi3DFunnel, Navi3DMaskType, Navi3DMesh, Navi3DPoint, Navi3DPoint2D, Navi3DPointFat, Navi3DRouter, Navi3DTriangle, NonSerialize, NormalMap_frag, OAnimationEvent, OBJParser, Object3D, Object3DEvent, Object3DTransformTools, Object3DUtil, ObjectAnimClip, OcclusionSystem, Octree, OctreeEntity, OrbitController, OrderMap, Orientation3D, OutLineBlendColor_cs, OutlineCalcOutline_cs, OutlinePass, OutlinePost, OutlinePostData, OutlinePostManager, OutlinePostSlot, Outline_cs, OvershootInterpolator, PARSING, PBRLItShader, PBRLitSSSShader, PLUGIN_REGISTERED, ParserBase, ParserFormat, ParticleSystemCurveEvalMode, ParticleSystemRandomnessIds, PassGenerate, PassShader, PassType, PhysicMaterialUniform_frag, PickCompute, PickFire, PickGUIEvent3D, PickResult, Picker_cs, PingPong, PipelinePool, Plane3D, PlaneClassification, PlaneGeometry, PointClassification, PointLight, PointLightShadowRenderer, PointShadowCubeCamera, PointerEvent3D, Polynomial, PolynomialCurve, Polynomials, PoolNode, PostBase, PostProcessingComponent, PostRenderer, PreDepthPassRenderer, PreFilteredEnvironment_cs, PreFilteredEnvironment_cs2, PreIntegratedLut, PreIntegratedLutCompute, PrefabAvatarData, PrefabAvatarParser, PrefabBoneData, PrefabMaterialParser, PrefabMeshData, PrefabMeshParser, PrefabNode, PrefabParser, PrefabStringUtil, PrefabTextureData, PrefabTextureParser, Preprocessor, PriorityQueue, Probe, ProbeEntries, ProbeGBufferFrame, ProfilerUtil, PropertyAnimClip, PropertyAnimTag, PropertyAnimation, PropertyAnimationClip, PropertyAnimationClipState, PropertyAnimationEvent, PropertyHelp, QuadAABB, QuadGlsl_fs, QuadGlsl_vs, QuadRoot, QuadShader, QuadTree, QuadTreeCell, Quad_depth2dArray_frag_wgsl, Quad_depth2d_frag_wgsl, Quad_depthCube_frag_wgsl, Quad_frag_wgsl, Quad_vert_wgsl, Quaternion, R32UintTexture, RADIANS_TO_DEGREES, RGBEErrorCode, RGBEHeader, RGBEParser, RTDescriptor, RTFrame, RTResourceConfig, RTResourceMap, Rand, RandomSeed, Ray, RayCastMeshDetail, Reader, Rect, Reference, Reflection, ReflectionCG, ReflectionEntries, ReflectionMaterial, ReflectionRenderer, ReflectionShader, ReflectionShader_shader, RegisterComponent, RegisterShader, RenderContext, RenderLayer, RenderLayerUtil, RenderNode, RenderShaderCollect, RenderShaderCompute, RenderShaderPass, RenderTexture, RendererBase, RendererJob, RendererMap, RendererMask, RendererMaskUtil, RendererPassState, RepeatSE, Res, RotationControlComponents, SHCommon_frag, SN_ArrayConstant, SN_BinaryOperation, SN_Break, SN_CodeBlock, SN_Constant, SN_Continue, SN_Declaration, SN_Discard, SN_DoWhileLoop, SN_Expression, SN_ForLoop, SN_Function, SN_FunctionArgs, SN_FunctionCall, SN_IFBranch, SN_Identifier, SN_IndexOperation, SN_Layout, SN_ParenExpression, SN_Precision, SN_Return, SN_SelectOperation, SN_Struct, SN_TernaryOperation, SN_UnaryOperation, SN_WhileLoop, SSAO_cs, SSGI2_cs, SSGIPost, SSRPost, SSR_BlendColor_cs, SSR_IS_Kernel, SSR_IS_cs, SSR_RayTrace_cs, ScaleControlComponents, Scene3D, Shader, ShaderAttributeInfo, ShaderConverter, ShaderConverterResult, ShaderLib, ShaderPassBase, ShaderReflection, ShaderStage, ShaderState, ShaderUniformInfo, ShaderUtil, ShadingInput, ShadowLightsCollect, ShadowMapPassRenderer, ShadowMapping_frag, Skeleton, SkeletonAnimationClip, SkeletonAnimationClipState, SkeletonAnimationComponent, SkeletonAnimationCompute, SkeletonAnimation_shader, SkeletonBlendComputeArgs, SkeletonPose, SkeletonTransformComputeArgs, SkinnedMeshRenderer, SkinnedMeshRenderer2, SkyGBufferPass, SkyGBuffer_pass, SkyMaterial, SkyRenderer, SkyShader, SolidColorSky, SphereColliderShape, SphereGeometry, SphereReflection, SpotLight, StandShader, StatementNode, StorageGPUBuffer, StringUtil, Struct, StructStorageGPUBuffer, SubGeometry, TAACopyTex_cs, TAAPost, TAASharpTex_cs, TAA_cs, TestComputeLoadBuffer, TextAnchor, TextFieldLayout, TextFieldLine, Texture, TextureCube, TextureCubeFaceData, TextureCubeStdCreator, TextureCubeUtils, TextureMipmapCompute, TextureMipmapGenerator, TextureScaleCompute, ThirdPersonCameraController, Tile, TileSet, TileSetChild, TileSetChildContent, TileSetChildContentMetaData, TileSetRoot, TilesRenderer, Time, TokenType, TorusGeometry, TouchData, TrailGeometry, Transform, TransformAxisEnum, TransformControllerBaseComponent, TransformMode, TransformSpaceMode, TranslationControlComponents, TranslatorContext, TriGeometry, Triangle, UIButton, UIButtonTransition, UIComponentBase, UIEvent, UIImage, UIImageGroup, UIInteractive, UIInteractiveStyle, UIPanel, UIRenderAble, UIShadow, UITextField, UITransform, UNLOADED, UUID, UV, Uint32ArrayTexture, Uint8ArrayTexture, UnLit, UnLitMaterial, UnLitMaterialUniform_frag, UnLitShader, UnLitTexArrayMaterial, UnLitTexArrayShader, UnLitTextureArray, UnLit_frag, UniformGPUBuffer, UniformNode, UniformType, ValueEnumType, ValueOp, ValueParser, ValueSpread, Vector2, Vector3, Vector3Ex, Vector4, VertexAttribute, VertexAttributeIndexShader, VertexAttributeName, VertexAttributeSize, VertexAttributeStride, VertexAttributes_vert, VertexBufferLayout, VertexFormat, VertexGPUBuffer, Vertical, VideoUniform_frag, View3D, ViewPanel, ViewQuad, VirtualTexture, WGS84_FLATTENING, WGS84_HEIGHT, WGS84_RADIUS, WGSLTranslator, WayLines3D, WayPoint3D, WebGPUDescriptorCreator, WorldMatrixUniform, WorldPanel, WrapMode, WrapTimeMode, ZCullingCompute, ZPassShader_cs, ZPassShader_fs, ZPassShader_vs, ZSorterUtil, append, arrayToString, blendComponent, buildCurves, byteSizeOfType, calculateCurveRangesValue, calculateMinMax, castPointShadowMap_vert, clamp, clampRepeat, computeAABBFromPositions, cos, crossProduct, cubicPolynomialRoot, cubicPolynomialRootsGeneric, curvesSupportProcedural, deg2Rad, detectGSplatFormat, directionShadowCastMap_frag, dot, doubleIntegrateSegment, downSample, fastInvSqrt, floorfToIntPos, fonts, generateRandom, generateRandom3, getFloatFromInt, getGLTypeFromTypedArray, getGLTypeFromTypedArrayType, getGlobalRandomSeed, getTypedArray, getTypedArrayTypeFromGLType, grad1, grad2, grad3, grad4, inferSHOrder, integrateSegment, irradianceDataReader, kPI, lerp, lerpByte, lerpColor, lerpVector3, lruPriorityCallback, magnitude, makeAloneSprite, makeGUISprite, makeMatrix44, markUsedSetLeaves, markUsedTiles, markVisibleTiles, matrixMultiply, matrixRotate, matrixRotateY, mergeFunctions, multiplyMatrices4x4REF, normal_distribution, normalizeFast, normalizeSafe, normalizedToByte, normalizedToWord, outlinePostData, outlinePostManager, parsePlyGaussianSplat, parsePlyHeader, perm, post, priorityCallback, quadraticPolynomialRootsGeneric, rad2Deg, random01, randomBarycentricCoord, randomPointBetweenEllipsoid, randomPointBetweenSphere, randomPointInsideCube, randomPointInsideEllipsoid, randomPointInsideUnitCircle, randomPointInsideUnitSphere, randomQuaternion, randomQuaternionUniformDistribution, randomSeed, randomUnitVector, randomUnitVector2, rangedRandomFloat, rangedRandomInt, readByType, readMagicBytes, registerMaterial, repeat, rotMatrix, rotateVectorByQuat, roundfToIntPos, scale, shadowCastMap_frag, shadowCastMap_vert, simplex, sin, snoise1, snoise2, snoise3, snoise4, sqrMagnitude, sqrtImpl, stencilStateFace, swap, textureCompress, threshold, throttle, toHalfFloat, toggleTiles, traverseAncestors, traverseSet, tw, uniform_real_distribution, uniform_real_distribution2, upSample$1 as upSample, webGPUContext, zSorterUtil };
|
|
69971
|
+
export { AccelerateDecelerateInterpolator, AccelerateInterpolator, AnimationCurve, AnimationCurveT, AnimationMonitor, AnimatorComponent, AnimatorEventKeyframe, AnticipateInterpolator, AnticipateOvershootInterpolator, ArrayHas, ArrayItemIndex, AtlasParser, AtmosphericComponent, AtmosphericScatteringSky, AtmosphericScatteringSkySetting, AtmosphericScatteringSky_shader, AttributeAnimCurve, AxisObject, B3DMLoader, B3DMLoaderBase, B3DMParseUtil, B3DMParser, BRDFLUT, BRDFLUTGenerate, BRDF_frag, BatchTable, BiMap, BillboardComponent, BillboardType, BitUtil, BitmapTexture2D, BitmapTexture2DArray, BitmapTextureCube, Blend, BlendFactor, BlendMode, BlendShapeData, BlendShapePropertyData, BloomPost, BlurEffectCreatorBlur_cs, BlurEffectCreatorSample_cs, BlurTexture2DBufferCreator, BounceInterpolator, BoundUtil, BoundingBox, BoundingSphere, BoundingVolume, BoxColliderShape, BoxGeometry, BrdfLut_frag, BsDF_frag, BxDF_frag, BxdfDebug_frag, BytesArray, CEvent, CEventDispatcher, CEventListener, CResizeEvent, CSM, Camera3D, CameraControllerBase, CameraType, CameraUtil, CapsuleColliderShape, CastPointShadowMaterialPass, CastShadowMaterialPass, Clearcoat_frag, ClusterBoundsSource_cs, ClusterConfig, ClusterDebug_frag, ClusterLight, ClusterLightingBuffer, ClusterLightingRender, ClusterLighting_cs, CollectInfo, ColliderComponent, ColliderShape, ColliderShapeType, Color, ColorGradient, ColorLitMaterial, ColorLitShader, ColorPassFragmentOutput, ColorPassRenderer, ColorUtil, ComData, Combine_cs, Common_frag, Common_vert, ComponentBase, ComponentCollect, ComputeGPUBuffer, ComputeShader, Context3D, CubeCamera, CubeMapFaceEnum, CubeSky_Shader, CubicBezierCurve, CubicBezierPath, CubicBezierType, CycleInterpolator, CylinderGeometry, DDGIIrradianceComputePass, DDGIIrradianceGPUBufferReader, DDGIIrradianceVolume, DDGIIrradiance_shader, DDGILightingPass, DDGILighting_shader, DDGIMultiBouncePass, DDGIProbeRenderer, DEGREES_TO_RADIANS, DRACO_DECODER_GLTF_JS, DecelerateInterpolator, Denoising_cs, Depth2DTextureArray, DepthCubeArrayTexture, DepthMaterialPass, DepthOfFieldPost, DepthOfView_cs, DirectLight, DoubleArray, EditorInspector, Engine3D, Entity, EntityBatchCollect, EntityCollect, EnvMap_frag, ErpImage2CubeMap, ErpImage2CubeMapCreateCube_cs, ErpImage2CubeMapRgbe2rgba_cs, ExtrudeGeometry, FAILED, FASTFLOOR, FXAAPost, FXAAShader, FastMathShader, FatLineGeometry, FatLineMaterial, FatLineRenderer, FatLineShader, FatLine_FS, FatLine_VS, FeatureTable, FileLoader, FirstPersonCameraController, Float16ArrayTexture, Float32ArrayTexture, FlyCameraController, FontChar, FontInfo, FontPage, FontParser, ForwardRenderJob, FragmentOutput, FragmentVarying, FrameCache, Frustum, FrustumCSM, FrustumCulling_cs, FullQuad_vert_wgsl, GBufferFrame, GBufferPass, GBufferPost, GBufferStand, GBuffer_pass, GILighting, GIProbeMaterial, GIProbeMaterialType, GIProbeShader, GIRenderCompleteEvent, GIRenderStartEvent, GLBChunk, GLBHeader, GLBParser, GLSLLexer, GLSLLexerToken, GLSLPreprocessor, GLSLSyntax, GLTFBinaryExtension, GLTFMaterial, GLTFParser, GLTFSubParser, GLTFSubParserCamera, GLTFSubParserConverter, GLTFSubParserMaterial, GLTFSubParserMesh, GLTFSubParserSkeleton, GLTFSubParserSkin, GLTFType, GLTF_Accessors, GLTF_Info, GLTF_Light, GLTF_Mesh, GLTF_Node, GLTF_Primitives, GLTF_Scene, GPUAddressMode, GPUBlendFactor, GPUBufferBase, GPUBufferType, GPUCompareFunction, GPUContext, GPUCullMode, GPUFilterMode, GPUPrimitiveTopology, GPUTextureFormat, GPUVertexFormat, GPUVertexStepMode, GSplatFormat, GSplatGeometry, GSplatMaterial, GSplatRenderer, GSplatShader, GSplat_FS, GSplat_VS, GTAOPost, GTAO_cs, GUIAtlasTexture, GUICanvas, GUIConfig, GUIGeometry, GUIGeometryRebuild, GUIMaterial, GUIPassRenderer, GUIPick, GUIPickHelper, GUIQuad, GUIQuadAttrEnum, GUIRenderer, GUIShader, GUISpace, GUISprite, GUITexture, GaussianSplatParser, GenerayRandomDir, GeoJsonParser, GeoJsonUtil, GeoType, GeometryBase, GeometryIndicesBuffer, GeometryUtil, GeometryVertexBuffer, GeometryVertexType, GetComponentClass, GetCountInstanceID, GetRepeat, GetShader, GlassShader, GlobalBindGroup, GlobalBindGroupLayout, GlobalFog, GlobalFog_shader, GlobalIlluminationComponent, GlobalUniform, GlobalUniformGroup, GodRayPost, GodRay_cs, GridObject, HDRTexture, HDRTextureCube, Hair_frag, Hair_shader_op, Hair_shader_tr, HaltonSeq, Horizontal, HoverCameraController, I3DMLoader, I3DMLoaderBase, I3DMParser, IBLEnvMapCreator, IBLEnvMapCreator_cs, IESProfiles, IESProfiles_frag, IKDTreeUserData, ImageType, IndicesGPUBuffer, Inline_vert, InputSystem, InstanceDrawComponent, InstanceUniform, InstancedMesh, Interpolator, InterpolatorEnum, IrradianceDataReaderCompleteEvent, IrradianceVolumeData_frag, Irradiance_frag, IsEditorInspector, IsNonSerialize, Joint, JointPose, JumperInterpolator, KDTreeEntity, KDTreeNode, KDTreeRange, KDTreeSpace, KDTreeUUID, KHR_draco_mesh_compression, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_emissive_strength, KHR_materials_ior, KHR_materials_unlit, KMZParser, KV, KelvinUtil, KeyCode, KeyEvent, Keyframe, KeyframeT, LDRTextureCube, LOADED, LOADING, LRUCache, LambertMaterial, Lambert_shader, Light, LightBase, LightData, LightEntries, LightType, LightingFunction_frag, Line, LineClassification, LinearInterpolator, LitMaterial, LitSSSShader, LitShader, Lit_shader, LoaderBase, LoaderEvent, LoaderManager, MAX_VALUE, MIN_VALUE, Material, MaterialDataUniformGPUBuffer, MaterialUtilities, MathShader, MathUtil, Matrix3, Matrix4, MatrixBindGroup, MatrixGPUBuffer, MatrixShader, MemoryDO, MemoryInfo, MergeRGBACreator, MergeRGBA_cs, MeshColliderShape, MeshFilter, MeshRenderer, MinMaxAnimationCurves, MinMaxCurve, MinMaxCurveState, MinMaxPolyCurves, MorePassParser, MorePassShader, MorphTargetBlender, MorphTargetData, MorphTargetFrame, MorphTargetTransformKey, MorphTarget_shader, MouseCode, MultiBouncePass_cs, Navi3DAstar, Navi3DConst, Navi3DEdge, Navi3DFunnel, Navi3DMaskType, Navi3DMesh, Navi3DPoint, Navi3DPoint2D, Navi3DPointFat, Navi3DRouter, Navi3DTriangle, NonSerialize, NormalMap_frag, OAnimationEvent, OBJParser, Object3D, Object3DEvent, Object3DTransformTools, Object3DUtil, ObjectAnimClip, OcclusionSystem, Octree, OctreeEntity, OrbitController, OrderMap, Orientation3D, OutLineBlendColor_cs, OutlineCalcOutline_cs, OutlinePass, OutlinePost, OutlinePostData, OutlinePostManager, OutlinePostSlot, Outline_cs, OvershootInterpolator, PARSING, PBRLItShader, PBRLitSSSShader, PLUGIN_REGISTERED, ParserBase, ParserFormat, ParticleSystemCurveEvalMode, ParticleSystemRandomnessIds, PassGenerate, PassShader, PassType, PhysicMaterialUniform_frag, PickCompute, PickFire, PickGUIEvent3D, PickResult, Picker_cs, PingPong, PipelinePool, Plane3D, PlaneClassification, PlaneGeometry, PlyMode, PlyParser, PointClassification, PointLight, PointLightShadowRenderer, PointShadowCubeCamera, PointerEvent3D, Polynomial, PolynomialCurve, Polynomials, PoolNode, PostBase, PostProcessingComponent, PostRenderer, PreDepthPassRenderer, PreFilteredEnvironment_cs, PreFilteredEnvironment_cs2, PreIntegratedLut, PreIntegratedLutCompute, PrefabAvatarData, PrefabAvatarParser, PrefabBoneData, PrefabMaterialParser, PrefabMeshData, PrefabMeshParser, PrefabNode, PrefabParser, PrefabStringUtil, PrefabTextureData, PrefabTextureParser, Preprocessor, PriorityQueue, Probe, ProbeEntries, ProbeGBufferFrame, ProfilerUtil, PropertyAnimClip, PropertyAnimTag, PropertyAnimation, PropertyAnimationClip, PropertyAnimationClipState, PropertyAnimationEvent, PropertyHelp, QuadAABB, QuadGlsl_fs, QuadGlsl_vs, QuadRoot, QuadShader, QuadTree, QuadTreeCell, Quad_depth2dArray_frag_wgsl, Quad_depth2d_frag_wgsl, Quad_depthCube_frag_wgsl, Quad_frag_wgsl, Quad_vert_wgsl, Quaternion, R32UintTexture, RADIANS_TO_DEGREES, RGBEErrorCode, RGBEHeader, RGBEParser, RTDescriptor, RTFrame, RTResourceConfig, RTResourceMap, Rand, RandomSeed, Ray, RayCastMeshDetail, Reader, Rect, Reference, Reflection, ReflectionCG, ReflectionEntries, ReflectionMaterial, ReflectionRenderer, ReflectionShader, ReflectionShader_shader, RegisterComponent, RegisterShader, RenderContext, RenderLayer, RenderLayerUtil, RenderNode, RenderShaderCollect, RenderShaderCompute, RenderShaderPass, RenderTexture, RendererBase, RendererJob, RendererMap, RendererMask, RendererMaskUtil, RendererPassState, RepeatSE, Res, RotationControlComponents, SHCommon_frag, SN_ArrayConstant, SN_BinaryOperation, SN_Break, SN_CodeBlock, SN_Constant, SN_Continue, SN_Declaration, SN_Discard, SN_DoWhileLoop, SN_Expression, SN_ForLoop, SN_Function, SN_FunctionArgs, SN_FunctionCall, SN_IFBranch, SN_Identifier, SN_IndexOperation, SN_Layout, SN_ParenExpression, SN_Precision, SN_Return, SN_SelectOperation, SN_Struct, SN_TernaryOperation, SN_UnaryOperation, SN_WhileLoop, SSAO_cs, SSGI2_cs, SSGIPost, SSRPost, SSR_BlendColor_cs, SSR_IS_Kernel, SSR_IS_cs, SSR_RayTrace_cs, ScaleControlComponents, Scene3D, Shader, ShaderAttributeInfo, ShaderConverter, ShaderConverterResult, ShaderLib, ShaderPassBase, ShaderReflection, ShaderStage, ShaderState, ShaderUniformInfo, ShaderUtil, ShadingInput, ShadowLightsCollect, ShadowMapPassRenderer, ShadowMapping_frag, Skeleton, SkeletonAnimationClip, SkeletonAnimationClipState, SkeletonAnimationComponent, SkeletonAnimationCompute, SkeletonAnimation_shader, SkeletonBlendComputeArgs, SkeletonPose, SkeletonTransformComputeArgs, SkinnedMeshRenderer, SkinnedMeshRenderer2, SkyGBufferPass, SkyGBuffer_pass, SkyMaterial, SkyRenderer, SkyShader, SolidColorSky, SphereColliderShape, SphereGeometry, SphereReflection, SpotLight, StandShader, StatementNode, StorageGPUBuffer, StringUtil, Struct, StructStorageGPUBuffer, SubGeometry, TAACopyTex_cs, TAAPost, TAASharpTex_cs, TAA_cs, TestComputeLoadBuffer, TextAnchor, TextFieldLayout, TextFieldLine, Texture, TextureCube, TextureCubeFaceData, TextureCubeStdCreator, TextureCubeUtils, TextureMipmapCompute, TextureMipmapGenerator, TextureScaleCompute, ThirdPersonCameraController, Tile, TileSet, TileSetChild, TileSetChildContent, TileSetChildContentMetaData, TileSetRoot, TilesRenderer, Time, TokenType, TorusGeometry, TouchData, TrailGeometry, Transform, TransformAxisEnum, TransformControllerBaseComponent, TransformMode, TransformSpaceMode, TranslationControlComponents, TranslatorContext, TriGeometry, Triangle, UIButton, UIButtonTransition, UIComponentBase, UIEvent, UIImage, UIImageGroup, UIInteractive, UIInteractiveStyle, UIPanel, UIRenderAble, UIShadow, UITextField, UITransform, UNLOADED, UUID, UV, Uint32ArrayTexture, Uint8ArrayTexture, UnLit, UnLitMaterial, UnLitMaterialUniform_frag, UnLitShader, UnLitTexArrayMaterial, UnLitTexArrayShader, UnLitTextureArray, UnLit_frag, UniformGPUBuffer, UniformNode, UniformType, ValueEnumType, ValueOp, ValueParser, ValueSpread, Vector2, Vector3, Vector3Ex, Vector4, VertexAttribute, VertexAttributeIndexShader, VertexAttributeName, VertexAttributeSize, VertexAttributeStride, VertexAttributes_vert, VertexBufferLayout, VertexFormat, VertexGPUBuffer, Vertical, VideoUniform_frag, View3D, ViewPanel, ViewQuad, VirtualTexture, WGS84_FLATTENING, WGS84_HEIGHT, WGS84_RADIUS, WGSLTranslator, WayLines3D, WayPoint3D, WebGPUDescriptorCreator, WorldMatrixUniform, WorldPanel, WrapMode, WrapTimeMode, ZCullingCompute, ZPassShader_cs, ZPassShader_fs, ZPassShader_vs, ZSorterUtil, append, arrayToString, blendComponent, buildCurves, byteSizeOfType, calculateCurveRangesValue, calculateMinMax, castPointShadowMap_vert, clamp, clampRepeat, computeAABBFromPositions, cos, crossProduct, cubicPolynomialRoot, cubicPolynomialRootsGeneric, curvesSupportProcedural, deg2Rad, detectGSplatFormat, directionShadowCastMap_frag, dot, doubleIntegrateSegment, downSample, fastInvSqrt, floorfToIntPos, fonts, generateRandom, generateRandom3, getFloatFromInt, getGLTypeFromTypedArray, getGLTypeFromTypedArrayType, getGlobalRandomSeed, getTypedArray, getTypedArrayTypeFromGLType, grad1, grad2, grad3, grad4, inferSHOrder, integrateSegment, irradianceDataReader, kPI, lerp, lerpByte, lerpColor, lerpVector3, lruPriorityCallback, magnitude, makeAloneSprite, makeGUISprite, makeMatrix44, markUsedSetLeaves, markUsedTiles, markVisibleTiles, matrixMultiply, matrixRotate, matrixRotateY, mergeFunctions, multiplyMatrices4x4REF, normal_distribution, normalizeFast, normalizeSafe, normalizedToByte, normalizedToWord, outlinePostData, outlinePostManager, parsePlyGaussianSplat, parsePlyHeader, parsePlyMesh, perm, post, priorityCallback, quadraticPolynomialRootsGeneric, rad2Deg, random01, randomBarycentricCoord, randomPointBetweenEllipsoid, randomPointBetweenSphere, randomPointInsideCube, randomPointInsideEllipsoid, randomPointInsideUnitCircle, randomPointInsideUnitSphere, randomQuaternion, randomQuaternionUniformDistribution, randomSeed, randomUnitVector, randomUnitVector2, rangedRandomFloat, rangedRandomInt, readByType, readMagicBytes, registerMaterial, repeat, rotMatrix, rotateVectorByQuat, roundfToIntPos, scale, shadowCastMap_frag, shadowCastMap_vert, simplex, sin, snoise1, snoise2, snoise3, snoise4, splatColorProperties, splatProperties, sqrMagnitude, sqrtImpl, stencilStateFace, swap, textureCompress, threshold, throttle, toHalfFloat, toggleTiles, traverseAncestors, traverseSet, tw, uniform_real_distribution, uniform_real_distribution2, upSample$1 as upSample, webGPUContext, zSorterUtil };
|