Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / RenderBackend

Interface: RenderBackend ​

Defined in: render/RenderBackend.ts:64

Everything renderer-specific the engine does, behind one small interface so a World can run on WebGL or WebGPU.

The default is webglBackend (exported from the package root). For a WebGPURenderer, pass webgpuBackend from @relu-interactives/spatial-ecs/webgpu.

Properties ​

PropertyModifierTypeDescriptionDefined in
kindreadonlyRendererKindRenderer family this backend drives.render/RenderBackend.ts:66

Methods ​

install()? ​

ts
optional install(world): void;

Defined in: render/RenderBackend.ts:68

One-time renderer setup, called once from the World constructor.

Parameters ​

ParameterType
worldWorld

Returns ​

void


prepareAreaLights()? ​

ts
optional prepareAreaLights(world): void;

Defined in: render/RenderBackend.ts:73

Called the first time an area light (RectAreaLight) is created, so the backend can load the lookup tables those lights need. Optional.

Parameters ​

ParameterType
worldWorld

Returns ​

void


createPostprocessing() ​

ts
createPostprocessing(context): PostprocessingPipeline | null;

Defined in: render/RenderBackend.ts:78

Build the post-processing chain for context.values. Return null to render the scene directly (no chain).

Parameters ​

ParameterType
contextPostprocessingBuildContext

Returns ​

PostprocessingPipeline | null


updatePostprocessing()? ​

ts
optional updatePostprocessing(
   pipeline, 
   previous, 
   next): boolean;

Defined in: render/RenderBackend.ts:87

Apply a values change to an existing chain without rebuilding it. Return true when the chain was updated in place, false when the change is structural (an effect switched on or off) and the caller must rebuild. When omitted, every change rebuilds.

Parameters ​

ParameterType
pipelinePostprocessingPipeline
previousPostprocessingState
nextPostprocessingState

Returns ​

boolean


createChromaKeyMaterial() ​

ts
createChromaKeyMaterial(texture, options): Material;

Defined in: render/RenderBackend.ts:93

Material that renders texture with options.keyColor keyed out.

Parameters ​

ParameterType
textureTexture
optionsChromaKeyOptions

Returns ​

Material


updateChromaKeyMaterial() ​

ts
updateChromaKeyMaterial(material, options): boolean;

Defined in: render/RenderBackend.ts:102

Push new options into a material made by createChromaKeyMaterial. Returns false when material is not one of this backend's chroma-key materials.

Parameters ​

ParameterType
materialMaterial
optionsChromaKeyOptions

Returns ​

boolean


createFoliageMaterial()? ​

ts
optional createFoliageMaterial(options): Material;

Defined in: render/RenderBackend.ts:107

Material for swaying grass (GrassComponent). Without one, grass is drawn still.

Parameters ​

ParameterType
optionsFoliageMaterialOptions

Returns ​

Material


updateFoliageMaterial()? ​

ts
optional updateFoliageMaterial(material, wind): boolean;

Defined in: render/RenderBackend.ts:109

Push the wind into a material made by createFoliageMaterial.

Parameters ​

ParameterType
materialMaterial
windFoliageWind

Returns ​

boolean