Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
Former-commit-id: 5a679d3
  • Loading branch information
deltakosh committed Sep 18, 2013
1 parent 0db5cef commit 1cd2f46
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Babylon/Tools/babylon.database.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
};

BABYLON.Database.ReturnFullUrlLocation = function (url) {
if (url.indexOf("http://") === -1) {
if (url.indexOf("http:/") === -1) {
return (parseURL(window.location.href) + url);
}
else {
Expand Down
57 changes: 31 additions & 26 deletions Babylon/babylon.scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

this._onBeforeRenderCallbacks = [];

this._mustCheckIsReady = false;

// Fog
this.fogMode = BABYLON.Scene.FOGMODE_NONE;
this.fogColor = new BABYLON.Color3(0.2, 0.2, 0.3);
Expand Down Expand Up @@ -72,7 +70,7 @@

// Layers
this.layers = [];

// Skeletons
this.skeletons = [];

Expand Down Expand Up @@ -143,15 +141,15 @@
BABYLON.Scene.prototype.getAnimationRatio = function () {
return this._animationRatio;
};

BABYLON.Scene.prototype.getRenderId = function () {
return this._renderId;
};

// Ready
BABYLON.Scene.prototype.isReady = function () {
for (var index = 0; index < this.meshes.length; index++) {
var mesh = this.meshes[index];
var mesh = this.meshes[index];
var mat = mesh.material;
if (mat && !mat.isReady(mesh)) {
return false;
Expand Down Expand Up @@ -201,11 +199,29 @@
this._pendingData.splice(index, 1);

if (this._pendingData.length === 0) {
this._mustCheckIsReady = true;
var that = this;
setTimeout(function () {
that._checkIsReady();
}, 150);
}
}
};

BABYLON.Scene.prototype._checkIsReady = function () {
if (this.isReady()) {
this._onReadyCallbacks.forEach(function (func) {
func();
});

this._onReadyCallbacks = [];
return;
}
var that = this;
setTimeout(function () {
that._checkIsReady();
}, 150);
};

// Animations
BABYLON.Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio) {
if (speedRatio === undefined) {
Expand Down Expand Up @@ -238,15 +254,15 @@
}
}
};

BABYLON.Scene.prototype._animate = function () {
if (!this._animationStartDate) {
this._animationStartDate = new Date();
}
// Getting time
var now = new Date();
var delay = now - this._animationStartDate;

for (var index = 0; index < this._activeAnimatables.length; index++) {
if (!this._activeAnimatables[index]._animate(delay)) {
this._activeAnimatables.splice(index, 1);
Expand Down Expand Up @@ -334,7 +350,7 @@

return null;
};

BABYLON.Scene.prototype.getLastSkeletonByID = function (id) {
for (var index = this.skeletons.length - 1; index >= 0 ; index--) {
if (this.skeletons[index].id === id) {
Expand All @@ -344,7 +360,7 @@

return null;
};

BABYLON.Scene.prototype.getSkeletonById = function (id) {
for (var index = 0; index < this.skeletons.length; index++) {
if (this.skeletons[index].id === id) {
Expand All @@ -354,7 +370,7 @@

return null;
};

BABYLON.Scene.prototype.getSkeletonByName = function (name) {
for (var index = 0; index < this.skeleton.length; index++) {
if (this.skeletons[index].name === name) {
Expand Down Expand Up @@ -426,7 +442,7 @@
for (var meshIndex = 0; meshIndex < block.meshes.length; meshIndex++) {
var mesh = block.meshes[meshIndex];

if (Math.abs(mesh._renderId) !== this._renderId) {
if (Math.abs(mesh._renderId) !== this._renderId) {
this._totalVertices += mesh.getTotalVertices();

if (!mesh.isReady()) {
Expand All @@ -436,7 +452,7 @@
mesh.computeWorldMatrix();
mesh._renderId = 0;
}

if (mesh._renderId === this._renderId || (mesh._renderId === 0 && mesh.isEnabled() && mesh.isVisible && mesh.visibility > 0 && mesh.isInFrustrum(this._frustumPlanes))) {
if (mesh._renderId === 0) {
this._activeMeshes.push(mesh);
Expand Down Expand Up @@ -477,7 +493,7 @@

if (mesh.isEnabled() && mesh.isVisible && mesh.visibility > 0 && mesh.isInFrustrum(this._frustumPlanes)) {
this._activeMeshes.push(mesh);

if (mesh.skeleton) {
this._activeSkeletons.pushNoDuplicate(mesh.skeleton);
}
Expand Down Expand Up @@ -566,17 +582,6 @@
this._particlesDuration = 0;
this._activeParticles = 0;
var engine = this._engine;

if (this._mustCheckIsReady) {
if (this.isReady()) {
this._mustCheckIsReady = false;
this._onReadyCallbacks.forEach(function(func) {
func();
});

this._onReadyCallbacks = [];
}
}

// Before render
if (this.beforeRender) {
Expand All @@ -602,7 +607,7 @@
var beforeEvaluateActiveMeshesDate = new Date();
this._evaluateActiveMeshes();
this._evaluateActiveMeshesDuration = new Date() - beforeEvaluateActiveMeshesDate;

// Skeletons
for (var skeletonIndex = 0; skeletonIndex < this._activeSkeletons.length; skeletonIndex++) {
var skeleton = this._activeSkeletons.data[skeletonIndex];
Expand Down
2 changes: 1 addition & 1 deletion babylon.1.4.1.js → babylon.1.4.2.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions what's new.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changes list
============
- 1.4.2:
- **Bugfixes**
- Fixing an issue with scene.executeWhenReady ([deltakosh](http://www.github.com/deltakosh))
- 1.4.1:
- **Bugfixes**
- Support for Safari ([deltakosh](http://www.github.com/deltakosh))
Expand Down

0 comments on commit 1cd2f46

Please sign in to comment.