(private) new SceneRegistry(app)
Container for storing the name and url for scene files
Parameters:
Name | Type | Description |
---|---|---|
app |
pc.Application | The application |
- Source:
Methods
(private) add(name, url) → {Boolean}
Add a new item to the scene registry
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the scene |
url |
String | The url of the scene file |
- Source:
Returns:
Returns true if the scene was successfully added to the registry, false otherwise
- Type
- Boolean
(private) find(name) → {pc.SceneRegistryItem}
Find a Scene by name and return the pc.SceneRegistryItem
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the scene |
- Source:
Returns:
The stored data about a scene
- Type
- pc.SceneRegistryItem
(private) findByUrl(url) → {pc.SceneRegistryItem}
Find a scene by the URL and return the pc.SceneRegistryItem
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to search by |
- Source:
Returns:
The stored data about a scene
- Type
- pc.SceneRegistryItem
(private) list() → {Array.<pc.SceneRegistryItem>}
return the list of scene
- Source:
Returns:
All items in the registry
- Type
- Array.<pc.SceneRegistryItem>
(private) loadScene(url, callback)
Load the scene hierarchy and scene settings. This is an internal method used by the pc.Application
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL of the scene file |
callback |
function | The function called after the settings are applied. Passed (err, scene) where err is null if no error occurred and scene is the pc.Scene |
- Source:
(private) loadSceneHierarchy(url, callback)
Load a scene file, create and initialize the Entity hierarchy
and add the hierarchy to the application root Entity.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL of the scene file. Usually this will be "scene_id.json" |
callback |
function | The function to call after loading, passed (err, entity) where err is null if no errors occurred. |
- Source:
Example
var url = app.getSceneUrl("Scene Name");
app.loadSceneHierarchy(url, function (err, entity) {
if (!err) {
var e = app.root.find("My New Entity");
} else {
// error
}
}
});
(private) loadSceneSettings(url, callback)
Load a scene file and apply the scene settings to the current scene
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL of the scene file. This can be looked up using app.getSceneUrl |
callback |
function | The function called after the settings are applied. Passed (err) where err is null if no error occurred. |
- Source:
Example
var url = app.getSceneUrl("Scene Name");
app.loadSceneSettings(url, function (err) {
if (!err) {
// success
} else {
// error
}
}
});
(private) remove(name)
Remove an item from the scene registry
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the scene |
- Source: