Physically Based Renderer (PBR) and scene graph designed as ECS for PEX: define entities to be rendered as collections of components with their update orchestrated by systems.


Keywords
pex, renderer, webgl, 3d, gltf, ecs, 3d-graphics, pbr
License
MIT
Install
npm install pex-renderer@4.0.0-alpha.53

Documentation

pex-renderer

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Physically Based Renderer (PBR) and scene graph designed as ECS for PEX: define entities to be rendered as collections of components with their update orchestrated by systems.

Installation

npm install pex-renderer

Usage

import {
  renderEngine as createRenderEngine,
  world as createWorld,
  entity as createEntity,
  components,
} from "pex-renderer";

import createContext from "pex-context";
import { sphere } from "primitive-geometry";

const ctx = createContext({ pixelRatio: devicePixelRatio });
const renderEngine = createRenderEngine({ ctx });

const world = createWorld();

const cameraEntity = createEntity({
  transform: components.transform({ position: [0, 0, 3] }),
  camera: components.camera(),
  orbiter: components.orbiter(),
});
world.add(cameraEntity);

const skyEntity = createEntity({
  skybox: components.skybox({ sunPosition: [1, 0.5, 1] }),
  reflectionProbe: components.reflectionProbe(),
});
world.add(skyEntity);

const geometryEntity = createEntity({
  transform: components.transform({ position: [0, 0, 0] }),
  geometry: components.geometry(sphere()),
  material: components.material({
    baseColor: [1, 0, 0, 1],
    metallic: 0,
    roughness: 0.5,
  }),
});
world.add(geometryEntity);

ctx.frame(() => {
  renderEngine.update(world.entities);
  renderEngine.render(world.entities, cameraEntity);
});

Architecture

  • components are plain old data objects
  • data lives in components or system caches
  • systems are functions
  • systems communicate through components
  • system order is maintained by the user

API

Modules

pex-renderer
components
systems
renderer

Typedefs

Entity : object
AmbientLightComponentOptions : object
AnimationComponentOptions : object
AreaLightComponentOptions : object
AxesHelperComponentOptions : object
BoundingBoxHelperComponentOptions : object
CameraHelperComponentOptions : object
CameraView : object
CameraComponentOptions : object
DirectionalLightComponentOptions : object
GeometryComponentOptions : object
GridHelperComponentOptions : object
LightHelperComponentOptions : object
TextureTransform : object
MaterialComponentOptions : object
LineMaterialComponentOptions : object
MorphComponentOptions : object
OrbiterComponentOptions : object
PointLightComponentOptions : object
SSAOComponentOptions : object
DoFComponentOptions : object
MSAAComponentOptions : object
AAComponentOptions : object
FogComponentOptions : object
BloomComponentOptions : object
LutComponentOptions : object
ColorCorrectionComponentOptions : object
VignetteComponentOptions : object
FilmGrainComponentOptions : object
PostProcessingComponentOptions : object
ReflectionProbeComponentOptions : object
SkinComponentOptions : object
SkyboxComponentOptions : object
SpotLightComponentOptions : object
TransformComponentOptions : object
VertexHelperComponentOptions : object
SystemOptions : object
SystemUpdate : function
SystemDispose : function
System : object
RenderEngineOptions
RenderEngineRender : function
RenderEngineDebug : function
RenderEngine : System
RendererSystemRender : function
RendererSystemStageOptions : object
RendererSystemStage : function
RendererSystem : object
WorldAdd : function
WorldAddSystem : function
WorldUpdate : function
World : object
RenderGraph : object
ResourceCacheUsage : "Transient" | "Retained"
ResourceCache : object
RenderView : object

pex-renderer

pex-renderer.components : components

All components as a function returning a component with default values.

Kind: static property of pex-renderer

pex-renderer.systems : systems

All systems as a function returning a system with a type property and an update function.

Kind: static property of pex-renderer

pex-renderer.world() ⇒ World

Create a world object to store entities and systems

Kind: static method of pex-renderer

pex-renderer.entity([components]) ⇒ Entity

Create an entity from an object of plain data components

Kind: static method of pex-renderer

Param Type Default
[components] object {}

pex-renderer.renderEngine() ⇒ RenderEngine

Create a render engine eg. a collection of systems for default rendering

Kind: static method of pex-renderer

pex-renderer.renderGraph(ctx) ⇒ RenderGraph

Create a render graph for rendering passes

Kind: static method of pex-renderer

Param Type
ctx module:pex-context/types/index.js

pex-renderer.resourceCache(ctx) ⇒ ResourceCache

Create a resource cache for pex-context caching.

Kind: static method of pex-renderer

Param Type
ctx module:pex-context/types/index.js

components

components.ambientLight([options]) ⇒ object

Ambient light component

Kind: static method of components

Param Type
[options] AmbientLightComponentOptions

components.animation([options]) ⇒ object

Animation component

Kind: static method of components

Param Type
[options] AnimationComponentOptions

components.areaLight([options]) ⇒ object

Area light component

Kind: static method of components

Param Type
[options] AreaLightComponentOptions

components.axesHelper([options]) ⇒ object

Axes helper component

Kind: static method of components

Param Type
[options] AxesHelperComponentOptions

components.boundingBoxHelper([options]) ⇒ object

Bounding box helper component

Kind: static method of components

Param Type
[options] BoundingBoxHelperComponentOptions

components.cameraHelper([options]) ⇒ object

Camera helper component

Kind: static method of components

Param Type
[options] CameraHelperComponentOptions

components.camera([options]) ⇒ object

Camera component

Kind: static method of components

Param Type
[options] CameraComponentOptions

components.directionalLight([options]) ⇒ object

Directional light component

Kind: static method of components

Param Type
[options] DirectionalLightComponentOptions

components.geometry([options]) ⇒ object

Geometry component

Kind: static method of components

Param Type
[options] GeometryComponentOptions

components.gridHelper([options]) ⇒ object

Grid helper component

Kind: static method of components

Param Type
[options] GridHelperComponentOptions

components.lightHelper([options]) ⇒ object

Light helper component

Kind: static method of components

Param Type
[options] LightHelperComponentOptions

components.material([options]) ⇒ object

Material component

Kind: static method of components

Param Type
[options] MaterialComponentOptions | LineMaterialComponentOptions

components.morph(options) ⇒ object

Morph component

Kind: static method of components

Param Type
options MorphComponentOptions

components.orbiter(options) ⇒ object

Orbiter component

Kind: static method of components

Param Type
options OrbiterComponentOptions

components.pointLight([options]) ⇒ object

Point light component

Kind: static method of components

Param Type
[options] PointLightComponentOptions

components.postProcessing([options]) ⇒ object

Post Processing component

Kind: static method of components

Param Type
[options] PostProcessingComponentOptions

postProcessing.ssao([options]) ⇒ object

Post Processing SSAO subcomponent

Kind: static method of postProcessing

Param Type
[options] SSAOComponentOptions

postProcessing.dof([options]) ⇒ object

Post Processing DoF subcomponent

Kind: static method of postProcessing

Param Type
[options] DoFComponentOptions

postProcessing.msaa([options]) ⇒ object

Post Processing MSAA subcomponent

Kind: static method of postProcessing

Param Type
[options] MSAAComponentOptions

postProcessing.aa([options]) ⇒ object

Post Processing AA subcomponent

Kind: static method of postProcessing

Param Type
[options] AAComponentOptions

postProcessing.fog([options]) ⇒ object

Post Processing Fog subcomponent

Kind: static method of postProcessing

Param Type
[options] FogComponentOptions

postProcessing.bloom([options]) ⇒ object

Post Processing Bloom subcomponent

Kind: static method of postProcessing

Param Type
[options] BloomComponentOptions

postProcessing.lut([options]) ⇒ object

Post Processing LUT subcomponent

Kind: static method of postProcessing

Param Type
[options] LutComponentOptions

postProcessing.colorCorrection([options]) ⇒ object

Post Processing Color Correction subcomponent

Kind: static method of postProcessing

Param Type
[options] ColorCorrectionComponentOptions

postProcessing.vignette([options]) ⇒ object

Post Processing Vignette subcomponent

Kind: static method of postProcessing

Param Type
[options] VignetteComponentOptions

postProcessing.filmGrain([options]) ⇒ object

Post Processing Film Grain subcomponent

Kind: static method of postProcessing

Param Type
[options] FilmGrainComponentOptions

components.reflectionProbe([options]) ⇒ object

Reflection probe component

Kind: static method of components

Param Type
[options] ReflectionProbeComponentOptions

components.skin([options]) ⇒ object

Skin component

Kind: static method of components

Param Type
[options] SkinComponentOptions

components.skybox([options]) ⇒ object

Skybox component

Kind: static method of components

Param Type
[options] SkyboxComponentOptions

components.spotLight([options]) ⇒ object

Spot light component

Kind: static method of components

Param Type
[options] SpotLightComponentOptions

components.transform([options]) ⇒ object

Transform component

Kind: static method of components

Param Type
[options] TransformComponentOptions

components.vertexHelper([options]) ⇒ object

Vertex helper component

Kind: static method of components

Param Type
[options] VertexHelperComponentOptions

systems

systems.renderer : renderer

All renderer systems

Kind: static property of systems

systems.animation() ⇒ System

Animation system

Kind: static method of systems

systems.camera() ⇒ System

Camera system

Adds:

  • "_orbiter" to orbiter components

Kind: static method of systems

systems.geometry(options) ⇒ System

Geometry system

Adds:

  • "bounds" to geometry components
  • "dirty" to geometry components properties
  • "_geometry" to entities as reference to internal cache

Kind: static method of systems

Param Type
options SystemOptions

systems.layer() ⇒ System

Layer system

Kind: static method of systems

systems.light() ⇒ System

Light system

Adds:

  • "_projectionMatrix" and "_viewMatrix" to light components
  • "_direction" to directional and spot light components

Kind: static method of systems

systems.morph() ⇒ System

Morph system

Kind: static method of systems

systems.reflectionProbe(options) ⇒ System

Reflection Probe system

Adds:

  • "_reflectionProbe" to reflectionProbe components

Kind: static method of systems

Param Type
options SystemOptions

systems.skin() ⇒ System

Skin system

Kind: static method of systems

systems.skybox(options) ⇒ System

Skybox system

Adds:

  • "_skyTexture" to skybox components with no envMap for skybox-renderer to render
  • "_skyTextureChanged" to skybox components for reflection-probe system

Kind: static method of systems

Param Type
options SystemOptions

systems.transform() ⇒ System

Transform system

Adds:

  • "worldBounds", "dirty" and "aabbDirty" to transform components
  • "_transform" to entities as reference to internal cache

Kind: static method of systems

systems.renderPipeline(options) ⇒ System

Render pipeline system

Adds:

  • "_near", "_far", "_radiusUV" and "_sceneBboxInLightSpace" to light components that cast shadows
  • "_shadowCubemap" to pointLight components and "_shadowMap" to other light components
  • "_targets" to postProcessing components

Kind: static method of systems

Param Type
options SystemOptions

renderer

renderer.base() ⇒ RendererSystem

Base renderer

All renderers are composed with it.

Kind: static method of renderer

renderer.basic(options) ⇒ RendererSystem

Basic renderer

Kind: static method of renderer

Param Type
options SystemOptions

renderer.helper(options) ⇒ RendererSystem

Helper renderer

Kind: static method of renderer

Param Type
options SystemOptions

renderer.line(options) ⇒ RendererSystem

Line renderer

Kind: static method of renderer

Param Type
options SystemOptions

renderer.skybox(options) ⇒ RendererSystem

Skybox renderer

Renders a skybox (envMap or _skyTexture) to screen or to reflection probes.

Kind: static method of renderer

Param Type
options SystemOptions

renderer.standard(options) ⇒ RendererSystem

Standard renderer

Kind: static method of renderer

Param Type
options SystemOptions

Entity : object

Kind: global typedef Properties

Name Type
id number
[ambientLight] AmbientLightComponentOptions
[animation] AnimationComponentOptions | Array.<AnimationComponentOptions>
[areaLight] AreaLightComponentOptions
[axesHelper] AxesHelperComponentOptions
[boundingBoxHelper] BoundingBoxHelperComponentOptions
[cameraHelper] CameraHelperComponentOptions
[camera] CameraComponentOptions
[directionalLight] DirectionalLightComponentOptions
[geometry] GeometryComponentOptions
[gridHelper] GridHelperComponentOptions
[lightHelper] LightHelperComponentOptions
[material] MaterialComponentOptions
[morph] MorphComponentOptions
[orbiter] OrbiterComponentOptions
[pointLight] PointLightComponentOptions
[postProcessing] PostProcessingComponentOptions
[reflectionProbe] ReflectionProbeComponentOptions
[skin] SkinComponentOptions
[skybox] SkyboxComponentOptions
[spotLight] SpotLightComponentOptions
[transform] TransformComponentOptions
[vertexHelper] VertexHelperComponentOptions

AmbientLightComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[intensity] number 1

AnimationComponentOptions : object

Kind: global typedef Properties

Name Type Default
[playing] boolean false
[loop] boolean false
[time] number 0
[channels] Array []

AreaLightComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[intensity] number 1
[disk] boolean false
[doubleSided] boolean false
[bias] number 0.1
[bulbRadius] number 1
[castShadows] boolean true
[shadowMapSize] number 2048

AxesHelperComponentOptions : object

Kind: global typedef

BoundingBoxHelperComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 0, 0, 1]

CameraHelperComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]

CameraView : object

Kind: global typedef Properties

Name Type
[totalSize] Array.<number>
[size] Array.<number>
[offset] Array.<number>

CameraComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[projection] "perspective" | "orthographic" "perspective"
[near] number 0.5
[far] number 1000
[aspect] number 1
[clearColor] module:pex-color~color
[viewMatrix] mat4
[invViewMatrix] mat4
[culling] boolean false
[exposure] number 1
[toneMap] "aces" | "agx" | "filmic" | "lottes" | "neutral" | "reinhard" | "reinhard2" | "uchimura" | "uncharted2" | "unreal" "aces"
[outputEncoding] number ctx.Encoding.Gamma
[focalLength] number 50 Focal length of the camera lens [10mm - 200mm] in mm
[fStop] number 2.8 Ratio of camera lens opening, f-number, f/N, aperture [1.2 - 32] in mm
[sensorSize] number [36, 24] Physical camera sensor or film size [sensorWidth, sensorHeight] in mm
sensorFit "vertical" | "horizontal" | "fit" | "overscan" | "vertical" Matching of camera frame to sensor frame
[view] CameraView
[fov] number Math.PI / 4
[left] number -1
[right] number 1
[bottom] number -1
[top] number 1
[zoom] number 1

DirectionalLightComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[intensity] number 1
[bias] number 0.1
[bulbRadius] number 1
[castShadows] boolean true
[shadowMapSize] number 2048

GeometryComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[positions] Float32Array
[normals] Float32Array
[uvs] Float32Array Alias: texCoords/texCoords0
[uvs1] Float32Array Alias: texCoords1
[vertexColors] Float32Array
[cells] Uint16Array | Uint32Array
[weights] Float32Array
[joints] Float32Array
[offsets] Float32Array Instanced
[rotations] Float32Array Instanced
[scales] Float32Array Instanced
[colors] Float32Array Instanced
[count] number
[multiDraw] object
[culled] boolean
[primitive] ctx.Primitive ctx.Primitive.Triangles

GridHelperComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[size] Array.<number> 10

LightHelperComponentOptions : object

Kind: global typedef

TextureTransform : object

Kind: global typedef Properties

Name Type Description
[offset] Array.<number> [x, y]
[rotation] number angle in radians
[scales] Array.<number> [x, y]

MaterialComponentOptions : object

Kind: global typedef Properties

Name Type Default
[unlit] boolean
[type] undefined | "line" "undefined"
[baseColor] Array.<number> [1, 1, 1, 1]
[emissiveColor] Array.<number> "undefined"
[emissiveIntensity] number 1
[metallic] number 1
[roughness] number 1
[ior] number
[specular] number
[specularTexture] ctx.texture2D | TextureTransform
[specularColor] Array.<number> [1, 1, 1]
[specularColorTexture] ctx.texture2D | TextureTransform
[baseColorTexture] ctx.texture2D | TextureTransform
[emissiveColorTexture] ctx.texture2D | TextureTransform
[normalTexture] ctx.texture2D | TextureTransform
[normalTextureScale] number 1
[roughnessTexture] ctx.texture2D | TextureTransform
[metallicTexture] ctx.texture2D | TextureTransform
[metallicRoughnessTexture] ctx.texture2D | TextureTransform
[occlusionTexture] ctx.texture2D | TextureTransform
[clearCoat] number
[clearCoatRoughness] number
[clearCoatTexture] ctx.texture2D | TextureTransform
[clearCoatRoughnessTexture] ctx.texture2D | TextureTransform
[clearCoatNormalTexture] ctx.texture2D | TextureTransform
[clearCoatNormalTextureScale] number
[sheenColor] Array.<number>
[sheenRoughness] number
[transmission] number
[transmissionTexture] ctx.texture2D | TextureTransform
[dispersion] number
[diffuseTransmission] number
[diffuseTransmissionTexture] ctx.texture2D | TextureTransform
[diffuseTransmissionColor] number [1, 1, 1]
[diffuseTransmissionColorTexture] ctx.texture2D | TextureTransform
[thickness] number
[thicknessTexture] ctx.texture2D | TextureTransform
[attenuationDistance] number
[attenuationColor] Array.<number>
[alphaTest] number "undefined"
[alphaTexture] ctx.texture2D | TextureTransform
[depthTest] boolean true
[depthWrite] boolean true
[depthFunc] ctx.DepthFunc ctx.DepthFunc.Less
[blend] boolean false
[blendSrcRGBFactor] ctx.BlendFactor "undefined"
[blendSrcAlphaFactor] ctx.BlendFactor "undefined"
[blendDstRGBFactor] ctx.BlendFactor "undefined"
[blendDstAlphaFactor] ctx.BlendFactor "undefined"
[cullFace] boolean true
[cullFaceMode] ctx.Face ctx.Face.Back
[pointSize] number 1
[castShadows] boolean false
[receiveShadows] boolean false

LineMaterialComponentOptions : object

Kind: global typedef Properties

Name Type Default
[type] "line" "line"
[baseColor] Array.<number> [1, 1, 1, 1]
[lineWidth] number 1
[lineResolution] number 16

MorphComponentOptions : object

Kind: global typedef Properties

Name Type Default
sources object
targets object
[current] object
[weights] Array []

OrbiterComponentOptions : object

Kind: global typedef Properties

Name Type Default
[element] HTMLElement document.body
[target] Array.<number> [0, 0, 0]
[lat] number 0
[lon] number 0
[distance] number 0

PointLightComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[intensity] number 1
[range] number 10
[bulbRadius] number 1
[castShadows] boolean true
[shadowMapSize] number 2048

SSAOComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[type] "sao" | "gtao" "sao"
[noiseTexture] boolean true
[mix] number 1
[samples] number "gtao" ? 6 : 11
[intensity] number 2.2
[radius] number 0.5 meters
[blurRadius] number 0.5
[blurSharpness] number 10
[brightness] number 0
[contrast] number 1 // SSAO
[bias] number 0.001 centimeters
[spiralTurns] number 7 // GTAO
[slices] number 3
[colorBounce] number true
[colorBounceIntensity] number 1.0

DoFComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[type] "gustafsson" | "upitis" "gustafsson" Gustafsson uses a spiral pattern while Upitis uses a circular one.
[physical] boolean true Use camera f-stop and focal length
[focusDistance] number 7 The point to focus on in meters.
[focusScale] number 1 Non physically based value for artistic control when physical is false, otherwise act as an fStop divider. Larger aperture (ie, smaller f-stop) or larger focal length (smaller fov) = smaller depth of field = more blur.
[focusOnScreenPoint] boolean false Read the depth buffer to find the first intersecting object to focus on instead of a fixed focus distance.
[screenPoint] Array.<number> [0.5, 0.5] The normalized screen point to focus on when "focusOnScreenPoint" is true.
[chromaticAberration] number 0.7 Amount of RGB separation
[luminanceThreshold] number 0.7 Threshold for out of focus hightlights
[luminanceGain] number 1 Gain for out of focus hightlights
[samples] number 6 Iteration steps. More steps means better blur but also degraded performances.
[shape] "disk" | "pentagon" "disk" The bokeh shape for type "upitis".
[debug] boolean false

MSAAComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[sampleCount] number 4 Multisample anti-aliasing samples: 1 or 4.

AAComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[subPixelQuality] number 0.75 Higher = softer. Helps mitigate fireflies but will blur small details.
[quality] number 2 For edge luma threshold: 0 to 4.

FogComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [0.5, 0.5, 0.5]
[start] number 5
[density] number 0.15
[sunPosition] Array.<number> [1, 1, 1]
[sunDispertion] number 0.2
[sunIntensity] number 0.1
[sunColor] Array.<number> [0.98, 0.98, 0.7]
[inscatteringCoeffs] Array.<number> [0.3, 0.3, 0.3]

BloomComponentOptions : object

Kind: global typedef Properties

Name Type Default Description
[quality] number 1 The bloom quality: 0 or 1 (0 is faster but flickers)
[colorFunction] "luma" | "luminance" | "average" "luma" The function used to determine the brightness of a pixel for the threshold.
[threshold] number 1 The brightness value at which pixels are filtered out for the threshold.
[source] "color" | "emissive" "color" The source texture for the threshold.
[intensity] number 0.1 The strength of the bloom effect.
[radius] number 1 The downsampling radius which controls how much glare gets blended in.

LutComponentOptions : object

Kind: global typedef Properties

Name Type
texture ctx.texture2D

ColorCorrectionComponentOptions : object

Kind: global typedef Properties

Name Type Default
[brightness] number 0
[contrast] number 1
[saturation] number 1
[hue] number 0

VignetteComponentOptions : object

Kind: global typedef Properties

Name Type Default
[radius] number 0.8
[intensity] number 0.2

FilmGrainComponentOptions : object

Kind: global typedef Properties

Name Type Default
[quality] number 2
[size] number 1.6
[intensity] number 0.05
[colorIntensity] number 0.6
[luminanceIntensity] number 1
[speed] number 0.5

PostProcessingComponentOptions : object

Kind: global typedef Properties

Name Type
[ssao] SSAOComponentOptions
[dof] DoFComponentOptions
[aa] AAComponentOptions
[fog] FogComponentOptions
[bloom] BloomComponentOptions
[lut] LutComponentOptions
[colorCorrection] ColorCorrectionComponentOptions
[vignette] VignetteComponentOptions
[filmGrain] FilmGrainComponentOptions
opacity number

ReflectionProbeComponentOptions : object

Kind: global typedef Properties

Name Type Default
[size] number 1024

SkinComponentOptions : object

Kind: global typedef

SkyboxComponentOptions : object

Kind: global typedef Properties

Name Type Default
[sunPosition] Array.<number>
[envMap] ctx.texture2D
[backgroundBlur] boolean false
[exposure] number 1
[turbidity] number 10
[rayleigh] number 2
[mieCoefficient] number 0.005
[mieDirectionalG] number 0.8

SpotLightComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [1, 1, 1, 1]
[intensity] number 1
[angle] number Math.PI / 4
[innerAngle] number 0
[range] number 10
[bias] number 0.1
[bulbRadius] number 1
[castShadows] boolean true
[shadowMapSize] number 2048

TransformComponentOptions : object

Kind: global typedef Properties

Name Type Default
[position] Array.<number> [0, 0, 0]
[rotation] Array.<number> [0, 0, 0, 1]
[scale] Array.<number> [1, 1, 1]

VertexHelperComponentOptions : object

Kind: global typedef Properties

Name Type Default
[color] Array.<number> [0, 1, 0, 1]
[size] Array.<number> 1
[attribute] string "&quot;normals&quot;"

SystemOptions : object

Kind: global typedef Properties

Name Type
ctx module:pex-context/types/index.js
[resourceCache] ResourceCache
[renderGraph] RenderGraph

SystemUpdate : function

Kind: global typedef

Param Type
entities Array.<Entity>
[deltaTime] number

SystemDispose : function

Kind: global typedef

Param Type
entities Array.<Entity>

System : object

Kind: global typedef Properties

Name Type
type string
cache object
debug boolean
update SystemUpdate
dispose SystemDispose

RenderEngineOptions

Kind: global typedef Properties

Name Type
width number
height number
renderers Array.<System>
drawToScreen boolean

RenderEngineRender : function

Kind: global typedef

Param Type Default
entities Array.<Entity>
cameraEntities Array.<Entity>
[options] RenderEngineOptions {}

RenderEngineDebug : function

Kind: global typedef

Param Type
enable boolean

RenderEngine : System

Kind: global typedef Properties

Name Type
render RenderEngineRender
debug RenderEngineDebug
systems Array.<System>
renderers Array.<System>

RendererSystemRender : function

Kind: global typedef

Param Type Default
renderView RenderView
entities Entity | Array.<Entity>
[options] object {}

RendererSystemStageOptions : object

Kind: global typedef Properties

Name Type
[attachmentsLocations] object
[shadowMappingLight] object
[backgroundColorTexture] ctx.texture2D
[renderingToReflectionProbe] boolean

RendererSystemStage : function

Kind: global typedef

Param Type
renderView Array.<RenderView>
entities Array.<Entity>
options RendererSystemStageOptions

RendererSystem : object

Kind: global typedef Properties

Name Type
type string
cache object
debug boolean
flagDefinitions Array.<Array>
update SystemUpdate
dispose SystemDispose
render RendererSystemRender
[renderBackground] RendererSystemStage
[renderShadow] RendererSystemStage
[renderOpaque] RendererSystemStage
[renderTransparent] RendererSystemStage
[renderPost] RendererSystemStage

WorldAdd : function

Kind: global typedef

Param Type
entity Entity

WorldAddSystem : function

Kind: global typedef

Param Type
system System

WorldUpdate : function

Kind: global typedef

Param Type
[deltaTime] number

World : object

Kind: global typedef Properties

Name Type
entities Array.<object>
systems Array.<object>
add WorldAdd
addSystem WorldAddSystem
update WorldUpdate

RenderGraph : object

Kind: global typedef Properties

Name Type
renderPasses Array.<object>
beginFrame function
renderPass function
endFrame function

ResourceCacheUsage : "Transient" | "Retained"

Kind: global typedef

ResourceCache : object

Kind: global typedef Properties

Name Type
beginFrame function
endFrame function
dispose function
Usage ResourceCacheUsage

RenderView : object

Kind: global typedef Properties

Name Type
camera object
cameraEntity Entity
viewport module:pex-context/types/types~Viewport
[exposure] object
[outputEncoding] object

License

MIT. See license file.