SceneFilterAssets

View source

ExtendsAssets

Typed resource alias for the shared Assets pool of SceneFilter assets. It inherits Assets behavior for adding filters with Assets#add and resolving handles with Assets#get.

Retrieve the shared pool with world.getResource and SceneFilterAssets. A SceneInstance can store an optional handle from this pool to constrain restored component and resource type IDs.

Examples

import { SceneFilter, SceneFilterAssets, SceneFilterMode, SceneInstance } from '@wimaengine/scene'
import { Position2D } from '@wimaengine/transform'
import { typeid } from '@wimaengine/type'

// `sceneHandle` is a Handle<Scene> from the SceneAssets pool.
const filters = world.getResource(SceneFilterAssets)
const filterHandle = filters.add(new SceneFilter(
  [typeid(Position2D)],
  SceneFilterMode.Allow
))

// `filterHandle` identifies the filter in the shared SceneFilterAssets pool.
world.spawn([new SceneInstance(sceneHandle, filterHandle)])

Constructor


constructor(type: object)

View source

Creates a typed asset pool for values identified by type.

The supplied constructor is retained as the asset family’s type identity for handles and resource access.

Parameters

NameDescriptionDefault
type

Constructor for the asset values in this container.

—