@galacean/effects-plugin-model 0.0.1-alpha.0 → 0.0.1-alpha.2
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/LICENSE +22 -0
- package/dist/gltf/loader-ext.d.ts +1 -5
- package/dist/gltf/loader-helper.d.ts +3 -3
- package/dist/gltf/loader-impl.d.ts +16 -16
- package/dist/gltf/protocol.d.ts +14 -14
- package/dist/index.d.ts +29 -29
- package/dist/index.js +205 -205
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +203 -203
- package/dist/loader.mjs +134 -134
- package/dist/plugin/model-tree-item.d.ts +2 -2
- package/dist/plugin/model-tree-vfx-item.d.ts +3 -3
- package/dist/plugin/model-vfx-item.d.ts +4 -4
- package/dist/runtime/animation.d.ts +8 -9
- package/dist/runtime/cache.d.ts +3 -3
- package/dist/runtime/camera.d.ts +3 -3
- package/dist/runtime/common.d.ts +3 -3
- package/dist/runtime/light.d.ts +3 -3
- package/dist/runtime/material.d.ts +4 -4
- package/dist/runtime/mesh.d.ts +11 -11
- package/dist/runtime/scene.d.ts +3 -3
- package/dist/runtime/skybox.d.ts +3 -3
- package/dist/utility/hit-test-helper.d.ts +2 -2
- package/dist/utility/plugin-helper.d.ts +25 -25
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player model plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 飂兮
|
|
6
|
-
* Version: v0.0.1-alpha.
|
|
6
|
+
* Version: v0.0.1-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -6474,18 +6474,18 @@ var PTransform = /** @class */ (function () {
|
|
|
6474
6474
|
this.setMatrix(matrix);
|
|
6475
6475
|
return this;
|
|
6476
6476
|
};
|
|
6477
|
-
PTransform.prototype.
|
|
6477
|
+
PTransform.prototype.fromEffectsTransform = function (trans) {
|
|
6478
6478
|
if (trans instanceof effects.Transform) {
|
|
6479
6479
|
this.setMatrix(trans.getWorldMatrix());
|
|
6480
6480
|
}
|
|
6481
6481
|
else {
|
|
6482
|
-
var
|
|
6483
|
-
|
|
6484
|
-
this.setMatrix(
|
|
6482
|
+
var effectsTrans = new effects.Transform(__assign(__assign({}, trans), { valid: true }));
|
|
6483
|
+
effectsTrans.setValid(true);
|
|
6484
|
+
this.setMatrix(effectsTrans.getWorldMatrix());
|
|
6485
6485
|
}
|
|
6486
6486
|
return this;
|
|
6487
6487
|
};
|
|
6488
|
-
PTransform.prototype.
|
|
6488
|
+
PTransform.prototype.toEffectsTransform = function (transform) {
|
|
6489
6489
|
var mat = this.getMatrix();
|
|
6490
6490
|
transform.cloneFromMatrix(mat.toArray());
|
|
6491
6491
|
return transform;
|
|
@@ -7065,10 +7065,10 @@ function ToggleItemBounding(composition, itemId) {
|
|
|
7065
7065
|
});
|
|
7066
7066
|
}
|
|
7067
7067
|
|
|
7068
|
-
var
|
|
7069
|
-
function
|
|
7068
|
+
var WebGLHelper = /** @class */ (function () {
|
|
7069
|
+
function WebGLHelper() {
|
|
7070
7070
|
}
|
|
7071
|
-
|
|
7071
|
+
WebGLHelper.createTexture2D = function (engine, image, texture, isBaseColor, tiny3dMode) {
|
|
7072
7072
|
return __awaiter(this, void 0, void 0, function () {
|
|
7073
7073
|
var blob, urlCreator, imageUrl, imageObj;
|
|
7074
7074
|
return __generator(this, function (_a) {
|
|
@@ -7100,7 +7100,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7100
7100
|
// || minFilter === glContext.LINEAR_MIPMAP_NEAREST) {
|
|
7101
7101
|
minFilter = effects.glContext.LINEAR_MIPMAP_LINEAR;
|
|
7102
7102
|
//}
|
|
7103
|
-
if (!
|
|
7103
|
+
if (!WebGLHelper.isPow2(imageObj.width) || !WebGLHelper.isPow2(imageObj.height)) {
|
|
7104
7104
|
minFilter = effects.glContext.LINEAR;
|
|
7105
7105
|
}
|
|
7106
7106
|
//
|
|
@@ -7134,7 +7134,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7134
7134
|
});
|
|
7135
7135
|
});
|
|
7136
7136
|
};
|
|
7137
|
-
|
|
7137
|
+
WebGLHelper.createTextureList = function (engine, images, textures) {
|
|
7138
7138
|
return __awaiter(this, void 0, void 0, function () {
|
|
7139
7139
|
var outTextures;
|
|
7140
7140
|
var _this = this;
|
|
@@ -7150,7 +7150,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7150
7150
|
});
|
|
7151
7151
|
});
|
|
7152
7152
|
};
|
|
7153
|
-
|
|
7153
|
+
WebGLHelper.getTextureCubeData = function (images) {
|
|
7154
7154
|
return __awaiter(this, void 0, void 0, function () {
|
|
7155
7155
|
var cubeData, _a;
|
|
7156
7156
|
return __generator(this, function (_b) {
|
|
@@ -7190,7 +7190,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7190
7190
|
});
|
|
7191
7191
|
});
|
|
7192
7192
|
};
|
|
7193
|
-
|
|
7193
|
+
WebGLHelper.getTextureCubeMipmapData = function (images) {
|
|
7194
7194
|
return __awaiter(this, void 0, void 0, function () {
|
|
7195
7195
|
var mipmaps, i, _a, _b;
|
|
7196
7196
|
return __generator(this, function (_c) {
|
|
@@ -7214,7 +7214,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7214
7214
|
});
|
|
7215
7215
|
});
|
|
7216
7216
|
};
|
|
7217
|
-
|
|
7217
|
+
WebGLHelper.createTextureCubeFromURL = function (engine, cubeImage) {
|
|
7218
7218
|
return __awaiter(this, void 0, void 0, function () {
|
|
7219
7219
|
var textureOptions;
|
|
7220
7220
|
return __generator(this, function (_a) {
|
|
@@ -7231,7 +7231,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7231
7231
|
});
|
|
7232
7232
|
});
|
|
7233
7233
|
};
|
|
7234
|
-
|
|
7234
|
+
WebGLHelper.createTextureCubeMipmapFromURL = function (engine, cubeImages) {
|
|
7235
7235
|
return __awaiter(this, void 0, void 0, function () {
|
|
7236
7236
|
var textureOptions;
|
|
7237
7237
|
return __generator(this, function (_a) {
|
|
@@ -7248,12 +7248,12 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7248
7248
|
});
|
|
7249
7249
|
});
|
|
7250
7250
|
};
|
|
7251
|
-
|
|
7251
|
+
WebGLHelper.createTextureCubeFromBuffer = function (engine, cubeImages) {
|
|
7252
7252
|
return __awaiter(this, void 0, void 0, function () {
|
|
7253
7253
|
var cubemap;
|
|
7254
7254
|
return __generator(this, function (_a) {
|
|
7255
7255
|
switch (_a.label) {
|
|
7256
|
-
case 0: return [4 /*yield*/,
|
|
7256
|
+
case 0: return [4 /*yield*/, WebGLHelper.getTextureCubeData(cubeImages)];
|
|
7257
7257
|
case 1:
|
|
7258
7258
|
cubemap = _a.sent();
|
|
7259
7259
|
return [2 /*return*/, effects.Texture.create(engine, __assign({ name: 'createTextureCubeFromBuffer', sourceType: effects.TextureSourceType.image, cube: cubemap, target: effects.glContext.TEXTURE_CUBE_MAP }, this.cubemapTexConfig))];
|
|
@@ -7261,12 +7261,12 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7261
7261
|
});
|
|
7262
7262
|
});
|
|
7263
7263
|
};
|
|
7264
|
-
|
|
7264
|
+
WebGLHelper.createTextureCubeMipmapFromBuffer = function (engine, cubeImages, level0Size) {
|
|
7265
7265
|
return __awaiter(this, void 0, void 0, function () {
|
|
7266
7266
|
var mipmaps, mipCount, index, url, imageData;
|
|
7267
7267
|
return __generator(this, function (_a) {
|
|
7268
7268
|
switch (_a.label) {
|
|
7269
|
-
case 0: return [4 /*yield*/,
|
|
7269
|
+
case 0: return [4 /*yield*/, WebGLHelper.getTextureCubeMipmapData(cubeImages)];
|
|
7270
7270
|
case 1:
|
|
7271
7271
|
mipmaps = _a.sent();
|
|
7272
7272
|
mipCount = 0;
|
|
@@ -7288,7 +7288,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7288
7288
|
});
|
|
7289
7289
|
});
|
|
7290
7290
|
};
|
|
7291
|
-
|
|
7291
|
+
WebGLHelper.getTexture = function (index, textures) {
|
|
7292
7292
|
if (index < 0 || index >= textures.length) {
|
|
7293
7293
|
return undefined;
|
|
7294
7294
|
}
|
|
@@ -7296,7 +7296,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7296
7296
|
return textures[index];
|
|
7297
7297
|
}
|
|
7298
7298
|
};
|
|
7299
|
-
|
|
7299
|
+
WebGLHelper.createTextureFromImage = function (engine, image) {
|
|
7300
7300
|
var options = {
|
|
7301
7301
|
name: 'createTextureFromImage',
|
|
7302
7302
|
image: image,
|
|
@@ -7309,7 +7309,7 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7309
7309
|
};
|
|
7310
7310
|
return effects.Texture.create(engine, options);
|
|
7311
7311
|
};
|
|
7312
|
-
|
|
7312
|
+
WebGLHelper.createRenderPass = function (renderer, name, priority, meshData, fboOpts) {
|
|
7313
7313
|
var meshList = meshData instanceof effects.Mesh ? [meshData] : meshData;
|
|
7314
7314
|
return new effects.RenderPass(renderer, {
|
|
7315
7315
|
name: name,
|
|
@@ -7330,10 +7330,10 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7330
7330
|
viewport: fboOpts.viewport,
|
|
7331
7331
|
});
|
|
7332
7332
|
};
|
|
7333
|
-
|
|
7333
|
+
WebGLHelper.deleteTexture = function (texture) {
|
|
7334
7334
|
texture.dispose();
|
|
7335
7335
|
};
|
|
7336
|
-
|
|
7336
|
+
WebGLHelper.deleteMesh = function (mesh) {
|
|
7337
7337
|
mesh.dispose({
|
|
7338
7338
|
geometries: effects.DestroyOptions.destroy,
|
|
7339
7339
|
material: {
|
|
@@ -7341,10 +7341,10 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7341
7341
|
},
|
|
7342
7342
|
});
|
|
7343
7343
|
};
|
|
7344
|
-
|
|
7344
|
+
WebGLHelper.deleteGeometry = function (geometry) {
|
|
7345
7345
|
geometry.dispose();
|
|
7346
7346
|
};
|
|
7347
|
-
|
|
7347
|
+
WebGLHelper.deleteRenderPass = function (pass) {
|
|
7348
7348
|
pass.dispose({
|
|
7349
7349
|
meshes: {
|
|
7350
7350
|
geometries: effects.DestroyOptions.destroy,
|
|
@@ -7363,14 +7363,14 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7363
7363
|
* @param mesh - gl mesh 对象
|
|
7364
7364
|
* @return 是否半透明
|
|
7365
7365
|
*/
|
|
7366
|
-
|
|
7366
|
+
WebGLHelper.isTransparentMesh = function (mesh) {
|
|
7367
7367
|
return mesh.material.blending === true;
|
|
7368
7368
|
};
|
|
7369
7369
|
/**
|
|
7370
7370
|
* renderer 是否支持 Float 纹理
|
|
7371
7371
|
* @returns
|
|
7372
7372
|
*/
|
|
7373
|
-
|
|
7373
|
+
WebGLHelper.isSupportFloatTexture = function (engine) {
|
|
7374
7374
|
var capability = engine.gpuCapability;
|
|
7375
7375
|
return capability.detail.floatTexture !== 0;
|
|
7376
7376
|
};
|
|
@@ -7378,37 +7378,37 @@ var MarsRIHelper = /** @class */ (function () {
|
|
|
7378
7378
|
* renderer 是否支持 HalfFloat 纹理
|
|
7379
7379
|
* @returns
|
|
7380
7380
|
*/
|
|
7381
|
-
|
|
7381
|
+
WebGLHelper.isSupportHalfFloatTexture = function (engine) {
|
|
7382
7382
|
var capability = engine.gpuCapability;
|
|
7383
7383
|
return capability.detail.halfFloatTexture !== 0;
|
|
7384
7384
|
};
|
|
7385
|
-
|
|
7385
|
+
WebGLHelper.isPow2 = function (v) {
|
|
7386
7386
|
return !(v & (v - 1)) && (!!v);
|
|
7387
7387
|
};
|
|
7388
|
-
|
|
7388
|
+
WebGLHelper.cubemapTexConfig = {
|
|
7389
7389
|
name: 'cubemap texture',
|
|
7390
7390
|
wrapS: effects.glContext.CLAMP_TO_EDGE,
|
|
7391
7391
|
wrapT: effects.glContext.CLAMP_TO_EDGE,
|
|
7392
7392
|
magFilter: effects.glContext.LINEAR,
|
|
7393
7393
|
minFilter: effects.glContext.LINEAR,
|
|
7394
7394
|
};
|
|
7395
|
-
|
|
7395
|
+
WebGLHelper.cubemapMipTexConfig = {
|
|
7396
7396
|
wrapS: effects.glContext.CLAMP_TO_EDGE,
|
|
7397
7397
|
wrapT: effects.glContext.CLAMP_TO_EDGE,
|
|
7398
7398
|
magFilter: effects.glContext.LINEAR,
|
|
7399
7399
|
minFilter: effects.glContext.LINEAR_MIPMAP_LINEAR,
|
|
7400
7400
|
};
|
|
7401
|
-
return
|
|
7401
|
+
return WebGLHelper;
|
|
7402
7402
|
}());
|
|
7403
7403
|
var MeshHelper = /** @class */ (function () {
|
|
7404
7404
|
function MeshHelper() {
|
|
7405
7405
|
}
|
|
7406
|
-
MeshHelper.
|
|
7406
|
+
MeshHelper.createFilterMesh = function (engine, name, material, uniformSemantics) {
|
|
7407
7407
|
var globalState = PGlobalState.getInstance();
|
|
7408
7408
|
var vertexShader = material.vertexShaderCode;
|
|
7409
7409
|
var fragmentShader = material.fragmentShaderCode;
|
|
7410
7410
|
var geometry = effects.Geometry.create(engine, MeshHelper.getPlaneGeometry());
|
|
7411
|
-
var
|
|
7411
|
+
var effectsMaterial = effects.Material.create(engine, {
|
|
7412
7412
|
shader: {
|
|
7413
7413
|
vertex: vertexShader,
|
|
7414
7414
|
fragment: fragmentShader,
|
|
@@ -7416,11 +7416,11 @@ var MeshHelper = /** @class */ (function () {
|
|
|
7416
7416
|
},
|
|
7417
7417
|
uniformSemantics: uniformSemantics,
|
|
7418
7418
|
});
|
|
7419
|
-
material.setMaterialStates(
|
|
7419
|
+
material.setMaterialStates(effectsMaterial);
|
|
7420
7420
|
return effects.Mesh.create(engine, {
|
|
7421
7421
|
name: name,
|
|
7422
7422
|
worldMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
7423
|
-
material:
|
|
7423
|
+
material: effectsMaterial,
|
|
7424
7424
|
geometry: geometry,
|
|
7425
7425
|
});
|
|
7426
7426
|
};
|
|
@@ -7608,12 +7608,12 @@ var PluginHelper = /** @class */ (function () {
|
|
|
7608
7608
|
rotationMat.multiplyByPoint3(deltaPos);
|
|
7609
7609
|
var newCamPos = deltaPos.clone().addVector(targetPos);
|
|
7610
7610
|
var viewMatrix = new Matrix4().lookAt(newCamPos, targetPos, new Vector3(0, 1, 0)).inverse();
|
|
7611
|
-
var
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
return
|
|
7611
|
+
var effectsTransform = new effects.Transform();
|
|
7612
|
+
effectsTransform.setValid(true);
|
|
7613
|
+
effectsTransform.cloneFromMatrix(viewMatrix.toArray());
|
|
7614
|
+
return effectsTransform;
|
|
7615
7615
|
};
|
|
7616
|
-
PluginHelper.
|
|
7616
|
+
PluginHelper.preprocessEffectsScene = function (scene, runtimeEnv, compatibleMode, autoAdjustScene) {
|
|
7617
7617
|
var _this = this;
|
|
7618
7618
|
var deviceEnv = (runtimeEnv !== effects.PLAYER_OPTIONS_ENV_EDITOR);
|
|
7619
7619
|
var tiny3dMode = (compatibleMode === 'tiny3d');
|
|
@@ -7934,7 +7934,8 @@ var WebHelper = /** @class */ (function () {
|
|
|
7934
7934
|
a.href = url;
|
|
7935
7935
|
a.click();
|
|
7936
7936
|
};
|
|
7937
|
-
WebHelper.createPlayer = function () {
|
|
7937
|
+
WebHelper.createPlayer = function (manualRender) {
|
|
7938
|
+
if (manualRender === void 0) { manualRender = true; }
|
|
7938
7939
|
var canvas = document.createElement('canvas');
|
|
7939
7940
|
canvas.width = 512;
|
|
7940
7941
|
canvas.height = 512;
|
|
@@ -7943,7 +7944,7 @@ var WebHelper = /** @class */ (function () {
|
|
|
7943
7944
|
renderFramework: 'webgl2',
|
|
7944
7945
|
env: effects.PLAYER_OPTIONS_ENV_EDITOR,
|
|
7945
7946
|
willCaptureImage: true,
|
|
7946
|
-
manualRender:
|
|
7947
|
+
manualRender: manualRender,
|
|
7947
7948
|
});
|
|
7948
7949
|
};
|
|
7949
7950
|
WebHelper.sleep = function (ms) {
|
|
@@ -8466,7 +8467,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8466
8467
|
CheckerHelper.checkTextureUndef = function (v) {
|
|
8467
8468
|
return v === undefined ? true : this.checkTexture(v);
|
|
8468
8469
|
};
|
|
8469
|
-
CheckerHelper.
|
|
8470
|
+
CheckerHelper.checkTexTransform = function (v) {
|
|
8470
8471
|
if (!this.checkVec2Undef(v.offset)) {
|
|
8471
8472
|
return false;
|
|
8472
8473
|
}
|
|
@@ -8484,17 +8485,17 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8484
8485
|
}
|
|
8485
8486
|
return true;
|
|
8486
8487
|
};
|
|
8487
|
-
CheckerHelper.
|
|
8488
|
-
return v === undefined ? true : this.
|
|
8488
|
+
CheckerHelper.checkTexTransformUndef = function (v) {
|
|
8489
|
+
return v === undefined ? true : this.checkTexTransform(v);
|
|
8489
8490
|
};
|
|
8490
|
-
CheckerHelper.
|
|
8491
|
+
CheckerHelper.checkMatBlending = function (v) {
|
|
8491
8492
|
return v === undefined
|
|
8492
8493
|
|| v === effects.spec.MaterialBlending.opaque
|
|
8493
8494
|
|| v === effects.spec.MaterialBlending.masked
|
|
8494
8495
|
|| v === effects.spec.MaterialBlending.translucent
|
|
8495
8496
|
|| v === effects.spec.MaterialBlending.additive;
|
|
8496
8497
|
};
|
|
8497
|
-
CheckerHelper.
|
|
8498
|
+
CheckerHelper.checkMatSide = function (v) {
|
|
8498
8499
|
return v === undefined || v === effects.spec.SideMode.BACK || v === effects.spec.SideMode.DOUBLE || v === effects.spec.SideMode.FRONT;
|
|
8499
8500
|
};
|
|
8500
8501
|
CheckerHelper.checkAnimPath = function (v) {
|
|
@@ -8589,7 +8590,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8589
8590
|
attribArray.create(dataAttrib, dataArray);
|
|
8590
8591
|
return attribArray;
|
|
8591
8592
|
};
|
|
8592
|
-
CheckerHelper.
|
|
8593
|
+
CheckerHelper.assertModelSkinOptions = function (v) {
|
|
8593
8594
|
if (!this.checkStringUndef(v.name)) {
|
|
8594
8595
|
console.error("Invalid skin name ".concat(v.name, ", ").concat(this.stringify(v)));
|
|
8595
8596
|
}
|
|
@@ -8626,7 +8627,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8626
8627
|
}
|
|
8627
8628
|
}
|
|
8628
8629
|
};
|
|
8629
|
-
CheckerHelper.
|
|
8630
|
+
CheckerHelper.assertMatOptions = function (v) {
|
|
8630
8631
|
if (v.type === effects.spec.MaterialType.unlit) {
|
|
8631
8632
|
if (!this.checkString(v.name)) {
|
|
8632
8633
|
console.error("Invalid material name ".concat(v.name, ", ").concat(this.stringify(v)));
|
|
@@ -8638,7 +8639,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8638
8639
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
8639
8640
|
console.error("Invalid material baseColorTexture ".concat(v.baseColorTexture, ", ").concat(this.stringify(v)));
|
|
8640
8641
|
}
|
|
8641
|
-
if (!this.
|
|
8642
|
+
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
8642
8643
|
console.error("Invalid material baseColorTextureTransform ".concat(v.baseColorTextureTransform, ", ").concat(this.stringify(v)));
|
|
8643
8644
|
}
|
|
8644
8645
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
@@ -8648,10 +8649,10 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8648
8649
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
8649
8650
|
console.error("Invalid material depthMask ".concat(v.depthMask, ", ").concat(this.stringify(v)));
|
|
8650
8651
|
}
|
|
8651
|
-
if (!this.
|
|
8652
|
+
if (!this.checkMatBlending(v.blending)) {
|
|
8652
8653
|
console.error("Invalid material blending ".concat(v.blending, ", ").concat(this.stringify(v)));
|
|
8653
8654
|
}
|
|
8654
|
-
if (!this.
|
|
8655
|
+
if (!this.checkMatSide(v.side)) {
|
|
8655
8656
|
console.error("Invalid material side ".concat(v.side, ", ").concat(this.stringify(v)));
|
|
8656
8657
|
}
|
|
8657
8658
|
if (v.blending === effects.spec.MaterialBlending.masked) {
|
|
@@ -8674,7 +8675,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8674
8675
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
8675
8676
|
console.error("Invalid material baseColorTexture ".concat(v.baseColorTexture, ", ").concat(this.stringify(v)));
|
|
8676
8677
|
}
|
|
8677
|
-
if (!this.
|
|
8678
|
+
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
8678
8679
|
console.error("Invalid material baseColorTextureTransform ".concat(v.baseColorTextureTransform, ", ").concat(this.stringify(v)));
|
|
8679
8680
|
}
|
|
8680
8681
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
@@ -8693,7 +8694,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8693
8694
|
if (!this.checkTextureUndef(v.metallicRoughnessTexture)) {
|
|
8694
8695
|
console.error("Invalid material metallicRoughnessTexture ".concat(v.metallicRoughnessTexture, ", ").concat(this.stringify(v)));
|
|
8695
8696
|
}
|
|
8696
|
-
if (!this.
|
|
8697
|
+
if (!this.checkTexTransformUndef(v.metallicRoughnessTextureTransform)) {
|
|
8697
8698
|
console.error("Invalid material metallicRoughnessTextureTransform ".concat(v.metallicRoughnessTextureTransform, ", ").concat(this.stringify(v)));
|
|
8698
8699
|
}
|
|
8699
8700
|
if (!this.checkTexCoord(v.metallicRoughnessTextureCoordinate)) {
|
|
@@ -8706,7 +8707,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8706
8707
|
if (!this.checkNonnegativeUndef(v.normalTextureScale)) {
|
|
8707
8708
|
console.error("Invalid material normalTextureScale ".concat(v.normalTextureScale, ", ").concat(this.stringify(v)));
|
|
8708
8709
|
}
|
|
8709
|
-
if (!this.
|
|
8710
|
+
if (!this.checkTexTransformUndef(v.normalTextureTransform)) {
|
|
8710
8711
|
console.error("Invalid material normalTextureTransform ".concat(v.normalTextureTransform, ", ").concat(this.stringify(v)));
|
|
8711
8712
|
}
|
|
8712
8713
|
if (!this.checkTexCoord(v.normalTextureCoordinate)) {
|
|
@@ -8719,7 +8720,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8719
8720
|
if (!this.checkNumber01Undef(v.occlusionTextureStrength)) {
|
|
8720
8721
|
console.error("Invalid material occlusionTextureStrength ".concat(v.occlusionTextureStrength, ", ").concat(this.stringify(v)));
|
|
8721
8722
|
}
|
|
8722
|
-
if (!this.
|
|
8723
|
+
if (!this.checkTexTransformUndef(v.occlusionTextureTransform)) {
|
|
8723
8724
|
console.error("Invalid material occlusionTextureTransform ".concat(v.occlusionTextureTransform, ", ").concat(this.stringify(v)));
|
|
8724
8725
|
}
|
|
8725
8726
|
if (!this.checkTexCoord(v.occlusionTextureCoordinate)) {
|
|
@@ -8736,7 +8737,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8736
8737
|
if (!this.checkTextureUndef(v.emissiveTexture)) {
|
|
8737
8738
|
console.error("Invalid material emissiveTexture ".concat(v.emissiveTexture, ", ").concat(this.stringify(v)));
|
|
8738
8739
|
}
|
|
8739
|
-
if (!this.
|
|
8740
|
+
if (!this.checkTexTransformUndef(v.emissiveTextureTransform)) {
|
|
8740
8741
|
console.error("Invalid material emissiveTextureTransform ".concat(v.emissiveTextureTransform, ", ").concat(this.stringify(v)));
|
|
8741
8742
|
}
|
|
8742
8743
|
if (!this.checkTexCoord(v.emissiveTextureCoordinate)) {
|
|
@@ -8746,10 +8747,10 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8746
8747
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
8747
8748
|
console.error("Invalid material depthMask ".concat(v.depthMask, ", ").concat(this.stringify(v)));
|
|
8748
8749
|
}
|
|
8749
|
-
if (!this.
|
|
8750
|
+
if (!this.checkMatBlending(v.blending)) {
|
|
8750
8751
|
console.error("Invalid material blending ".concat(v.blending, ", ").concat(this.stringify(v)));
|
|
8751
8752
|
}
|
|
8752
|
-
if (!this.
|
|
8753
|
+
if (!this.checkMatSide(v.side)) {
|
|
8753
8754
|
console.error("Invalid material side ".concat(v.side, ", ").concat(this.stringify(v)));
|
|
8754
8755
|
}
|
|
8755
8756
|
if (v.blending === effects.spec.MaterialBlending.masked) {
|
|
@@ -8765,22 +8766,22 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8765
8766
|
console.error("Invalid material type ".concat(this.stringify(v)));
|
|
8766
8767
|
}
|
|
8767
8768
|
};
|
|
8768
|
-
CheckerHelper.
|
|
8769
|
+
CheckerHelper.assertPrimOptions = function (v, s) {
|
|
8769
8770
|
this.assertGeometry(v.geometry, s);
|
|
8770
|
-
this.
|
|
8771
|
+
this.assertMatOptions(v.material);
|
|
8771
8772
|
return true;
|
|
8772
8773
|
};
|
|
8773
|
-
CheckerHelper.
|
|
8774
|
+
CheckerHelper.assertModelMeshOptions = function (v) {
|
|
8774
8775
|
if (!this.checkParent(v.parent)) {
|
|
8775
8776
|
console.error("Invalid mesh parent ".concat(v.parent, ", ").concat(this.stringify(v)));
|
|
8776
8777
|
}
|
|
8777
8778
|
if (v.skin !== undefined) {
|
|
8778
|
-
this.
|
|
8779
|
+
this.assertModelSkinOptions(v.skin);
|
|
8779
8780
|
}
|
|
8780
8781
|
var morphList = [];
|
|
8781
8782
|
for (var i = 0; i < v.primitives.length; i++) {
|
|
8782
8783
|
var prim = v.primitives[i];
|
|
8783
|
-
if (!this.
|
|
8784
|
+
if (!this.assertPrimOptions(prim)) {
|
|
8784
8785
|
console.error("Invalid primitive ".concat(prim, ", ").concat(this.stringify(v)));
|
|
8785
8786
|
}
|
|
8786
8787
|
var morph = new PMorph();
|
|
@@ -8798,7 +8799,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8798
8799
|
console.error("Invalid mesh hide ".concat(v.hide, ", ").concat(this.stringify(v)));
|
|
8799
8800
|
}
|
|
8800
8801
|
};
|
|
8801
|
-
CheckerHelper.
|
|
8802
|
+
CheckerHelper.assertModelCameraOptions = function (v) {
|
|
8802
8803
|
if (!this.checkParent(v.parent)) {
|
|
8803
8804
|
console.error("Invalid camera parent ".concat(v.parent, ", ").concat(this.stringify(v)));
|
|
8804
8805
|
}
|
|
@@ -8818,7 +8819,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8818
8819
|
console.error("Invalid camera clipMode ".concat(v.clipMode, ", ").concat(this.stringify(v)));
|
|
8819
8820
|
}
|
|
8820
8821
|
};
|
|
8821
|
-
CheckerHelper.
|
|
8822
|
+
CheckerHelper.assertModelLightOptions = function (v) {
|
|
8822
8823
|
if (v.lightType === 'directional') {
|
|
8823
8824
|
if (!this.checkParent(v.parent)) {
|
|
8824
8825
|
console.error("Invalid light parent ".concat(v.parent, ", ").concat(this.stringify(v)));
|
|
@@ -8879,7 +8880,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8879
8880
|
console.error("Invalid light type ".concat(this.stringify(v)));
|
|
8880
8881
|
}
|
|
8881
8882
|
};
|
|
8882
|
-
CheckerHelper.
|
|
8883
|
+
CheckerHelper.assertModelSkyboxOptions = function (v) {
|
|
8883
8884
|
var _this = this;
|
|
8884
8885
|
if (!this.checkBoolean(v.renderable)) {
|
|
8885
8886
|
console.error("Invalid skybox renderable ".concat(v.renderable, ", ").concat(this.stringify(v)));
|
|
@@ -8923,7 +8924,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8923
8924
|
console.error("Invalid skybox specularMipCount or specularImageSize, ".concat(this.stringify(v)));
|
|
8924
8925
|
}
|
|
8925
8926
|
};
|
|
8926
|
-
CheckerHelper.
|
|
8927
|
+
CheckerHelper.checkModelAnimTrackOptions = function (v) {
|
|
8927
8928
|
if (!this.checkNonnegative(v.node)) {
|
|
8928
8929
|
console.error("Invalid track node ".concat(v.node, ", ").concat(this.stringify(v)));
|
|
8929
8930
|
return false;
|
|
@@ -8946,7 +8947,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8946
8947
|
}
|
|
8947
8948
|
return true;
|
|
8948
8949
|
};
|
|
8949
|
-
CheckerHelper.
|
|
8950
|
+
CheckerHelper.assertModelAnimOptions = function (v) {
|
|
8950
8951
|
var _this = this;
|
|
8951
8952
|
if (!this.checkStringUndef(v.name)) {
|
|
8952
8953
|
console.error("Invalid animation name ".concat(v.name, ", ").concat(this.stringify(v)));
|
|
@@ -8955,7 +8956,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8955
8956
|
console.error("Invalid animation tracks ".concat(v.tracks, ", ").concat(this.stringify(v)));
|
|
8956
8957
|
}
|
|
8957
8958
|
v.tracks.forEach(function (t) {
|
|
8958
|
-
if (!_this.
|
|
8959
|
+
if (!_this.checkModelAnimTrackOptions(t)) {
|
|
8959
8960
|
console.error("Invalid animation track ".concat(t, ", ").concat(_this.stringify(v)));
|
|
8960
8961
|
}
|
|
8961
8962
|
});
|
|
@@ -8969,7 +8970,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8969
8970
|
if (!Array.isArray(v.animations)) {
|
|
8970
8971
|
console.error("Invalid tree animations ".concat(v.animations, ", ").concat(this.stringify(v)));
|
|
8971
8972
|
}
|
|
8972
|
-
v.animations.forEach(function (anim) { _this.
|
|
8973
|
+
v.animations.forEach(function (anim) { _this.assertModelAnimOptions(anim); });
|
|
8973
8974
|
if (v.animation !== undefined) {
|
|
8974
8975
|
if (v.animation < -1 || v.animation >= v.animations.length) {
|
|
8975
8976
|
console.error("Invalid tree animations ".concat(v.animations, ", ").concat(this.stringify(v)));
|
|
@@ -8984,7 +8985,7 @@ var CheckerHelper = /** @class */ (function () {
|
|
|
8984
8985
|
// continue;
|
|
8985
8986
|
// }
|
|
8986
8987
|
if (prop === 'internal') {
|
|
8987
|
-
//
|
|
8988
|
+
// 与WebGL相关的数据,可以忽略
|
|
8988
8989
|
continue;
|
|
8989
8990
|
}
|
|
8990
8991
|
if (typeof (object[prop]) == 'function') {
|
|
@@ -9229,7 +9230,7 @@ var PMorph = /** @class */ (function (_super) {
|
|
|
9229
9230
|
return _this;
|
|
9230
9231
|
}
|
|
9231
9232
|
/**
|
|
9232
|
-
* 通过
|
|
9233
|
+
* 通过 Geometry 数据创建 Morph 动画相关状态,并进行必要的正确性检查
|
|
9233
9234
|
*
|
|
9234
9235
|
* @param geometry - Mesh 的几何对象,是否包含 Morph 动画都是可以的
|
|
9235
9236
|
*/
|
|
@@ -9333,7 +9334,7 @@ var PMorph = /** @class */ (function (_super) {
|
|
|
9333
9334
|
* 主要用于统计 Morph 动画中新增的 Attribute 名称的个数,会作为最终的 weights 数组长度使用
|
|
9334
9335
|
*
|
|
9335
9336
|
* @param attributeNameList - Attribute 名数组列表,只与 Morph Target 中的属性有关
|
|
9336
|
-
* @param geometry -
|
|
9337
|
+
* @param geometry - Geometry 对象,是否有 Morph 动画都可以
|
|
9337
9338
|
* @returns 存在的 Attribute 名称数目
|
|
9338
9339
|
*/
|
|
9339
9340
|
PMorph.prototype.getAttributeMorphCount = function (attributeNameList, geometry) {
|
|
@@ -9500,7 +9501,6 @@ var PAnimTrack = /** @class */ (function () {
|
|
|
9500
9501
|
};
|
|
9501
9502
|
/**
|
|
9502
9503
|
* 生成 Mesh 元素的父节点
|
|
9503
|
-
* 为 Mesh 元素生成 Mars 中的父节点,这里是和燃燃确定的生成方式
|
|
9504
9504
|
*
|
|
9505
9505
|
* @param parentId - 父节点 id 名称
|
|
9506
9506
|
* @param nodeIndex - Mesh 节点索引
|
|
@@ -10800,10 +10800,10 @@ var PSkyboxCreator = /** @class */ (function () {
|
|
|
10800
10800
|
minFilter: effects.glContext.LINEAR_MIPMAP_LINEAR,
|
|
10801
10801
|
});
|
|
10802
10802
|
if (params.type === 'url') {
|
|
10803
|
-
return [2 /*return*/,
|
|
10803
|
+
return [2 /*return*/, WebGLHelper.createTextureCubeMipmapFromURL(engine, params.specularImage)];
|
|
10804
10804
|
}
|
|
10805
10805
|
else {
|
|
10806
|
-
return [2 /*return*/,
|
|
10806
|
+
return [2 /*return*/, WebGLHelper.createTextureCubeMipmapFromBuffer(engine, params.specularImage, params.specularImageSize)];
|
|
10807
10807
|
}
|
|
10808
10808
|
});
|
|
10809
10809
|
});
|
|
@@ -10815,10 +10815,10 @@ var PSkyboxCreator = /** @class */ (function () {
|
|
|
10815
10815
|
return [2 /*return*/];
|
|
10816
10816
|
}
|
|
10817
10817
|
if (params.type === 'url') {
|
|
10818
|
-
return [2 /*return*/,
|
|
10818
|
+
return [2 /*return*/, WebGLHelper.createTextureCubeFromURL(engine, params.diffuseImage)];
|
|
10819
10819
|
}
|
|
10820
10820
|
else {
|
|
10821
|
-
return [2 /*return*/,
|
|
10821
|
+
return [2 /*return*/, WebGLHelper.createTextureCubeFromBuffer(engine, params.diffuseImage)];
|
|
10822
10822
|
}
|
|
10823
10823
|
});
|
|
10824
10824
|
});
|
|
@@ -11129,7 +11129,7 @@ var CompositionCache = /** @class */ (function () {
|
|
|
11129
11129
|
if (cachedMesh !== undefined) {
|
|
11130
11130
|
return cachedMesh;
|
|
11131
11131
|
}
|
|
11132
|
-
var mesh = MeshHelper.
|
|
11132
|
+
var mesh = MeshHelper.createFilterMesh(this.engine, name, material, uniformSemantics);
|
|
11133
11133
|
this.meshCache.set(name, mesh);
|
|
11134
11134
|
return mesh;
|
|
11135
11135
|
};
|
|
@@ -11148,7 +11148,7 @@ var CompositionCache = /** @class */ (function () {
|
|
|
11148
11148
|
}
|
|
11149
11149
|
else {
|
|
11150
11150
|
var renderer = this.engine.renderer;
|
|
11151
|
-
var renderPass =
|
|
11151
|
+
var renderPass = WebGLHelper.createRenderPass(renderer, name, priority, meshList, fboOptions);
|
|
11152
11152
|
this.renderPassCache.set(name, renderPass);
|
|
11153
11153
|
return renderPass;
|
|
11154
11154
|
}
|
|
@@ -11158,22 +11158,22 @@ var CompositionCache = /** @class */ (function () {
|
|
|
11158
11158
|
this.engine = null;
|
|
11159
11159
|
this.brdfLutTexture = undefined;
|
|
11160
11160
|
this.meshCache.forEach(function (mesh) {
|
|
11161
|
-
|
|
11161
|
+
WebGLHelper.deleteMesh(mesh);
|
|
11162
11162
|
});
|
|
11163
11163
|
this.meshCache.clear();
|
|
11164
11164
|
//
|
|
11165
11165
|
this.textureCache.forEach(function (texture) {
|
|
11166
|
-
|
|
11166
|
+
WebGLHelper.deleteTexture(texture);
|
|
11167
11167
|
});
|
|
11168
11168
|
this.textureCache.clear();
|
|
11169
11169
|
//
|
|
11170
11170
|
this.geometryCache.forEach(function (geometry) {
|
|
11171
|
-
|
|
11171
|
+
WebGLHelper.deleteGeometry(geometry);
|
|
11172
11172
|
});
|
|
11173
11173
|
this.geometryCache.clear();
|
|
11174
11174
|
//
|
|
11175
11175
|
this.renderPassCache.forEach(function (pass) {
|
|
11176
|
-
|
|
11176
|
+
WebGLHelper.deleteRenderPass(pass);
|
|
11177
11177
|
});
|
|
11178
11178
|
this.renderPassCache.clear();
|
|
11179
11179
|
};
|
|
@@ -11226,7 +11226,7 @@ var PCamera = /** @class */ (function (_super) {
|
|
|
11226
11226
|
}
|
|
11227
11227
|
PCamera.prototype.update = function () {
|
|
11228
11228
|
if (this.ownerItem !== undefined) {
|
|
11229
|
-
this.transform.
|
|
11229
|
+
this.transform.fromEffectsTransform(this.ownerItem.transform);
|
|
11230
11230
|
}
|
|
11231
11231
|
this.projectionMatrix.perspective(this.fovy * deg2rad, this.aspect, this.nearPlane, this.farPlane, this.isReversed());
|
|
11232
11232
|
this.viewMatrix = this.matrix.inverse();
|
|
@@ -11382,7 +11382,7 @@ var PLight = /** @class */ (function (_super) {
|
|
|
11382
11382
|
_this.visible = false;
|
|
11383
11383
|
_this.ownerItem = ownerItem;
|
|
11384
11384
|
if (ownerItem !== undefined) {
|
|
11385
|
-
_this.transform.
|
|
11385
|
+
_this.transform.fromEffectsTransform(ownerItem.transform);
|
|
11386
11386
|
}
|
|
11387
11387
|
_this.direction = new Vector3(0, 0, -1);
|
|
11388
11388
|
_this.range = 0;
|
|
@@ -11413,7 +11413,7 @@ var PLight = /** @class */ (function (_super) {
|
|
|
11413
11413
|
}
|
|
11414
11414
|
PLight.prototype.tick = function (deltaSeconds) {
|
|
11415
11415
|
if (this.ownerItem !== undefined) {
|
|
11416
|
-
this.transform.
|
|
11416
|
+
this.transform.fromEffectsTransform(this.ownerItem.transform);
|
|
11417
11417
|
}
|
|
11418
11418
|
};
|
|
11419
11419
|
PLight.prototype.isDirectional = function () {
|
|
@@ -12106,10 +12106,10 @@ var PShadowManager = /** @class */ (function () {
|
|
|
12106
12106
|
};
|
|
12107
12107
|
PShadowManager.prototype.isSupportTextureOptions = function () {
|
|
12108
12108
|
if (this.type === effects.glContext.FLOAT) {
|
|
12109
|
-
return
|
|
12109
|
+
return WebGLHelper.isSupportFloatTexture(this.engine);
|
|
12110
12110
|
}
|
|
12111
12111
|
else if (this.type === effects.glContext.HALF_FLOAT) {
|
|
12112
|
-
return
|
|
12112
|
+
return WebGLHelper.isSupportHalfFloatTexture(this.engine);
|
|
12113
12113
|
}
|
|
12114
12114
|
else {
|
|
12115
12115
|
return true;
|
|
@@ -12321,7 +12321,7 @@ var PMesh = /** @class */ (function (_super) {
|
|
|
12321
12321
|
_this.visBoundingBox = false;
|
|
12322
12322
|
_this.isBuilt = false;
|
|
12323
12323
|
_this.isDisposed = false;
|
|
12324
|
-
var proxy = new
|
|
12324
|
+
var proxy = new EffectsMeshProxy(itemMesh, parentItem);
|
|
12325
12325
|
_this.name = proxy.getName();
|
|
12326
12326
|
_this.type = exports.PObjectType.mesh;
|
|
12327
12327
|
_this.visible = false;
|
|
@@ -12373,7 +12373,7 @@ var PMesh = /** @class */ (function (_super) {
|
|
|
12373
12373
|
PMesh.prototype.addToRenderObjectSet = function (renderObjectSet) {
|
|
12374
12374
|
if (this.visible) {
|
|
12375
12375
|
this.primitives.forEach(function (prim) {
|
|
12376
|
-
renderObjectSet.add(prim.
|
|
12376
|
+
renderObjectSet.add(prim.effectsMesh);
|
|
12377
12377
|
});
|
|
12378
12378
|
if (this.visBoundingBox && this.boundingBoxMesh !== undefined) {
|
|
12379
12379
|
renderObjectSet.add(this.boundingBoxMesh.mesh);
|
|
@@ -12534,7 +12534,7 @@ var PMesh = /** @class */ (function (_super) {
|
|
|
12534
12534
|
Object.defineProperty(PMesh.prototype, "mriMeshs", {
|
|
12535
12535
|
get: function () {
|
|
12536
12536
|
return this.primitives.map(function (prim) {
|
|
12537
|
-
return prim.
|
|
12537
|
+
return prim.effectsMesh;
|
|
12538
12538
|
});
|
|
12539
12539
|
},
|
|
12540
12540
|
enumerable: false,
|
|
@@ -12547,7 +12547,7 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12547
12547
|
this.engine = engine;
|
|
12548
12548
|
//
|
|
12549
12549
|
this.name = '';
|
|
12550
|
-
this.
|
|
12550
|
+
this.effectsPriority = 0;
|
|
12551
12551
|
this.boundingBox = new Box3();
|
|
12552
12552
|
this.isCompressed = false;
|
|
12553
12553
|
//
|
|
@@ -12560,7 +12560,7 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12560
12560
|
this.setGeometry(options.geometry);
|
|
12561
12561
|
this.setMaterial(options.material);
|
|
12562
12562
|
this.name = parent.name;
|
|
12563
|
-
this.
|
|
12563
|
+
this.effectsPriority = parent.priority;
|
|
12564
12564
|
this.geometry.setHide(parent.hide);
|
|
12565
12565
|
if (this.skin !== undefined) {
|
|
12566
12566
|
var jointCount = this.skin.getJointCount();
|
|
@@ -12611,13 +12611,13 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12611
12611
|
var mesh = effects.Mesh.create(this.engine, {
|
|
12612
12612
|
name: this.name,
|
|
12613
12613
|
material: material,
|
|
12614
|
-
geometry: this.
|
|
12615
|
-
priority: this.
|
|
12614
|
+
geometry: this.getEffectsGeometry(),
|
|
12615
|
+
priority: this.effectsPriority,
|
|
12616
12616
|
});
|
|
12617
|
-
if (this.
|
|
12618
|
-
this.
|
|
12617
|
+
if (this.effectsMesh !== undefined) {
|
|
12618
|
+
this.effectsMesh.dispose();
|
|
12619
12619
|
}
|
|
12620
|
-
this.
|
|
12620
|
+
this.effectsMesh = mesh;
|
|
12621
12621
|
if (this.isEnableShadow()) {
|
|
12622
12622
|
this.shadowMaterial = new PMaterialShadowBaseTest();
|
|
12623
12623
|
this.shadowMaterial.create({
|
|
@@ -12640,8 +12640,8 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12640
12640
|
var shadowMesh = effects.Mesh.create(this.engine, {
|
|
12641
12641
|
name: this.name + '_shadow',
|
|
12642
12642
|
material: shadowMaterial,
|
|
12643
|
-
geometry: this.
|
|
12644
|
-
priority: this.
|
|
12643
|
+
geometry: this.getEffectsGeometry(),
|
|
12644
|
+
priority: this.effectsPriority,
|
|
12645
12645
|
});
|
|
12646
12646
|
if (this.shadowMesh !== undefined) {
|
|
12647
12647
|
this.shadowMesh.dispose();
|
|
@@ -12734,7 +12734,7 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12734
12734
|
return featureList;
|
|
12735
12735
|
};
|
|
12736
12736
|
PPrimitive.prototype.addToRenderObjectSet = function (renderObjectSet) {
|
|
12737
|
-
renderObjectSet.add(this.
|
|
12737
|
+
renderObjectSet.add(this.effectsMesh);
|
|
12738
12738
|
};
|
|
12739
12739
|
PPrimitive.prototype.dispose = function () {
|
|
12740
12740
|
var _a, _b, _c, _d;
|
|
@@ -12752,12 +12752,12 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12752
12752
|
this.jointMatrixTexture = undefined;
|
|
12753
12753
|
(_b = this.jointNormalMatTexture) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
12754
12754
|
this.jointNormalMatTexture = undefined;
|
|
12755
|
-
this.
|
|
12755
|
+
this.effectsMesh.dispose({
|
|
12756
12756
|
geometries: effects.DestroyOptions.keep,
|
|
12757
12757
|
material: effects.DestroyOptions.keep,
|
|
12758
12758
|
});
|
|
12759
12759
|
// @ts-expect-error
|
|
12760
|
-
this.
|
|
12760
|
+
this.effectsMesh = undefined;
|
|
12761
12761
|
(_c = this.shadowMesh) === null || _c === void 0 ? void 0 : _c.dispose({
|
|
12762
12762
|
geometries: effects.DestroyOptions.keep,
|
|
12763
12763
|
material: effects.DestroyOptions.keep,
|
|
@@ -12769,10 +12769,10 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12769
12769
|
PPrimitive.prototype.updateUniformsForScene = function (worldMatrix, nomralMatrix, sceneStates) {
|
|
12770
12770
|
this.updateUniformsByAnimation(worldMatrix, nomralMatrix);
|
|
12771
12771
|
this.updateUniformsByScene(sceneStates);
|
|
12772
|
-
this.material.updateUniforms(this.
|
|
12772
|
+
this.material.updateUniforms(this.getModelMaterial());
|
|
12773
12773
|
};
|
|
12774
12774
|
PPrimitive.prototype.updateUniformForShadow = function (shadowOpts) {
|
|
12775
|
-
var shadowMriMaterial = this.
|
|
12775
|
+
var shadowMriMaterial = this.getShadowModelMaterial();
|
|
12776
12776
|
if (shadowMriMaterial !== undefined) {
|
|
12777
12777
|
shadowMriMaterial.setMatrix('u_ViewProjectionMatrix', shadowOpts.viewProjectionMatrix.toArray());
|
|
12778
12778
|
if (this.shadowMaterial !== undefined) {
|
|
@@ -12842,8 +12842,8 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12842
12842
|
}
|
|
12843
12843
|
};
|
|
12844
12844
|
PPrimitive.prototype.updateUniformsByAnimation = function (worldMatrix, normalMatrix) {
|
|
12845
|
-
var material = this.
|
|
12846
|
-
var shadowMaterial = this.
|
|
12845
|
+
var material = this.getModelMaterial();
|
|
12846
|
+
var shadowMaterial = this.getShadowModelMaterial();
|
|
12847
12847
|
material.setMatrix('u_ModelMatrix', worldMatrix.toArray());
|
|
12848
12848
|
material.setMatrix('u_NormalMatrix', normalMatrix.toArray());
|
|
12849
12849
|
if (shadowMaterial !== undefined) {
|
|
@@ -12891,7 +12891,7 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12891
12891
|
};
|
|
12892
12892
|
PPrimitive.prototype.updateUniformsByScene = function (sceneStates) {
|
|
12893
12893
|
var _a;
|
|
12894
|
-
var material = this.
|
|
12894
|
+
var material = this.getModelMaterial();
|
|
12895
12895
|
material.setMatrix('u_ViewProjectionMatrix', sceneStates.viewProjectionMatrix.toArray());
|
|
12896
12896
|
material.setVector3('u_Camera', sceneStates.cameraPosition.toArray());
|
|
12897
12897
|
if (this.isEnableShadow()) ;
|
|
@@ -12946,7 +12946,7 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12946
12946
|
PPrimitive.prototype.hasSkin = function () {
|
|
12947
12947
|
return this.skin !== undefined;
|
|
12948
12948
|
};
|
|
12949
|
-
PPrimitive.prototype.
|
|
12949
|
+
PPrimitive.prototype.getEffectsGeometry = function () {
|
|
12950
12950
|
return this.geometry.geometry;
|
|
12951
12951
|
};
|
|
12952
12952
|
PPrimitive.prototype.setGeometry = function (val) {
|
|
@@ -12968,10 +12968,10 @@ var PPrimitive = /** @class */ (function () {
|
|
|
12968
12968
|
this.material = createPluginMaterial(val);
|
|
12969
12969
|
}
|
|
12970
12970
|
};
|
|
12971
|
-
PPrimitive.prototype.
|
|
12972
|
-
return this.
|
|
12971
|
+
PPrimitive.prototype.getModelMaterial = function () {
|
|
12972
|
+
return this.effectsMesh.material;
|
|
12973
12973
|
};
|
|
12974
|
-
PPrimitive.prototype.
|
|
12974
|
+
PPrimitive.prototype.getShadowModelMaterial = function () {
|
|
12975
12975
|
var _a;
|
|
12976
12976
|
return (_a = this.shadowMesh) === null || _a === void 0 ? void 0 : _a.material;
|
|
12977
12977
|
};
|
|
@@ -13077,8 +13077,8 @@ var PGeometry = /** @class */ (function () {
|
|
|
13077
13077
|
};
|
|
13078
13078
|
return PGeometry;
|
|
13079
13079
|
}());
|
|
13080
|
-
var
|
|
13081
|
-
function
|
|
13080
|
+
var EffectsMeshProxy = /** @class */ (function () {
|
|
13081
|
+
function EffectsMeshProxy(item, parentItem) {
|
|
13082
13082
|
this.item = item;
|
|
13083
13083
|
this.parentItem = parentItem;
|
|
13084
13084
|
this.options = item.content.options;
|
|
@@ -13116,7 +13116,7 @@ var MarsMeshProxy = /** @class */ (function () {
|
|
|
13116
13116
|
this.morphObj = new PMorph();
|
|
13117
13117
|
}
|
|
13118
13118
|
}
|
|
13119
|
-
|
|
13119
|
+
EffectsMeshProxy.prototype.hasMorphTarget = function () {
|
|
13120
13120
|
return this.morphObj.hasMorph();
|
|
13121
13121
|
};
|
|
13122
13122
|
/**
|
|
@@ -13125,45 +13125,45 @@ var MarsMeshProxy = /** @class */ (function () {
|
|
|
13125
13125
|
*
|
|
13126
13126
|
* @returns 缓存的 Morph 对象,或者 undefined
|
|
13127
13127
|
*/
|
|
13128
|
-
|
|
13128
|
+
EffectsMeshProxy.prototype.getMorphObj = function () {
|
|
13129
13129
|
if (!this.hasMorphTarget()) {
|
|
13130
13130
|
return;
|
|
13131
13131
|
}
|
|
13132
13132
|
return this.morphObj;
|
|
13133
13133
|
};
|
|
13134
|
-
|
|
13134
|
+
EffectsMeshProxy.prototype.getParentId = function () {
|
|
13135
13135
|
return this.item.parentId;
|
|
13136
13136
|
};
|
|
13137
|
-
|
|
13137
|
+
EffectsMeshProxy.prototype.getName = function () {
|
|
13138
13138
|
return this.item.name;
|
|
13139
13139
|
};
|
|
13140
|
-
|
|
13140
|
+
EffectsMeshProxy.prototype.isHide = function () {
|
|
13141
13141
|
return this.options.hide === true;
|
|
13142
13142
|
};
|
|
13143
|
-
|
|
13143
|
+
EffectsMeshProxy.prototype.getParentNode = function () {
|
|
13144
13144
|
var nodeIndex = this.getParentIndex();
|
|
13145
13145
|
if (this.parentItem !== undefined && nodeIndex >= 0) {
|
|
13146
13146
|
return this.parentItem.content.getNodeById(nodeIndex);
|
|
13147
13147
|
}
|
|
13148
13148
|
return undefined;
|
|
13149
13149
|
};
|
|
13150
|
-
|
|
13150
|
+
EffectsMeshProxy.prototype.getParentIndex = function () {
|
|
13151
13151
|
var _a;
|
|
13152
13152
|
return (_a = this.options.parent) !== null && _a !== void 0 ? _a : -1;
|
|
13153
13153
|
};
|
|
13154
|
-
|
|
13154
|
+
EffectsMeshProxy.prototype.getPrimitives = function () {
|
|
13155
13155
|
return this.options.primitives;
|
|
13156
13156
|
};
|
|
13157
|
-
|
|
13157
|
+
EffectsMeshProxy.prototype.getPrimitiveCount = function () {
|
|
13158
13158
|
return this.options.primitives.length;
|
|
13159
13159
|
};
|
|
13160
|
-
|
|
13160
|
+
EffectsMeshProxy.prototype.hasSkin = function () {
|
|
13161
13161
|
return this.options.skin !== undefined;
|
|
13162
13162
|
};
|
|
13163
|
-
|
|
13163
|
+
EffectsMeshProxy.prototype.getSkinOpts = function () {
|
|
13164
13164
|
return this.options.skin;
|
|
13165
13165
|
};
|
|
13166
|
-
|
|
13166
|
+
EffectsMeshProxy.prototype.getSkinObj = function (engine) {
|
|
13167
13167
|
var skin = this.getSkinOpts();
|
|
13168
13168
|
if (skin !== undefined) {
|
|
13169
13169
|
var skinObj = new PSkin();
|
|
@@ -13172,7 +13172,7 @@ var MarsMeshProxy = /** @class */ (function () {
|
|
|
13172
13172
|
}
|
|
13173
13173
|
return undefined;
|
|
13174
13174
|
};
|
|
13175
|
-
return
|
|
13175
|
+
return EffectsMeshProxy;
|
|
13176
13176
|
}());
|
|
13177
13177
|
|
|
13178
13178
|
var PSceneManager = /** @class */ (function () {
|
|
@@ -13317,8 +13317,8 @@ var PSceneManager = /** @class */ (function () {
|
|
|
13317
13317
|
effects.removeItem(this.itemList, entity);
|
|
13318
13318
|
};
|
|
13319
13319
|
PSceneManager.prototype.updateDefaultCamera = function (camera) {
|
|
13320
|
-
var
|
|
13321
|
-
var newTransform = new PTransform().
|
|
13320
|
+
var effectsTransfrom = new effects.Transform(__assign(__assign({}, camera), { valid: true }));
|
|
13321
|
+
var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
13322
13322
|
this.cameraManager.updateDefaultCamera(camera.fov, camera.near, camera.far, camera.position, newTransform.getRotation(), camera.clipMode);
|
|
13323
13323
|
};
|
|
13324
13324
|
PSceneManager.prototype.buildItem = function (item) {
|
|
@@ -13410,7 +13410,7 @@ var PSceneManager = /** @class */ (function () {
|
|
|
13410
13410
|
};
|
|
13411
13411
|
/**
|
|
13412
13412
|
* 动态调整 Mesh 渲染优先级
|
|
13413
|
-
* 主要是为了和 Tiny
|
|
13413
|
+
* 主要是为了和 Tiny 渲染对齐,正常渲染不进行调整
|
|
13414
13414
|
*
|
|
13415
13415
|
* @param states - 场景中的状态数据
|
|
13416
13416
|
*/
|
|
@@ -13427,8 +13427,8 @@ var PSceneManager = /** @class */ (function () {
|
|
|
13427
13427
|
// 将透明和不透明物体拆开,从而渲染正确
|
|
13428
13428
|
var viewMatrix = states.viewMatrix;
|
|
13429
13429
|
meshList.sort(function (a, b) {
|
|
13430
|
-
var atransparent =
|
|
13431
|
-
var btransparent =
|
|
13430
|
+
var atransparent = WebGLHelper.isTransparentMesh(a);
|
|
13431
|
+
var btransparent = WebGLHelper.isTransparentMesh(b);
|
|
13432
13432
|
if (atransparent && btransparent) {
|
|
13433
13433
|
var aposition = Vector3.unpack(a.worldMatrix, 12, new Vector3());
|
|
13434
13434
|
var bposition = Vector3.unpack(b.worldMatrix, 12, new Vector3());
|
|
@@ -13455,9 +13455,9 @@ var PSceneManager = /** @class */ (function () {
|
|
|
13455
13455
|
};
|
|
13456
13456
|
/**
|
|
13457
13457
|
* 查询场景中的 Mesh
|
|
13458
|
-
* 通过
|
|
13458
|
+
* 通过 parentId 查询 Mesh 对象,可能找不到 Mesh 对象
|
|
13459
13459
|
*
|
|
13460
|
-
* @param parentId -
|
|
13460
|
+
* @param parentId - Item 中定义的 parentId
|
|
13461
13461
|
* @returns 查询到的 PMesh,或者是没找到。如果 Mesh 不可见,也是没找到。
|
|
13462
13462
|
*/
|
|
13463
13463
|
PSceneManager.prototype.queryMesh = function (parentId) {
|
|
@@ -13814,24 +13814,24 @@ var ModelVFXItem = /** @class */ (function (_super) {
|
|
|
13814
13814
|
switch ((_a = this.options) === null || _a === void 0 ? void 0 : _a.type) {
|
|
13815
13815
|
case 'mesh': {
|
|
13816
13816
|
var meshOptions = this.options.content.options;
|
|
13817
|
-
CheckerHelper.
|
|
13817
|
+
CheckerHelper.assertModelMeshOptions(meshOptions);
|
|
13818
13818
|
var engine = (_b = this.composition) === null || _b === void 0 ? void 0 : _b.getEngine();
|
|
13819
13819
|
return new PMesh(engine, this.options, this);
|
|
13820
13820
|
}
|
|
13821
13821
|
case 'camera': {
|
|
13822
13822
|
var cameraOptions = this.options.content.options;
|
|
13823
|
-
CheckerHelper.
|
|
13823
|
+
CheckerHelper.assertModelCameraOptions(cameraOptions);
|
|
13824
13824
|
var width = composition.width, height = composition.height;
|
|
13825
13825
|
return new PCamera(this.options, width, height, this);
|
|
13826
13826
|
}
|
|
13827
13827
|
case 'light': {
|
|
13828
13828
|
var lightOptions = this.options.content.options;
|
|
13829
|
-
CheckerHelper.
|
|
13829
|
+
CheckerHelper.assertModelLightOptions(lightOptions);
|
|
13830
13830
|
return new PLight(this.options, this);
|
|
13831
13831
|
}
|
|
13832
13832
|
case 'skybox': {
|
|
13833
13833
|
var skyboxOptions = this.options.content.options;
|
|
13834
|
-
CheckerHelper.
|
|
13834
|
+
CheckerHelper.assertModelSkyboxOptions(skyboxOptions);
|
|
13835
13835
|
return new PSkybox(this.options, this);
|
|
13836
13836
|
}
|
|
13837
13837
|
default: {
|
|
@@ -14026,7 +14026,7 @@ var ModelPlugin = /** @class */ (function (_super) {
|
|
|
14026
14026
|
autoAdjustScene = (_c = options.pluginData['autoAdjustScene']) !== null && _c !== void 0 ? _c : autoAdjustScene;
|
|
14027
14027
|
}
|
|
14028
14028
|
//
|
|
14029
|
-
PluginHelper.
|
|
14029
|
+
PluginHelper.preprocessEffectsScene(scene, runtimeEnv, compatibleMode, autoAdjustScene);
|
|
14030
14030
|
//
|
|
14031
14031
|
return [4 /*yield*/, CompositionCache.loadStaticResources()];
|
|
14032
14032
|
case 1:
|
|
@@ -14116,7 +14116,7 @@ var ModelPlugin = /** @class */ (function (_super) {
|
|
|
14116
14116
|
// 但只会在第一帧进行更新,主要是用于测试使用
|
|
14117
14117
|
// this.autoAdjustScene = false;
|
|
14118
14118
|
var cameraParams = composition.camera;
|
|
14119
|
-
var cameraTransform = new PTransform().
|
|
14119
|
+
var cameraTransform = new PTransform().fromEffectsTransform(cameraParams);
|
|
14120
14120
|
var cameraCoordinate = new PCoordinate().fromPTransform(cameraTransform);
|
|
14121
14121
|
var cameraDirection = cameraCoordinate.zAxis.clone();
|
|
14122
14122
|
var cameraFov = (_a = cameraParams.fov) !== null && _a !== void 0 ? _a : 45;
|
|
@@ -14300,8 +14300,8 @@ var CameraGestureHandlerImp = /** @class */ (function () {
|
|
|
14300
14300
|
return this.composition.camera.getOptions();
|
|
14301
14301
|
}
|
|
14302
14302
|
var camera = this.composition.camera;
|
|
14303
|
-
var
|
|
14304
|
-
var cameraTransform = new PTransform().
|
|
14303
|
+
var effectsTransfrom = new effects.Transform(__assign(__assign({}, camera.getOptions()), { valid: true }));
|
|
14304
|
+
var cameraTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
14305
14305
|
var cameraCoordiante = new PCoordinate().fromPTransform(cameraTransform);
|
|
14306
14306
|
// compute move direction
|
|
14307
14307
|
var xAxis = (_a = event.xAxis) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -14492,7 +14492,7 @@ var CameraGestureHandlerImp = /** @class */ (function () {
|
|
|
14492
14492
|
var newDistance = distance !== null && distance !== void 0 ? distance : 5;
|
|
14493
14493
|
var targetPoint = Vector3.fromArray(point);
|
|
14494
14494
|
//
|
|
14495
|
-
var transform = new PTransform().
|
|
14495
|
+
var transform = new PTransform().fromEffectsTransform(item.transform);
|
|
14496
14496
|
var coordinate = new PCoordinate().fromPTransform(transform);
|
|
14497
14497
|
var lookatDir = coordinate.zAxis.clone().multiplyScalar(1.0);
|
|
14498
14498
|
//
|
|
@@ -14518,7 +14518,7 @@ var CameraGestureHandlerImp = /** @class */ (function () {
|
|
|
14518
14518
|
// const newLookatDir = targetPoint.clone().subVector(cameraPos).normalize();
|
|
14519
14519
|
// const newOffset = newLookatDir.clone().multiplyScalar(newDistance);
|
|
14520
14520
|
// const newPosition = targetPoint.clone().subVector(newOffset);
|
|
14521
|
-
// const oldTransform = new PTransform().
|
|
14521
|
+
// const oldTransform = new PTransform().fromEffectsTransform(item.transform);
|
|
14522
14522
|
// const oldCoordinate = new PCoordinate().fromPTransform(oldTransform)
|
|
14523
14523
|
// const oldLookatDir = oldCoordinate.zAxis.clone().multiplyScalar(-1.0);
|
|
14524
14524
|
// const rotateAxis = oldLookatDir.cross(newLookatDir);
|
|
@@ -14629,9 +14629,9 @@ var CameraGestureHandlerImp = /** @class */ (function () {
|
|
|
14629
14629
|
this.startParams.target = '';
|
|
14630
14630
|
};
|
|
14631
14631
|
CameraGestureHandlerImp.prototype.updateCameraTransform = function (cameraOptions) {
|
|
14632
|
-
var
|
|
14633
|
-
|
|
14634
|
-
this.cameraTransform.
|
|
14632
|
+
var effectsTransfrom = new effects.Transform(cameraOptions);
|
|
14633
|
+
effectsTransfrom.setValid(true);
|
|
14634
|
+
this.cameraTransform.fromEffectsTransform(effectsTransfrom);
|
|
14635
14635
|
this.cameraCoordiante.fromPTransform(this.cameraTransform);
|
|
14636
14636
|
};
|
|
14637
14637
|
return CameraGestureHandlerImp;
|
|
@@ -14648,7 +14648,7 @@ var LoaderHelper = /** @class */ (function () {
|
|
|
14648
14648
|
scale: transform.scale.xyz,
|
|
14649
14649
|
};
|
|
14650
14650
|
};
|
|
14651
|
-
LoaderHelper.
|
|
14651
|
+
LoaderHelper.getEffectsTransformFromMat4 = function (mat) {
|
|
14652
14652
|
var transform = new effects.Transform({
|
|
14653
14653
|
valid: true,
|
|
14654
14654
|
});
|
|
@@ -14677,7 +14677,7 @@ var LoaderHelper = /** @class */ (function () {
|
|
|
14677
14677
|
var mat = Matrix4.IDENTITY.clone().rotate(c, a);
|
|
14678
14678
|
return LoaderHelper.getTransformFromMat4(mat);
|
|
14679
14679
|
};
|
|
14680
|
-
LoaderHelper.
|
|
14680
|
+
LoaderHelper.getEffectsTransformFromDirection = function (d) {
|
|
14681
14681
|
var d0 = Vector3.fromArray([0, 0, 1]);
|
|
14682
14682
|
var d1 = d.clone().normalize();
|
|
14683
14683
|
var a = Vector3.cross(d0, d1);
|
|
@@ -14688,15 +14688,15 @@ var LoaderHelper = /** @class */ (function () {
|
|
|
14688
14688
|
var b = Vector3.dot(d1, d0);
|
|
14689
14689
|
var c = Math.acos(b);
|
|
14690
14690
|
var mat = Matrix4.IDENTITY.clone().rotate(c, a);
|
|
14691
|
-
return LoaderHelper.
|
|
14691
|
+
return LoaderHelper.getEffectsTransformFromMat4(mat);
|
|
14692
14692
|
};
|
|
14693
14693
|
LoaderHelper.getTransformFromTransDir = function (t, d) {
|
|
14694
14694
|
var transform = LoaderHelper.getTransformFromDirection(d);
|
|
14695
14695
|
transform.position = t.xyz;
|
|
14696
14696
|
return transform;
|
|
14697
14697
|
};
|
|
14698
|
-
LoaderHelper.
|
|
14699
|
-
var transform = LoaderHelper.
|
|
14698
|
+
LoaderHelper.getEffectsTransformFromTransDir = function (t, d) {
|
|
14699
|
+
var transform = LoaderHelper.getEffectsTransformFromDirection(d);
|
|
14700
14700
|
transform.position = t.xyz;
|
|
14701
14701
|
return transform;
|
|
14702
14702
|
};
|
|
@@ -14741,14 +14741,14 @@ var LoaderHelper = /** @class */ (function () {
|
|
|
14741
14741
|
}());
|
|
14742
14742
|
|
|
14743
14743
|
var globalGLTFLoader;
|
|
14744
|
-
function
|
|
14744
|
+
function getDefaultEffectsGLTFLoader(engine, options) {
|
|
14745
14745
|
if (!globalGLTFLoader) {
|
|
14746
14746
|
globalGLTFLoader = new LoaderImpl();
|
|
14747
14747
|
}
|
|
14748
14748
|
globalGLTFLoader.initial(engine, options);
|
|
14749
14749
|
return globalGLTFLoader;
|
|
14750
14750
|
}
|
|
14751
|
-
function
|
|
14751
|
+
function setDefaultEffectsGLTFLoader(loader) {
|
|
14752
14752
|
globalGLTFLoader = loader;
|
|
14753
14753
|
}
|
|
14754
14754
|
var LoaderImpl = /** @class */ (function () {
|
|
@@ -14758,11 +14758,11 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14758
14758
|
this.engine = engine;
|
|
14759
14759
|
this._loaderOptions = options !== null && options !== void 0 ? options : {};
|
|
14760
14760
|
};
|
|
14761
|
-
LoaderImpl.prototype.processLight = function (lights,
|
|
14761
|
+
LoaderImpl.prototype.processLight = function (lights, fromGLTF) {
|
|
14762
14762
|
var _this = this;
|
|
14763
14763
|
lights.forEach(function (l) {
|
|
14764
14764
|
if (l.color === undefined) {
|
|
14765
|
-
if (
|
|
14765
|
+
if (fromGLTF) {
|
|
14766
14766
|
l.color = [255, 255, 255, 255];
|
|
14767
14767
|
}
|
|
14768
14768
|
else {
|
|
@@ -14770,26 +14770,26 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14770
14770
|
}
|
|
14771
14771
|
}
|
|
14772
14772
|
else {
|
|
14773
|
-
l.color[0] = _this.scaleColorVal(l.color[0],
|
|
14774
|
-
l.color[1] = _this.scaleColorVal(l.color[1],
|
|
14775
|
-
l.color[2] = _this.scaleColorVal(l.color[2],
|
|
14776
|
-
l.color[3] = _this.scaleColorVal(l.color[3],
|
|
14773
|
+
l.color[0] = _this.scaleColorVal(l.color[0], fromGLTF);
|
|
14774
|
+
l.color[1] = _this.scaleColorVal(l.color[1], fromGLTF);
|
|
14775
|
+
l.color[2] = _this.scaleColorVal(l.color[2], fromGLTF);
|
|
14776
|
+
l.color[3] = _this.scaleColorVal(l.color[3], fromGLTF);
|
|
14777
14777
|
}
|
|
14778
14778
|
});
|
|
14779
14779
|
};
|
|
14780
|
-
LoaderImpl.prototype.processCamera = function (cameras,
|
|
14781
|
-
var scale =
|
|
14780
|
+
LoaderImpl.prototype.processCamera = function (cameras, fromGLTF) {
|
|
14781
|
+
var scale = fromGLTF ? 180.0 / Math.PI : Math.PI / 180.0;
|
|
14782
14782
|
cameras.forEach(function (camera) {
|
|
14783
14783
|
if (camera.perspective !== undefined) {
|
|
14784
14784
|
camera.perspective.yfov *= scale;
|
|
14785
14785
|
}
|
|
14786
14786
|
});
|
|
14787
14787
|
};
|
|
14788
|
-
LoaderImpl.prototype.processMaterial = function (materials,
|
|
14788
|
+
LoaderImpl.prototype.processMaterial = function (materials, fromGLTF) {
|
|
14789
14789
|
var _this = this;
|
|
14790
14790
|
materials.forEach(function (mat) {
|
|
14791
14791
|
if (mat.baseColorFactor === undefined) {
|
|
14792
|
-
if (
|
|
14792
|
+
if (fromGLTF) {
|
|
14793
14793
|
mat.baseColorFactor = [255, 255, 255, 255];
|
|
14794
14794
|
}
|
|
14795
14795
|
else {
|
|
@@ -14797,13 +14797,13 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14797
14797
|
}
|
|
14798
14798
|
}
|
|
14799
14799
|
else {
|
|
14800
|
-
mat.baseColorFactor[0] = _this.scaleColorVal(mat.baseColorFactor[0],
|
|
14801
|
-
mat.baseColorFactor[1] = _this.scaleColorVal(mat.baseColorFactor[1],
|
|
14802
|
-
mat.baseColorFactor[2] = _this.scaleColorVal(mat.baseColorFactor[2],
|
|
14803
|
-
mat.baseColorFactor[3] = _this.scaleColorVal(mat.baseColorFactor[3],
|
|
14800
|
+
mat.baseColorFactor[0] = _this.scaleColorVal(mat.baseColorFactor[0], fromGLTF);
|
|
14801
|
+
mat.baseColorFactor[1] = _this.scaleColorVal(mat.baseColorFactor[1], fromGLTF);
|
|
14802
|
+
mat.baseColorFactor[2] = _this.scaleColorVal(mat.baseColorFactor[2], fromGLTF);
|
|
14803
|
+
mat.baseColorFactor[3] = _this.scaleColorVal(mat.baseColorFactor[3], fromGLTF);
|
|
14804
14804
|
}
|
|
14805
14805
|
if (mat.emissiveFactor === undefined) {
|
|
14806
|
-
if (
|
|
14806
|
+
if (fromGLTF) {
|
|
14807
14807
|
mat.emissiveFactor = [255, 255, 255, 255];
|
|
14808
14808
|
}
|
|
14809
14809
|
else {
|
|
@@ -14811,12 +14811,12 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14811
14811
|
}
|
|
14812
14812
|
}
|
|
14813
14813
|
else {
|
|
14814
|
-
mat.emissiveFactor[0] = _this.scaleColorVal(mat.emissiveFactor[0],
|
|
14815
|
-
mat.emissiveFactor[1] = _this.scaleColorVal(mat.emissiveFactor[1],
|
|
14816
|
-
mat.emissiveFactor[2] = _this.scaleColorVal(mat.emissiveFactor[2],
|
|
14817
|
-
mat.emissiveFactor[3] = _this.scaleColorVal(mat.emissiveFactor[3],
|
|
14814
|
+
mat.emissiveFactor[0] = _this.scaleColorVal(mat.emissiveFactor[0], fromGLTF);
|
|
14815
|
+
mat.emissiveFactor[1] = _this.scaleColorVal(mat.emissiveFactor[1], fromGLTF);
|
|
14816
|
+
mat.emissiveFactor[2] = _this.scaleColorVal(mat.emissiveFactor[2], fromGLTF);
|
|
14817
|
+
mat.emissiveFactor[3] = _this.scaleColorVal(mat.emissiveFactor[3], fromGLTF);
|
|
14818
14818
|
}
|
|
14819
|
-
if (
|
|
14819
|
+
if (fromGLTF && mat.occlusionTexture !== undefined && mat.occlusionTexture.strength === undefined) {
|
|
14820
14820
|
mat.occlusionTexture.strength = _this.isTiny3dMode() ? 0 : 1;
|
|
14821
14821
|
}
|
|
14822
14822
|
});
|
|
@@ -14909,7 +14909,7 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14909
14909
|
return proxy.material;
|
|
14910
14910
|
};
|
|
14911
14911
|
LoaderImpl.prototype.createTexture2D = function (image, texture, isBaseColor) {
|
|
14912
|
-
return
|
|
14912
|
+
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
14913
14913
|
};
|
|
14914
14914
|
LoaderImpl.prototype.createTextureCube = function (cubeImages, level0Size) {
|
|
14915
14915
|
var _this = this;
|
|
@@ -14943,11 +14943,11 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14943
14943
|
//
|
|
14944
14944
|
if (mipmaps.length == 1) {
|
|
14945
14945
|
// no mipmaps
|
|
14946
|
-
return
|
|
14946
|
+
return WebGLHelper.createTextureCubeFromBuffer(this.engine, mipmaps[0]);
|
|
14947
14947
|
}
|
|
14948
14948
|
else {
|
|
14949
14949
|
// has mipmaps
|
|
14950
|
-
return
|
|
14950
|
+
return WebGLHelper.createTextureCubeMipmapFromBuffer(this.engine, mipmaps, level0Size !== null && level0Size !== void 0 ? level0Size : Math.pow(2, mipmaps.length - 1));
|
|
14951
14951
|
}
|
|
14952
14952
|
};
|
|
14953
14953
|
LoaderImpl.prototype.createSkybox = function (ibl) {
|
|
@@ -14994,24 +14994,24 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
14994
14994
|
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
14995
14995
|
return PSkyboxCreator.createSkyboxOptions(this.engine, params);
|
|
14996
14996
|
};
|
|
14997
|
-
LoaderImpl.prototype.scaleColorVal = function (val,
|
|
14998
|
-
return
|
|
14997
|
+
LoaderImpl.prototype.scaleColorVal = function (val, fromGLTF) {
|
|
14998
|
+
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
14999
14999
|
};
|
|
15000
|
-
LoaderImpl.prototype.scaleColorVec = function (vec,
|
|
15000
|
+
LoaderImpl.prototype.scaleColorVec = function (vec, fromGLTF) {
|
|
15001
15001
|
var _this = this;
|
|
15002
|
-
return vec.map(function (val) { return _this.scaleColorVal(val,
|
|
15002
|
+
return vec.map(function (val) { return _this.scaleColorVal(val, fromGLTF); });
|
|
15003
15003
|
};
|
|
15004
15004
|
LoaderImpl.prototype.loadScene = function (options) {
|
|
15005
15005
|
var _a;
|
|
15006
15006
|
return __awaiter(this, void 0, void 0, function () {
|
|
15007
|
-
var gltfResource,
|
|
15007
|
+
var gltfResource, modelItems, treeId, itemSkybox, sceneAABB;
|
|
15008
15008
|
var _this = this;
|
|
15009
15009
|
return __generator(this, function (_b) {
|
|
15010
15010
|
switch (_b.label) {
|
|
15011
15011
|
case 0:
|
|
15012
15012
|
this._clear();
|
|
15013
15013
|
this._sceneOptions = options;
|
|
15014
|
-
this.engine = (_a = options.
|
|
15014
|
+
this.engine = (_a = options.effects.renderer) === null || _a === void 0 ? void 0 : _a.engine;
|
|
15015
15015
|
this._loaderOptions = { compatibleMode: options.gltf.compatibleMode };
|
|
15016
15016
|
gltfResource = options.gltf.resource;
|
|
15017
15017
|
if (typeof gltfResource === 'string' || gltfResource instanceof Uint8Array) {
|
|
@@ -15030,30 +15030,30 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15030
15030
|
return [4 /*yield*/, this._preprocess()];
|
|
15031
15031
|
case 1:
|
|
15032
15032
|
_b.sent();
|
|
15033
|
-
|
|
15033
|
+
modelItems = [];
|
|
15034
15034
|
treeId = 'sceneTree';
|
|
15035
|
-
|
|
15035
|
+
modelItems.push(this._createItemTree(treeId, this._gltfScene));
|
|
15036
15036
|
itemSkybox = this._createItemSkybox();
|
|
15037
15037
|
if (itemSkybox !== undefined) {
|
|
15038
|
-
|
|
15038
|
+
modelItems.push(itemSkybox);
|
|
15039
15039
|
}
|
|
15040
15040
|
this._gltfScene.nodes.forEach(function (node) {
|
|
15041
15041
|
if (node.mesh !== undefined) {
|
|
15042
15042
|
var itemMesh = _this._createItemMesh(node, treeId);
|
|
15043
15043
|
if (itemMesh !== undefined) {
|
|
15044
|
-
|
|
15044
|
+
modelItems.push(itemMesh);
|
|
15045
15045
|
}
|
|
15046
15046
|
}
|
|
15047
15047
|
if (node.light !== undefined) {
|
|
15048
15048
|
var itemLight = _this._createItemLight(node, treeId);
|
|
15049
15049
|
if (itemLight !== undefined) {
|
|
15050
|
-
|
|
15050
|
+
modelItems.push(itemLight);
|
|
15051
15051
|
}
|
|
15052
15052
|
}
|
|
15053
15053
|
if (node.camera !== undefined) {
|
|
15054
15054
|
var itemCamera = _this._createItemCamera(node, treeId);
|
|
15055
15055
|
if (itemCamera !== undefined) {
|
|
15056
|
-
|
|
15056
|
+
modelItems.push(itemCamera);
|
|
15057
15057
|
}
|
|
15058
15058
|
}
|
|
15059
15059
|
});
|
|
@@ -15066,7 +15066,7 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15066
15066
|
});
|
|
15067
15067
|
return [2 /*return*/, {
|
|
15068
15068
|
source: this.getRemarkString(),
|
|
15069
|
-
items:
|
|
15069
|
+
items: modelItems,
|
|
15070
15070
|
sceneAABB: {
|
|
15071
15071
|
min: sceneAABB.min.toArray(),
|
|
15072
15072
|
max: sceneAABB.max.toArray(),
|
|
@@ -15160,7 +15160,7 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15160
15160
|
var texIndex = texInfo.index;
|
|
15161
15161
|
var tex = this._gltfTextures[texIndex];
|
|
15162
15162
|
var img = this._gltfImages[tex.source];
|
|
15163
|
-
return
|
|
15163
|
+
return WebGLHelper.createTexture2D(this.engine, img, tex, isBaseColor, this.isTiny3dMode()).then(function (tex) {
|
|
15164
15164
|
_this.getTextureManager().addTexture(matIndex, texIndex, tex, isBaseColor);
|
|
15165
15165
|
});
|
|
15166
15166
|
};
|
|
@@ -15391,7 +15391,7 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15391
15391
|
// 硬编码,内部指定的播放全部动画的索引值
|
|
15392
15392
|
return -88888888;
|
|
15393
15393
|
}
|
|
15394
|
-
var animationInfo = this._sceneOptions.
|
|
15394
|
+
var animationInfo = this._sceneOptions.effects.playAnimation;
|
|
15395
15395
|
if (animationInfo === undefined) {
|
|
15396
15396
|
return -1;
|
|
15397
15397
|
}
|
|
@@ -15416,10 +15416,10 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15416
15416
|
}
|
|
15417
15417
|
};
|
|
15418
15418
|
LoaderImpl.prototype.isPlayAnimation = function () {
|
|
15419
|
-
return this._sceneOptions.
|
|
15419
|
+
return this._sceneOptions.effects.playAnimation !== undefined;
|
|
15420
15420
|
};
|
|
15421
15421
|
LoaderImpl.prototype.isPlayAllAnimation = function () {
|
|
15422
|
-
return this._sceneOptions.
|
|
15422
|
+
return this._sceneOptions.effects.playAllAnimation === true;
|
|
15423
15423
|
};
|
|
15424
15424
|
LoaderImpl.prototype.getRemarkString = function () {
|
|
15425
15425
|
var remark = this._sceneOptions.gltf.remark;
|
|
@@ -15441,11 +15441,11 @@ var LoaderImpl = /** @class */ (function () {
|
|
|
15441
15441
|
};
|
|
15442
15442
|
LoaderImpl.prototype.getItemDuration = function () {
|
|
15443
15443
|
var _a;
|
|
15444
|
-
return (_a = this._sceneOptions.
|
|
15444
|
+
return (_a = this._sceneOptions.effects.duration) !== null && _a !== void 0 ? _a : 9999;
|
|
15445
15445
|
};
|
|
15446
15446
|
LoaderImpl.prototype.getItemEndBehavior = function () {
|
|
15447
15447
|
var _a;
|
|
15448
|
-
return (_a = this._sceneOptions.
|
|
15448
|
+
return (_a = this._sceneOptions.effects.endBehavior) !== null && _a !== void 0 ? _a : effects.spec.ItemEndBehavior.loop;
|
|
15449
15449
|
};
|
|
15450
15450
|
LoaderImpl.prototype.getSkyboxType = function () {
|
|
15451
15451
|
var typeName = this._sceneOptions.gltf.skyboxType;
|
|
@@ -16045,8 +16045,8 @@ var GLTFHelper = /** @class */ (function () {
|
|
|
16045
16045
|
|
|
16046
16046
|
effects.registerPlugin('tree', ModelTreePlugin, ModelTreeVFXItem, true);
|
|
16047
16047
|
effects.registerPlugin('model', ModelPlugin, ModelVFXItem);
|
|
16048
|
-
var version = "0.0.1-alpha.
|
|
16049
|
-
console.debug('[Galacean Effects Plugin Model] version: ' + "0.0.1-alpha.
|
|
16048
|
+
var version = "0.0.1-alpha.2";
|
|
16049
|
+
console.debug('[Galacean Effects Plugin Model] version: ' + "0.0.1-alpha.2");
|
|
16050
16050
|
|
|
16051
16051
|
exports.Box3 = Box3;
|
|
16052
16052
|
exports.BoxMesh = BoxMesh;
|
|
@@ -16063,7 +16063,6 @@ exports.HookOGLFunc = HookOGLFunc;
|
|
|
16063
16063
|
exports.InterpolationSampler = InterpolationSampler;
|
|
16064
16064
|
exports.LoaderHelper = LoaderHelper;
|
|
16065
16065
|
exports.LoaderImpl = LoaderImpl;
|
|
16066
|
-
exports.MarsRIHelper = MarsRIHelper;
|
|
16067
16066
|
exports.Matrix2 = Matrix2;
|
|
16068
16067
|
exports.Matrix3 = Matrix3;
|
|
16069
16068
|
exports.Matrix4 = Matrix4;
|
|
@@ -16113,11 +16112,12 @@ exports.Vector2 = Vector2;
|
|
|
16113
16112
|
exports.Vector3 = Vector3;
|
|
16114
16113
|
exports.Vector4 = Vector4;
|
|
16115
16114
|
exports.VertexAttribBuffer = VertexAttribBuffer;
|
|
16115
|
+
exports.WebGLHelper = WebGLHelper;
|
|
16116
16116
|
exports.WebHelper = WebHelper;
|
|
16117
16117
|
exports.createAnimationSampler = createAnimationSampler;
|
|
16118
16118
|
exports.createInternalMaterial = createInternalMaterial;
|
|
16119
16119
|
exports.createPluginMaterial = createPluginMaterial;
|
|
16120
|
-
exports.
|
|
16120
|
+
exports.getDefaultEffectsGLTFLoader = getDefaultEffectsGLTFLoader;
|
|
16121
16121
|
exports.getDiffuseOnlyShaderCode = getDiffuseOnlyShaderCode;
|
|
16122
16122
|
exports.getGaussianBlurShaderCodeV1 = getGaussianBlurShaderCodeV1;
|
|
16123
16123
|
exports.getGaussianBlurShaderCodeV2 = getGaussianBlurShaderCodeV2;
|
|
@@ -16132,6 +16132,6 @@ exports.getSimpleFilterShaderCode = getSimpleFilterShaderCode;
|
|
|
16132
16132
|
exports.getSkyBoxShaderCode = getSkyBoxShaderCode;
|
|
16133
16133
|
exports.getTransparecyBaseShader = getTransparecyBaseShader;
|
|
16134
16134
|
exports.getTransparecyFilterShader = getTransparecyFilterShader;
|
|
16135
|
-
exports.
|
|
16135
|
+
exports.setDefaultEffectsGLTFLoader = setDefaultEffectsGLTFLoader;
|
|
16136
16136
|
exports.version = version;
|
|
16137
16137
|
//# sourceMappingURL=index.js.map
|