forked from xeolabs/scenejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added getStatus method to scene node
Added "loading" and "loaded" events to geometry and texture nodes Fixed render interval
- Loading branch information
Showing
7 changed files
with
118 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Backend that tracks statistics on loading states of nodes during scene traversal. | ||
* | ||
* This supports the "loading-status" events that we can listen for on scene nodes. | ||
* | ||
* When a node with that listener is pre-visited, it will call getStatus on this module to | ||
* save a copy of the status. Then when it is post-visited, it will call diffStatus on this | ||
* module to find the status for its sub-nodes, which it then reports through the "loading-status" event. | ||
* | ||
* @private | ||
*/ | ||
var SceneJS_sceneStatusModule = new (function() { | ||
|
||
this.sceneStatus = {}; | ||
|
||
var self = this; | ||
|
||
SceneJS_eventModule.addListener( | ||
SceneJS_eventModule.SCENE_CREATED, | ||
function(params) { | ||
self.sceneStatus[params.sceneId] = { | ||
numLoading: 0 | ||
}; | ||
}); | ||
|
||
this.nodeLoading = function(node) { | ||
this.sceneStatus[node.scene.attr.id].numLoading++; | ||
}; | ||
|
||
this.nodeLoaded = function(node) { | ||
this.sceneStatus[node.scene.attr.id].numLoading--; | ||
}; | ||
|
||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters