|
@@ -8210,6 +8210,7 @@ var BABYLON;
|
|
var exception = _a[_i];
|
|
var exception = _a[_i];
|
|
if (ua.indexOf(exception) > -1) {
|
|
if (ua.indexOf(exception) > -1) {
|
|
this.disableUniformBuffers = true;
|
|
this.disableUniformBuffers = true;
|
|
|
|
+ console.log("TODO remove this!! this.disableUniformBuffers set to true!!!!");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -12678,7 +12679,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/** Use this array to turn off some WebGL2 features on known buggy browsers version */
|
|
/** Use this array to turn off some WebGL2 features on known buggy browsers version */
|
|
- Engine.WebGL2UniformBuffersExceptionList = ["Chrome/63"];
|
|
|
|
|
|
+ Engine.WebGL2UniformBuffersExceptionList = ["Chrome/63", "Firefox/58"];
|
|
Engine.Instances = new Array();
|
|
Engine.Instances = new Array();
|
|
// Const statics
|
|
// Const statics
|
|
Engine._ALPHA_DISABLE = 0;
|
|
Engine._ALPHA_DISABLE = 0;
|
|
@@ -12780,15 +12781,18 @@ var BABYLON;
|
|
if (this._parentNode === parent) {
|
|
if (this._parentNode === parent) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (this._parentNode) {
|
|
|
|
|
|
+ // Remove self from list of children of parent
|
|
|
|
+ if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {
|
|
var index = this._parentNode._children.indexOf(this);
|
|
var index = this._parentNode._children.indexOf(this);
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
this._parentNode._children.splice(index, 1);
|
|
this._parentNode._children.splice(index, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // Store new parent
|
|
this._parentNode = parent;
|
|
this._parentNode = parent;
|
|
|
|
+ // Add as child to new parent
|
|
if (this._parentNode) {
|
|
if (this._parentNode) {
|
|
- if (!this._parentNode._children) {
|
|
|
|
|
|
+ if (this._parentNode._children === undefined || this._parentNode._children === null) {
|
|
this._parentNode._children = new Array();
|
|
this._parentNode._children = new Array();
|
|
}
|
|
}
|
|
this._parentNode._children.push(this);
|
|
this._parentNode._children.push(this);
|
|
@@ -12926,16 +12930,21 @@ var BABYLON;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Is this node enabled.
|
|
* Is this node enabled.
|
|
- * If the node has a parent and is enabled, the parent will be inspected as well.
|
|
|
|
|
|
+ * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true.
|
|
|
|
+ * @param {boolean} [checkAncestors=true] - Indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors.
|
|
* @return {boolean} whether this node (and its parent) is enabled.
|
|
* @return {boolean} whether this node (and its parent) is enabled.
|
|
* @see setEnabled
|
|
* @see setEnabled
|
|
*/
|
|
*/
|
|
- Node.prototype.isEnabled = function () {
|
|
|
|
- if (!this._isEnabled) {
|
|
|
|
|
|
+ Node.prototype.isEnabled = function (checkAncestors) {
|
|
|
|
+ if (checkAncestors === void 0) { checkAncestors = true; }
|
|
|
|
+ if (checkAncestors === false) {
|
|
|
|
+ return this._isEnabled;
|
|
|
|
+ }
|
|
|
|
+ if (this._isEnabled === false) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (this.parent) {
|
|
|
|
- return this.parent.isEnabled();
|
|
|
|
|
|
+ if (this.parent !== undefined && this.parent !== null) {
|
|
|
|
+ return this.parent.isEnabled(checkAncestors);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
@@ -13903,7 +13912,7 @@ var BABYLON;
|
|
* Returns the TransformNode.
|
|
* Returns the TransformNode.
|
|
*/
|
|
*/
|
|
TransformNode.prototype.setParent = function (node) {
|
|
TransformNode.prototype.setParent = function (node) {
|
|
- if (node == null) {
|
|
|
|
|
|
+ if (node === null) {
|
|
var rotation = BABYLON.Tmp.Quaternion[0];
|
|
var rotation = BABYLON.Tmp.Quaternion[0];
|
|
var position = BABYLON.Tmp.Vector3[0];
|
|
var position = BABYLON.Tmp.Vector3[0];
|
|
var scale = BABYLON.Tmp.Vector3[1];
|
|
var scale = BABYLON.Tmp.Vector3[1];
|
|
@@ -15636,7 +15645,7 @@ var BABYLON;
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
var index;
|
|
var index;
|
|
// Action manager
|
|
// Action manager
|
|
- if (this.actionManager) {
|
|
|
|
|
|
+ if (this.actionManager !== undefined && this.actionManager !== null) {
|
|
this.actionManager.dispose();
|
|
this.actionManager.dispose();
|
|
this.actionManager = null;
|
|
this.actionManager = null;
|
|
}
|
|
}
|
|
@@ -15687,7 +15696,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Octree
|
|
// Octree
|
|
var sceneOctree = this.getScene().selectionOctree;
|
|
var sceneOctree = this.getScene().selectionOctree;
|
|
- if (sceneOctree) {
|
|
|
|
|
|
+ if (sceneOctree !== undefined && sceneOctree !== null) {
|
|
var index = sceneOctree.dynamicContent.indexOf(this);
|
|
var index = sceneOctree.dynamicContent.indexOf(this);
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
sceneOctree.dynamicContent.splice(index, 1);
|
|
sceneOctree.dynamicContent.splice(index, 1);
|
|
@@ -17801,7 +17810,7 @@ var BABYLON;
|
|
this._renderingGroups.length = 0;
|
|
this._renderingGroups.length = 0;
|
|
};
|
|
};
|
|
RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {
|
|
RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {
|
|
- if (!this._renderingGroups[renderingGroupId]) {
|
|
|
|
|
|
+ if (this._renderingGroups[renderingGroupId] === undefined) {
|
|
this._renderingGroups[renderingGroupId] = new BABYLON.RenderingGroup(renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);
|
|
this._renderingGroups[renderingGroupId] = new BABYLON.RenderingGroup(renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -17815,11 +17824,18 @@ var BABYLON;
|
|
this._prepareRenderingGroup(renderingGroupId);
|
|
this._prepareRenderingGroup(renderingGroupId);
|
|
this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);
|
|
this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);
|
|
};
|
|
};
|
|
- RenderingManager.prototype.dispatch = function (subMesh) {
|
|
|
|
- var mesh = subMesh.getMesh();
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @param subMesh The submesh to dispatch
|
|
|
|
+ * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.
|
|
|
|
+ * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.
|
|
|
|
+ */
|
|
|
|
+ RenderingManager.prototype.dispatch = function (subMesh, mesh, material) {
|
|
|
|
+ if (mesh === undefined) {
|
|
|
|
+ mesh = subMesh.getMesh();
|
|
|
|
+ }
|
|
var renderingGroupId = mesh.renderingGroupId || 0;
|
|
var renderingGroupId = mesh.renderingGroupId || 0;
|
|
this._prepareRenderingGroup(renderingGroupId);
|
|
this._prepareRenderingGroup(renderingGroupId);
|
|
- this._renderingGroups[renderingGroupId].dispatch(subMesh);
|
|
|
|
|
|
+ this._renderingGroups[renderingGroupId].dispatch(subMesh, mesh, material);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Overrides the default sort function applied in the renderging group to prepare the meshes.
|
|
* Overrides the default sort function applied in the renderging group to prepare the meshes.
|
|
@@ -18161,29 +18177,36 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Inserts the submesh in its correct queue depending on its material.
|
|
* Inserts the submesh in its correct queue depending on its material.
|
|
* @param subMesh The submesh to dispatch
|
|
* @param subMesh The submesh to dispatch
|
|
|
|
+ * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.
|
|
|
|
+ * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.
|
|
*/
|
|
*/
|
|
- RenderingGroup.prototype.dispatch = function (subMesh) {
|
|
|
|
- var material = subMesh.getMaterial();
|
|
|
|
- var mesh = subMesh.getMesh();
|
|
|
|
- if (!material) {
|
|
|
|
|
|
+ RenderingGroup.prototype.dispatch = function (subMesh, mesh, material) {
|
|
|
|
+ // Get mesh and materials if not provided
|
|
|
|
+ if (mesh === undefined) {
|
|
|
|
+ mesh = subMesh.getMesh();
|
|
|
|
+ }
|
|
|
|
+ if (material === undefined) {
|
|
|
|
+ material = subMesh.getMaterial();
|
|
|
|
+ }
|
|
|
|
+ if (material === null || material === undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (material.needAlphaBlendingForMesh(mesh)) {
|
|
if (material.needAlphaBlendingForMesh(mesh)) {
|
|
this._transparentSubMeshes.push(subMesh);
|
|
this._transparentSubMeshes.push(subMesh);
|
|
}
|
|
}
|
|
else if (material.needAlphaTesting()) {
|
|
else if (material.needAlphaTesting()) {
|
|
- if (material.needDepthPrePass) {
|
|
|
|
|
|
+ if (material.needDepthPrePass === true) {
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
}
|
|
}
|
|
this._alphaTestSubMeshes.push(subMesh);
|
|
this._alphaTestSubMeshes.push(subMesh);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- if (material.needDepthPrePass) {
|
|
|
|
|
|
+ if (material.needDepthPrePass === true) {
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
}
|
|
}
|
|
this._opaqueSubMeshes.push(subMesh); // Opaque
|
|
this._opaqueSubMeshes.push(subMesh); // Opaque
|
|
}
|
|
}
|
|
- if (mesh._edgesRenderer) {
|
|
|
|
|
|
+ if (mesh._edgesRenderer !== null && mesh._edgesRenderer !== undefined) {
|
|
this._edgesRenderers.push(mesh._edgesRenderer);
|
|
this._edgesRenderers.push(mesh._edgesRenderer);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -18677,6 +18700,7 @@ var BABYLON;
|
|
this._activeRequests = new Array();
|
|
this._activeRequests = new Array();
|
|
this._pendingData = new Array();
|
|
this._pendingData = new Array();
|
|
this._isDisposed = false;
|
|
this._isDisposed = false;
|
|
|
|
+ this.dispatchAllSubMeshesOfActiveMeshes = false;
|
|
this._activeMeshes = new BABYLON.SmartArray(256);
|
|
this._activeMeshes = new BABYLON.SmartArray(256);
|
|
this._processedMaterials = new BABYLON.SmartArray(256);
|
|
this._processedMaterials = new BABYLON.SmartArray(256);
|
|
this._renderTargets = new BABYLON.SmartArrayNoDuplicate(256);
|
|
this._renderTargets = new BABYLON.SmartArrayNoDuplicate(256);
|
|
@@ -20744,15 +20768,17 @@ var BABYLON;
|
|
return this._externalData.remove(key);
|
|
return this._externalData.remove(key);
|
|
};
|
|
};
|
|
Scene.prototype._evaluateSubMesh = function (subMesh, mesh) {
|
|
Scene.prototype._evaluateSubMesh = function (subMesh, mesh) {
|
|
- if (mesh.alwaysSelectAsActiveMesh || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {
|
|
|
|
- var material = subMesh.getMaterial();
|
|
|
|
- if (mesh.showSubMeshesBoundingBox) {
|
|
|
|
|
|
+ if (this.dispatchAllSubMeshesOfActiveMeshes === true || mesh.alwaysSelectAsActiveMesh === true || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {
|
|
|
|
+ if (mesh.showSubMeshesBoundingBox === true) {
|
|
var boundingInfo = subMesh.getBoundingInfo();
|
|
var boundingInfo = subMesh.getBoundingInfo();
|
|
- this.getBoundingBoxRenderer().renderList.push(boundingInfo.boundingBox);
|
|
|
|
|
|
+ if (boundingInfo !== null && boundingInfo !== undefined) {
|
|
|
|
+ this.getBoundingBoxRenderer().renderList.push(boundingInfo.boundingBox);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (material) {
|
|
|
|
|
|
+ var material = subMesh.getMaterial();
|
|
|
|
+ if (material !== null && material !== undefined) {
|
|
// Render targets
|
|
// Render targets
|
|
- if (material.getRenderTargetTextures) {
|
|
|
|
|
|
+ if (material.getRenderTargetTextures !== undefined) {
|
|
if (this._processedMaterials.indexOf(material) === -1) {
|
|
if (this._processedMaterials.indexOf(material) === -1) {
|
|
this._processedMaterials.push(material);
|
|
this._processedMaterials.push(material);
|
|
this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());
|
|
this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());
|
|
@@ -20760,13 +20786,19 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Dispatch
|
|
// Dispatch
|
|
this._activeIndices.addCount(subMesh.indexCount, false);
|
|
this._activeIndices.addCount(subMesh.indexCount, false);
|
|
- this._renderingManager.dispatch(subMesh);
|
|
|
|
|
|
+ this._renderingManager.dispatch(subMesh, mesh, material);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Scene.prototype._isInIntermediateRendering = function () {
|
|
Scene.prototype._isInIntermediateRendering = function () {
|
|
return this._intermediateRendering;
|
|
return this._intermediateRendering;
|
|
};
|
|
};
|
|
|
|
+ Scene.prototype.setActiveMeshCandidateProvider = function (provider) {
|
|
|
|
+ this._activeMeshCandidateProvider = provider;
|
|
|
|
+ };
|
|
|
|
+ Scene.prototype.getActiveMeshCandidateProvider = function () {
|
|
|
|
+ return this._activeMeshCandidateProvider;
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* Use this function to stop evaluating active meshes. The current list will be keep alive between frames
|
|
* Use this function to stop evaluating active meshes. The current list will be keep alive between frames
|
|
*/
|
|
*/
|
|
@@ -20803,22 +20835,38 @@ var BABYLON;
|
|
// Meshes
|
|
// Meshes
|
|
var meshes;
|
|
var meshes;
|
|
var len;
|
|
var len;
|
|
- if (this._selectionOctree) {
|
|
|
|
|
|
+ var checkIsEnabled = true;
|
|
|
|
+ // Determine mesh candidates
|
|
|
|
+ if (this._activeMeshCandidateProvider !== undefined) {
|
|
|
|
+ // Use _activeMeshCandidateProvider
|
|
|
|
+ meshes = this._activeMeshCandidateProvider.getMeshes(this);
|
|
|
|
+ checkIsEnabled = this._activeMeshCandidateProvider.checksIsEnabled === false;
|
|
|
|
+ if (meshes !== undefined) {
|
|
|
|
+ len = meshes.length;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ len = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (this._selectionOctree !== undefined) {
|
|
|
|
+ // Octree
|
|
var selection = this._selectionOctree.select(this._frustumPlanes);
|
|
var selection = this._selectionOctree.select(this._frustumPlanes);
|
|
meshes = selection.data;
|
|
meshes = selection.data;
|
|
len = selection.length;
|
|
len = selection.length;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
|
|
+ // Full scene traversal
|
|
len = this.meshes.length;
|
|
len = this.meshes.length;
|
|
meshes = this.meshes;
|
|
meshes = this.meshes;
|
|
}
|
|
}
|
|
- for (var meshIndex = 0; meshIndex < len; meshIndex++) {
|
|
|
|
- var mesh = meshes[meshIndex];
|
|
|
|
- if (mesh.isBlocked) {
|
|
|
|
|
|
+ // Check each mesh
|
|
|
|
+ for (var meshIndex = 0, mesh, meshLOD; meshIndex < len; meshIndex++) {
|
|
|
|
+ mesh = meshes[meshIndex];
|
|
|
|
+ if (mesh.isBlocked === true) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
this._totalVertices.addCount(mesh.getTotalVertices(), false);
|
|
this._totalVertices.addCount(mesh.getTotalVertices(), false);
|
|
- if (!mesh.isReady() || !mesh.isEnabled()) {
|
|
|
|
|
|
+ if (mesh.isReady() === false || (checkIsEnabled === true && mesh.isEnabled() === false)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
mesh.computeWorldMatrix();
|
|
mesh.computeWorldMatrix();
|
|
@@ -20827,8 +20875,8 @@ var BABYLON;
|
|
this._meshesForIntersections.pushNoDuplicate(mesh);
|
|
this._meshesForIntersections.pushNoDuplicate(mesh);
|
|
}
|
|
}
|
|
// Switch to current LOD
|
|
// Switch to current LOD
|
|
- var meshLOD = mesh.getLOD(this.activeCamera);
|
|
|
|
- if (!meshLOD) {
|
|
|
|
|
|
+ meshLOD = mesh.getLOD(this.activeCamera);
|
|
|
|
+ if (meshLOD === undefined || meshLOD === null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
mesh._preActivate();
|
|
mesh._preActivate();
|
|
@@ -20862,7 +20910,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Scene.prototype._activeMesh = function (sourceMesh, mesh) {
|
|
Scene.prototype._activeMesh = function (sourceMesh, mesh) {
|
|
- if (mesh.skeleton && this.skeletonsEnabled) {
|
|
|
|
|
|
+ if (this.skeletonsEnabled === true && mesh.skeleton !== null && mesh.skeleton !== undefined) {
|
|
if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {
|
|
if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {
|
|
mesh.skeleton.prepare();
|
|
mesh.skeleton.prepare();
|
|
}
|
|
}
|
|
@@ -20870,15 +20918,16 @@ var BABYLON;
|
|
this._softwareSkinnedMeshes.pushNoDuplicate(mesh);
|
|
this._softwareSkinnedMeshes.pushNoDuplicate(mesh);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (sourceMesh.showBoundingBox || this.forceShowBoundingBoxes) {
|
|
|
|
|
|
+ if (sourceMesh.showBoundingBox === true || this.forceShowBoundingBoxes === true) {
|
|
var boundingInfo = sourceMesh.getBoundingInfo();
|
|
var boundingInfo = sourceMesh.getBoundingInfo();
|
|
this.getBoundingBoxRenderer().renderList.push(boundingInfo.boundingBox);
|
|
this.getBoundingBoxRenderer().renderList.push(boundingInfo.boundingBox);
|
|
}
|
|
}
|
|
- if (mesh && mesh.subMeshes) {
|
|
|
|
|
|
+ if (mesh !== undefined && mesh !== null
|
|
|
|
+ && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0) {
|
|
// Submeshes Octrees
|
|
// Submeshes Octrees
|
|
var len;
|
|
var len;
|
|
var subMeshes;
|
|
var subMeshes;
|
|
- if (mesh._submeshesOctree && mesh.useOctreeForRenderingSelection) {
|
|
|
|
|
|
+ if (mesh.useOctreeForRenderingSelection === true && mesh._submeshesOctree !== undefined && mesh._submeshesOctree !== null) {
|
|
var intersections = mesh._submeshesOctree.select(this._frustumPlanes);
|
|
var intersections = mesh._submeshesOctree.select(this._frustumPlanes);
|
|
len = intersections.length;
|
|
len = intersections.length;
|
|
subMeshes = intersections.data;
|
|
subMeshes = intersections.data;
|
|
@@ -20887,8 +20936,8 @@ var BABYLON;
|
|
subMeshes = mesh.subMeshes;
|
|
subMeshes = mesh.subMeshes;
|
|
len = subMeshes.length;
|
|
len = subMeshes.length;
|
|
}
|
|
}
|
|
- for (var subIndex = 0; subIndex < len; subIndex++) {
|
|
|
|
- var subMesh = subMeshes[subIndex];
|
|
|
|
|
|
+ for (var subIndex = 0, subMesh; subIndex < len; subIndex++) {
|
|
|
|
+ subMesh = subMeshes[subIndex];
|
|
this._evaluateSubMesh(subMesh, mesh);
|
|
this._evaluateSubMesh(subMesh, mesh);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -23952,7 +24001,7 @@ var BABYLON;
|
|
* Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
|
|
* Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
|
|
*/
|
|
*/
|
|
Mesh.prototype.getTotalVertices = function () {
|
|
Mesh.prototype.getTotalVertices = function () {
|
|
- if (!this._geometry) {
|
|
|
|
|
|
+ if (this._geometry === null || this._geometry === undefined) {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
return this._geometry.getTotalVertices();
|
|
return this._geometry.getTotalVertices();
|
|
@@ -25419,7 +25468,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
serializationObject.scaling = this.scaling.asArray();
|
|
serializationObject.scaling = this.scaling.asArray();
|
|
serializationObject.localMatrix = this.getPivotMatrix().asArray();
|
|
serializationObject.localMatrix = this.getPivotMatrix().asArray();
|
|
- serializationObject.isEnabled = this.isEnabled();
|
|
|
|
|
|
+ serializationObject.isEnabled = this.isEnabled(false);
|
|
serializationObject.isVisible = this.isVisible;
|
|
serializationObject.isVisible = this.isVisible;
|
|
serializationObject.infiniteDistance = this.infiniteDistance;
|
|
serializationObject.infiniteDistance = this.infiniteDistance;
|
|
serializationObject.pickable = this.isPickable;
|
|
serializationObject.pickable = this.isPickable;
|
|
@@ -26639,7 +26688,10 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
SubMesh.prototype.getMaterial = function () {
|
|
SubMesh.prototype.getMaterial = function () {
|
|
var rootMaterial = this._renderingMesh.material;
|
|
var rootMaterial = this._renderingMesh.material;
|
|
- if (rootMaterial && rootMaterial.getSubMaterial) {
|
|
|
|
|
|
+ if (rootMaterial === null || rootMaterial === undefined) {
|
|
|
|
+ return this._mesh.getScene().defaultMaterial;
|
|
|
|
+ }
|
|
|
|
+ else if (rootMaterial.getSubMaterial) {
|
|
var multiMaterial = rootMaterial;
|
|
var multiMaterial = rootMaterial;
|
|
var effectiveMaterial = multiMaterial.getSubMaterial(this.materialIndex);
|
|
var effectiveMaterial = multiMaterial.getSubMaterial(this.materialIndex);
|
|
if (this._currentMaterial !== effectiveMaterial) {
|
|
if (this._currentMaterial !== effectiveMaterial) {
|
|
@@ -26648,9 +26700,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
return effectiveMaterial;
|
|
return effectiveMaterial;
|
|
}
|
|
}
|
|
- if (!rootMaterial) {
|
|
|
|
- return this._mesh.getScene().defaultMaterial;
|
|
|
|
- }
|
|
|
|
return rootMaterial;
|
|
return rootMaterial;
|
|
};
|
|
};
|
|
// Methods
|
|
// Methods
|
|
@@ -31401,7 +31450,7 @@ var BABYLON;
|
|
this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);
|
|
this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);
|
|
};
|
|
};
|
|
Geometry.prototype.getTotalVertices = function () {
|
|
Geometry.prototype.getTotalVertices = function () {
|
|
- if (!this.isReady()) {
|
|
|
|
|
|
+ if (this.isReady() === false) {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
return this._totalVertices;
|
|
return this._totalVertices;
|
|
@@ -32057,8 +32106,9 @@ var BABYLON;
|
|
// Update
|
|
// Update
|
|
mesh.computeWorldMatrix(true);
|
|
mesh.computeWorldMatrix(true);
|
|
// Octree
|
|
// Octree
|
|
- if (scene['_selectionOctree']) {
|
|
|
|
- scene['_selectionOctree'].addMesh(mesh);
|
|
|
|
|
|
+ var sceneOctree = scene.selectionOctree;
|
|
|
|
+ if (sceneOctree !== undefined && sceneOctree !== null) {
|
|
|
|
+ sceneOctree.addMesh(mesh);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {
|
|
Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {
|
|
@@ -34557,25 +34607,24 @@ var BABYLON;
|
|
MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, usePhysicalLightFalloff) {
|
|
MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, usePhysicalLightFalloff) {
|
|
if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
|
|
if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
|
|
if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }
|
|
if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }
|
|
- var lightIndex = 0;
|
|
|
|
- for (var _i = 0, _a = mesh._lightSources; _i < _a.length; _i++) {
|
|
|
|
- var light = _a[_i];
|
|
|
|
|
|
+ for (var i = 0, len = mesh._lightSources.length, light, iAsString; i < len; i++) {
|
|
|
|
+ light = mesh._lightSources[i];
|
|
|
|
+ iAsString = i.toString();
|
|
var scaledIntensity = light.getScaledIntensity();
|
|
var scaledIntensity = light.getScaledIntensity();
|
|
- light._uniformBuffer.bindToEffect(effect, "Light" + lightIndex);
|
|
|
|
- MaterialHelper.BindLightProperties(light, effect, lightIndex);
|
|
|
|
|
|
+ light._uniformBuffer.bindToEffect(effect, "Light" + i);
|
|
|
|
+ MaterialHelper.BindLightProperties(light, effect, i);
|
|
light.diffuse.scaleToRef(scaledIntensity, BABYLON.Tmp.Color3[0]);
|
|
light.diffuse.scaleToRef(scaledIntensity, BABYLON.Tmp.Color3[0]);
|
|
- light._uniformBuffer.updateColor4("vLightDiffuse", BABYLON.Tmp.Color3[0], usePhysicalLightFalloff ? light.radius : light.range, lightIndex + "");
|
|
|
|
|
|
+ light._uniformBuffer.updateColor4("vLightDiffuse", BABYLON.Tmp.Color3[0], usePhysicalLightFalloff ? light.radius : light.range, iAsString);
|
|
if (defines["SPECULARTERM"]) {
|
|
if (defines["SPECULARTERM"]) {
|
|
light.specular.scaleToRef(scaledIntensity, BABYLON.Tmp.Color3[1]);
|
|
light.specular.scaleToRef(scaledIntensity, BABYLON.Tmp.Color3[1]);
|
|
- light._uniformBuffer.updateColor3("vLightSpecular", BABYLON.Tmp.Color3[1], lightIndex + "");
|
|
|
|
|
|
+ light._uniformBuffer.updateColor3("vLightSpecular", BABYLON.Tmp.Color3[1], iAsString);
|
|
}
|
|
}
|
|
// Shadows
|
|
// Shadows
|
|
- if (scene.shadowsEnabled) {
|
|
|
|
- this.BindLightShadow(light, scene, mesh, lightIndex + "", effect);
|
|
|
|
|
|
+ if (scene.shadowsEnabled === true) {
|
|
|
|
+ this.BindLightShadow(light, scene, mesh, iAsString, effect);
|
|
}
|
|
}
|
|
light._uniformBuffer.update();
|
|
light._uniformBuffer.update();
|
|
- lightIndex++;
|
|
|
|
- if (lightIndex === maxSimultaneousLights)
|
|
|
|
|
|
+ if (i === maxSimultaneousLights)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -51808,7 +51857,7 @@ var BABYLON;
|
|
for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
|
|
for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
|
|
var subMesh = mesh.subMeshes[subIndex];
|
|
var subMesh = mesh.subMeshes[subIndex];
|
|
scene._activeIndices.addCount(subMesh.indexCount, false);
|
|
scene._activeIndices.addCount(subMesh.indexCount, false);
|
|
- this._renderingManager.dispatch(subMesh);
|
|
|
|
|
|
+ this._renderingManager.dispatch(subMesh, mesh);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|