@rings-webgpu/core 1.0.19 → 1.0.21
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 +35 -37
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +279 -83
- package/dist/rings.umd.js +39 -41
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +279 -83
- package/dist/types/index.d.ts +3 -3
- package/dist/types/loader/parser/3dgs/loaders/index.d.ts +0 -1
- package/dist/types/loader/parser/OBJParser.d.ts +22 -0
- package/package.json +1 -1
- /package/dist/types/loader/parser/{3dgs/loaders/ply → ply}/PlyLoader.d.ts +0 -0
- /package/dist/types/loader/parser/{3dgs/loaders/ply → ply}/PlyTypes.d.ts +0 -0
- /package/dist/types/loader/parser/{3dgs/loaders/ply → ply}/PlyUtils.d.ts +0 -0
- /package/dist/types/loader/parser/{3dgs/loaders/ply → ply}/index.d.ts +0 -0
package/dist/rings.es.max.js
CHANGED
|
@@ -25040,30 +25040,32 @@ class BoundUtil {
|
|
|
25040
25040
|
static genGSplatBounds(obj, bound) {
|
|
25041
25041
|
bound ||= new BoundingBox(Vector3.ZERO, Vector3.ZERO);
|
|
25042
25042
|
bound.setFromMinMax(this.maxVector, this.minVector);
|
|
25043
|
-
let
|
|
25044
|
-
if (!
|
|
25043
|
+
let gsplatRenderers = obj.getComponents(GSplatRenderer);
|
|
25044
|
+
if (!gsplatRenderers) {
|
|
25045
25045
|
console.warn("genGSplatBounds: No GSplatRenderer found on object");
|
|
25046
25046
|
return bound;
|
|
25047
25047
|
}
|
|
25048
|
-
const
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25059
|
-
|
|
25060
|
-
|
|
25061
|
-
|
|
25062
|
-
|
|
25063
|
-
|
|
25064
|
-
|
|
25048
|
+
for (const gsplatRenderer of gsplatRenderers) {
|
|
25049
|
+
const positions = gsplatRenderer.positions;
|
|
25050
|
+
const count = gsplatRenderer.fullCount;
|
|
25051
|
+
if (!positions || count === 0) {
|
|
25052
|
+
console.warn("genGSplatBounds: No position data available");
|
|
25053
|
+
return bound;
|
|
25054
|
+
}
|
|
25055
|
+
const matrix = obj.transform.worldMatrix;
|
|
25056
|
+
const point = new Vector3();
|
|
25057
|
+
for (let i = 0; i < count; i++) {
|
|
25058
|
+
const idx = i * 3;
|
|
25059
|
+
point.set(
|
|
25060
|
+
positions[idx + 0],
|
|
25061
|
+
positions[idx + 1],
|
|
25062
|
+
positions[idx + 2]
|
|
25063
|
+
);
|
|
25064
|
+
matrix.transformPoint(point, point);
|
|
25065
|
+
bound.expandByPoint(point);
|
|
25066
|
+
}
|
|
25067
|
+
bound.setFromMinMax(bound.min, bound.max);
|
|
25065
25068
|
}
|
|
25066
|
-
bound.setFromMinMax(bound.min, bound.max);
|
|
25067
25069
|
return bound;
|
|
25068
25070
|
}
|
|
25069
25071
|
static genMeshBounds(obj, bound) {
|
|
@@ -36926,6 +36928,8 @@ class OBJParser extends ParserBase {
|
|
|
36926
36928
|
matLibs;
|
|
36927
36929
|
geometrys;
|
|
36928
36930
|
activeGeo;
|
|
36931
|
+
currentObjectName;
|
|
36932
|
+
currentMaterialName;
|
|
36929
36933
|
facesMaterialsIndex;
|
|
36930
36934
|
mtl;
|
|
36931
36935
|
mtlUrl;
|
|
@@ -36934,26 +36938,35 @@ class OBJParser extends ParserBase {
|
|
|
36934
36938
|
this.source_normals = [];
|
|
36935
36939
|
this.source_tangents = [];
|
|
36936
36940
|
this.source_textureCoords = [];
|
|
36941
|
+
this.currentObjectName = "default";
|
|
36942
|
+
this.currentMaterialName = "";
|
|
36937
36943
|
this.matLibs = {};
|
|
36938
36944
|
this.geometrys = {};
|
|
36945
|
+
this.activeGeo = void 0;
|
|
36939
36946
|
this.textData = obj;
|
|
36940
36947
|
await Promise.all([this.parserOBJ(), this.loadMTL()]);
|
|
36941
36948
|
this.parser_mesh();
|
|
36942
36949
|
return `null`;
|
|
36943
36950
|
}
|
|
36944
36951
|
applyVector2(fi, sourceData, destData) {
|
|
36945
|
-
if (sourceData[fi] && sourceData[fi].length > 0) {
|
|
36952
|
+
if (fi >= 0 && sourceData[fi] && sourceData[fi].length > 0) {
|
|
36946
36953
|
destData.push(sourceData[fi][0]);
|
|
36947
|
-
destData.push(sourceData[fi][1]);
|
|
36954
|
+
destData.push(-sourceData[fi][1]);
|
|
36948
36955
|
} else {
|
|
36949
36956
|
destData.push(0);
|
|
36950
36957
|
destData.push(0);
|
|
36951
36958
|
}
|
|
36952
36959
|
}
|
|
36953
36960
|
applyVector3(fi, sourceData, destData) {
|
|
36954
|
-
|
|
36955
|
-
|
|
36956
|
-
|
|
36961
|
+
if (fi >= 0 && sourceData[fi] && sourceData[fi].length > 0) {
|
|
36962
|
+
destData.push(sourceData[fi][0]);
|
|
36963
|
+
destData.push(sourceData[fi][1]);
|
|
36964
|
+
destData.push(sourceData[fi][2]);
|
|
36965
|
+
} else {
|
|
36966
|
+
destData.push(0);
|
|
36967
|
+
destData.push(0);
|
|
36968
|
+
destData.push(0);
|
|
36969
|
+
}
|
|
36957
36970
|
}
|
|
36958
36971
|
applyVector4(fi, sourceData, destData) {
|
|
36959
36972
|
destData.push(sourceData[fi][0]);
|
|
@@ -36961,12 +36974,76 @@ class OBJParser extends ParserBase {
|
|
|
36961
36974
|
destData.push(sourceData[fi][2]);
|
|
36962
36975
|
destData.push(sourceData[fi][3]);
|
|
36963
36976
|
}
|
|
36977
|
+
/**
|
|
36978
|
+
* Parse UV index with support for negative indices (OBJ format)
|
|
36979
|
+
* Similar to Three.js parseUVIndex method
|
|
36980
|
+
*/
|
|
36981
|
+
parseUVIndex(value, uvCount) {
|
|
36982
|
+
const index = parseInt(value, 10);
|
|
36983
|
+
if (index >= 0) {
|
|
36984
|
+
return index - 1;
|
|
36985
|
+
} else {
|
|
36986
|
+
return uvCount + index;
|
|
36987
|
+
}
|
|
36988
|
+
}
|
|
36989
|
+
/**
|
|
36990
|
+
* Parse vertex index with support for negative indices (OBJ format)
|
|
36991
|
+
*/
|
|
36992
|
+
parseVertexIndex(value, vertexCount) {
|
|
36993
|
+
const index = parseInt(value, 10);
|
|
36994
|
+
if (index >= 0) {
|
|
36995
|
+
return index - 1;
|
|
36996
|
+
} else {
|
|
36997
|
+
return vertexCount + index;
|
|
36998
|
+
}
|
|
36999
|
+
}
|
|
37000
|
+
/**
|
|
37001
|
+
* Parse normal index with support for negative indices (OBJ format)
|
|
37002
|
+
*/
|
|
37003
|
+
parseNormalIndex(value, normalCount) {
|
|
37004
|
+
const index = parseInt(value, 10);
|
|
37005
|
+
if (index >= 0) {
|
|
37006
|
+
return index - 1;
|
|
37007
|
+
} else {
|
|
37008
|
+
return normalCount + index;
|
|
37009
|
+
}
|
|
37010
|
+
}
|
|
37011
|
+
/**
|
|
37012
|
+
* Calculate face normal from three vertices using cross product
|
|
37013
|
+
* Similar to Three.js addFaceNormal method
|
|
37014
|
+
*/
|
|
37015
|
+
calculateFaceNormal(v0, v1, v2) {
|
|
37016
|
+
const edge1 = [
|
|
37017
|
+
v1[0] - v0[0],
|
|
37018
|
+
v1[1] - v0[1],
|
|
37019
|
+
v1[2] - v0[2]
|
|
37020
|
+
];
|
|
37021
|
+
const edge2 = [
|
|
37022
|
+
v2[0] - v0[0],
|
|
37023
|
+
v2[1] - v0[1],
|
|
37024
|
+
v2[2] - v0[2]
|
|
37025
|
+
];
|
|
37026
|
+
const normal = [
|
|
37027
|
+
edge1[1] * edge2[2] - edge1[2] * edge2[1],
|
|
37028
|
+
edge1[2] * edge2[0] - edge1[0] * edge2[2],
|
|
37029
|
+
edge1[0] * edge2[1] - edge1[1] * edge2[0]
|
|
37030
|
+
];
|
|
37031
|
+
const length = Math.sqrt(
|
|
37032
|
+
normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]
|
|
37033
|
+
);
|
|
37034
|
+
if (length > 0) {
|
|
37035
|
+
normal[0] /= length;
|
|
37036
|
+
normal[1] /= length;
|
|
37037
|
+
normal[2] /= length;
|
|
37038
|
+
}
|
|
37039
|
+
return normal;
|
|
37040
|
+
}
|
|
36964
37041
|
async loadMTL() {
|
|
36965
37042
|
let fileLoad = new FileLoader();
|
|
36966
37043
|
let sourceData = await fileLoad.loadTxt(this.baseUrl + this.mtlUrl);
|
|
36967
37044
|
let sourceStr = sourceData[`data`];
|
|
36968
37045
|
let mat;
|
|
36969
|
-
let str = sourceStr.split(
|
|
37046
|
+
let str = sourceStr.split(/\r?\n/);
|
|
36970
37047
|
for (let i = 0; i < str.length; i++) {
|
|
36971
37048
|
let line = str[i];
|
|
36972
37049
|
var commentStart = line.indexOf("#");
|
|
@@ -37017,20 +37094,41 @@ class OBJParser extends ParserBase {
|
|
|
37017
37094
|
}
|
|
37018
37095
|
async load_textures() {
|
|
37019
37096
|
}
|
|
37097
|
+
getGeometryKey(objectName, materialName) {
|
|
37098
|
+
const objName = (objectName ?? this.currentObjectName ?? "default") || "default";
|
|
37099
|
+
const matName = materialName ?? this.currentMaterialName ?? "";
|
|
37100
|
+
const matKey = matName.length > 0 ? matName : "default";
|
|
37101
|
+
return `${objName}::${matKey}`;
|
|
37102
|
+
}
|
|
37103
|
+
ensureActiveGeo(objectName, materialName) {
|
|
37104
|
+
const objName = (objectName ?? this.currentObjectName ?? "default") || "default";
|
|
37105
|
+
const matName = materialName ?? this.currentMaterialName ?? "";
|
|
37106
|
+
const geoKey = this.getGeometryKey(objName, matName);
|
|
37107
|
+
if (!this.geometrys[geoKey]) {
|
|
37108
|
+
this.geometrys[geoKey] = {
|
|
37109
|
+
type: objName,
|
|
37110
|
+
name: geoKey,
|
|
37111
|
+
source_mat: matName,
|
|
37112
|
+
source_faces: []
|
|
37113
|
+
};
|
|
37114
|
+
} else if (this.geometrys[geoKey].source_mat !== matName) {
|
|
37115
|
+
this.geometrys[geoKey].source_mat = matName;
|
|
37116
|
+
}
|
|
37117
|
+
this.activeGeo = this.geometrys[geoKey];
|
|
37118
|
+
}
|
|
37020
37119
|
parserLine(line) {
|
|
37021
37120
|
var commentStart = line.indexOf("#");
|
|
37022
37121
|
if (commentStart != -1) {
|
|
37023
37122
|
if (line.indexOf(`# object`) != -1) {
|
|
37024
|
-
|
|
37025
|
-
|
|
37026
|
-
|
|
37027
|
-
this.
|
|
37028
|
-
|
|
37029
|
-
|
|
37030
|
-
|
|
37031
|
-
|
|
37032
|
-
}
|
|
37033
|
-
this.geometrys[geoName] = this.activeGeo;
|
|
37123
|
+
const commentParts = line.split(/\s+/);
|
|
37124
|
+
const type = commentParts[1] || "default";
|
|
37125
|
+
const geoName = commentParts[2] || "default";
|
|
37126
|
+
this.currentObjectName = geoName;
|
|
37127
|
+
this.activeGeo = void 0;
|
|
37128
|
+
this.ensureActiveGeo(geoName, this.currentMaterialName);
|
|
37129
|
+
if (this.activeGeo) {
|
|
37130
|
+
this.activeGeo.type = type;
|
|
37131
|
+
}
|
|
37034
37132
|
}
|
|
37035
37133
|
line = line.substring(0, commentStart);
|
|
37036
37134
|
}
|
|
@@ -37065,33 +37163,30 @@ class OBJParser extends ParserBase {
|
|
|
37065
37163
|
normal: []
|
|
37066
37164
|
};
|
|
37067
37165
|
for (var i = 1; i < splitedLine.length; ++i) {
|
|
37068
|
-
var
|
|
37069
|
-
|
|
37070
|
-
|
|
37071
|
-
|
|
37072
|
-
|
|
37073
|
-
|
|
37074
|
-
|
|
37075
|
-
|
|
37076
|
-
} else if (splitedFaceIndices.length === 2) {
|
|
37077
|
-
face.indices.push(splitedFaceIndices[0]);
|
|
37078
|
-
face.texture.push(splitedFaceIndices[1]);
|
|
37079
|
-
} else if (splitedFaceIndices.length === 3) {
|
|
37080
|
-
face.indices.push(splitedFaceIndices[0]);
|
|
37081
|
-
face.texture.push(splitedFaceIndices[1]);
|
|
37082
|
-
face.normal.push(splitedFaceIndices[2]);
|
|
37083
|
-
}
|
|
37166
|
+
var vertexStr = splitedLine[i];
|
|
37167
|
+
if (vertexStr.length === 0) continue;
|
|
37168
|
+
var vertexParts = vertexStr.split("/");
|
|
37169
|
+
var positionIndex = vertexParts[0] || "";
|
|
37170
|
+
var textureIndex = vertexParts.length >= 2 ? vertexParts[1] || "" : "";
|
|
37171
|
+
var normalIndex = vertexParts.length >= 3 ? vertexParts[2] || "" : "";
|
|
37172
|
+
if (positionIndex.length === 0) {
|
|
37173
|
+
continue;
|
|
37084
37174
|
}
|
|
37175
|
+
face.indices.push(positionIndex);
|
|
37176
|
+
face.texture.push(textureIndex);
|
|
37177
|
+
face.normal.push(normalIndex);
|
|
37085
37178
|
}
|
|
37179
|
+
this.ensureActiveGeo();
|
|
37086
37180
|
this.activeGeo.source_faces.push(face);
|
|
37087
37181
|
} else if (splitedLine[0] === "usemtl") {
|
|
37088
|
-
this.
|
|
37182
|
+
this.currentMaterialName = splitedLine[1] || "";
|
|
37183
|
+
this.ensureActiveGeo(this.currentObjectName, this.currentMaterialName);
|
|
37089
37184
|
} else if (splitedLine[0] === `mtllib`) {
|
|
37090
37185
|
this.mtlUrl = splitedLine[1];
|
|
37091
37186
|
}
|
|
37092
37187
|
}
|
|
37093
37188
|
async parserOBJ() {
|
|
37094
|
-
let str = this.textData.split(
|
|
37189
|
+
let str = this.textData.split(/\r?\n/);
|
|
37095
37190
|
for (let i = 0; i < str.length; i++) {
|
|
37096
37191
|
const element = str[i];
|
|
37097
37192
|
this.parserLine(element);
|
|
@@ -37108,44 +37203,138 @@ class OBJParser extends ParserBase {
|
|
|
37108
37203
|
geoData.uv_arr = [];
|
|
37109
37204
|
geoData.indeice_arr = [];
|
|
37110
37205
|
let index = 0;
|
|
37206
|
+
const vertexCount = this.source_vertices.length;
|
|
37207
|
+
const normalCount = this.source_normals.length;
|
|
37208
|
+
const uvCount = this.source_textureCoords.length;
|
|
37111
37209
|
for (let i = 0; i < geoData.source_faces.length; i++) {
|
|
37112
37210
|
const face = geoData.source_faces[i];
|
|
37113
|
-
let f0 =
|
|
37114
|
-
let f1 =
|
|
37115
|
-
let f2 =
|
|
37116
|
-
|
|
37117
|
-
|
|
37118
|
-
|
|
37119
|
-
|
|
37120
|
-
|
|
37121
|
-
|
|
37211
|
+
let f0 = this.parseVertexIndex(face.indices[0], vertexCount);
|
|
37212
|
+
let f1 = this.parseVertexIndex(face.indices[1], vertexCount);
|
|
37213
|
+
let f2 = this.parseVertexIndex(face.indices[2], vertexCount);
|
|
37214
|
+
const getNormalIndex = (value) => {
|
|
37215
|
+
if (!value || value.length === 0) {
|
|
37216
|
+
return -1;
|
|
37217
|
+
}
|
|
37218
|
+
const parsed = this.parseNormalIndex(value, normalCount);
|
|
37219
|
+
return Number.isFinite(parsed) && parsed >= 0 && parsed < normalCount ? parsed : -1;
|
|
37220
|
+
};
|
|
37221
|
+
const getUVIndex = (value) => {
|
|
37222
|
+
if (!value || value.length === 0) {
|
|
37223
|
+
return -1;
|
|
37224
|
+
}
|
|
37225
|
+
const parsed = this.parseUVIndex(value, uvCount);
|
|
37226
|
+
return Number.isFinite(parsed) && parsed >= 0 && parsed < uvCount ? parsed : -1;
|
|
37227
|
+
};
|
|
37228
|
+
let n0 = getNormalIndex(face.normal[0]);
|
|
37229
|
+
let n1 = getNormalIndex(face.normal[1]);
|
|
37230
|
+
let n2 = getNormalIndex(face.normal[2]);
|
|
37231
|
+
const needsFaceNormal = n0 < 0 || n1 < 0 || n2 < 0;
|
|
37232
|
+
let faceNormal = null;
|
|
37233
|
+
if (needsFaceNormal && f0 >= 0 && f1 >= 0 && f2 >= 0 && this.source_vertices[f0] && this.source_vertices[f1] && this.source_vertices[f2]) {
|
|
37234
|
+
faceNormal = this.calculateFaceNormal(
|
|
37235
|
+
this.source_vertices[f0],
|
|
37236
|
+
this.source_vertices[f1],
|
|
37237
|
+
this.source_vertices[f2]
|
|
37238
|
+
);
|
|
37239
|
+
}
|
|
37240
|
+
let u0 = getUVIndex(face.texture[0]);
|
|
37241
|
+
let u1 = getUVIndex(face.texture[1]);
|
|
37242
|
+
let u2 = getUVIndex(face.texture[2]);
|
|
37122
37243
|
this.applyVector3(f0, this.source_vertices, geoData.vertex_arr);
|
|
37123
|
-
|
|
37124
|
-
|
|
37244
|
+
if (n0 >= 0) {
|
|
37245
|
+
this.applyVector3(n0, this.source_normals, geoData.normal_arr);
|
|
37246
|
+
} else if (faceNormal) {
|
|
37247
|
+
geoData.normal_arr.push(faceNormal[0], faceNormal[1], faceNormal[2]);
|
|
37248
|
+
} else {
|
|
37249
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37250
|
+
}
|
|
37251
|
+
if (u0 >= 0) {
|
|
37252
|
+
this.applyVector2(u0, this.source_textureCoords, geoData.uv_arr);
|
|
37253
|
+
} else {
|
|
37254
|
+
geoData.uv_arr.push(0, 0);
|
|
37255
|
+
}
|
|
37125
37256
|
geoData.indeice_arr[index] = index++;
|
|
37126
37257
|
this.applyVector3(f1, this.source_vertices, geoData.vertex_arr);
|
|
37127
|
-
|
|
37128
|
-
|
|
37258
|
+
if (n1 >= 0) {
|
|
37259
|
+
this.applyVector3(n1, this.source_normals, geoData.normal_arr);
|
|
37260
|
+
} else if (faceNormal) {
|
|
37261
|
+
geoData.normal_arr.push(faceNormal[0], faceNormal[1], faceNormal[2]);
|
|
37262
|
+
} else {
|
|
37263
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37264
|
+
}
|
|
37265
|
+
if (u1 >= 0) {
|
|
37266
|
+
this.applyVector2(u1, this.source_textureCoords, geoData.uv_arr);
|
|
37267
|
+
} else {
|
|
37268
|
+
geoData.uv_arr.push(0, 0);
|
|
37269
|
+
}
|
|
37129
37270
|
geoData.indeice_arr[index] = index++;
|
|
37130
37271
|
this.applyVector3(f2, this.source_vertices, geoData.vertex_arr);
|
|
37131
|
-
|
|
37132
|
-
|
|
37272
|
+
if (n2 >= 0) {
|
|
37273
|
+
this.applyVector3(n2, this.source_normals, geoData.normal_arr);
|
|
37274
|
+
} else if (faceNormal) {
|
|
37275
|
+
geoData.normal_arr.push(faceNormal[0], faceNormal[1], faceNormal[2]);
|
|
37276
|
+
} else {
|
|
37277
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37278
|
+
}
|
|
37279
|
+
if (u2 >= 0) {
|
|
37280
|
+
this.applyVector2(u2, this.source_textureCoords, geoData.uv_arr);
|
|
37281
|
+
} else {
|
|
37282
|
+
geoData.uv_arr.push(0, 0);
|
|
37283
|
+
}
|
|
37133
37284
|
geoData.indeice_arr[index] = index++;
|
|
37134
37285
|
if (face.indices.length > 3) {
|
|
37135
|
-
let f3 =
|
|
37136
|
-
let n3 =
|
|
37137
|
-
let u3 =
|
|
37286
|
+
let f3 = this.parseVertexIndex(face.indices[3], vertexCount);
|
|
37287
|
+
let n3 = getNormalIndex(face.normal[3]);
|
|
37288
|
+
let u3 = getUVIndex(face.texture[3]);
|
|
37289
|
+
let faceNormal2 = null;
|
|
37290
|
+
if ((n0 < 0 || n2 < 0 || n3 < 0) && f0 >= 0 && f2 >= 0 && f3 >= 0 && this.source_vertices[f0] && this.source_vertices[f2] && this.source_vertices[f3]) {
|
|
37291
|
+
faceNormal2 = this.calculateFaceNormal(
|
|
37292
|
+
this.source_vertices[f0],
|
|
37293
|
+
this.source_vertices[f2],
|
|
37294
|
+
this.source_vertices[f3]
|
|
37295
|
+
);
|
|
37296
|
+
}
|
|
37138
37297
|
this.applyVector3(f0, this.source_vertices, geoData.vertex_arr);
|
|
37139
|
-
|
|
37140
|
-
|
|
37298
|
+
if (n0 >= 0) {
|
|
37299
|
+
this.applyVector3(n0, this.source_normals, geoData.normal_arr);
|
|
37300
|
+
} else if (faceNormal2) {
|
|
37301
|
+
geoData.normal_arr.push(faceNormal2[0], faceNormal2[1], faceNormal2[2]);
|
|
37302
|
+
} else {
|
|
37303
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37304
|
+
}
|
|
37305
|
+
if (u0 >= 0) {
|
|
37306
|
+
this.applyVector2(u0, this.source_textureCoords, geoData.uv_arr);
|
|
37307
|
+
} else {
|
|
37308
|
+
geoData.uv_arr.push(0, 0);
|
|
37309
|
+
}
|
|
37141
37310
|
geoData.indeice_arr[index] = index++;
|
|
37142
37311
|
this.applyVector3(f2, this.source_vertices, geoData.vertex_arr);
|
|
37143
|
-
|
|
37144
|
-
|
|
37312
|
+
if (n2 >= 0) {
|
|
37313
|
+
this.applyVector3(n2, this.source_normals, geoData.normal_arr);
|
|
37314
|
+
} else if (faceNormal2) {
|
|
37315
|
+
geoData.normal_arr.push(faceNormal2[0], faceNormal2[1], faceNormal2[2]);
|
|
37316
|
+
} else {
|
|
37317
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37318
|
+
}
|
|
37319
|
+
if (u2 >= 0) {
|
|
37320
|
+
this.applyVector2(u2, this.source_textureCoords, geoData.uv_arr);
|
|
37321
|
+
} else {
|
|
37322
|
+
geoData.uv_arr.push(0, 0);
|
|
37323
|
+
}
|
|
37145
37324
|
geoData.indeice_arr[index] = index++;
|
|
37146
37325
|
this.applyVector3(f3, this.source_vertices, geoData.vertex_arr);
|
|
37147
|
-
|
|
37148
|
-
|
|
37326
|
+
if (n3 >= 0) {
|
|
37327
|
+
this.applyVector3(n3, this.source_normals, geoData.normal_arr);
|
|
37328
|
+
} else if (faceNormal2) {
|
|
37329
|
+
geoData.normal_arr.push(faceNormal2[0], faceNormal2[1], faceNormal2[2]);
|
|
37330
|
+
} else {
|
|
37331
|
+
geoData.normal_arr.push(0, 0, 0);
|
|
37332
|
+
}
|
|
37333
|
+
if (u3 >= 0) {
|
|
37334
|
+
this.applyVector2(u3, this.source_textureCoords, geoData.uv_arr);
|
|
37335
|
+
} else {
|
|
37336
|
+
geoData.uv_arr.push(0, 0);
|
|
37337
|
+
}
|
|
37149
37338
|
geoData.indeice_arr[index] = index++;
|
|
37150
37339
|
}
|
|
37151
37340
|
}
|
|
@@ -37177,10 +37366,17 @@ class OBJParser extends ParserBase {
|
|
|
37177
37366
|
topology: 0
|
|
37178
37367
|
});
|
|
37179
37368
|
let mat = new LitMaterial();
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37369
|
+
const matName = geoData.source_mat;
|
|
37370
|
+
const matData = matName ? this.matLibs[matName] : void 0;
|
|
37371
|
+
if (matData && matData.map_Kd) {
|
|
37372
|
+
const texturePath = StringUtil.normalizePath(
|
|
37373
|
+
this.baseUrl + matData.map_Kd
|
|
37374
|
+
);
|
|
37375
|
+
const texture = Engine3D.res.getTexture(texturePath);
|
|
37376
|
+
if (texture) {
|
|
37377
|
+
mat.baseMap = texture;
|
|
37378
|
+
}
|
|
37379
|
+
}
|
|
37184
37380
|
let obj = new Object3D();
|
|
37185
37381
|
let mr = obj.addComponent(MeshRenderer);
|
|
37186
37382
|
mr.geometry = geo;
|
|
@@ -41057,7 +41253,7 @@ class PostProcessingComponent extends ComponentBase {
|
|
|
41057
41253
|
}
|
|
41058
41254
|
}
|
|
41059
41255
|
|
|
41060
|
-
const version = "1.0.
|
|
41256
|
+
const version = "1.0.20";
|
|
41061
41257
|
|
|
41062
41258
|
class Engine3D {
|
|
41063
41259
|
/**
|