|
@@ -22207,41 +22207,51 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.mesh.js.map
|
|
|
|
|
|
+
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
- var SubMesh = (function () {
|
|
|
- function SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {
|
|
|
- if (createBoundingBox === void 0) { createBoundingBox = true; }
|
|
|
- this.materialIndex = materialIndex;
|
|
|
- this.verticesStart = verticesStart;
|
|
|
- this.verticesCount = verticesCount;
|
|
|
- this.indexStart = indexStart;
|
|
|
- this.indexCount = indexCount;
|
|
|
- this._renderId = 0;
|
|
|
- this._mesh = mesh;
|
|
|
- this._renderingMesh = renderingMesh || mesh;
|
|
|
- mesh.subMeshes.push(this);
|
|
|
- this._trianglePlanes = [];
|
|
|
- this._id = mesh.subMeshes.length - 1;
|
|
|
- if (createBoundingBox) {
|
|
|
- this.refreshBoundingInfo();
|
|
|
- mesh.computeWorldMatrix(true);
|
|
|
- }
|
|
|
+ var BaseSubMesh = (function () {
|
|
|
+ function BaseSubMesh() {
|
|
|
}
|
|
|
- Object.defineProperty(SubMesh.prototype, "effect", {
|
|
|
+ Object.defineProperty(BaseSubMesh.prototype, "effect", {
|
|
|
get: function () {
|
|
|
return this._materialEffect;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
- SubMesh.prototype.setEffect = function (effect, defines) {
|
|
|
+ BaseSubMesh.prototype.setEffect = function (effect, defines) {
|
|
|
if (this._materialEffect === effect) {
|
|
|
return;
|
|
|
}
|
|
|
this._materialDefines = defines;
|
|
|
this._materialEffect = effect;
|
|
|
};
|
|
|
+ return BaseSubMesh;
|
|
|
+ }());
|
|
|
+ BABYLON.BaseSubMesh = BaseSubMesh;
|
|
|
+ var SubMesh = (function (_super) {
|
|
|
+ __extends(SubMesh, _super);
|
|
|
+ function SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {
|
|
|
+ if (createBoundingBox === void 0) { createBoundingBox = true; }
|
|
|
+ var _this = _super.call(this) || this;
|
|
|
+ _this.materialIndex = materialIndex;
|
|
|
+ _this.verticesStart = verticesStart;
|
|
|
+ _this.verticesCount = verticesCount;
|
|
|
+ _this.indexStart = indexStart;
|
|
|
+ _this.indexCount = indexCount;
|
|
|
+ _this._renderId = 0;
|
|
|
+ _this._mesh = mesh;
|
|
|
+ _this._renderingMesh = renderingMesh || mesh;
|
|
|
+ mesh.subMeshes.push(_this);
|
|
|
+ _this._trianglePlanes = [];
|
|
|
+ _this._id = mesh.subMeshes.length - 1;
|
|
|
+ if (createBoundingBox) {
|
|
|
+ _this.refreshBoundingInfo();
|
|
|
+ mesh.computeWorldMatrix(true);
|
|
|
+ }
|
|
|
+ return _this;
|
|
|
+ }
|
|
|
Object.defineProperty(SubMesh.prototype, "IsGlobal", {
|
|
|
get: function () {
|
|
|
return (this.verticesStart === 0 && this.verticesCount == this._mesh.getTotalVertices());
|
|
@@ -22481,7 +22491,7 @@ var BABYLON;
|
|
|
return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);
|
|
|
};
|
|
|
return SubMesh;
|
|
|
- }());
|
|
|
+ }(BaseSubMesh));
|
|
|
BABYLON.SubMesh = SubMesh;
|
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|
@@ -23994,8 +24004,6 @@ var BABYLON;
|
|
|
/**
|
|
|
* Child classes can use it to update shaders
|
|
|
*/
|
|
|
- Material.prototype.markAsDirty = function (flag) {
|
|
|
- };
|
|
|
Material.prototype.getClassName = function () {
|
|
|
return "Material";
|
|
|
};
|
|
@@ -24096,6 +24104,57 @@ var BABYLON;
|
|
|
}
|
|
|
return result;
|
|
|
};
|
|
|
+ Material.prototype.markAsDirty = function (flag) {
|
|
|
+ if (flag & Material.TextureDirtyFlag) {
|
|
|
+ this._markAllSubMeshesAsTexturesDirty();
|
|
|
+ }
|
|
|
+ if (flag & Material.LightDirtyFlag) {
|
|
|
+ this._markAllSubMeshesAsLightsDirty();
|
|
|
+ }
|
|
|
+ if (flag & Material.FresnelDirtyFlag) {
|
|
|
+ this._markAllSubMeshesAsFresnelDirty();
|
|
|
+ }
|
|
|
+ if (flag & Material.AttributesDirtyFlag) {
|
|
|
+ this._markAllSubMeshesAsAttributesDirty();
|
|
|
+ }
|
|
|
+ if (flag & Material.MiscDirtyFlag) {
|
|
|
+ this._markAllSubMeshesAsMiscDirty();
|
|
|
+ }
|
|
|
+ this.getScene().resetCachedMaterial();
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsDirty = function (func) {
|
|
|
+ for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {
|
|
|
+ var mesh = _a[_i];
|
|
|
+ if (!mesh.subMeshes) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (var _b = 0, _c = mesh.subMeshes; _b < _c.length; _b++) {
|
|
|
+ var subMesh = _c[_b];
|
|
|
+ if (subMesh.getMaterial() !== this) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!subMesh._materialDefines) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ func(subMesh._materialDefines);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsTexturesDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsTexturesDirty(); });
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsFresnelDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsFresnelDirty(); });
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsLightsDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(); });
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsAttributesDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });
|
|
|
+ };
|
|
|
+ Material.prototype._markAllSubMeshesAsMiscDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });
|
|
|
+ };
|
|
|
Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
|
// Animations
|
|
|
this.getScene().stopAnimation(this);
|
|
@@ -24744,57 +24803,6 @@ var BABYLON;
|
|
|
if (visibility === void 0) { visibility = 0; }
|
|
|
return scene.isCachedMaterialValid(this, effect, visibility);
|
|
|
};
|
|
|
- PushMaterial.prototype.markAsDirty = function (flag) {
|
|
|
- if (flag & BABYLON.Material.TextureDirtyFlag) {
|
|
|
- this._markAllSubMeshesAsTexturesDirty();
|
|
|
- }
|
|
|
- if (flag & BABYLON.Material.LightDirtyFlag) {
|
|
|
- this._markAllSubMeshesAsLightsDirty();
|
|
|
- }
|
|
|
- if (flag & BABYLON.Material.FresnelDirtyFlag) {
|
|
|
- this._markAllSubMeshesAsFresnelDirty();
|
|
|
- }
|
|
|
- if (flag & BABYLON.Material.AttributesDirtyFlag) {
|
|
|
- this._markAllSubMeshesAsAttributesDirty();
|
|
|
- }
|
|
|
- if (flag & BABYLON.Material.MiscDirtyFlag) {
|
|
|
- this._markAllSubMeshesAsMiscDirty();
|
|
|
- }
|
|
|
- this.getScene().resetCachedMaterial();
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsDirty = function (func) {
|
|
|
- for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {
|
|
|
- var mesh = _a[_i];
|
|
|
- if (!mesh.subMeshes) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (var _b = 0, _c = mesh.subMeshes; _b < _c.length; _b++) {
|
|
|
- var subMesh = _c[_b];
|
|
|
- if (subMesh.getMaterial() !== this) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!subMesh._materialDefines) {
|
|
|
- return;
|
|
|
- }
|
|
|
- func(subMesh._materialDefines);
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsTexturesDirty = function () {
|
|
|
- this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsTexturesDirty(); });
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsFresnelDirty = function () {
|
|
|
- this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsFresnelDirty(); });
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsLightsDirty = function () {
|
|
|
- this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(); });
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsAttributesDirty = function () {
|
|
|
- this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });
|
|
|
- };
|
|
|
- PushMaterial.prototype._markAllSubMeshesAsMiscDirty = function () {
|
|
|
- this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });
|
|
|
- };
|
|
|
return PushMaterial;
|
|
|
}(BABYLON.Material));
|
|
|
BABYLON.PushMaterial = PushMaterial;
|
|
@@ -30573,6 +30581,10 @@ var BABYLON;
|
|
|
this._target.copyFrom(pos);
|
|
|
}
|
|
|
}
|
|
|
+ var lockedTargetPosition = this._getLockedTargetPosition();
|
|
|
+ if (lockedTargetPosition) {
|
|
|
+ return lockedTargetPosition;
|
|
|
+ }
|
|
|
return this._target;
|
|
|
};
|
|
|
// Synchronized
|
|
@@ -34467,10 +34479,40 @@ var BABYLON;
|
|
|
__extends(MultiMaterial, _super);
|
|
|
function MultiMaterial(name, scene) {
|
|
|
var _this = _super.call(this, name, scene, true) || this;
|
|
|
- _this.subMaterials = new Array();
|
|
|
scene.multiMaterials.push(_this);
|
|
|
+ _this.subMaterials = new Array();
|
|
|
return _this;
|
|
|
}
|
|
|
+ Object.defineProperty(MultiMaterial.prototype, "subMaterials", {
|
|
|
+ get: function () {
|
|
|
+ return this._subMaterials;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ this._subMaterials = value;
|
|
|
+ this._hookArray(value);
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ MultiMaterial.prototype._hookArray = function (array) {
|
|
|
+ var _this = this;
|
|
|
+ var oldPush = array.push;
|
|
|
+ array.push = function () {
|
|
|
+ var items = [];
|
|
|
+ for (var _i = 0; _i < arguments.length; _i++) {
|
|
|
+ items[_i] = arguments[_i];
|
|
|
+ }
|
|
|
+ var result = oldPush.apply(array, items);
|
|
|
+ _this._markAllSubMeshesAsTexturesDirty();
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ var oldSplice = array.splice;
|
|
|
+ array.splice = function (index, deleteCount) {
|
|
|
+ var deleted = oldSplice.apply(array, [index, deleteCount]);
|
|
|
+ _this._markAllSubMeshesAsTexturesDirty();
|
|
|
+ return deleted;
|
|
|
+ };
|
|
|
+ };
|
|
|
// Properties
|
|
|
MultiMaterial.prototype.getSubMaterial = function (index) {
|
|
|
if (index < 0 || index >= this.subMaterials.length) {
|