API Reference

Class List

pc.Scene

A scene is graphical representation of an environment. It manages the scene hierarchy, all graphical objects, lights, and scene-wide properties.

Summary

Properties

ambientLightThe color of the scene's ambient light.
fogThe type of fog used by the scene.
fogColorThe color of the fog (if enabled).
fogDensityThe density of the fog (if enabled).
fogEndThe distance from the viewpoint where linear fog reaches its maximum.
fogStartThe distance from the viewpoint where linear fog begins.
gammaCorrectionThe gamma correction to apply when rendering the scene.
layersA pc.LayerComposition that defines rendering order of this scene.
lightmapMaxResolutionThe maximum lightmap resolution.
lightmapModeThe lightmap baking mode.
lightmapSizeMultiplierThe lightmap resolution multiplier.
skyboxA cube map texture used as the scene's skybox.
skyboxIntensityMultiplier for skybox intensity.
skyboxMipThe mip level of the skybox to be displayed.
toneMappingThe tonemapping transform to apply when writing fragments to the frame buffer.

Events

set:layersFired when the layer composition is set.
set:skyboxFired when the skybox is set.

Details

Constructor

Scene()

Creates a new Scene.

Properties

pc.ColorambientLight

The color of the scene's ambient light. Defaults to black (0, 0, 0).

Stringfog

The type of fog used by the scene. Can be:

  • pc.FOG_NONE
  • pc.FOG_LINEAR
  • pc.FOG_EXP
  • pc.FOG_EXP2
Defaults to pc.FOG_NONE.

pc.ColorfogColor

The color of the fog (if enabled). Defaults to black (0, 0, 0).

NumberfogDensity

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.

NumberfogEnd

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.

NumberfogStart

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.

NumbergammaCorrection

The gamma correction to apply when rendering the scene. Can be:

  • pc.GAMMA_NONE
  • pc.GAMMA_SRGB
Defaults to pc.GAMMA_NONE.

pc.LayerCompositionlayers

A pc.LayerComposition that defines rendering order of this scene.

NumberlightmapMaxResolution

The maximum lightmap resolution. Defaults to 2048.

NumberlightmapMode

The lightmap baking mode. Can be:

  • pc.BAKE_COLOR: single color lightmap
  • pc.BAKE_COLORDIR: single color lightmap + dominant light direction (used for bump/specular)
Only lights with bakeDir=true will be used for generating the dominant light direction. Defaults to pc.BAKE_COLORDIR.

NumberlightmapSizeMultiplier

The lightmap resolution multiplier. Defaults to 1.

pc.Textureskybox

A cube map texture used as the scene's skybox. Defaults to null.

NumberskyboxIntensity

Multiplier for skybox intensity. Defaults to 1.

NumberskyboxMip

The mip level of the skybox to be displayed. Only valid for prefiltered cubemap skyboxes. Defaults to 0 (base level).

NumbertoneMapping

The tonemapping transform to apply when writing fragments to the frame buffer. Can be:

  • pc.TONEMAP_LINEAR
  • pc.TONEMAP_FILMIC
  • pc.TONEMAP_HEJL
  • pc.TONEMAP_ACES
Defaults to pc.TONEMAP_LINEAR.

Events

set:layers

Fired when the layer composition is set. Use this event to add callbacks or advanced properties to your layers.

this.app.scene.on('set:layers', function(oldComp, newComp) {
      var list = newComp.layerList;
      var layer;
      for(var i=0; i

Parameters

oldComppc.LayerCompositionPreviously used pc.LayerComposition.
newComppc.LayerCompositionNewly set pc.LayerComposition.

set:skybox

Fired when the skybox is set.

Parameters

usedTexpc.TexturePreviously used cubemap texture. New is in the pc.Scene#skybox.