Constructor
new Scene()
Creates a new Scene.
Properties:
Name | Type | Description |
---|---|---|
ambientLight |
pc.Color | The color of the scene's ambient light. Defaults to black (0, 0, 0). |
fog |
String | The type of fog used by the scene. Can be:
|
fogColor |
pc.Color | The color of the fog (if enabled). Defaults to black (0, 0, 0). |
fogDensity |
Number | The density of the fog (if enabled). This property is only valid if the fog property is set to pc.FOG_EXP or pc.FOG_EXP2. Defaults to 0. |
fogEnd |
Number | The distance from the viewpoint where linear fog reaches its maximum. This property is only valid if the fog property is set to pc.FOG_LINEAR. Defaults to 1000. |
fogStart |
Number | The distance from the viewpoint where linear fog begins. This property is only valid if the fog property is set to pc.FOG_LINEAR. Defaults to 1. |
gammaCorrection |
Number | The gamma correction to apply when rendering the scene. Can be:
|
toneMapping |
Number | The tonemapping transform to apply when writing fragments to the
frame buffer. Can be:
|
skybox |
pc.Texture | A cube map texture used as the scene's skybox. Defaults to null. |
skyboxIntensity |
Number | Multiplier for skybox intensity. Defaults to 1. |
skyboxMip |
Number | The mip level of the skybox to be displayed. Only valid for prefiltered cubemap skyboxes. Defaults to 0 (base level). |
lightmapSizeMultiplier |
Number | The lightmap resolution multiplier. Defaults to 1. |
lightmapMaxResolution |
Number | The maximum lightmap resolution. Defaults to 2048. |
lightmapMode |
Number | The lightmap baking mode. Can be:
|
layers |
pc.LayerComposition | A pc.LayerComposition that defines rendering order of this scene. |
- Source:
Events
set:layers
Fired when the layer composition is set. Use this event to add callbacks or advanced properties to your layers.
Parameters:
Name | Type | Description |
---|---|---|
oldComp |
pc.LayerComposition | Previously used pc.LayerComposition. |
newComp |
pc.LayerComposition | Newly set pc.LayerComposition. |
- Source:
Example
this.app.scene.on('set:layers', function(oldComp, newComp) {
var list = newComp.layerList;
var layer;
for(var i=0; i<list.length; i++) {
layer = list[i];
switch(layer.name) {
case 'MyLayer':
layer.onEnable = myOnEnableFunction;
layer.onDisable = myOnDisableFunction;
break;
case 'MyOtherLayer':
layer.shaderPass = myShaderPass;
break;
}
}
});
set:skybox
Fired when the skybox is set.
Parameters:
Name | Type | Description |
---|---|---|
usedTex |
pc.Texture | Previously used cubemap texture. New is in the pc.Scene#skybox. |
- Source: