|
@@ -4172,19 +4172,19 @@ var BABYLON;
|
|
|
return vbo;
|
|
|
};
|
|
|
|
|
|
- Engine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, length) {
|
|
|
+ Engine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, offset) {
|
|
|
this._gl.bindBuffer(this._gl.ARRAY_BUFFER, vertexBuffer);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (offset === undefined) {
|
|
|
+ offset = 0;
|
|
|
+ }
|
|
|
+
|
|
|
if (vertices instanceof Float32Array) {
|
|
|
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, vertices);
|
|
|
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, offset, vertices);
|
|
|
} else {
|
|
|
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(vertices));
|
|
|
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, offset, new Float32Array(vertices));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
this._resetVertexBufferBinding();
|
|
|
};
|
|
|
|
|
@@ -8305,6 +8305,7 @@ var BABYLON;
|
|
|
this.animationsEnabled = true;
|
|
|
this.cameraToUseForPointers = null;
|
|
|
|
|
|
+ this.fogEnabled = true;
|
|
|
this.fogMode = Scene.FOGMODE_NONE;
|
|
|
this.fogColor = new BABYLON.Color3(0.2, 0.2, 0.3);
|
|
|
this.fogDensity = 0.1;
|
|
@@ -9018,7 +9019,7 @@ var BABYLON;
|
|
|
}
|
|
|
|
|
|
|
|
|
- this._activeVertices += subMesh.verticesCount;
|
|
|
+ this._activeVertices += subMesh.indexCount;
|
|
|
this._renderingManager.dispatch(subMesh);
|
|
|
}
|
|
|
}
|
|
@@ -9478,6 +9479,20 @@ var BABYLON;
|
|
|
var cameraDirection = BABYLON.Vector3.TransformNormal(new BABYLON.Vector3(0, 0, -1), mat);
|
|
|
cameraDirection.normalize();
|
|
|
audioEngine.audioContext.listener.setOrientation(cameraDirection.x, cameraDirection.y, cameraDirection.z, 0, 1, 0);
|
|
|
+ for (var i = 0; i < this.mainSoundTrack.soundCollection.length; i++) {
|
|
|
+ var sound = this.mainSoundTrack.soundCollection[i];
|
|
|
+ if (sound.useBabylonJSAttenuation) {
|
|
|
+ sound.updateDistanceFromListener();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.soundTracks.length; i++) {
|
|
|
+ for (var j = 0; i < this.soundTracks[i].soundCollection.length; j++) {
|
|
|
+ var sound = this.soundTracks[i].soundCollection[j];
|
|
|
+ if (sound.useBabylonJSAttenuation) {
|
|
|
+ sound.updateDistanceFromListener();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -9945,13 +9960,13 @@ var BABYLON;
|
|
|
this.create(data);
|
|
|
};
|
|
|
|
|
|
- VertexBuffer.prototype.updateDirectly = function (data) {
|
|
|
+ VertexBuffer.prototype.updateDirectly = function (data, offset) {
|
|
|
if (!this._buffer) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this._updatable) {
|
|
|
- this._engine.updateDynamicVertexBuffer(this._buffer, data);
|
|
|
+ this._engine.updateDynamicVertexBuffer(this._buffer, data, offset);
|
|
|
this._data = null;
|
|
|
}
|
|
|
};
|
|
@@ -10047,7 +10062,7 @@ var BABYLON;
|
|
|
this.position = new BABYLON.Vector3(0, 0, 0);
|
|
|
this.rotation = new BABYLON.Vector3(0, 0, 0);
|
|
|
this.scaling = new BABYLON.Vector3(1, 1, 1);
|
|
|
- this.billboardMode = BABYLON.AbstractMesh.BILLBOARDMODE_NONE;
|
|
|
+ this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
|
|
|
this.visibility = 1.0;
|
|
|
this.alphaIndex = Number.MAX_VALUE;
|
|
|
this.infiniteDistance = false;
|
|
@@ -10633,7 +10648,7 @@ var BABYLON;
|
|
|
camera = this.getScene().activeCamera;
|
|
|
}
|
|
|
|
|
|
- return this.absolutePosition.subtract(camera.position);
|
|
|
+ return this.absolutePosition.subtract(camera.position).length();
|
|
|
};
|
|
|
|
|
|
AbstractMesh.prototype.applyImpulse = function (force, contactPoint) {
|
|
@@ -11226,15 +11241,15 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- Mesh.prototype.updateVerticesDataDirectly = function (kind, data, makeItUnique) {
|
|
|
+ Mesh.prototype.updateVerticesDataDirectly = function (kind, data, offset, makeItUnique) {
|
|
|
if (!this._geometry) {
|
|
|
return;
|
|
|
}
|
|
|
if (!makeItUnique) {
|
|
|
- this._geometry.updateVerticesDataDirectly(kind, data);
|
|
|
+ this._geometry.updateVerticesDataDirectly(kind, data, offset);
|
|
|
} else {
|
|
|
this.makeGeometryUnique();
|
|
|
- this.updateVerticesDataDirectly(kind, data, false);
|
|
|
+ this.updateVerticesDataDirectly(kind, data, offset, false);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -11246,7 +11261,7 @@ var BABYLON;
|
|
|
geometry.applyToMesh(this);
|
|
|
};
|
|
|
|
|
|
- Mesh.prototype.setIndices = function (indices) {
|
|
|
+ Mesh.prototype.setIndices = function (indices, totalVertices) {
|
|
|
if (!this._geometry) {
|
|
|
var vertexData = new BABYLON.VertexData();
|
|
|
vertexData.indices = indices;
|
|
@@ -11255,7 +11270,7 @@ var BABYLON;
|
|
|
|
|
|
new BABYLON.Geometry(BABYLON.Geometry.RandomId(), scene, vertexData, false, this);
|
|
|
} else {
|
|
|
- this._geometry.setIndices(indices);
|
|
|
+ this._geometry.setIndices(indices, totalVertices);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -12644,7 +12659,6 @@ var BABYLON;
|
|
|
|
|
|
for (subIndex = 0; subIndex < this._opaqueSubMeshes.length; subIndex++) {
|
|
|
submesh = this._opaqueSubMeshes.data[subIndex];
|
|
|
- this._activeVertices += submesh.verticesCount;
|
|
|
|
|
|
submesh.render();
|
|
|
}
|
|
@@ -12653,7 +12667,6 @@ var BABYLON;
|
|
|
engine.setAlphaTesting(true);
|
|
|
for (subIndex = 0; subIndex < this._alphaTestSubMeshes.length; subIndex++) {
|
|
|
submesh = this._alphaTestSubMeshes.data[subIndex];
|
|
|
- this._activeVertices += submesh.verticesCount;
|
|
|
|
|
|
submesh.render();
|
|
|
}
|
|
@@ -12697,7 +12710,6 @@ var BABYLON;
|
|
|
engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
|
|
|
for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {
|
|
|
submesh = sortedArray[subIndex];
|
|
|
- this._activeVertices += submesh.verticesCount;
|
|
|
|
|
|
submesh.render();
|
|
|
}
|
|
@@ -13261,7 +13273,7 @@ var BABYLON;
|
|
|
|
|
|
for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
|
|
|
var subMesh = mesh.subMeshes[subIndex];
|
|
|
- scene._activeVertices += subMesh.verticesCount;
|
|
|
+ scene._activeVertices += subMesh.indexCount;
|
|
|
this._renderingManager.dispatch(subMesh);
|
|
|
}
|
|
|
}
|
|
@@ -15264,7 +15276,7 @@ var BABYLON;
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (mesh && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
+ if (scene.fogEnabled && mesh && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
defines.push("#define FOG");
|
|
|
fallbacks.addFallback(1, "FOG");
|
|
|
}
|
|
@@ -15363,36 +15375,38 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled || this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled || this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
- var fresnelRank = 1;
|
|
|
+ if (StandardMaterial.FresnelEnabled) {
|
|
|
+
|
|
|
+ if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled || this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled || this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
+ var fresnelRank = 1;
|
|
|
|
|
|
- if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
|
|
|
- defines.push("#define DIFFUSEFRESNEL");
|
|
|
- fallbacks.addFallback(fresnelRank, "DIFFUSEFRESNEL");
|
|
|
- fresnelRank++;
|
|
|
- }
|
|
|
+ if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
|
|
|
+ defines.push("#define DIFFUSEFRESNEL");
|
|
|
+ fallbacks.addFallback(fresnelRank, "DIFFUSEFRESNEL");
|
|
|
+ fresnelRank++;
|
|
|
+ }
|
|
|
|
|
|
- if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
|
|
|
- defines.push("#define OPACITYFRESNEL");
|
|
|
- fallbacks.addFallback(fresnelRank, "OPACITYFRESNEL");
|
|
|
- fresnelRank++;
|
|
|
- }
|
|
|
+ if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
|
|
|
+ defines.push("#define OPACITYFRESNEL");
|
|
|
+ fallbacks.addFallback(fresnelRank, "OPACITYFRESNEL");
|
|
|
+ fresnelRank++;
|
|
|
+ }
|
|
|
|
|
|
- if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
- defines.push("#define REFLECTIONFRESNEL");
|
|
|
- fallbacks.addFallback(fresnelRank, "REFLECTIONFRESNEL");
|
|
|
- fresnelRank++;
|
|
|
- }
|
|
|
+ if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
+ defines.push("#define REFLECTIONFRESNEL");
|
|
|
+ fallbacks.addFallback(fresnelRank, "REFLECTIONFRESNEL");
|
|
|
+ fresnelRank++;
|
|
|
+ }
|
|
|
|
|
|
- if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
|
- defines.push("#define EMISSIVEFRESNEL");
|
|
|
- fallbacks.addFallback(fresnelRank, "EMISSIVEFRESNEL");
|
|
|
- fresnelRank++;
|
|
|
- }
|
|
|
+ if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
|
+ defines.push("#define EMISSIVEFRESNEL");
|
|
|
+ fallbacks.addFallback(fresnelRank, "EMISSIVEFRESNEL");
|
|
|
+ fresnelRank++;
|
|
|
+ }
|
|
|
|
|
|
- defines.push("#define FRESNEL");
|
|
|
- fallbacks.addFallback(fresnelRank - 1, "FRESNEL");
|
|
|
+ defines.push("#define FRESNEL");
|
|
|
+ fallbacks.addFallback(fresnelRank - 1, "FRESNEL");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -15495,24 +15509,26 @@ var BABYLON;
|
|
|
}
|
|
|
|
|
|
if (scene.getCachedMaterial() !== this) {
|
|
|
-
|
|
|
- if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
|
|
|
- this._effect.setColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);
|
|
|
- this._effect.setColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);
|
|
|
- }
|
|
|
+ if (StandardMaterial.FresnelEnabled) {
|
|
|
+
|
|
|
+ if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
|
|
|
+ this._effect.setColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);
|
|
|
+ this._effect.setColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);
|
|
|
+ }
|
|
|
|
|
|
- if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
|
|
|
- this._effect.setColor4("opacityParts", new BABYLON.Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);
|
|
|
- }
|
|
|
+ if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
|
|
|
+ this._effect.setColor4("opacityParts", new BABYLON.Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);
|
|
|
+ }
|
|
|
|
|
|
- if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
- this._effect.setColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);
|
|
|
- this._effect.setColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);
|
|
|
- }
|
|
|
+ if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
|
|
|
+ this._effect.setColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);
|
|
|
+ this._effect.setColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);
|
|
|
+ }
|
|
|
|
|
|
- if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
|
- this._effect.setColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);
|
|
|
- this._effect.setColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);
|
|
|
+ if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
|
+ this._effect.setColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);
|
|
|
+ this._effect.setColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -15651,12 +15667,12 @@ var BABYLON;
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE || this.reflectionTexture) {
|
|
|
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE || this.reflectionTexture) {
|
|
|
this._effect.setMatrix("view", scene.getViewMatrix());
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
|
|
|
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
|
|
|
this._effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
|
|
|
this._effect.setColor3("vFogColor", scene.fogColor);
|
|
|
}
|
|
@@ -15778,6 +15794,7 @@ var BABYLON;
|
|
|
StandardMaterial.EmissiveTextureEnabled = true;
|
|
|
StandardMaterial.SpecularTextureEnabled = true;
|
|
|
StandardMaterial.BumpTextureEnabled = true;
|
|
|
+ StandardMaterial.FresnelEnabled = true;
|
|
|
return StandardMaterial;
|
|
|
})(BABYLON.Material);
|
|
|
BABYLON.StandardMaterial = StandardMaterial;
|
|
@@ -16460,7 +16477,7 @@ var BABYLON;
|
|
|
|
|
|
var effect = this._effectBase;
|
|
|
|
|
|
- if (this._scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
+ if (this._scene.fogEnabled && this._scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
effect = this._effectFog;
|
|
|
}
|
|
|
|
|
@@ -16474,7 +16491,7 @@ var BABYLON;
|
|
|
effect.setFloat2("textureInfos", this.cellSize / baseSize.width, this.cellSize / baseSize.height);
|
|
|
|
|
|
|
|
|
- if (this._scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
+ if (this._scene.fogEnabled && this._scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
|
|
|
effect.setFloat4("vFogInfos", this._scene.fogMode, this._scene.fogStart, this._scene.fogEnd, this._scene.fogDensity);
|
|
|
effect.setColor3("vFogColor", this._scene.fogColor);
|
|
|
}
|
|
@@ -26881,14 +26898,14 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- Geometry.prototype.updateVerticesDataDirectly = function (kind, data) {
|
|
|
+ Geometry.prototype.updateVerticesDataDirectly = function (kind, data, offset) {
|
|
|
var vertexBuffer = this.getVertexBuffer(kind);
|
|
|
|
|
|
if (!vertexBuffer) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- vertexBuffer.updateDirectly(data);
|
|
|
+ vertexBuffer.updateDirectly(data, offset);
|
|
|
};
|
|
|
|
|
|
Geometry.prototype.updateVerticesData = function (kind, data, updateExtends) {
|
|
@@ -26903,9 +26920,10 @@ var BABYLON;
|
|
|
if (kind === BABYLON.VertexBuffer.PositionKind) {
|
|
|
var extend;
|
|
|
|
|
|
+ var stride = vertexBuffer.getStrideSize();
|
|
|
+ this._totalVertices = data.length / stride;
|
|
|
+
|
|
|
if (updateExtends) {
|
|
|
- var stride = vertexBuffer.getStrideSize();
|
|
|
- this._totalVertices = data.length / stride;
|
|
|
extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this._totalVertices);
|
|
|
}
|
|
|
|
|
@@ -26977,7 +26995,7 @@ var BABYLON;
|
|
|
return result;
|
|
|
};
|
|
|
|
|
|
- Geometry.prototype.setIndices = function (indices) {
|
|
|
+ Geometry.prototype.setIndices = function (indices, totalVertices) {
|
|
|
if (this._indexBuffer) {
|
|
|
this._engine._releaseBuffer(this._indexBuffer);
|
|
|
}
|
|
@@ -26987,6 +27005,10 @@ var BABYLON;
|
|
|
this._indexBuffer = this._engine.createIndexBuffer(this._indices);
|
|
|
}
|
|
|
|
|
|
+ if (totalVertices !== undefined) {
|
|
|
+ this._totalVertices = totalVertices;
|
|
|
+ }
|
|
|
+
|
|
|
var meshes = this._meshes;
|
|
|
var numOfMeshes = meshes.length;
|
|
|
|
|
@@ -29027,14 +29049,13 @@ var BABYLON;
|
|
|
*/
|
|
|
function Sound(name, url, scene, readyToPlayCallback, options) {
|
|
|
var _this = this;
|
|
|
- this.maxDistance = 10;
|
|
|
+ this.maxDistance = 20;
|
|
|
this.autoplay = false;
|
|
|
this.loop = false;
|
|
|
- this.useBabylonJSAttenuation = false;
|
|
|
+ this.useBabylonJSAttenuation = true;
|
|
|
this._position = BABYLON.Vector3.Zero();
|
|
|
this._localDirection = new BABYLON.Vector3(1, 0, 0);
|
|
|
this._volume = 1;
|
|
|
- this._distanceFromCamera = 1;
|
|
|
this._isLoaded = false;
|
|
|
this._isReadyToPlay = false;
|
|
|
this._isPlaying = false;
|
|
@@ -29049,8 +29070,8 @@ var BABYLON;
|
|
|
this._audioEngine = this._scene.getEngine().getAudioEngine();
|
|
|
this._readyToPlayCallback = readyToPlayCallback;
|
|
|
if (options) {
|
|
|
- if (options.distanceMax) {
|
|
|
- this.maxDistance = options.distanceMax;
|
|
|
+ if (options.maxDistance) {
|
|
|
+ this.maxDistance = options.maxDistance;
|
|
|
}
|
|
|
if (options.autoplay) {
|
|
|
this.autoplay = options.autoplay;
|
|
@@ -29131,6 +29152,22 @@ var BABYLON;
|
|
|
this._soundPanner.setOrientation(direction.x, direction.y, direction.z);
|
|
|
};
|
|
|
|
|
|
+ Sound.prototype.updateDistanceFromListener = function () {
|
|
|
+ if (this._connectedMesh) {
|
|
|
+ var distance = this._connectedMesh.getDistanceToCamera(this._scene.activeCamera);
|
|
|
+
|
|
|
+ if (distance < 1)
|
|
|
+ distance = 1;
|
|
|
+ if (this.useBabylonJSAttenuation) {
|
|
|
+ if (distance < this.maxDistance) {
|
|
|
+ this._soundGain.gain.value = this._volume / distance;
|
|
|
+ } else {
|
|
|
+ this._soundGain.gain.value = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* Play the sound
|
|
|
* @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
|
|
@@ -29223,7 +29260,7 @@ var BABYLON;
|
|
|
this._isMainTrack = false;
|
|
|
this._scene = scene;
|
|
|
this._audioEngine = scene.getEngine().getAudioEngine();
|
|
|
- this._soundCollection = new Array();
|
|
|
+ this.soundCollection = new Array();
|
|
|
if (this._audioEngine.canUseWebAudio) {
|
|
|
this._trackGain = this._audioEngine.audioContext.createGain();
|
|
|
|
|
@@ -29254,14 +29291,14 @@ var BABYLON;
|
|
|
this._scene.soundTracks[sound.soundTrackId].RemoveSound(sound);
|
|
|
}
|
|
|
}
|
|
|
- this._soundCollection.push(sound);
|
|
|
+ this.soundCollection.push(sound);
|
|
|
sound.soundTrackId = this.id;
|
|
|
};
|
|
|
|
|
|
SoundTrack.prototype.RemoveSound = function (sound) {
|
|
|
- var index = this._soundCollection.indexOf(sound);
|
|
|
+ var index = this.soundCollection.indexOf(sound);
|
|
|
if (index !== -1) {
|
|
|
- this._soundCollection.splice(index, 1);
|
|
|
+ this.soundCollection.splice(index, 1);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -29303,7 +29340,7 @@ var BABYLON;
|
|
|
_this._optionsDiv.style.top = "10px";
|
|
|
_this._optionsDiv.style.width = "200px";
|
|
|
_this._optionsDiv.style.height = "auto";
|
|
|
- _this._optionsSubsetDiv.style.maxHeight = (canvasRect.height - 60) + "px";
|
|
|
+ _this._optionsSubsetDiv.style.maxHeight = (canvasRect.height * 0.6) + "px";
|
|
|
|
|
|
_this._logDiv.style.left = "0px";
|
|
|
_this._logDiv.style.bottom = "10px";
|
|
@@ -29316,6 +29353,11 @@ var BABYLON;
|
|
|
_this._treeDiv.style.height = "auto";
|
|
|
}
|
|
|
|
|
|
+ _this._globalDiv.style.left = canvasRect.left + "px";
|
|
|
+ _this._globalDiv.style.top = canvasRect.top + "px";
|
|
|
+ _this._globalDiv.style.width = canvasRect.width + "px";
|
|
|
+ _this._globalDiv.style.height = canvasRect.height + "px";
|
|
|
+
|
|
|
_this._drawingCanvas.style.left = "0px";
|
|
|
_this._drawingCanvas.style.top = "0px";
|
|
|
_this._drawingCanvas.style.width = engine.getRenderWidth() + "px";
|
|
@@ -29355,6 +29397,12 @@ var BABYLON;
|
|
|
|
|
|
if (_this._displayTree) {
|
|
|
_this._treeDiv.style.display = "";
|
|
|
+
|
|
|
+ if (_this._needToRefreshMeshesTree) {
|
|
|
+ _this._needToRefreshMeshesTree = false;
|
|
|
+
|
|
|
+ _this._refreshMeshesTreeContent();
|
|
|
+ }
|
|
|
} else {
|
|
|
_this._treeDiv.style.display = "none";
|
|
|
}
|
|
@@ -29433,6 +29481,31 @@ var BABYLON;
|
|
|
_this._clickPosition = undefined;
|
|
|
};
|
|
|
}
|
|
|
+ DebugLayer.prototype._refreshMeshesTreeContent = function () {
|
|
|
+
|
|
|
+ var sortedArray = this._scene.meshes.slice(0, this._scene.meshes.length);
|
|
|
+
|
|
|
+ sortedArray.sort(function (a, b) {
|
|
|
+ if (a.name === b.name) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return (a.name > b.name) ? 1 : -1;
|
|
|
+ });
|
|
|
+
|
|
|
+ for (var index = 0; index < sortedArray.length; index++) {
|
|
|
+ var mesh = sortedArray[index];
|
|
|
+
|
|
|
+ if (!mesh.isEnabled()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ this._generateAdvancedCheckBox(this._treeSubsetDiv, mesh.name, mesh.getTotalVertices() + " verts", mesh.isVisible, function (element, mesh) {
|
|
|
+ mesh.isVisible = element.checked;
|
|
|
+ }, mesh);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
DebugLayer.prototype._renderSingleAxis = function (zero, unit, unitText, label, color) {
|
|
|
this._drawingContext.beginPath();
|
|
|
this._drawingContext.moveTo(zero.x, zero.y);
|
|
@@ -29688,6 +29761,8 @@ var BABYLON;
|
|
|
var _this = this;
|
|
|
this._globalDiv.id = "DebugLayer";
|
|
|
|
|
|
+ this._globalDiv.style.position = "absolute";
|
|
|
+
|
|
|
|
|
|
this._drawingCanvas = document.createElement("canvas");
|
|
|
this._drawingCanvas.id = "DebugLayerDrawingCanvas";
|
|
@@ -29726,32 +29801,11 @@ var BABYLON;
|
|
|
this._generateheader(this._treeDiv, "Meshes tree");
|
|
|
this._treeSubsetDiv = document.createElement("div");
|
|
|
this._treeSubsetDiv.style.paddingTop = "5px";
|
|
|
+ this._treeSubsetDiv.style.paddingRight = "5px";
|
|
|
this._treeSubsetDiv.style.overflowY = "auto";
|
|
|
this._treeSubsetDiv.style.maxHeight = "300px";
|
|
|
this._treeDiv.appendChild(this._treeSubsetDiv);
|
|
|
-
|
|
|
-
|
|
|
- var sortedArray = this._scene.meshes.slice(0, this._scene.meshes.length);
|
|
|
-
|
|
|
- sortedArray.sort(function (a, b) {
|
|
|
- if (a.name === b.name) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
- return (a.name > b.name) ? 1 : -1;
|
|
|
- });
|
|
|
-
|
|
|
- for (var index = 0; index < sortedArray.length; index++) {
|
|
|
- var mesh = sortedArray[index];
|
|
|
-
|
|
|
- if (!mesh.isEnabled()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- this._generateAdvancedCheckBox(this._treeSubsetDiv, mesh.name, mesh.getTotalVertices() + " verts", mesh.isVisible, function (element, mesh) {
|
|
|
- mesh.isVisible = element.checked;
|
|
|
- }, mesh);
|
|
|
- }
|
|
|
+ this._needToRefreshMeshesTree = true;
|
|
|
|
|
|
|
|
|
this._logDiv = document.createElement("div");
|
|
@@ -29799,6 +29853,7 @@ var BABYLON;
|
|
|
});
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Meshes tree", this._displayTree, function (element) {
|
|
|
_this._displayTree = element.checked;
|
|
|
+ _this._needToRefreshMeshesTree = true;
|
|
|
});
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Bounding boxes", this._scene.forceShowBoundingBoxes, function (element) {
|
|
|
_this._scene.forceShowBoundingBoxes = element.checked;
|
|
@@ -29860,6 +29915,9 @@ var BABYLON;
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Reflection", BABYLON.StandardMaterial.ReflectionTextureEnabled, function (element) {
|
|
|
BABYLON.StandardMaterial.ReflectionTextureEnabled = element.checked;
|
|
|
});
|
|
|
+ this._generateCheckBox(this._optionsSubsetDiv, "Fresnel", BABYLON.StandardMaterial.FresnelEnabled, function (element) {
|
|
|
+ BABYLON.StandardMaterial.FresnelEnabled = element.checked;
|
|
|
+ });
|
|
|
this._optionsSubsetDiv.appendChild(document.createElement("br"));
|
|
|
this._generateTexBox(this._optionsSubsetDiv, "<b>Options:</b>");
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Animations", this._scene.animationsEnabled, function (element) {
|
|
@@ -29868,6 +29926,9 @@ var BABYLON;
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Collisions", this._scene.collisionsEnabled, function (element) {
|
|
|
_this._scene.collisionsEnabled = element.checked;
|
|
|
});
|
|
|
+ this._generateCheckBox(this._optionsSubsetDiv, "Fog", this._scene.fogEnabled, function (element) {
|
|
|
+ _this._scene.fogEnabled = element.checked;
|
|
|
+ });
|
|
|
this._generateCheckBox(this._optionsSubsetDiv, "Lens flares", this._scene.lensFlaresEnabled, function (element) {
|
|
|
_this._scene.lensFlaresEnabled = element.checked;
|
|
|
});
|